├── .babelrc ├── .gitignore ├── .whitesource ├── CODEOWNERS ├── LICENSE.txt ├── README.md ├── licenses.csv ├── package-lock.json ├── package.json ├── preact.config.js ├── readme_resources └── screenrecord_arch_diagram.gif ├── sample_json_data ├── large_web.json ├── no_steps.json ├── readme_example.json ├── section_example.json ├── simple_structure.json └── zones_example.json ├── sample_plantuml_data ├── example.adoc ├── example.png └── example.svg ├── src ├── assets │ ├── data.json │ ├── favicon.ico │ ├── grid_data.json │ ├── icons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── info.png │ │ └── mstile-150x150.png │ └── test_data.json ├── components │ ├── app.js │ ├── controls.js │ ├── diagram.js │ ├── diagramArea.js │ ├── info.js │ ├── infoArea.js │ ├── key.js │ ├── tableOfContents.js │ ├── tocStep.js │ └── zoneLegend.js ├── index.js ├── manifest.json ├── routes │ ├── home │ │ ├── index.js │ │ └── style.less │ └── profile │ │ ├── index.js │ │ └── style.less ├── style │ ├── helpers.less │ ├── index.css │ └── jquery.qtip.less ├── sw.js ├── template.html └── utils │ ├── dataValidator.js │ ├── parser.js │ └── stepUtils.js └── tests ├── __mocks__ ├── browserMocks.js ├── fileMocks.js └── setupTests.js ├── parser.test.js ├── testfiles ├── aliased_participants.adoc ├── bigspace.json ├── dividers.adoc ├── doubled_names.adoc ├── empty.adoc ├── meta.adoc ├── notes_multiline.adoc ├── notes_singleline.adoc ├── parsefile.adoc ├── participant_decl.adoc ├── participant_info.adoc ├── readme.adoc ├── steps_aliased.adoc ├── steps_group.adoc ├── steps_group.json ├── steps_group_mixed.adoc ├── steps_group_mixed.json ├── steps_loop.adoc ├── steps_loop.json ├── steps_mixed.adoc ├── steps_steptest.adoc ├── steps_unaliased.adoc ├── supernodes.adoc ├── unaliased_participants.adoc ├── undeclaredparticipant.adoc ├── xsstest.adoc └── zoned_participants.adoc └── validator.test.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": [ 5 | ["preact-cli/babel", { "modules": "commonjs" }] 6 | ] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | scripts/repo/ 4 | scripts-output/* 5 | build/ 6 | size-plugin.json 7 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "checkRunSettings": { 3 | "vulnerableCheckRunConclusionLevel": "failure" 4 | }, 5 | "issueSettings": { 6 | "minSeverityLevel": "NONE" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Owner: https://github.com/daj 2 | * @daj @handstandsam 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Due to changes in the priorities, this project is currently not being supported. The project is archived as of 9/17/21 and will be available in a read-only state. Please note, since archival, the project is not maintained or reviewed. # 2 | 3 | 4 | 5 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 6 | 7 | - [Architecture Diagram Web App](#architecture-diagram-web-app) 8 | - [Demo](#demo) 9 | - [Usage](#usage) 10 | - [Features](#features) 11 | - [Supported File Formats](#supported-file-formats) 12 | - [PlantUML](#plantuml) 13 | - [JSON](#json) 14 | - [Embedding in Wikis and Webpages](#embedding-in-wikis-and-webpages) 15 | - [Deployment (for developers)](#deployment-for-developers) 16 | - [Build Requirements](#build-requirements) 17 | - [Build steps](#build-steps) 18 | - [Contributing](#contributing) 19 | 20 | 21 | 22 | # Architecture Diagram Web App 23 | 24 | Start building and analyzing technical flows in seconds! 25 | 26 | [PlantUML sequence diagrams](http://plantuml.com/sequence-diagram) are very useful for documenting API flows. However, they can often overwhelm you with detail, which obscures the high level architecture. 27 | 28 | The architecture-viewer converts PlantUML sequence diagrams into interactive HTML architecture diagrams, which make it easier to step through the sequence, without losing the high level context. 29 | 30 | ## Demo 31 | 32 | ![the application demo](readme_resources/screenrecord_arch_diagram.gif) 33 | 34 | The PlantUML source for this demo is [here](sample_plantuml_data/example.adoc). 35 | 36 | ## Usage 37 | 38 | 1) Open a JSON or PlantUML file directly [in the webpage](https://capitalone.github.io/architecture-viewer/). 39 | 40 | 2) Launch [the webpage](https://capitalone.github.io/architecture-viewer/?url=https://raw.githubusercontent.com/capitalone/architecture-viewer/master/sample_json_data/large_web.json) directly with a `?url=` query parameter linking to the JSON or PlantUML file to display, e.g. 41 | ``` 42 | https://capitalone.github.io/architecture-viewer/?url=https://raw.githubusercontent.com/capitalone/architecture-viewer/master/sample_json_data/large_web.json 43 | ``` 44 | 45 | The same can be done with a plantUML file, as seen [here](https://capitalone.github.io/architecture-viewer/?url=https://raw.githubusercontent.com/capitalone/architecture-viewer/master/sample_plantuml_data/example.adoc) 46 | 47 | ``` 48 | https://capitalone.github.io/architecture-viewer/?url=https://raw.githubusercontent.com/capitalone/architecture-viewer/master/sample_plantuml_data/example.adoc 49 | ``` 50 | 51 | ## Features 52 | 53 | - Each node is clickable. Once clicked, a popup with details about them will appear. 54 | - Each step from the sequence diagram is listed in the sidebar. 55 | - Step through each part of the flow and see it visualized in an easy to digest graph. 56 | - Notes can be added to steps for clarity. 57 | 58 | ### Supported File Formats 59 | 60 | #### PlantUML 61 | 62 | The architecture-viewer supports a subset of the [PlantUML sequence diagrams syntax](http://plantuml.com/sequence-diagram). This repository also includes [this example](sample_plantuml_data/example.adoc) which was used to generate the demo above. 63 | 64 | The following PlantUML sequence diagram features are supported: 65 | 66 | - `@startuml` and `@enduml` to indicate diagrams 67 | - `title << title text here >>` to declare a title 68 | - `autonumber` is ignored and starts the indices at 0 (but the table of contents starts at 1) 69 | - participants are able to be created using the `participant` and `actor` keyword, and the following syntax is valid 70 | - `participant A` 71 | - `participant "AAA" as A` 72 | - `participant "A"` 73 | - stereotypes (`<< (X, zone_color) zone_name >>`) can be used with participants to provide colors, and to group participants into zones 74 | - `participant A << (X, #000000) zoneA >>` 75 | - `participant "AAA" as A << (X, #000000) zoneA >>` 76 | - `participant "A" << (X, #000000) zoneA >>` 77 | - steps 78 | - the following syntax for steps (and their backwards form) are supported 79 | - `->` 80 | - `-\` 81 | - `-/` 82 | - `->>` 83 | - `-\\` 84 | - `-//` 85 | - `-->` 86 | - `--\\` 87 | - `--//` 88 | - `-->>` 89 | - the following syntax for arrows is NOT supported 90 | - `-[#red]>` 91 | - grouping 92 | - The following grouping keywords are supported 93 | - loops 94 | ``` 95 | loop [x times] 96 | <> 97 | end 98 | ``` 99 | - groups 100 | ``` 101 | group <> 102 | <> 103 | end 104 | ``` 105 | - Nested loops are supported 106 | - notes 107 | - The following syntax is supported 108 | - single line notes: `note [left|right]: <>` 109 | - multiline notes 110 | 111 | note [left|right] 112 | <> 113 | end note 114 | - Notes over steps, and notes over participants (notes over participants translate to clickable tooltips on nodes) are supported 115 | - any other line included will be ignored 116 | - WARNING: using any other blocked feature (such as `alt`) may break the renderer. Make sure the .adoc file uploaded does not contain any unsupported features 117 | 118 | To change the default diagram, edit `src/assets/data.json` and redeploy. 119 | 120 | #### JSON 121 | 122 | The architecture-viewer uses a custom JSON format as input. PlantUML files are converted into this format for rendering. You may also import files directly if they are in this format. 123 | 124 | You need to define the following JSON fields: 125 | - `title` 126 | - `graphData` 127 | - `nodes` 128 | - `id` (shorthand id, ex. FBI) 129 | - `fname` (longhand name, ex. Federal Bureau of Investigation) 130 | - `zone` (optional) 131 | - `info` (optional) 132 | - `edges` 133 | - `id` 134 | - `source` 135 | - `target` 136 | - `stepData` (optional) 137 | 138 | _note: the graphData in the JSON is compatible with [cytoscape](http://www.cytoscape.org/)_ 139 | 140 | Example (JSON): 141 | ```javascript 142 | { 143 | "title": "some_title", 144 | "graphData": { 145 | "nodes": [ 146 | { 147 | "data": { 148 | "id": "s_id", 149 | "fname": "some_id", 150 | "zone": "#ffb2b2", 151 | "info": "info about some_id" 152 | } 153 | }, 154 | { 155 | "data": { 156 | "id": "s_id_2", 157 | "fname": "some_id_2", 158 | "zone": "#b2b2ff", 159 | "info": "info about some_id_2" 160 | } 161 | } 162 | ], 163 | "edges": [ 164 | { 165 | "data": { 166 | "id": "some_edge_id", 167 | "source": "s_id", 168 | "target": "s_id_2" 169 | } 170 | } 171 | ] 172 | }, 173 | "stepData": [ 174 | { 175 | "id": "0", 176 | "type": "single", 177 | "nodes": [ 178 | "some_id", 179 | "some_id_2" 180 | ], 181 | "steps": [], 182 | "description": "an example step", 183 | "note": "" 184 | } 185 | ] 186 | } 187 | ``` 188 | 189 | ### Embedding in Wikis and Webpages 190 | 191 | You can embed the interactive architecture-viewer using an ` 195 | ``` 196 | 197 | Some content management/collaboration software (e.g. [Confluence](https://www.atlassian.com/software/confluence)) will block external sites, so you may need to add your architecture-viewer domain to a whitelist before it will display. 198 | 199 | ### Deployment (for developers) 200 | 201 | #### Build Requirements 202 | 203 | - node (ideally v7 or later) 204 | - npm (if you meet the node requirements you SHOULD meet the npm requirements) 205 | 206 | #### Build steps 207 | 208 | ``` 209 | # Install dependencies 210 | npm install 211 | 212 | # This will run a dev server on http://localhost:8080 213 | npm run dev 214 | 215 | # This will run all the tests located in __tests__/ 216 | npm run test 217 | 218 | # This will build the app and place the built files in build/ 219 | npm run build 220 | 221 | # This will deploy the contents of build/ to the gh-pages branch 222 | npm run deploy 223 | 224 | ``` 225 | 226 | The `build` directory is a static website so it can be deployed to any static hosting platform. 227 | 228 | If you need to customize the base resource paths used by this web application, you can edit the provided [preact.config.js](preact.config.js). 229 | 230 | ### Contributing 231 | 232 | We welcome Your interest in Capital One’s Open Source Projects (the “Project”). Any Contributor to the Project must accept and sign an Agreement indicating agreement to the license terms below. Except for the license granted in this Agreement to Capital One and to recipients of software distributed by Capital One, You reserve all right, title, and interest in and to Your Contributions; this Agreement does not impact Your rights to use Your own Contributions for any other purpose. 233 | 234 | [Sign the Individual Agreement](https://docs.google.com/forms/d/19LpBBjykHPox18vrZvBbZUcK6gQTj7qv1O5hCduAZFU/viewform) 235 | 236 | [Sign the Corporate Agreement](https://docs.google.com/forms/d/e/1FAIpQLSeAbobIPLCVZD_ccgtMWBDAcN68oqbAJBQyDTSAQ1AkYuCp_g/viewform?usp=send_form) 237 | 238 | This project adheres to the [Open Code of Conduct](http://www.capitalone.io/codeofconduct/). By participating, you are expected to honor this code. 239 | -------------------------------------------------------------------------------- /licenses.csv: -------------------------------------------------------------------------------- 1 | "module name","license","repository" 2 | "ajv@6.5.3","MIT","https://github.com/epoberezkin/ajv" 3 | "cytoscape-dagre@2.2.1","MIT","https://github.com/cytoscape/cytoscape.js-dagre" 4 | "cytoscape-popper@1.0.2","MIT","https://github.com/cytoscape/cytoscape.js-popper" 5 | "cytoscape@3.2.16","MIT","https://github.com/cytoscape/cytoscape.js" 6 | "dagre@0.7.4","MIT","https://github.com/cpettitt/dagre" 7 | "dagre@0.8.2","MIT","https://github.com/dagrejs/dagre" 8 | "fast-deep-equal@2.0.1","MIT","https://github.com/epoberezkin/fast-deep-equal" 9 | "fast-json-stable-stringify@2.0.0","MIT","https://github.com/epoberezkin/fast-json-stable-stringify" 10 | "fillthisfornow@0.0.0","UNLICENSED","" 11 | "fs-access@1.0.1","MIT","https://github.com/sindresorhus/fs-access" 12 | "graphlib@1.0.7","MIT","https://github.com/cpettitt/graphlib" 13 | "graphlib@2.1.5","MIT","https://github.com/dagrejs/graphlib" 14 | "heap@0.2.6","PSF","https://github.com/qiao/heap.js" 15 | "immutability-helper@2.7.1","MIT","https://github.com/kolodny/immutability-helper" 16 | "invariant@2.2.4","MIT","https://github.com/zertosh/invariant" 17 | "isexe@2.0.0","ISC","https://github.com/isaacs/isexe" 18 | "js-tokens@4.0.0","MIT","https://github.com/lydell/js-tokens" 19 | "json-schema-traverse@0.4.1","MIT","https://github.com/epoberezkin/json-schema-traverse" 20 | "karma-chrome-launcher@2.2.0","MIT","https://github.com/karma-runner/karma-chrome-launcher" 21 | "lodash.debounce@4.0.8","MIT","https://github.com/lodash/lodash" 22 | "lodash@3.10.1","MIT","https://github.com/lodash/lodash" 23 | "lodash@4.17.10","MIT","https://github.com/lodash/lodash" 24 | "loose-envify@1.4.0","MIT","https://github.com/zertosh/loose-envify" 25 | "null-check@1.0.0","MIT","https://github.com/sindresorhus/null-check" 26 | "object-assign@4.1.1","MIT","https://github.com/sindresorhus/object-assign" 27 | "popper.js@1.14.4","MIT","https://github.com/FezVrasta/popper.js" 28 | "preact-compat@3.18.3","MIT","https://github.com/developit/preact-compat" 29 | "preact-render-to-string@3.8.2","MIT","https://github.com/developit/preact-render-to-string" 30 | "preact-router@2.6.1","MIT","https://github.com/developit/preact-router" 31 | "preact-transition-group@1.1.1","MIT","https://github.com/developit/preact-transition-group" 32 | "preact@8.3.1","MIT","https://github.com/developit/preact" 33 | "pretty-format@3.8.0","MIT","https://github.com/thejameskyle/pretty-format" 34 | "prop-types@15.6.2","MIT","https://github.com/facebook/prop-types" 35 | "punycode@2.1.1","MIT","https://github.com/bestiejs/punycode.js" 36 | "standalone-react-addons-pure-render-mixin@0.1.1","MIT","" 37 | "tippy.js@2.5.4","MIT","https://github.com/atomiks/tippyjs" 38 | "uri-js@4.2.2","BSD-2-Clause","https://github.com/garycourt/uri-js" 39 | "which@1.3.1","ISC","https://github.com/isaacs/node-which" 40 | 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "architecture-viewer", 4 | "version": "1.0.0", 5 | "license": "Apache-2.0", 6 | "scripts": { 7 | "build": "preact build --no-prerender", 8 | "serve": "sirv build --port 8080 --cors --single", 9 | "dev": "preact watch", 10 | "lint": "eslint src", 11 | "license": "license-checker --csv --production > licenses.csv", 12 | "deploy": "gh-pages -d build", 13 | "test": "jest" 14 | }, 15 | "eslintConfig": { 16 | "extends": "preact", 17 | "ignorePatterns": [ 18 | "build/" 19 | ] 20 | }, 21 | "devDependencies": { 22 | "enzyme": "^3.10.0", 23 | "enzyme-adapter-preact-pure": "^2.0.0", 24 | "eslint": "^6.0.1", 25 | "eslint-config-preact": "^1.1.0", 26 | "gh-pages": "^3.1.0", 27 | "identity-obj-proxy": "^3.0.0", 28 | "jest": "^24.9.0", 29 | "jest-preset-preact": "^1.0.0", 30 | "jest-raw-loader": "^1.0.1", 31 | "license-checker": "^20.2.0", 32 | "preact-cli": "^3.0.0", 33 | "preact-render-spy": "^1.2.1", 34 | "sirv-cli": "1.0.3" 35 | }, 36 | "dependencies": { 37 | "ajv": "^6.12.3", 38 | "cytoscape": "^3.15.2", 39 | "cytoscape-dagre": "^2.2.2", 40 | "cytoscape-popper": "^1.0.7", 41 | "dagre": "^0.8.5", 42 | "preact": "^10.3.2", 43 | "preact-render-to-string": "^5.1.4", 44 | "preact-router": "^3.2.1", 45 | "tippy.js": "^2.5.4" 46 | }, 47 | "jest": { 48 | "modulePathIgnorePatterns": [ 49 | "/.publish/" 50 | ], 51 | "preset": "jest-preset-preact", 52 | "setupFiles": [ 53 | "/tests/__mocks__/browserMocks.js", 54 | "/tests/__mocks__/setupTests.js" 55 | ], 56 | "transform": { 57 | "\\.adoc$": "jest-raw-loader" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /preact.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const fs = require('fs'); 18 | 19 | // Use this method to modify the base path URLs used in the web application. 20 | export default function (config, env, helpers) { 21 | if (env.production) { 22 | 23 | // Keep infinity when minifying to avoid low severity static analysis warnings 24 | //let { plugin } = helpers.getPluginsByName(config, "UglifyJsPlugin")[0]; 25 | //plugin.options.compress.keep_infinity = true; 26 | 27 | // Use a relative path for the base URL so the web application works when 28 | // hosting through enterprise or public GitHub Pages. 29 | config.output.publicPath = ''; 30 | 31 | // For another example, the code below reads the GitHub remote URL and 32 | // prefixes "/pages/github-org/github-repo/" onto the path URLs in the 33 | // web application. This is not required when hosting through 34 | // enterprise or public GitHub Pages. 35 | // 36 | // const config_file = '.git/config'; 37 | // let path = null; 38 | // 39 | // if (fs.existsSync(config_file)) { 40 | // // grab the contents of the config file 41 | // let contents = fs.readFileSync(config_file, 'utf8').split('\n'); 42 | // 43 | // // grab the origin remote url 44 | // let url = ''; 45 | // for (let i = 0; i < contents.length; i++) { 46 | // if (contents[i].startsWith('[remote "origin"]')) { 47 | // url = contents[i + 1].split(' ')[2]; 48 | // } 49 | // } 50 | // 51 | // // grab the 'path' 52 | // let path_parts = url.replace('.git', '') 53 | // .split(/[:\/]/) 54 | // .slice(-2); 55 | // 56 | // path_parts.unshift('pages'); 57 | // 58 | // let path = '/' + path_parts.join('/') + '/'; 59 | // config.output.publicPath = path 60 | // } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /readme_resources/screenrecord_arch_diagram.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/readme_resources/screenrecord_arch_diagram.gif -------------------------------------------------------------------------------- /sample_json_data/large_web.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "large web", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "A", 8 | "fname": "A", 9 | "zone": "#FBDCD6" 10 | } 11 | }, 12 | { 13 | "data": { 14 | "id": "B", 15 | "fname": "B", 16 | "zone": "#FBDCD6" 17 | } 18 | }, 19 | { 20 | "data": { 21 | "id": "C", 22 | "fname": "C", 23 | "zone": "#FBDCD6" 24 | } 25 | }, 26 | { 27 | "data": { 28 | "id": "D", 29 | "fname": "D", 30 | "zone": "#FBDCD6" 31 | } 32 | }, 33 | { 34 | "data": { 35 | "id": "E", 36 | "zone": "#FBDCD6", 37 | "fname": "E" 38 | } 39 | }, 40 | { 41 | "data": { 42 | "id": "F", 43 | "zone": "#FBDCD6", 44 | "fname": "F" 45 | } 46 | }, 47 | { 48 | "data": { 49 | "id": "G", 50 | "zone": "#FBDCD6", 51 | "fname": "G" 52 | } 53 | }, 54 | { 55 | "data": { 56 | "id": "H", 57 | "zone": "#FBDCD6", 58 | "fname": "H" 59 | } 60 | }, 61 | { 62 | "data": { 63 | "id": "I", 64 | "zone": "#FBDCD6", 65 | "fname": "I" 66 | } 67 | }, 68 | { 69 | "data": { 70 | "id": "J", 71 | "zone": "#FBDCD6", 72 | "fname": "J" 73 | } 74 | }, 75 | { 76 | "data": { 77 | "id": "K", 78 | "zone": "#FBDCD6", 79 | "fname": "K" 80 | } 81 | }, 82 | { 83 | "data": { 84 | "id": "L", 85 | "zone": "#FBDCD6", 86 | "fname": "L" 87 | } 88 | }, 89 | { 90 | "data": { 91 | "id": "M", 92 | "zone": "#FBDCD6", 93 | "fname": "M" 94 | } 95 | }, 96 | { 97 | "data": { 98 | "id": "N", 99 | "zone": "#FBDCD6", 100 | "fname": "N" 101 | } 102 | }, 103 | { 104 | "data": { 105 | "id": "O", 106 | "zone": "#FBDCD6", 107 | "fname": "O" 108 | } 109 | }, 110 | { 111 | "data": { 112 | "id": "P", 113 | "zone": "#FBDCD6", 114 | "fname": "P" 115 | } 116 | }, 117 | { 118 | "data": { 119 | "id": "Q", 120 | "zone": "#FBDCD6", 121 | "fname": "Q" 122 | } 123 | }, 124 | { 125 | "data": { 126 | "id": "R", 127 | "zone": "#FBDCD6", 128 | "fname": "R" 129 | } 130 | }, 131 | { 132 | "data": { 133 | "id": "S", 134 | "zone": "#FBDCD6", 135 | "fname": "S" 136 | } 137 | } 138 | ], 139 | "edges": [ 140 | { 141 | "data": { 142 | "id": "1", 143 | "source": "A", 144 | "target": "B" 145 | } 146 | }, 147 | { 148 | "data": { 149 | "id": "2", 150 | "source": "B", 151 | "target": "C" 152 | } 153 | }, 154 | { 155 | "data": { 156 | "id": "3", 157 | "source": "C", 158 | "target": "D" 159 | } 160 | }, 161 | { 162 | "data": { 163 | "id": "4", 164 | "source": "D", 165 | "target": "E" 166 | } 167 | }, 168 | { 169 | "data": { 170 | "id": "5", 171 | "source": "E", 172 | "target": "F" 173 | } 174 | }, 175 | { 176 | "data": { 177 | "id": "6", 178 | "source": "F", 179 | "target": "G" 180 | } 181 | }, 182 | { 183 | "data": { 184 | "id": "7", 185 | "source": "F", 186 | "target": "H" 187 | } 188 | }, 189 | { 190 | "data": { 191 | "id": "8", 192 | "source": "F", 193 | "target": "I" 194 | } 195 | }, 196 | { 197 | "data": { 198 | "id": "9", 199 | "source": "F", 200 | "target": "J" 201 | } 202 | }, 203 | { 204 | "data": { 205 | "id": "10", 206 | "source": "F", 207 | "target": "K" 208 | } 209 | }, 210 | { 211 | "data": { 212 | "id": "11", 213 | "source": "G", 214 | "target": "C" 215 | } 216 | }, 217 | { 218 | "data": { 219 | "id": "12", 220 | "source": "G", 221 | "target": "L" 222 | } 223 | }, 224 | { 225 | "data": { 226 | "id": "13", 227 | "source": "G", 228 | "target": "M" 229 | } 230 | }, 231 | { 232 | "data": { 233 | "id": "14", 234 | "source": "G", 235 | "target": "N" 236 | } 237 | }, 238 | { 239 | "data": { 240 | "id": "15", 241 | "source": "G", 242 | "target": "O" 243 | } 244 | }, 245 | { 246 | "data": { 247 | "id": "16", 248 | "source": "G", 249 | "target": "P" 250 | } 251 | }, 252 | { 253 | "data": { 254 | "id": "17", 255 | "source": "H", 256 | "target": "Q" 257 | } 258 | }, 259 | { 260 | "data": { 261 | "id": "18", 262 | "source": "I", 263 | "target": "Q" 264 | } 265 | }, 266 | { 267 | "data": { 268 | "id": "19", 269 | "source": "J", 270 | "target": "R" 271 | } 272 | }, 273 | { 274 | "data": { 275 | "id": "20", 276 | "source": "K", 277 | "target": "S" 278 | } 279 | } 280 | ] 281 | }, 282 | "stepData": [], 283 | "zoneData": [ 284 | { 285 | "name": "main", 286 | "color": "#FBDCD6" 287 | } 288 | ] 289 | } -------------------------------------------------------------------------------- /sample_json_data/no_steps.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "this diagram has no steps", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "Americas", 8 | "zone": "#B2D6EB" 9 | } 10 | }, 11 | { 12 | "data": { 13 | "id": "Asia", 14 | "zone": "#FDEDEB" 15 | } 16 | }, 17 | { 18 | "data": { 19 | "id": "Australia", 20 | "zone": "#C7E7C1" 21 | } 22 | }, 23 | { 24 | "data": { 25 | "id": "CAN", 26 | "fname": "Canada", 27 | "zone": "#66AED8", 28 | "parent": "Americas" 29 | } 30 | }, 31 | { 32 | "data": { 33 | "id": "USA", 34 | "fname": "United States of America", 35 | "zone": "#66AED8", 36 | "parent": "Americas" 37 | } 38 | }, 39 | { 40 | "data": { 41 | "id": "MEX", 42 | "fname": "Mexico", 43 | "zone": "#66AED8", 44 | "parent": "Americas" 45 | } 46 | }, 47 | { 48 | "data": { 49 | "id": "GTM", 50 | "fname": "Guatemala", 51 | "zone": "#66AED8", 52 | "parent": "Americas" 53 | } 54 | }, 55 | { 56 | "data": { 57 | "id": "HND", 58 | "fname": "Honduras", 59 | "zone": "#66AED8", 60 | "parent": "Americas" 61 | } 62 | }, 63 | { 64 | "data": { 65 | "id": "RUS", 66 | "fname": "Russia", 67 | "zone": "#FBDCD7", 68 | "parent": "Asia" 69 | } 70 | }, 71 | { 72 | "data": { 73 | "id": "MNG", 74 | "fname": "Mongolia", 75 | "zone": "#FBDCD7", 76 | "parent": "Asia" 77 | } 78 | }, 79 | { 80 | "data": { 81 | "id": "CHN", 82 | "fname": "China", 83 | "zone": "#FBDCD7", 84 | "parent": "Asia" 85 | } 86 | }, 87 | { 88 | "data": { 89 | "id": "IND", 90 | "fname": "India", 91 | "zone": "#FBDCD7", 92 | "parent": "Asia" 93 | } 94 | }, 95 | { 96 | "data": { 97 | "id": "AUS", 98 | "fname": "Australia", 99 | "zone": "#90D083", 100 | "parent": "Australia" 101 | } 102 | } 103 | ], 104 | "edges": [ 105 | { 106 | "data": { 107 | "id": "0", 108 | "source": "CAN", 109 | "target": "USA" 110 | } 111 | }, 112 | { 113 | "data": { 114 | "id": "1", 115 | "source": "USA", 116 | "target": "MEX" 117 | } 118 | }, 119 | { 120 | "data": { 121 | "id": "2", 122 | "source": "MEX", 123 | "target": "GTM" 124 | } 125 | }, 126 | { 127 | "data": { 128 | "id": "3", 129 | "source": "MEX", 130 | "target": "HND" 131 | } 132 | }, 133 | { 134 | "data": { 135 | "id": "4", 136 | "source": "RUS", 137 | "target": "MNG" 138 | } 139 | }, 140 | { 141 | "data": { 142 | "id": "5", 143 | "source": "MNG", 144 | "target": "CHN" 145 | } 146 | }, 147 | { 148 | "data": { 149 | "id": "6", 150 | "source": "CHN", 151 | "target": "IND" 152 | } 153 | }, 154 | { 155 | "data": { 156 | "id": "7", 157 | "source": "USA", 158 | "target": "CHN" 159 | } 160 | }, 161 | { 162 | "data": { 163 | "id": "8", 164 | "source": "USA", 165 | "target": "IND" 166 | } 167 | }, 168 | { 169 | "data": { 170 | "id": "9", 171 | "source": "CHN", 172 | "target": "AUS" 173 | } 174 | }, 175 | { 176 | "data": { 177 | "id": "10", 178 | "source": "USA", 179 | "target": "RUS" 180 | } 181 | } 182 | ] 183 | }, 184 | "stepData": [] 185 | } -------------------------------------------------------------------------------- /sample_json_data/readme_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "some_title", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "s_id", 8 | "fname": "some_id", 9 | "zone": "#ffb2b2", 10 | "info": "info about some_id" 11 | } 12 | }, 13 | { 14 | "data": { 15 | "id": "s_id_2", 16 | "fname": "some_id_2", 17 | "zone": "#b2b2ff", 18 | "info": "info about some_id_2" 19 | } 20 | } 21 | ], 22 | "edges": [ 23 | { 24 | "data": { 25 | "id": "some_edge_id", 26 | "source": "s_id", 27 | "target": "s_id_2" 28 | } 29 | } 30 | ] 31 | }, 32 | "stepData": [ 33 | { 34 | "id": "0", 35 | "type": "single", 36 | "nodes": [ 37 | "s_id", 38 | "s_id_2" 39 | ], 40 | "steps": [], 41 | "description": "an example step", 42 | "note": "" 43 | } 44 | ], 45 | "zoneData": [ 46 | { 47 | "name": "zone1", 48 | "color": "#ffb2b2" 49 | }, 50 | { 51 | "name": "zone2", 52 | "color": "#b2b2ff" 53 | } 54 | ] 55 | } -------------------------------------------------------------------------------- /sample_json_data/section_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "sectioning example", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "A", 8 | "fname": "A", 9 | "zone": "#FBDCD6", 10 | "info": "qwer" 11 | } 12 | }, 13 | { 14 | "data": { 15 | "id": "B", 16 | "fname": "B", 17 | "zone": "#FBDCD6", 18 | "info": "qwer" 19 | } 20 | }, 21 | { 22 | "data": { 23 | "id": "C", 24 | "fname": "C", 25 | "zone": "#FBDCD6", 26 | "info": "qwer" 27 | } 28 | }, 29 | { 30 | "data": { 31 | "id": "D", 32 | "fname": "D", 33 | "zone": "#FBDCD6", 34 | "info": "qwer" 35 | } 36 | }, 37 | { 38 | "data": { 39 | "id": "E", 40 | "fname": "E", 41 | "zone": "#FBDCD6", 42 | "info": "qwer" 43 | } 44 | }, 45 | { 46 | "data": { 47 | "id": "F", 48 | "fname": "F", 49 | "zone": "#FBDCD6", 50 | "info": "qwer" 51 | } 52 | }, 53 | { 54 | "data": { 55 | "id": "G", 56 | "fname": "G", 57 | "zone": "#FBDCD6", 58 | "info": "qwer" 59 | } 60 | }, 61 | { 62 | "data": { 63 | "id": "H", 64 | "fname": "H", 65 | "zone": "#FBDCD6", 66 | "info": "qwer" 67 | } 68 | } 69 | ], 70 | "edges": [ 71 | { 72 | "data": { 73 | "id": "1", 74 | "source": "A", 75 | "target": "B" 76 | } 77 | }, 78 | { 79 | "data": { 80 | "id": "2", 81 | "source": "B", 82 | "target": "H" 83 | } 84 | }, 85 | { 86 | "data": { 87 | "id": "3", 88 | "source": "B", 89 | "target": "C" 90 | } 91 | }, 92 | { 93 | "data": { 94 | "id": "4", 95 | "source": "C", 96 | "target": "E" 97 | } 98 | }, 99 | { 100 | "data": { 101 | "id": "5", 102 | "source": "B", 103 | "target": "F" 104 | } 105 | } 106 | ] 107 | }, 108 | "stepData": [ 109 | { 110 | "id": "0", 111 | "type": "single", 112 | "groupName": "", 113 | "nodes": [ 114 | "A", 115 | "B" 116 | ], 117 | "steps": [], 118 | "description": "AB", 119 | "note": "AB note" 120 | }, 121 | { 122 | "id": "1", 123 | "type": "single", 124 | "groupName": "", 125 | "nodes": [ 126 | "B", 127 | "H" 128 | ], 129 | "steps": [], 130 | "description": "BH", 131 | "note": "BH note" 132 | }, 133 | { 134 | "id": "2", 135 | "type": "single", 136 | "groupName": "", 137 | "nodes": [ 138 | "H" 139 | ], 140 | "steps": [], 141 | "description": "H", 142 | "note": "" 143 | }, 144 | { 145 | "id": "3", 146 | "type": "single", 147 | "groupName": "", 148 | "nodes": [ 149 | "H", 150 | "B" 151 | ], 152 | "steps": [], 153 | "description": "HB", 154 | "note": "" 155 | }, 156 | { 157 | "id": "g0", 158 | "type": "group", 159 | "groupName": "loop", 160 | "nodes": [], 161 | "steps": [ 162 | { 163 | "id": "4", 164 | "type": "single", 165 | "groupName": "", 166 | "nodes": [ 167 | "B", 168 | "C" 169 | ], 170 | "steps": [], 171 | "description": "BC", 172 | "note": "BC note" 173 | }, 174 | { 175 | "id": "5", 176 | "type": "single", 177 | "groupName": "", 178 | "nodes": [ 179 | "C", 180 | "E" 181 | ], 182 | "steps": [], 183 | "description": "CE", 184 | "note": "" 185 | }, 186 | { 187 | "id": "6", 188 | "type": "single", 189 | "groupName": "", 190 | "nodes": [ 191 | "E" 192 | ], 193 | "steps": [], 194 | "description": "E", 195 | "note": "" 196 | }, 197 | { 198 | "id": "7", 199 | "type": "single", 200 | "groupName": "", 201 | "nodes": [ 202 | "E", 203 | "C" 204 | ], 205 | "steps": [], 206 | "description": "EC", 207 | "note": "" 208 | }, 209 | { 210 | "id": "8", 211 | "type": "single", 212 | "groupName": "", 213 | "nodes": [ 214 | "C", 215 | "B" 216 | ], 217 | "steps": [], 218 | "description": "CB", 219 | "note": "" 220 | } 221 | ], 222 | "description": "", 223 | "note": "" 224 | }, 225 | { 226 | "id": "g1", 227 | "type": "group", 228 | "groupName": "loop", 229 | "nodes": [], 230 | "steps": [ 231 | { 232 | "id": "9", 233 | "type": "single", 234 | "groupName": "", 235 | "nodes": [ 236 | "B", 237 | "F" 238 | ], 239 | "steps": [], 240 | "description": "BF", 241 | "note": "BF note" 242 | }, 243 | { 244 | "id": "10", 245 | "type": "single", 246 | "groupName": "", 247 | "nodes": [ 248 | "F" 249 | ], 250 | "steps": [], 251 | "description": "F", 252 | "note": "" 253 | }, 254 | { 255 | "id": "11", 256 | "type": "single", 257 | "groupName": "", 258 | "nodes": [ 259 | "F" 260 | ], 261 | "steps": [], 262 | "description": "F", 263 | "note": "" 264 | }, 265 | { 266 | "id": "12", 267 | "type": "single", 268 | "groupName": "", 269 | "nodes": [ 270 | "F", 271 | "B" 272 | ], 273 | "steps": [], 274 | "description": "FB", 275 | "note": "" 276 | }, 277 | { 278 | "id": "13", 279 | "type": "single", 280 | "groupName": "", 281 | "nodes": [ 282 | "B", 283 | "F" 284 | ], 285 | "steps": [], 286 | "description": "BF", 287 | "note": "" 288 | }, 289 | { 290 | "id": "14", 291 | "type": "single", 292 | "groupName": "", 293 | "nodes": [ 294 | "F" 295 | ], 296 | "steps": [], 297 | "description": "F", 298 | "note": "" 299 | }, 300 | { 301 | "id": "15", 302 | "type": "single", 303 | "groupName": "", 304 | "nodes": [ 305 | "F", 306 | "B" 307 | ], 308 | "steps": [], 309 | "description": "FB", 310 | "note": "" 311 | } 312 | ], 313 | "description": "", 314 | "note": "" 315 | } 316 | ], 317 | "zoneData": [ 318 | { 319 | "name": "main", 320 | "color": "#FBDCD6" 321 | } 322 | ] 323 | } -------------------------------------------------------------------------------- /sample_json_data/simple_structure.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "simple", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "AAA", 8 | "fname": "AAA", 9 | "zone": "#FBDCD6", 10 | "info": "asd" 11 | } 12 | }, 13 | { 14 | "data": { 15 | "id": "BBB", 16 | "fname": "BBB", 17 | "zone": "#FBDCD6" 18 | } 19 | }, 20 | { 21 | "data": { 22 | "id": "CCC", 23 | "fname": "CCC", 24 | "zone": "#FBDCD6" 25 | } 26 | }, 27 | { 28 | "data": { 29 | "id": "DDD", 30 | "fname": "DDD", 31 | "zone": "#FBDCD6" 32 | } 33 | }, 34 | { 35 | "data": { 36 | "id": "EEE", 37 | "fname": "EEE", 38 | "zone": "#FBDCD6" 39 | } 40 | }, 41 | { 42 | "data": { 43 | "id": "FFF", 44 | "fname": "FFF", 45 | "zone": "#FBDCD6" 46 | } 47 | }, 48 | { 49 | "data": { 50 | "id": "GGG", 51 | "fname": "GGG", 52 | "zone": "#FBDCD6" 53 | } 54 | }, 55 | { 56 | "data": { 57 | "id": "HHH", 58 | "fname": "HHH", 59 | "zone": "#FBDCD6" 60 | } 61 | } 62 | ], 63 | "edges": [ 64 | { 65 | "data": { 66 | "id": "1", 67 | "source": "AAA", 68 | "target": "BBB" 69 | } 70 | }, 71 | { 72 | "data": { 73 | "id": "2", 74 | "source": "AAA", 75 | "target": "CCC" 76 | } 77 | }, 78 | { 79 | "data": { 80 | "id": "3", 81 | "source": "BBB", 82 | "target": "DDD" 83 | } 84 | }, 85 | { 86 | "data": { 87 | "id": "4", 88 | "source": "CCC", 89 | "target": "EEE" 90 | } 91 | }, 92 | { 93 | "data": { 94 | "id": "5", 95 | "source": "DDD", 96 | "target": "FFF" 97 | } 98 | }, 99 | { 100 | "data": { 101 | "id": "6", 102 | "source": "DDD", 103 | "target": "GGG" 104 | } 105 | }, 106 | { 107 | "data": { 108 | "id": "7", 109 | "source": "FFF", 110 | "target": "HHH" 111 | } 112 | }, 113 | { 114 | "data": { 115 | "id": "8", 116 | "source": "GGG", 117 | "target": "EEE" 118 | } 119 | } 120 | ] 121 | }, 122 | "stepData": [ 123 | 124 | ], 125 | "zoneData": [ 126 | { 127 | "name": "main", 128 | "color": "#FBDCD6" 129 | } 130 | ] 131 | } -------------------------------------------------------------------------------- /sample_json_data/zones_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "zones example", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "zoneA", 8 | "zone": "#FBDCD6" 9 | } 10 | }, 11 | { 12 | "data": { 13 | "id": "zoneB", 14 | "zone": "#E5F5E3" 15 | } 16 | }, 17 | { 18 | "data": { 19 | "id": "zoneC", 20 | "zone": "#DBE6F2" 21 | } 22 | }, 23 | { 24 | "data": { 25 | "id": "A", 26 | "fname": "A", 27 | "zone": "#fbb4ae", 28 | "parent": "zoneA", 29 | "info": "A node" 30 | } 31 | }, 32 | { 33 | "data": { 34 | "id": "B", 35 | "fname": "B", 36 | "zone": "#b3cde3", 37 | "parent": "zoneC", 38 | "info": "B node" 39 | } 40 | }, 41 | { 42 | "data": { 43 | "id": "C", 44 | "fname": "C", 45 | "zone": "#b3cde3", 46 | "parent": "zoneC", 47 | "info": "C node" 48 | } 49 | }, 50 | { 51 | "data": { 52 | "id": "D", 53 | "fname": "D", 54 | "zone": "#ccebc5", 55 | "parent": "zoneB", 56 | "info": "D node" 57 | } 58 | }, 59 | { 60 | "data": { 61 | "id": "E", 62 | "fname": "E", 63 | "zone": "#ccebc5", 64 | "parent": "zoneB", 65 | "info": "E node" 66 | } 67 | }, 68 | { 69 | "data": { 70 | "id": "F", 71 | "fname": "F", 72 | "zone": "#b3cde3", 73 | "parent": "zoneC", 74 | "info": "F node" 75 | } 76 | }, 77 | { 78 | "data": { 79 | "id": "G", 80 | "fname": "G", 81 | "zone": "#b3cde3", 82 | "parent": "zoneC", 83 | "info": "G node" 84 | } 85 | }, 86 | { 87 | "data": { 88 | "id": "H", 89 | "fname": "H", 90 | "zone": "#b3cde3", 91 | "parent": "zoneC", 92 | "info": "H node" 93 | } 94 | }, 95 | { 96 | "data": { 97 | "id": "I", 98 | "fname": "I", 99 | "zone": "#b3cde3", 100 | "parent": "zoneC", 101 | "info": "I node" 102 | } 103 | } 104 | ], 105 | "edges": [ 106 | { 107 | "data": { 108 | "id": "arb2", 109 | "source": "B", 110 | "target": "D" 111 | } 112 | }, 113 | { 114 | "data": { 115 | "id": "arb3", 116 | "source": "B", 117 | "target": "E" 118 | } 119 | }, 120 | { 121 | "data": { 122 | "id": "arb4", 123 | "source": "B", 124 | "target": "C" 125 | } 126 | }, 127 | { 128 | "data": { 129 | "id": "arb5", 130 | "source": "C", 131 | "target": "F" 132 | } 133 | }, 134 | { 135 | "data": { 136 | "id": "arb6", 137 | "source": "A", 138 | "target": "B" 139 | } 140 | }, 141 | { 142 | "data": { 143 | "id": "arb7", 144 | "source": "C", 145 | "target": "G" 146 | } 147 | }, 148 | { 149 | "data": { 150 | "id": "arb8", 151 | "source": "C", 152 | "target": "I" 153 | } 154 | }, 155 | { 156 | "data": { 157 | "id": "arb9", 158 | "source": "G", 159 | "target": "H" 160 | } 161 | } 162 | ] 163 | }, 164 | "stepData": [ 165 | { 166 | "id": "0", 167 | "type": "single", 168 | "nodes": [ 169 | "B", 170 | "D" 171 | ], 172 | "steps": [], 173 | "description": "BD" 174 | }, 175 | { 176 | "id": "1", 177 | "type": "single", 178 | "nodes": [ 179 | "B", 180 | "E" 181 | ], 182 | "steps": [], 183 | "description": "BE" 184 | }, 185 | { 186 | "id": "2", 187 | "type": "single", 188 | "nodes": [ 189 | "A" 190 | ], 191 | "steps": [], 192 | "description": "A" 193 | }, 194 | { 195 | "id": "3", 196 | "type": "single", 197 | "nodes": [ 198 | "A" 199 | ], 200 | "steps": [], 201 | "description": "A" 202 | }, 203 | { 204 | "id": "4", 205 | "type": "single", 206 | "nodes": [ 207 | "A" 208 | ], 209 | "steps": [], 210 | "description": "A" 211 | }, 212 | { 213 | "id": "5", 214 | "type": "single", 215 | "nodes": [ 216 | "A", 217 | "B" 218 | ], 219 | "steps": [], 220 | "description": "AB" 221 | }, 222 | { 223 | "id": "6", 224 | "type": "single", 225 | "nodes": [ 226 | "B", 227 | "C" 228 | ], 229 | "steps": [], 230 | "description": "BC" 231 | }, 232 | { 233 | "id": "7", 234 | "type": "single", 235 | "nodes": [ 236 | "C", 237 | "F" 238 | ], 239 | "steps": [], 240 | "description": "CF" 241 | }, 242 | { 243 | "id": "8", 244 | "type": "single", 245 | "nodes": [ 246 | "F", 247 | "C" 248 | ], 249 | "steps": [], 250 | "description": "FC" 251 | }, 252 | { 253 | "id": "9", 254 | "type": "single", 255 | "nodes": [ 256 | "C" 257 | ], 258 | "steps": [], 259 | "description": "C" 260 | }, 261 | { 262 | "id": "10", 263 | "type": "single", 264 | "nodes": [ 265 | "C", 266 | "F" 267 | ], 268 | "steps": [], 269 | "description": "CF" 270 | }, 271 | { 272 | "id": "11", 273 | "type": "single", 274 | "nodes": [ 275 | "C", 276 | "F" 277 | ], 278 | "steps": [], 279 | "description": "CF" 280 | }, 281 | { 282 | "id": "12", 283 | "type": "single", 284 | "nodes": [ 285 | "F" 286 | ], 287 | "steps": [], 288 | "description": "F" 289 | }, 290 | { 291 | "id": "13", 292 | "type": "single", 293 | "nodes": [ 294 | "F", 295 | "C" 296 | ], 297 | "steps": [], 298 | "description": "FC" 299 | }, 300 | { 301 | "id": "14", 302 | "type": "single", 303 | "nodes": [ 304 | "C", 305 | "G" 306 | ], 307 | "steps": [], 308 | "description": "CG" 309 | }, 310 | { 311 | "id": "15", 312 | "type": "single", 313 | "nodes": [ 314 | "G", 315 | "H" 316 | ], 317 | "steps": [], 318 | "description": "GH" 319 | }, 320 | { 321 | "id": "16", 322 | "type": "single", 323 | "nodes": [ 324 | "G", 325 | "C" 326 | ], 327 | "steps": [], 328 | "description": "GC" 329 | }, 330 | { 331 | "id": "17", 332 | "type": "single", 333 | "nodes": [ 334 | "G" 335 | ], 336 | "steps": [], 337 | "description": "G" 338 | }, 339 | { 340 | "id": "18", 341 | "type": "single", 342 | "nodes": [ 343 | "C", 344 | "B" 345 | ], 346 | "steps": [], 347 | "description": "CB" 348 | }, 349 | { 350 | "id": "19", 351 | "type": "single", 352 | "nodes": [ 353 | "B", 354 | "C" 355 | ], 356 | "steps": [], 357 | "description": "BC" 358 | }, 359 | { 360 | "id": "20", 361 | "type": "single", 362 | "nodes": [ 363 | "C", 364 | "I" 365 | ], 366 | "steps": [], 367 | "description": "CI" 368 | }, 369 | { 370 | "id": "21", 371 | "type": "single", 372 | "nodes": [ 373 | "I", 374 | "C" 375 | ], 376 | "steps": [], 377 | "description": "IC" 378 | }, 379 | { 380 | "id": "22", 381 | "type": "single", 382 | "nodes": [ 383 | "C", 384 | "F" 385 | ], 386 | "steps": [], 387 | "description": "CF" 388 | }, 389 | { 390 | "id": "23", 391 | "type": "single", 392 | "nodes": [ 393 | "F" 394 | ], 395 | "steps": [], 396 | "description": "F" 397 | }, 398 | { 399 | "id": "24", 400 | "type": "single", 401 | "nodes": [ 402 | "F", 403 | "C" 404 | ], 405 | "steps": [], 406 | "description": "FC" 407 | }, 408 | { 409 | "id": "25", 410 | "type": "single", 411 | "nodes": [ 412 | "C" 413 | ], 414 | "steps": [], 415 | "description": "C" 416 | }, 417 | { 418 | "id": "26", 419 | "type": "single", 420 | "nodes": [ 421 | "C", 422 | "B" 423 | ], 424 | "steps": [], 425 | "description": "CB" 426 | } 427 | ], 428 | "zoneData": [ 429 | { 430 | "name": "zoneA", 431 | "color": "#fbb4ae", 432 | "base_color": "#FBDCD6" 433 | }, 434 | { 435 | "name": "zoneC", 436 | "color": "#b3cde3", 437 | "base_color": "#DBE6F2" 438 | }, 439 | { 440 | "name": "zoneB", 441 | "color": "#ccebc5", 442 | "base_color": "#E5F5E3" 443 | } 444 | ] 445 | } -------------------------------------------------------------------------------- /sample_plantuml_data/example.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title "Push Notification Enrollment" 4 | 5 | hide footbox 6 | autonumber "[0] " 7 | 8 | participant "Client App" as Client << (U, #ccebc5) user >> 9 | 10 | participant "Orchestration Layer" as Orch << (C, #b3cde3) capital one >> 11 | participant "Messaging Server" as MS << (C, #b3cde3) capital one >> 12 | note over MS 13 | This is where you can put useful information like links to documentation or support processes. 14 | end note 15 | 16 | participant "Notification Subscription Server" as NSS << (C, #b3cde3) capital one >> 17 | 18 | participant "APNS" as APNS << (E, #fbb4ae) external >> 19 | participant "GCM" as GCM << (E, #fbb4ae) external >> 20 | 21 | ==Customer Action== 22 | 23 | Client -> Client: First time login, or app upgrade, or user toggles notifications on/off in the app. 24 | 25 | ==Device Registration== 26 | 27 | Client -> APNS: If iOS, register device token in APNS 28 | Client -> GCM: If Android, register device token in GCM 29 | 30 | ==Update Messaging Server== 31 | 32 | Client -> Orch: Update device token 33 | 34 | Orch -> MS: Get existing subscriptions 35 | MS -> Orch: If success, return all 36 | Orch -> Orch: Check if device token is present 37 | 38 | Orch -> MS: If device token is present, stop (skip to next group) 39 | 40 | Orch -> MS: If device token not present, add subscription 41 | note left 42 | { "device_token" : "APA91bE_YiasYasbda..." } 43 | end note 44 | MS -> Orch: Return success/failure 45 | 46 | ==Update Master Subscription== 47 | 48 | Orch -> NSS: Register device token 49 | NSS -> Orch: Return success/failure 50 | 51 | Orch -> Orch: Swallow failure 52 | Orch -> Client: Return success/failure 53 | 54 | ==Replicate Subscriptions== 55 | 56 | Client -> Orch: Update subscriptions 57 | Orch -> MS: Update subscriptions 58 | 59 | MS -> MS: Update subscription in Messaging Server 60 | 61 | MS -> Orch: Return success/failure 62 | Orch -> Orch: Swallow failure 63 | Orch -> Client: Return success/failure 64 | 65 | @enduml 66 | -------------------------------------------------------------------------------- /sample_plantuml_data/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/sample_plantuml_data/example.png -------------------------------------------------------------------------------- /src/assets/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "zones example", 3 | "graphData": { 4 | "nodes": [ 5 | { 6 | "data": { 7 | "id": "zoneA", 8 | "zone": "#FBDCD6" 9 | } 10 | }, 11 | { 12 | "data": { 13 | "id": "zoneB", 14 | "zone": "#E5F5E3" 15 | } 16 | }, 17 | { 18 | "data": { 19 | "id": "zoneC", 20 | "zone": "#DBE6F2" 21 | } 22 | }, 23 | { 24 | "data": { 25 | "id": "A", 26 | "fname": "A", 27 | "zone": "#fbb4ae", 28 | "parent": "zoneA", 29 | "info": "A node" 30 | } 31 | }, 32 | { 33 | "data": { 34 | "id": "B", 35 | "fname": "B", 36 | "zone": "#b3cde3", 37 | "parent": "zoneC", 38 | "info": "B node" 39 | } 40 | }, 41 | { 42 | "data": { 43 | "id": "C", 44 | "fname": "C", 45 | "zone": "#b3cde3", 46 | "parent": "zoneC", 47 | "info": "C node" 48 | } 49 | }, 50 | { 51 | "data": { 52 | "id": "D", 53 | "fname": "D", 54 | "zone": "#ccebc5", 55 | "parent": "zoneB", 56 | "info": "D node" 57 | } 58 | }, 59 | { 60 | "data": { 61 | "id": "E", 62 | "fname": "E", 63 | "zone": "#ccebc5", 64 | "parent": "zoneB", 65 | "info": "E node" 66 | } 67 | }, 68 | { 69 | "data": { 70 | "id": "F", 71 | "fname": "F", 72 | "zone": "#b3cde3", 73 | "parent": "zoneC", 74 | "info": "F node" 75 | } 76 | }, 77 | { 78 | "data": { 79 | "id": "G", 80 | "fname": "G", 81 | "zone": "#b3cde3", 82 | "parent": "zoneC", 83 | "info": "G node" 84 | } 85 | }, 86 | { 87 | "data": { 88 | "id": "H", 89 | "fname": "H", 90 | "zone": "#b3cde3", 91 | "parent": "zoneC", 92 | "info": "H node" 93 | } 94 | }, 95 | { 96 | "data": { 97 | "id": "I", 98 | "fname": "I", 99 | "zone": "#b3cde3", 100 | "parent": "zoneC", 101 | "info": "I node" 102 | } 103 | } 104 | ], 105 | "edges": [ 106 | { 107 | "data": { 108 | "id": "arb2", 109 | "source": "B", 110 | "target": "D" 111 | } 112 | }, 113 | { 114 | "data": { 115 | "id": "arb3", 116 | "source": "B", 117 | "target": "E" 118 | } 119 | }, 120 | { 121 | "data": { 122 | "id": "arb4", 123 | "source": "B", 124 | "target": "C" 125 | } 126 | }, 127 | { 128 | "data": { 129 | "id": "arb5", 130 | "source": "C", 131 | "target": "F" 132 | } 133 | }, 134 | { 135 | "data": { 136 | "id": "arb6", 137 | "source": "A", 138 | "target": "B" 139 | } 140 | }, 141 | { 142 | "data": { 143 | "id": "arb7", 144 | "source": "C", 145 | "target": "G" 146 | } 147 | }, 148 | { 149 | "data": { 150 | "id": "arb8", 151 | "source": "C", 152 | "target": "I" 153 | } 154 | }, 155 | { 156 | "data": { 157 | "id": "arb9", 158 | "source": "G", 159 | "target": "H" 160 | } 161 | } 162 | ] 163 | }, 164 | "stepData": [ 165 | { 166 | "id": "0", 167 | "type": "single", 168 | "nodes": [ 169 | "B", 170 | "D" 171 | ], 172 | "steps": [], 173 | "description": "BD" 174 | }, 175 | { 176 | "id": "1", 177 | "type": "single", 178 | "nodes": [ 179 | "B", 180 | "E" 181 | ], 182 | "steps": [], 183 | "description": "BE" 184 | }, 185 | { 186 | "id": "2", 187 | "type": "single", 188 | "nodes": [ 189 | "A" 190 | ], 191 | "steps": [], 192 | "description": "A" 193 | }, 194 | { 195 | "id": "3", 196 | "type": "single", 197 | "nodes": [ 198 | "A" 199 | ], 200 | "steps": [], 201 | "description": "A" 202 | }, 203 | { 204 | "id": "4", 205 | "type": "single", 206 | "nodes": [ 207 | "A" 208 | ], 209 | "steps": [], 210 | "description": "A" 211 | }, 212 | { 213 | "id": "5", 214 | "type": "single", 215 | "nodes": [ 216 | "A", 217 | "B" 218 | ], 219 | "steps": [], 220 | "description": "AB" 221 | }, 222 | { 223 | "id": "6", 224 | "type": "single", 225 | "nodes": [ 226 | "B", 227 | "C" 228 | ], 229 | "steps": [], 230 | "description": "BC" 231 | }, 232 | { 233 | "id": "7", 234 | "type": "single", 235 | "nodes": [ 236 | "C", 237 | "F" 238 | ], 239 | "steps": [], 240 | "description": "CF" 241 | }, 242 | { 243 | "id": "8", 244 | "type": "single", 245 | "nodes": [ 246 | "F", 247 | "C" 248 | ], 249 | "steps": [], 250 | "description": "FC" 251 | }, 252 | { 253 | "id": "9", 254 | "type": "single", 255 | "nodes": [ 256 | "C" 257 | ], 258 | "steps": [], 259 | "description": "C" 260 | }, 261 | { 262 | "id": "10", 263 | "type": "single", 264 | "nodes": [ 265 | "C", 266 | "F" 267 | ], 268 | "steps": [], 269 | "description": "CF" 270 | }, 271 | { 272 | "id": "11", 273 | "type": "single", 274 | "nodes": [ 275 | "C", 276 | "F" 277 | ], 278 | "steps": [], 279 | "description": "CF" 280 | }, 281 | { 282 | "id": "12", 283 | "type": "single", 284 | "nodes": [ 285 | "F" 286 | ], 287 | "steps": [], 288 | "description": "F" 289 | }, 290 | { 291 | "id": "13", 292 | "type": "single", 293 | "nodes": [ 294 | "F", 295 | "C" 296 | ], 297 | "steps": [], 298 | "description": "FC" 299 | }, 300 | { 301 | "id": "14", 302 | "type": "single", 303 | "nodes": [ 304 | "C", 305 | "G" 306 | ], 307 | "steps": [], 308 | "description": "CG" 309 | }, 310 | { 311 | "id": "15", 312 | "type": "single", 313 | "nodes": [ 314 | "G", 315 | "H" 316 | ], 317 | "steps": [], 318 | "description": "GH" 319 | }, 320 | { 321 | "id": "16", 322 | "type": "single", 323 | "nodes": [ 324 | "G", 325 | "C" 326 | ], 327 | "steps": [], 328 | "description": "GC" 329 | }, 330 | { 331 | "id": "17", 332 | "type": "single", 333 | "nodes": [ 334 | "G" 335 | ], 336 | "steps": [], 337 | "description": "G" 338 | }, 339 | { 340 | "id": "18", 341 | "type": "single", 342 | "nodes": [ 343 | "C", 344 | "B" 345 | ], 346 | "steps": [], 347 | "description": "CB" 348 | }, 349 | { 350 | "id": "19", 351 | "type": "single", 352 | "nodes": [ 353 | "B", 354 | "C" 355 | ], 356 | "steps": [], 357 | "description": "BC" 358 | }, 359 | { 360 | "id": "20", 361 | "type": "single", 362 | "nodes": [ 363 | "C", 364 | "I" 365 | ], 366 | "steps": [], 367 | "description": "CI" 368 | }, 369 | { 370 | "id": "21", 371 | "type": "single", 372 | "nodes": [ 373 | "I", 374 | "C" 375 | ], 376 | "steps": [], 377 | "description": "IC" 378 | }, 379 | { 380 | "id": "22", 381 | "type": "single", 382 | "nodes": [ 383 | "C", 384 | "F" 385 | ], 386 | "steps": [], 387 | "description": "CF" 388 | }, 389 | { 390 | "id": "23", 391 | "type": "single", 392 | "nodes": [ 393 | "F" 394 | ], 395 | "steps": [], 396 | "description": "F" 397 | }, 398 | { 399 | "id": "24", 400 | "type": "single", 401 | "nodes": [ 402 | "F", 403 | "C" 404 | ], 405 | "steps": [], 406 | "description": "FC" 407 | }, 408 | { 409 | "id": "25", 410 | "type": "single", 411 | "nodes": [ 412 | "C" 413 | ], 414 | "steps": [], 415 | "description": "C" 416 | }, 417 | { 418 | "id": "26", 419 | "type": "single", 420 | "nodes": [ 421 | "C", 422 | "B" 423 | ], 424 | "steps": [], 425 | "description": "CB" 426 | } 427 | ], 428 | "zoneData": [ 429 | { 430 | "name": "zoneA", 431 | "color": "#fbb4ae", 432 | "base_color": "#FBDCD6" 433 | }, 434 | { 435 | "name": "zoneC", 436 | "color": "#b3cde3", 437 | "base_color": "#DBE6F2" 438 | }, 439 | { 440 | "name": "zoneB", 441 | "color": "#ccebc5", 442 | "base_color": "#E5F5E3" 443 | } 444 | ] 445 | } -------------------------------------------------------------------------------- /src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/favicon.ico -------------------------------------------------------------------------------- /src/assets/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /src/assets/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /src/assets/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /src/assets/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/favicon-16x16.png -------------------------------------------------------------------------------- /src/assets/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/icons/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/info.png -------------------------------------------------------------------------------- /src/assets/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/capitalone/architecture-viewer/70558ccdec3088ef8bd2ba0ed85f337fe2bc0024/src/assets/icons/mstile-150x150.png -------------------------------------------------------------------------------- /src/assets/test_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "Service A": { 3 | "type": "service", 4 | "outbound": [ 5 | { 6 | "name": "step 1", 7 | "process": "init", 8 | "endpoint": "Service B", 9 | "step": 1, 10 | "certainty_level": 2, 11 | "alternate": false 12 | } 13 | ] 14 | }, 15 | "Service B": { 16 | "type": "service", 17 | "outbound": [ 18 | { 19 | "name": "step 2", 20 | "process": "init", 21 | "endpoint": "Service C", 22 | "step": 2, 23 | "certainty_level": 2, 24 | "alternate": false 25 | } 26 | ] 27 | }, 28 | "Service C": { 29 | "type": "service", 30 | "outbound": [] 31 | } 32 | } -------------------------------------------------------------------------------- /src/components/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | import { Router } from 'preact-router'; 19 | 20 | // import Header from './header'; 21 | // import Home from '../routes/home'; 22 | // import Profile from '../routes/profile'; 23 | 24 | import DiagramArea from './diagramArea'; 25 | import InfoArea from './infoArea' 26 | 27 | import { parseContents } from './../utils/parser'; 28 | 29 | // import Home from 'async!./home'; 30 | // import Profile from 'async!./profile'; 31 | 32 | 33 | 34 | export default class App extends Component { 35 | // /** Gets fired when the route changes. 36 | // * @param {Object} event "change" event from [preact-router](http://git.io/preact-router) 37 | // * @param {string} event.url The newly routed URL 38 | // */ 39 | // handleRoute = e => { 40 | // this.currentUrl = e.url; 41 | // }; 42 | 43 | constructor(props) { 44 | super(props); 45 | this.fillProps = this.fillProps.bind(this); 46 | this.updateStep = this.updateStep.bind(this); 47 | this.updateData = this.updateData.bind(this); 48 | this.updateSelectedNode = this.updateSelectedNode.bind(this); 49 | this.state = { 50 | graphData: null, 51 | stepData: null, 52 | zoneData: null, 53 | curStep: 0, 54 | validJson: true, 55 | selectedNode: null 56 | }; 57 | } 58 | 59 | componentDidMount() { 60 | this.fillProps(); 61 | } 62 | 63 | /* 64 | sets selectedNode to null to clear out the greying out of 65 | unrelated steps 66 | */ 67 | updateStep(step_num) { 68 | this.setState(Object.assign(this.state, { 69 | curStep: step_num, 70 | selectedNode: null 71 | })) 72 | } 73 | 74 | updateSelectedNode(id) { 75 | this.setState(Object.assign(this.state, { 76 | selectedNode: id 77 | })) 78 | } 79 | 80 | updateData(data) { 81 | this.setState(Object.assign(this.state, { 82 | flowTitle: data.title, 83 | graphData: data.graphData, 84 | stepData: data.stepData, 85 | zoneData: data.zoneData, 86 | curStep: 0, 87 | selectedNode: null 88 | })); 89 | } 90 | 91 | getData() { 92 | const queryParams = new URLSearchParams(window.location.search); 93 | if (queryParams == undefined || queryParams == null || queryParams == "") { 94 | return fetch('assets/data.json') 95 | .then(res => res.json()) 96 | .then(json => ({ 97 | filename: "Wallet-Push Notifications-Subscription/Enrollment", 98 | data: json 99 | })) 100 | .catch(err => { 101 | alert(err); 102 | }); 103 | } else { 104 | const url = queryParams.get('url'); 105 | if (url == null) { 106 | return fetch('assets/data.json') 107 | .then(res => res.json()) 108 | .then(json => ({ 109 | filename: "Wallet-Push Notifications-Subscription/Enrollment", 110 | data: json 111 | })) 112 | .catch(err => { 113 | alert(err); 114 | }); 115 | } else { 116 | let filename = url.substring(url.lastIndexOf('/') + 1); 117 | let ext = filename.substr(filename.lastIndexOf('.') + 1); 118 | if (ext == "adoc") { 119 | return fetch(url) 120 | .then((res) => { 121 | if (res.ok) { 122 | return res.text() 123 | } else { 124 | throw { 125 | errtype: "custom", 126 | errmsg: "There seems to be an error with the page. Click 'OK' to open the page in a new tab and confirm it is a valid URL" 127 | } 128 | } 129 | }) 130 | .then(text => ({ 131 | filename: filename, 132 | data: parseContents(text.split("\n")) 133 | })) 134 | .catch(err => { 135 | console.log(((typeof err) === "object")); 136 | console.log(err.errtype === "custom"); 137 | if (((typeof err) === "object") && err.errtype === "custom") { 138 | if (confirm(err.errmsg)) { 139 | window.open(url); 140 | } 141 | } else { 142 | alert(err); 143 | } 144 | }); 145 | } else if (ext == "json") { 146 | return fetch(url) 147 | .then(res => res.json()) 148 | .then(json => ({ 149 | filename: filename, 150 | data: json 151 | })) 152 | .catch(err => { 153 | alert(err); 154 | }); 155 | } else { 156 | return fetch('assets/data.json') 157 | .then(res => res.json()) 158 | .then(json => ({ 159 | filename: "zones example", 160 | data: json 161 | })) 162 | .catch(err => { 163 | alert(err); 164 | }); 165 | } 166 | 167 | } 168 | } 169 | } 170 | 171 | fillProps() { 172 | 173 | let that = this; 174 | 175 | this.getData() 176 | .then((result) => { 177 | 178 | // console.log(result); 179 | const data = result.data; 180 | // console.log(data); 181 | data.title = data.title == undefined || data.title == "" ? result.filename : data.title; 182 | 183 | that.setState( 184 | Object.assign(this.state, { 185 | graphData: data.graphData, 186 | stepData: data.stepData, 187 | // zoneData: data.zoneData, 188 | flowTitle: data.title 189 | }) 190 | ); 191 | }) 192 | 193 | } 194 | 195 | render() { 196 | 197 | let repoUrl = window.location.href.replace("pages/", ""); 198 | 199 | if (this.state.graphData && this.state.stepData) { 200 | return ( 201 |
202 |
203 | 208 |
216 |
217 | 218 |
219 | ); 220 | } else { 221 | return
Loading...
222 | } 223 | } 224 | } 225 | 226 | /*
227 | 228 | 229 | 230 | 231 | */ -------------------------------------------------------------------------------- /src/components/controls.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | import validate from '../utils/dataValidator.js'; 19 | import { parseContents } from '../utils/parser.js'; 20 | 21 | export default class Controls extends Component { 22 | 23 | constructor(props) { 24 | super(props); 25 | this.decrementStep = this.decrementStep.bind(this); 26 | this.incrementStep = this.incrementStep.bind(this); 27 | this.firstStep = this.firstStep.bind(this); 28 | this.lastStep = this.lastStep.bind(this); 29 | this.handleKeyboardShortcuts = this.handleKeyboardShortcuts.bind(this); 30 | this.updateData = this.updateData.bind(this); 31 | } 32 | 33 | componentWillMount() { 34 | document.addEventListener("keydown", this.handleKeyboardShortcuts); 35 | } 36 | 37 | decrementStep() { 38 | const step = parseInt(this.props.curStep); 39 | if (step > 0) { 40 | this.props.updateStep(step - 1); 41 | } 42 | } 43 | 44 | incrementStep() { 45 | const step = parseInt(this.props.curStep); 46 | if (step < this.props.stepNum - 1) { 47 | this.props.updateStep(step + 1); 48 | } 49 | } 50 | 51 | firstStep() { 52 | let step = 0; 53 | this.props.updateStep(step); 54 | } 55 | 56 | lastStep() { 57 | let step = this.props.stepNum - 1; 58 | this.props.updateStep(step); 59 | } 60 | 61 | handleKeyboardShortcuts(event) { 62 | switch (event.keyCode) { 63 | case 37: 64 | //left arrow key 65 | this.decrementStep(); 66 | break; 67 | case 38: 68 | //up arrow key 69 | this.decrementStep(); 70 | break; 71 | case 39: 72 | //right arrow key 73 | this.incrementStep(); 74 | break; 75 | case 40: 76 | //down arrow key 77 | this.incrementStep(); 78 | break; 79 | } 80 | } 81 | 82 | updateData(evt) { 83 | const file = evt.target.files[0]; 84 | 85 | const fileName = file.name.slice(0, -5); 86 | 87 | // Clear out the file input. This is necessary to force a refresh of 88 | // the file any time you select a file. 89 | // 90 | // If you don't do this, then selecting a file with the same name will 91 | // cache the first version, and not load the newest version. 92 | evt.target.value = ''; 93 | 94 | var reader = new FileReader(); 95 | 96 | reader.onload = (e) => { 97 | //would update the data here 98 | let empty_json = { 99 | title: '', 100 | graphData: { 101 | nodes: [], 102 | edges: [] 103 | }, 104 | stepData: [], 105 | zoneData: [] 106 | }; 107 | 108 | let json = {}; 109 | try { 110 | 111 | let ext = file.name.substr(file.name.lastIndexOf('.') + 1); 112 | let validFileType = true; 113 | 114 | //TODO: REUSABLE FROM APP.JS 115 | if (ext == "json") { 116 | json = JSON.parse(reader.result); 117 | } else if (ext == "adoc") { 118 | json = parseContents(reader.result.split("\n")); 119 | } else { 120 | validFileType = false; 121 | } 122 | 123 | json.title = json.title == "" ? fileName : json.title; 124 | //this is where a parser would come in and check if the structure is correct 125 | //the checker is very rough at this point 126 | const validatorResult = validate(json); 127 | console.log("valid?: ", validatorResult.valid); 128 | 129 | var error = false; 130 | 131 | if (!validFileType) { 132 | json = empty_json; 133 | console.log("invalid file type!"); 134 | } 135 | else if (!validatorResult.valid) { 136 | json = empty_json; 137 | //TODO: RESERVE A SPOT ON THE SCREEN FOR ERRORS, put it in the TOC area 138 | console.log(validatorResult.errors); 139 | } 140 | 141 | } catch (e) { 142 | console.error(e); 143 | console.error('json could not be parsed!'); 144 | json = empty_json; 145 | } 146 | // console.log(json); 147 | this.props.updateData(json); 148 | } 149 | 150 | reader.readAsText(file); 151 | } 152 | 153 | render() { 154 | 155 | let controlsStyle = { 156 | display: 'flex', 157 | flexDirection: 'column', 158 | alignItems: 'center', 159 | justifyContent: 'space-around' 160 | } 161 | 162 | let stepElems; 163 | 164 | //fix to be 1-started 165 | const pNum = 1; 166 | 167 | if (this.props.stepNum == 0) { 168 | stepElems = null; 169 | } else { 170 | let iframeCheck; 171 | if (window.self != window.top) { 172 | iframeCheck = "iframe-button-style"; 173 | } else { 174 | iframeCheck = ""; 175 | } 176 | stepElems =
177 | 178 | 179 | Step: {parseInt(this.props.curStep) + 1} 180 | 181 | 182 |
; 183 | } 184 | 185 | return ( 186 |
187 | { stepElems } 188 |
189 | open a PlantUML file:  
190 | 191 |
192 |
193 | ) 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /src/components/diagram.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | // import cytoscape from './lib/cytoscape.min'; 20 | import cytoscape from 'cytoscape'; 21 | 22 | import cydagre from 'cytoscape-dagre'; 23 | import popper from 'cytoscape-popper'; 24 | 25 | import tippy from 'tippy.js'; 26 | 27 | // import undoRedo from 'cytoscape-undo-redo'; 28 | 29 | // import jquery from 'jquery'; 30 | // import expandCollapse from 'cytoscape-expand-collapse'; 31 | 32 | import { getCurrentStep } from '../utils/stepUtils' 33 | 34 | cytoscape.use(cydagre); 35 | cytoscape.use(popper); 36 | 37 | // cydagre(cytoscape); 38 | 39 | // undoRedo(cytoscape); 40 | // expandCollapse(cytoscape, jquery); 41 | 42 | export default class Diagram extends Component { 43 | 44 | constructor(props) { 45 | super(props); 46 | this.renderDiagram = this.renderDiagram.bind(this); 47 | this.processStep = this.processStep.bind(this); 48 | this.transferStep = this.transferStep.bind(this); 49 | this.curStep = 0; 50 | this.highlighted_nodes = []; 51 | } 52 | 53 | componentDidMount() { 54 | this.renderDiagram(); 55 | } 56 | 57 | componentDidUpdate(prevProps, prevState) { 58 | try { 59 | 60 | const curGraphData = Object.assign({}, this.props.graphData); 61 | const prevGraphData = Object.assign({},prevProps.graphData); 62 | 63 | // console.log(curGraphData); 64 | 65 | const extractNodeData = node => { 66 | const selectAttrs = ({ id, fname, zone, parent, info }) => ({ id, fname, zone, parent, info }); 67 | node.data = selectAttrs(node.data); 68 | return node; 69 | }; 70 | 71 | const extractEdgeData = edge => { 72 | const selectAttrs = ({ id, source, target }) => ({ id, source, target}); 73 | edge.data = selectAttrs(edge.data) 74 | return edge; 75 | } 76 | 77 | curGraphData.nodes = curGraphData.nodes.map(extractNodeData); 78 | curGraphData.edges = curGraphData.edges.map(extractEdgeData); 79 | 80 | prevGraphData.nodes = prevGraphData.nodes.map(extractNodeData); 81 | prevGraphData.edges = prevGraphData.edges.map(extractEdgeData); 82 | 83 | const curGraphDataStr = JSON.stringify(curGraphData); 84 | const prevGraphDataStr = JSON.stringify(prevGraphData); 85 | 86 | // console.log(curGraphDataStr, "\n", prevGraphDataStr); 87 | // console.log(previousGraphData); 88 | if (curGraphDataStr !== prevGraphDataStr) { 89 | this.renderDiagram(); 90 | } else { 91 | this.transferStep(this.props.curStep); 92 | } 93 | } catch (e) { 94 | // this.renderDiagram(); 95 | if (e instanceof TypeError) { 96 | 97 | } 98 | console.error(e); 99 | } 100 | } 101 | 102 | renderDiagram() { 103 | let that = this; 104 | 105 | this.cy = null; 106 | this.cy = cytoscape({ 107 | container: that.base, 108 | 109 | boxSelectionEnabled: false, 110 | autounselectify: true, 111 | panningEnabled: true, 112 | userPanningEnabled: true, 113 | userZoomingEnabled: true, 114 | 115 | 116 | layout: { 117 | name: 'dagre', 118 | directed: false, 119 | rankDir: 'LR', 120 | // ranker: 'tight-tree' 121 | animate: true, 122 | animationDuration: 0 123 | }, 124 | 125 | style: [ 126 | { 127 | selector: '[fname]', 128 | style: { 129 | 'height': 125, 130 | 'width': 175, 131 | 'background-color': 'data(zone)', 132 | 'content': e => e.data('fname') ? e.data('fname') : '', 133 | 'text-valign': 'center', 134 | 'text-halign': 'center', 135 | 'font-size': 25, 136 | 'shape': 'roundrectangle', 137 | 'border-width': '5px', 138 | 'border-color': e => e.data('zone'), 139 | 'text-wrap': 'wrap', 140 | 'text-max-width': 175, 141 | 'z-index': 20 142 | } 143 | }, 144 | { 145 | selector: '$node > [fname]', 146 | style: { 147 | 'height': 125, 148 | 'width': 175, 149 | 'background-color': 'data(zone)', 150 | 'content': e => e.data('fname') ? e.data('fname') : '', 151 | 'text-valign': 'top', 152 | 'text-halign': 'center', 153 | 'font-size': 25, 154 | 'shape': 'roundrectangle', 155 | 'border-width': '5px', 156 | 'border-color': e => e.data('zone'), 157 | 'z-index': 20 158 | } 159 | }, 160 | { 161 | selector: 'edge', 162 | style: { 163 | 'curve-style': 'bezier', 164 | // 'haystack-radius': 0, 165 | 'width': 10, 166 | 'opacity': 0.5, 167 | 'line-color': '#888', 168 | 'target-arrow-shape': 'none', 169 | 'target-arrow-color': '#888', 170 | 'target-endpoint': 'inside-to-node', 171 | 'source-arrow-shape': 'none', 172 | 'source-arrow-color': '#888', 173 | 'source-endpoint': 'inside-to-node', 174 | 'z-index': 30 175 | // 'mid-source-arrow-color': 'red', 176 | // 'mid-source-arrow-fill': 'filled' 177 | } 178 | }, 179 | { 180 | selector: '.highlighted', 181 | style: { 182 | 'border-color': '#248bca', 183 | // 'line-color': '#61bffc', 184 | 'transition-property': 'border-color', 185 | 'transition-duration': '0.25s', 186 | } 187 | }, 188 | { 189 | selector: '.highlighted-to-target', 190 | style: { 191 | 'border-color': '#248bca', 192 | 'line-color': '#248bca', 193 | 'transition-property': 'border-color, line-color, target-arrow-color', 194 | 'transition-duration': '0.25s', 195 | 'target-arrow-color': '#248bca', 196 | // 'source-arrow-color': '#61bffc', 197 | 'target-arrow-shape': 'triangle', 198 | // 'source-arrow-shape': 'none', 199 | 'target-endpoint': 'outside-to-node', 200 | 'arrow-scale': 1.5, 201 | 'opacity': 1 202 | } 203 | }, 204 | { 205 | selector: '.highlighted-to-source', 206 | style: { 207 | 'border-color': '#248bca', 208 | 'line-color': '#248bca', 209 | 'transition-property': 'border-color, line-color, source-arrow-color', 210 | 'transition-duration': '0.25s', 211 | 'source-arrow-color': '#248bca', 212 | // 'source-arrow-color': '#61bffc', 213 | 'source-arrow-shape': 'triangle', 214 | // 'source-arrow-shape': 'none', 215 | 'source-endpoint': 'outside-to-node', 216 | 'arrow-scale': 1.5, 217 | 'opacity': 1 218 | } 219 | }, 220 | ], 221 | 222 | elements: this.props.graphData 223 | }); 224 | 225 | this.cy.fit(this.cy.elements(), 20); 226 | this.cy.center(); 227 | 228 | 229 | let nodes = this.cy.filter((ele, i, eles) => { 230 | return (ele.data('parent') != undefined); 231 | }) 232 | 233 | let popperNodes = this.cy.filter((ele, i, eles) => { 234 | return (ele.data('parent') != undefined) && (ele.data('info') != undefined && ele.data('info') != ""); 235 | }); 236 | 237 | let parents = this.cy.filter((ele, i, eles) => { 238 | return (ele.data('parent') == undefined); 239 | }) 240 | 241 | //if none of them have parents, that means no zones 242 | if (nodes.length == 0) { 243 | nodes = this.cy.filter((ele, i, eles) => { 244 | return (ele.data('parent') == undefined); 245 | }) 246 | 247 | popperNodes = this.cy.filter((ele, i, eles) => { 248 | return (ele.data('parent') == undefined) && (ele.data('info') != undefined && ele.data('info') != ""); 249 | }) 250 | } 251 | 252 | let tippyMap = {}; 253 | 254 | for (let i = 0; i < popperNodes.length; i++) { 255 | let popperNode = popperNodes[i]; 256 | 257 | tippyMap[popperNode.data('id')] = tippy(popperNode.popperRef(), { 258 | html: (() => { 259 | let content = document.createElement('div'); 260 | content.innerHTML = popperNode.data('info'); 261 | 262 | return content; 263 | })(), 264 | trigger: 'manual' 265 | }).tooltips[0]; 266 | 267 | // tippyMap[popperNode.data('id')].show(); 268 | } 269 | 270 | nodes.on('click', function(evt) { 271 | that.props.updateSelectedNode(evt.target.id()); 272 | // the only way I could get this tooltip to appear 273 | // was with a timeout 274 | // TODO: find a better way to do this 275 | setTimeout(() => { 276 | // console.log(tippyMap[evt.target.id()]); 277 | tippyMap[evt.target.id()].show(); 278 | }, 250); 279 | }) 280 | 281 | // console.log(this.props.curStep); 282 | this.transferStep(this.props.curStep); 283 | } 284 | 285 | processStep(step) { 286 | //a bit of debugging 287 | 288 | let nodes = step.nodes.map(node => { 289 | return this.cy.filter((ele, i, eles) => ele.data('id') === node)[0] 290 | }); 291 | 292 | this.highlighted_nodes = this.highlighted_nodes.concat(nodes); 293 | 294 | // console.log(nodes); 295 | 296 | nodes[0].addClass('highlighted'); 297 | 298 | if (nodes.length == 1) { 299 | return; 300 | } 301 | 302 | let edges = this.cy.filter((ele, i, eles) => { 303 | if (ele.data('source') == step.nodes[0] && 304 | ele.data('target') == step.nodes[1] || 305 | ele.data('target') == step.nodes[0] && 306 | ele.data('source') == step.nodes[1]) { 307 | return true; 308 | } 309 | }); 310 | 311 | this.highlighted_nodes = this.highlighted_nodes.concat(edges); 312 | 313 | if (edges[0].data('source') == step.nodes[0]) { 314 | edges[0].addClass('highlighted-to-target'); 315 | } else { 316 | edges[0].addClass('highlighted-to-source'); 317 | } 318 | 319 | nodes[1].addClass('highlighted'); 320 | } 321 | 322 | transferStep(stepNum) { 323 | 324 | //find the step 325 | const stepStr = ""+(this.props.curStep); 326 | const relevantStep = getCurrentStep(stepStr, this.props.stepData); 327 | 328 | this.highlighted_nodes.map(node => { 329 | node.removeClass('highlighted'); 330 | node.removeClass('highlighted-to-target'); 331 | node.removeClass('highlighted-to-source'); 332 | }) 333 | 334 | this.highlighted_nodes = []; 335 | 336 | if (stepNum >= 0 && relevantStep != null) { 337 | 338 | this.curStep = stepNum; 339 | this.processStep(relevantStep); 340 | } 341 | } 342 | 343 | render() { 344 | 345 | let style = { 346 | width: '100%', 347 | height: '100%' 348 | }; 349 | 350 | if (this.props.dims && this.props.dims.width) { 351 | style.width = this.props.dims.width; 352 | } 353 | 354 | if (this.props.dims && this.props.dims.height) { 355 | style.height = this.props.dims.height; 356 | } 357 | 358 | return ( 359 |
360 | ) 361 | } 362 | } -------------------------------------------------------------------------------- /src/components/diagramArea.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | import Diagram from './diagram'; 20 | import ZoneLegend from './zoneLegend'; 21 | 22 | export default class DiagramArea extends Component { 23 | constructor(props) { 24 | super(props); 25 | // console.log(props); 26 | } 27 | 28 | render() { 29 | 30 | let dims = {}; 31 | 32 | //this is a hack but it's ok 33 | if (this.props.stepData.length == 0 && window.self == window.top) { 34 | dims.width = 'calc(80vw - 30px)'; 35 | } else if (this.props.stepData.length == 0 && window.self != window.top) { 36 | dims.width = 'calc(70vw - 30px)' 37 | } else { 38 | dims.width = 'calc(60vw - 30px)' 39 | } 40 | 41 | let diagramAreaStyle = { 42 | width: dims.width, 43 | height: 'calc(100% - 20px)', 44 | zIndex: '999' 45 | }; 46 | 47 | let btnStyle = { 48 | position: 'absolute', 49 | left: '10px', 50 | top: '10px', 51 | zIndex: 1000 52 | }; 53 | 54 | return
55 | {this.diag = d; }} 63 | /> 64 | 65 |
66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/components/info.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | export default class Info extends Component { 20 | 21 | render() { 22 | 23 | let el; 24 | 25 | if (!this.props.flowTitle) { 26 | el =
27 |

Invalid Title!

28 |
29 | } else { 30 | el =
31 |

{this.props.flowTitle}

32 |
33 | } 34 | 35 | return el; 36 | } 37 | } -------------------------------------------------------------------------------- /src/components/infoArea.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | import Controls from './controls'; 20 | import TableOfContents from './tableOfContents'; 21 | import Info from './info'; 22 | 23 | 24 | export default class InfoArea extends Component { 25 | 26 | render() { 27 | 28 | let width; 29 | 30 | if (this.props.stepData.length == 0 && window.self == window.top) { 31 | width = 'calc(20% - 30px)' 32 | } else if (this.props.stepData.length == 0 && window.self != window.top) { 33 | width = 'calc(30% - 30px)'; 34 | } else { 35 | width = 'calc(40% - 30px)' 36 | } 37 | 38 | let infoAreaStyle = { 39 | width: width, 40 | height: 'calc(100% - 20px)', 41 | zIndex: '999', 42 | display: 'flex', 43 | flexDirection: 'column', 44 | alignItems: 'center', 45 | justifyContent: 'space-around' 46 | } 47 | 48 | const countSteps = (sum, step) => { 49 | if (step.type == "single") { 50 | return sum + 1; 51 | } else if (step.type == "group") { 52 | return step.steps.reduce(countSteps, sum); 53 | } 54 | } 55 | 56 | let stepNum = this.props.stepData.reduce(countSteps, 0); 57 | 58 | return ( 59 |
60 | 61 | 65 | 66 | 70 |
71 | ) 72 | } 73 | } 74 | 75 | /*
info
*/ -------------------------------------------------------------------------------- /src/components/key.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | export default class Key extends Component { 20 | 21 | constructor(props) { 22 | super(props); 23 | } 24 | 25 | render() { 26 | 27 | let keyStyle = { 28 | width: 'calc(50% - 5px)', 29 | backgroundColor: this.props.color, 30 | padding: '5px', 31 | border: '1px solid ' + this.props.color, 32 | borderRadius: '3px', 33 | margin: '5px' 34 | } 35 | 36 | return ( 37 |
38 | {this.props.name} 39 |
40 | ) 41 | } 42 | } -------------------------------------------------------------------------------- /src/components/tableOfContents.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | import TocStep from './tocStep'; 20 | 21 | import { getCurrentStep } from '../utils/stepUtils' 22 | 23 | export default class TableOfContents extends Component { 24 | 25 | constructor(props) { 26 | super(props); 27 | } 28 | 29 | render() { 30 | 31 | 32 | let tableOfContentsStyle = { 33 | overflowY: 'auto', 34 | overflowX: 'hidden' 35 | } 36 | 37 | const stepStr = ""+(this.props.curStep); 38 | const currentStep = getCurrentStep(stepStr, this.props.stepData); 39 | 40 | 41 | const flattenSteps = (steps) => { 42 | const flattened = []; 43 | 44 | steps.forEach(s => { 45 | if (s.type == "single") { 46 | flattened.push(s); 47 | } else if (s.type == "group") { 48 | flattened.push(...flattenSteps(s.steps)); 49 | } 50 | }); 51 | 52 | return flattened; 53 | } 54 | const flattenedSteps = flattenSteps(this.props.stepData); 55 | 56 | const filterRelated = flattenedSteps.filter(step => this.props.selectedNode != null && 57 | step.nodes.includes(this.props.selectedNode)).length > 0; 58 | 59 | 60 | const renderStep = (step) => { 61 | if (step.type == "single") { 62 | let matches = false; 63 | let related = false; 64 | if (this.props.selectedNode != null) { 65 | related = step.nodes.includes(this.props.selectedNode); 66 | } 67 | matches = currentStep != null && step.id === currentStep.id; 68 | return 73 | 74 | } else if (step.type == "group") { 75 | return ( 76 |
  • 77 | ({step.groupName}) {step.description} 78 |
      79 | {step.steps.map(renderStep)} 80 |
    81 |
  • 82 | ); 83 | } 84 | 85 | } 86 | 87 | const stepLi = this.props.stepData.map(renderStep); 88 | 89 | let emptyMsg; 90 | let msgStyle = { 91 | textAlign: 'center' 92 | }; 93 | 94 | if (stepLi.length == 0) { 95 | emptyMsg =

    add steps to the JSON file if you want to step through a flow

    96 | } else { 97 | emptyMsg = null; 98 | } 99 | 100 | return ( 101 |
    { this.scrolldiv = div }}> 105 | {emptyMsg} 106 |
      107 | {stepLi} 108 |
    109 |
    110 | ) 111 | } 112 | } -------------------------------------------------------------------------------- /src/components/tocStep.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | import info from '../assets/icons/info.png'; 19 | 20 | export default class TocStep extends Component { 21 | 22 | constructor(props) { 23 | super(props); 24 | this.setStep = this.setStep.bind(this); 25 | this.toggleToolTip = this.toggleToolTip.bind(this); 26 | this.state = { 27 | showToolTip: false 28 | }; 29 | } 30 | 31 | componentDidUpdate() { 32 | // console.log(!elementInViewport(this.elem)); 33 | 34 | function isElementInContainer(el, container) { 35 | 36 | var el_rect = el.getBoundingClientRect(); 37 | // console.log(el_rect); 38 | 39 | var cont_rect = container.getBoundingClientRect(); 40 | // console.log(cont_rect); 41 | 42 | return ( 43 | el_rect.top >= cont_rect.top && 44 | el_rect.bottom <= cont_rect.bottom 45 | ); 46 | } 47 | 48 | if (this.props.matches && !isElementInContainer(this.elem, document.getElementById("table-of-contents"))) { 49 | this.elem.scrollIntoView(false); 50 | } 51 | } 52 | 53 | setStep() { 54 | this.props.updateStep(this.props.step.id); 55 | } 56 | 57 | toggleToolTip() { 58 | this.setState({ 59 | showToolTip: !this.state.showToolTip 60 | }); 61 | } 62 | 63 | render() { 64 | 65 | let classNames = []; 66 | if (this.props.matches) { 67 | classNames.push("current-step-toc"); 68 | } 69 | if (!this.props.related && this.props.filterRelated) { 70 | classNames.push("unrelated-step-toc"); 71 | } 72 | 73 | if (window.self != window.top) { 74 | classNames.push("iframe-list-style"); 75 | } 76 | 77 | const hasToolTip = this.props.step.note != undefined && this.props.step.note != ""; 78 | let toolTip = null; 79 | let toolTipText = null; 80 | // console.log(this.props.step); 81 | if (hasToolTip) { 82 | classNames.push("hasnote"); 83 | toolTip = ( 84 | 85 | ); 86 | toolTipText = ( 87 |
    ")}}>
    88 | ) 89 | } 90 | 91 | return
  • { this.elem = elem }} 93 | className={classNames.join(' ')} 94 | onclick={this.setStep} > 95 | {toolTip} 96 | {this.props.step.description}
    97 | {this.state.showToolTip ? toolTipText : null} 98 |
  • 99 | } 100 | } -------------------------------------------------------------------------------- /src/components/zoneLegend.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | 19 | import Key from './key'; 20 | 21 | export default class ZoneLegend extends Component { 22 | 23 | constructor(props) { 24 | super(props); 25 | } 26 | 27 | render() { 28 | 29 | let zoneLegendStyle = { 30 | display: 'flex', 31 | flexDirection: 'column', 32 | // justifyContent: 'space-around', 33 | flexWrap: 'wrap', 34 | position: 'absolute', 35 | bottom: '15px', 36 | left: '20px', 37 | width: '200px', 38 | height: '160px' 39 | } 40 | 41 | if (this.props.keys.length <= 0) { 42 | zoneLegendStyle.display = 'none'; 43 | } 44 | 45 | let keys = this.props.keys.map(key => { 46 | return 47 | }) 48 | 49 | return ( 50 |
    51 | { keys } 52 |
    53 | ) 54 | } 55 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './style'; 18 | import App from './components/app'; 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Architecture Viewer", 3 | "short_name": "Arch Viewer", 4 | "start_url": "/", 5 | "display": "standalone", 6 | "orientation": "portrait", 7 | "background_color": "#fff", 8 | "theme_color": "#673ab8", 9 | "icons": [{ 10 | "src": "/assets/icons/android-chrome-192x192.png", 11 | "type": "image/png", 12 | "sizes": "192x192" 13 | }, 14 | { 15 | "src": "/assets/icons/android-chrome-512x512.png", 16 | "type": "image/png", 17 | "sizes": "512x512" 18 | }] 19 | } 20 | -------------------------------------------------------------------------------- /src/routes/home/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | import style from './style'; 19 | 20 | export default class Home extends Component { 21 | render() { 22 | return ( 23 |
    24 |

    Home

    25 |

    This is the Home component.

    26 |
    27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/routes/home/style.less: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @import '~style/helpers'; 18 | 19 | .home { 20 | padding: 56px 20px; 21 | min-height: 100%; 22 | width: 100%; 23 | } 24 | -------------------------------------------------------------------------------- /src/routes/profile/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { h, Component } from 'preact'; 18 | import style from './style'; 19 | 20 | export default class Profile extends Component { 21 | state = { 22 | time: Date.now(), 23 | count: 10 24 | }; 25 | 26 | // gets called when this route is navigated to 27 | componentDidMount() { 28 | // start a timer for the clock: 29 | this.timer = setInterval(this.updateTime, 1000); 30 | } 31 | 32 | // gets called just before navigating away from the route 33 | componentWillUnmount() { 34 | clearInterval(this.timer); 35 | } 36 | 37 | // update the current time 38 | updateTime = () => { 39 | this.setState({ time: Date.now() }); 40 | }; 41 | 42 | increment = () => { 43 | this.setState({ count: this.state.count+1 }); 44 | }; 45 | 46 | // Note: `user` comes from the URL, courtesy of our router 47 | render({ user }, { time, count }) { 48 | return ( 49 |
    50 |

    Profile: {user}

    51 |

    This is the user profile for a user named { user }.

    52 | 53 |
    Current time: {new Date(time).toLocaleString()}
    54 | 55 |

    56 | 57 | {' '} 58 | Clicked {count} times. 59 |

    60 |
    61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/routes/profile/style.less: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @import '~style/helpers'; 18 | 19 | .profile { 20 | padding: 56px 20px; 21 | min-height: 100%; 22 | width: 100%; 23 | } 24 | -------------------------------------------------------------------------------- /src/style/helpers.less: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @red: #F00; 18 | @blue: #00F; 19 | @white: #FFF; 20 | @gray: #999; 21 | @black: #000; 22 | 23 | .fill() { 24 | position: absolute; 25 | left: 0; 26 | top: 0; 27 | width: 100%; 28 | height: 100%; 29 | } 30 | 31 | .scroll() { 32 | overflow: auto; 33 | overflow-scrolling: touch; 34 | 35 | & > .inner { 36 | position: relative; 37 | transform: translateZ(0); 38 | overflow: hidden; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/style/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | html, body { 18 | height: 100%; 19 | width: 100%; 20 | padding: 0; 21 | margin: 0; 22 | background: #FAFAFA; 23 | font-family: 'Helvetica Neue', arial, sans-serif; 24 | font-weight: 400; 25 | color: #444; 26 | -webkit-font-smoothing: antialiased; 27 | -moz-osx-font-smoothing: grayscale; 28 | } 29 | 30 | * { 31 | box-sizing: border-box; 32 | } 33 | 34 | h1, h2, h3, h4, h5 { 35 | margin: 0; 36 | -webkit-margin-before: 0; 37 | -webkit-margin-after: 0; 38 | } 39 | 40 | #container { 41 | height: 97%; 42 | } 43 | 44 | #app { 45 | height: 100%; 46 | display: flex; 47 | flex-direction: row; 48 | justify-content: space-around; 49 | align-items: center; 50 | } 51 | 52 | #footer { 53 | width: 100%; 54 | text-align: center; 55 | } 56 | 57 | /* 58 | /*#infoArea { 59 | /* height: 100%; 60 | /* width: 50%; 61 | /* display: flex; 62 | /* flex-direction: column; 63 | /* /*justify-content: center; 64 | /* align-items: center; 65 | /*} 66 | */ 67 | 68 | #info { 69 | height: calc(22.5% - 5px); 70 | width: calc(100% - 5px); 71 | /* padding: 10px; */ 72 | text-align: center; 73 | /* margin: 10px; */ 74 | display: flex; 75 | flex-direction: column; 76 | justify-content: center; 77 | overflow-y: 'auto'; 78 | min-height: min-content; 79 | } 80 | 81 | #controls { 82 | height: calc(22.5% - 5px); 83 | width: calc(100% - 5px); 84 | padding: 10px; 85 | text-align: center; 86 | min-height: min-content; 87 | /* margin: 10px; */ 88 | } 89 | 90 | button { 91 | padding: 10px 15px; 92 | margin: 5px; 93 | border-radius: 3px; 94 | cursor: pointer; 95 | background-color: white; 96 | border-color: #ddd; 97 | } 98 | 99 | #table-of-contents { 100 | height: calc(55% + 5px); 101 | width: calc(100% - 5px); 102 | padding: 10px; 103 | } 104 | 105 | #zone-legend { 106 | /* height: 20%; */ 107 | /* width: calc(100% - 5px); */ 108 | padding: 10px; 109 | } 110 | 111 | #table-of-contents > ol { 112 | cursor: pointer; 113 | } 114 | 115 | .sub-container-border { 116 | border: 1px solid #ddd; 117 | border-radius: 4px; 118 | } 119 | 120 | .container-border { 121 | border: 2px solid #bbb; 122 | border-radius: 2px; 123 | } 124 | 125 | .cur-step { 126 | margin-left: 10px; 127 | margin-right: 10px; 128 | } 129 | 130 | .current-step-toc { 131 | font-weight: bold; 132 | } 133 | 134 | .unrelated-step-toc { 135 | color: #ccc; 136 | } 137 | 138 | .iframe-list-style { 139 | font-size: 10px; 140 | } 141 | 142 | .iframe-button-style { 143 | padding: 5px 10px; 144 | } 145 | 146 | .tooltip { 147 | position: relative; 148 | display: inline-block; 149 | border-bottom: 1px dotted black; 150 | } 151 | 152 | .tooltip .tooltiptext { 153 | visibility: hidden; 154 | width: 300px; 155 | background-color: black; 156 | color: #fff; 157 | text-align: center; 158 | border-radius: 6px; 159 | padding: 5px 0; 160 | position: absolute; 161 | z-index: 1; 162 | top: -5px; 163 | left: 110%; 164 | } 165 | 166 | .tooltip .tooltiptext::after { 167 | content: ""; 168 | position: absolute; 169 | top: 50%; 170 | right: 100%; 171 | margin-top: -5px; 172 | border-width: 5px; 173 | border-style: solid; 174 | border-color: transparent black transparent transparent; 175 | } 176 | 177 | .tooltip:hover .tooltiptext { 178 | visibility: visible; 179 | } 180 | 181 | .custom-list { 182 | list-style-type: none; 183 | counter-reset: step-counter; 184 | } 185 | 186 | .custom-list li { 187 | counter-increment: step-counter; 188 | position: relative; 189 | 190 | } 191 | 192 | .custom-list li::before { 193 | content: counter(step-counter); 194 | margin-right: 5px; 195 | /* font-size: 80%; */ 196 | /* background-color: rgb(200,200,200); */ 197 | color: #444; 198 | font-weight: bold; 199 | /* padding: 3px 8px; */ 200 | /* border-radius: 3px; */ 201 | } 202 | 203 | .custom-list .hasnote::before { 204 | content: counter(step-counter); 205 | margin-right: 5px; 206 | /* font-size: 80%; */ 207 | /* background-color: rgb(0,200,200); */ 208 | color: #444; 209 | font-weight: bold; 210 | /* padding: 3px 8px; */ 211 | /* border-radius: 3px; */ 212 | } 213 | 214 | .to-left { 215 | position: absolute; 216 | left: -25px; 217 | } 218 | 219 | .note { 220 | border: 1px #A80036 solid; 221 | margin: 10px; 222 | padding: 5px; 223 | background-color: #FBFB77; 224 | } -------------------------------------------------------------------------------- /src/style/jquery.qtip.less: -------------------------------------------------------------------------------- 1 | /* 2 | * qTip2 - Pretty powerful tooltips - v2.2.0 3 | * http://qtip2.com 4 | * 5 | * Copyright (c) 2013 Craig Michael Thompson 6 | * Released under the MIT, GPL licenses 7 | * http://jquery.org/license 8 | * 9 | * Date: Thu Nov 21 2013 08:34 GMT+0000 10 | * Plugins: tips modal viewport svg imagemap ie6 11 | * Styles: basic css3 12 | */ 13 | .qtip{ 14 | position: absolute; 15 | left: -28000px; 16 | top: -28000px; 17 | display: none; 18 | 19 | max-width: 280px; 20 | min-width: 50px; 21 | 22 | font-size: 10.5px; 23 | line-height: 12px; 24 | 25 | direction: ltr; 26 | 27 | box-shadow: none; 28 | padding: 0; 29 | } 30 | 31 | .qtip-content{ 32 | position: relative; 33 | padding: 5px 9px; 34 | overflow: hidden; 35 | 36 | text-align: left; 37 | word-wrap: break-word; 38 | } 39 | 40 | .qtip-titlebar{ 41 | position: relative; 42 | padding: 5px 35px 5px 10px; 43 | overflow: hidden; 44 | 45 | border-width: 0 0 1px; 46 | font-weight: bold; 47 | } 48 | 49 | .qtip-titlebar + .qtip-content{ border-top-width: 0 !important; } 50 | 51 | /* Default close button class */ 52 | .qtip-close{ 53 | position: absolute; 54 | right: -9px; top: -9px; 55 | 56 | cursor: pointer; 57 | outline: medium none; 58 | 59 | border-width: 1px; 60 | border-style: solid; 61 | border-color: transparent; 62 | } 63 | 64 | .qtip-titlebar .qtip-close{ 65 | right: 4px; top: 50%; 66 | margin-top: -9px; 67 | } 68 | 69 | * html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */ 70 | 71 | .qtip-titlebar .ui-icon, 72 | .qtip-icon .ui-icon{ 73 | display: block; 74 | text-indent: -1000em; 75 | direction: ltr; 76 | } 77 | 78 | .qtip-icon, .qtip-icon .ui-icon{ 79 | -moz-border-radius: 3px; 80 | -webkit-border-radius: 3px; 81 | border-radius: 3px; 82 | text-decoration: none; 83 | } 84 | 85 | .qtip-icon .ui-icon{ 86 | width: 18px; 87 | height: 14px; 88 | 89 | line-height: 14px; 90 | text-align: center; 91 | text-indent: 0; 92 | font: normal bold 10px/13px Tahoma,sans-serif; 93 | 94 | color: inherit; 95 | background: transparent none no-repeat -100em -100em; 96 | } 97 | 98 | /* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */ 99 | .qtip-focus{} 100 | 101 | /* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */ 102 | .qtip-hover{} 103 | 104 | /* Default tooltip style */ 105 | .qtip-default{ 106 | border-width: 1px; 107 | border-style: solid; 108 | border-color: #F1D031; 109 | 110 | background-color: #FFFFA3; 111 | color: #555; 112 | } 113 | 114 | .qtip-default .qtip-titlebar{ 115 | background-color: #FFEF93; 116 | } 117 | 118 | .qtip-default .qtip-icon{ 119 | border-color: #CCC; 120 | background: #F1F1F1; 121 | color: #777; 122 | } 123 | 124 | .qtip-default .qtip-titlebar .qtip-close{ 125 | border-color: #AAA; 126 | color: #111; 127 | } 128 | 129 | 130 | 131 | /*! Light tooltip style */ 132 | .qtip-light{ 133 | background-color: white; 134 | border-color: #E2E2E2; 135 | color: #454545; 136 | } 137 | 138 | .qtip-light .qtip-titlebar{ 139 | background-color: #f1f1f1; 140 | } 141 | 142 | 143 | /*! Dark tooltip style */ 144 | .qtip-dark{ 145 | background-color: #505050; 146 | border-color: #303030; 147 | color: #f3f3f3; 148 | } 149 | 150 | .qtip-dark .qtip-titlebar{ 151 | background-color: #404040; 152 | } 153 | 154 | .qtip-dark .qtip-icon{ 155 | border-color: #444; 156 | } 157 | 158 | .qtip-dark .qtip-titlebar .ui-state-hover{ 159 | border-color: #303030; 160 | } 161 | 162 | 163 | /*! Cream tooltip style */ 164 | .qtip-cream{ 165 | background-color: #FBF7AA; 166 | border-color: #F9E98E; 167 | color: #A27D35; 168 | } 169 | 170 | .qtip-cream .qtip-titlebar{ 171 | background-color: #F0DE7D; 172 | } 173 | 174 | .qtip-cream .qtip-close .qtip-icon{ 175 | background-position: -82px 0; 176 | } 177 | 178 | 179 | /*! Red tooltip style */ 180 | .qtip-red{ 181 | background-color: #F78B83; 182 | border-color: #D95252; 183 | color: #912323; 184 | } 185 | 186 | .qtip-red .qtip-titlebar{ 187 | background-color: #F06D65; 188 | } 189 | 190 | .qtip-red .qtip-close .qtip-icon{ 191 | background-position: -102px 0; 192 | } 193 | 194 | .qtip-red .qtip-icon{ 195 | border-color: #D95252; 196 | } 197 | 198 | .qtip-red .qtip-titlebar .ui-state-hover{ 199 | border-color: #D95252; 200 | } 201 | 202 | 203 | /*! Green tooltip style */ 204 | .qtip-green{ 205 | background-color: #CAED9E; 206 | border-color: #90D93F; 207 | color: #3F6219; 208 | } 209 | 210 | .qtip-green .qtip-titlebar{ 211 | background-color: #B0DE78; 212 | } 213 | 214 | .qtip-green .qtip-close .qtip-icon{ 215 | background-position: -42px 0; 216 | } 217 | 218 | 219 | /*! Blue tooltip style */ 220 | .qtip-blue{ 221 | background-color: #E5F6FE; 222 | border-color: #ADD9ED; 223 | color: #5E99BD; 224 | } 225 | 226 | .qtip-blue .qtip-titlebar{ 227 | background-color: #D0E9F5; 228 | } 229 | 230 | .qtip-blue .qtip-close .qtip-icon{ 231 | background-position: -2px 0; 232 | } 233 | 234 | 235 | 236 | .qtip-shadow{ 237 | -webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); 238 | -moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); 239 | box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); 240 | } 241 | 242 | /* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */ 243 | .qtip-rounded, 244 | .qtip-tipsy, 245 | .qtip-bootstrap{ 246 | -moz-border-radius: 5px; 247 | -webkit-border-radius: 5px; 248 | border-radius: 5px; 249 | } 250 | 251 | .qtip-rounded .qtip-titlebar{ 252 | -moz-border-radius: 4px 4px 0 0; 253 | -webkit-border-radius: 4px 4px 0 0; 254 | border-radius: 4px 4px 0 0; 255 | } 256 | 257 | /* Youtube tooltip style */ 258 | .qtip-youtube{ 259 | -moz-border-radius: 2px; 260 | -webkit-border-radius: 2px; 261 | border-radius: 2px; 262 | 263 | -webkit-box-shadow: 0 0 3px #333; 264 | -moz-box-shadow: 0 0 3px #333; 265 | box-shadow: 0 0 3px #333; 266 | 267 | color: white; 268 | border-width: 0; 269 | 270 | background: #4A4A4A; 271 | background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black)); 272 | background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%); 273 | background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%); 274 | background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%); 275 | background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%); 276 | } 277 | 278 | .qtip-youtube .qtip-titlebar{ 279 | background-color: #4A4A4A; 280 | background-color: rgba(0,0,0,0); 281 | } 282 | 283 | .qtip-youtube .qtip-content{ 284 | padding: .75em; 285 | font: 12px arial,sans-serif; 286 | 287 | filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000); 288 | -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);"; 289 | } 290 | 291 | .qtip-youtube .qtip-icon{ 292 | border-color: #222; 293 | } 294 | 295 | .qtip-youtube .qtip-titlebar .ui-state-hover{ 296 | border-color: #303030; 297 | } 298 | 299 | 300 | /* jQuery TOOLS Tooltip style */ 301 | .qtip-jtools{ 302 | background: #232323; 303 | background: rgba(0, 0, 0, 0.7); 304 | background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323)); 305 | background-image: -moz-linear-gradient(top, #717171, #232323); 306 | background-image: -webkit-linear-gradient(top, #717171, #232323); 307 | background-image: -ms-linear-gradient(top, #717171, #232323); 308 | background-image: -o-linear-gradient(top, #717171, #232323); 309 | 310 | border: 2px solid #ddd; 311 | border: 2px solid rgba(241,241,241,1); 312 | 313 | -moz-border-radius: 2px; 314 | -webkit-border-radius: 2px; 315 | border-radius: 2px; 316 | 317 | -webkit-box-shadow: 0 0 12px #333; 318 | -moz-box-shadow: 0 0 12px #333; 319 | box-shadow: 0 0 12px #333; 320 | } 321 | 322 | /* IE Specific */ 323 | .qtip-jtools .qtip-titlebar{ 324 | background-color: transparent; 325 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A); 326 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)"; 327 | } 328 | .qtip-jtools .qtip-content{ 329 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323); 330 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)"; 331 | } 332 | 333 | .qtip-jtools .qtip-titlebar, 334 | .qtip-jtools .qtip-content{ 335 | background: transparent; 336 | color: white; 337 | border: 0 dashed transparent; 338 | } 339 | 340 | .qtip-jtools .qtip-icon{ 341 | border-color: #555; 342 | } 343 | 344 | .qtip-jtools .qtip-titlebar .ui-state-hover{ 345 | border-color: #333; 346 | } 347 | 348 | 349 | /* Cluetip style */ 350 | .qtip-cluetip{ 351 | -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); 352 | -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); 353 | box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); 354 | 355 | background-color: #D9D9C2; 356 | color: #111; 357 | border: 0 dashed transparent; 358 | } 359 | 360 | .qtip-cluetip .qtip-titlebar{ 361 | background-color: #87876A; 362 | color: white; 363 | border: 0 dashed transparent; 364 | } 365 | 366 | .qtip-cluetip .qtip-icon{ 367 | border-color: #808064; 368 | } 369 | 370 | .qtip-cluetip .qtip-titlebar .ui-state-hover{ 371 | border-color: #696952; 372 | color: #696952; 373 | } 374 | 375 | 376 | /* Tipsy style */ 377 | .qtip-tipsy{ 378 | background: black; 379 | background: rgba(0, 0, 0, .87); 380 | 381 | color: white; 382 | border: 0 solid transparent; 383 | 384 | font-size: 11px; 385 | font-family: 'Lucida Grande', sans-serif; 386 | font-weight: bold; 387 | line-height: 16px; 388 | text-shadow: 0 1px black; 389 | } 390 | 391 | .qtip-tipsy .qtip-titlebar{ 392 | padding: 6px 35px 0 10px; 393 | background-color: transparent; 394 | } 395 | 396 | .qtip-tipsy .qtip-content{ 397 | padding: 6px 10px; 398 | } 399 | 400 | .qtip-tipsy .qtip-icon{ 401 | border-color: #222; 402 | text-shadow: none; 403 | } 404 | 405 | .qtip-tipsy .qtip-titlebar .ui-state-hover{ 406 | border-color: #303030; 407 | } 408 | 409 | 410 | /* Tipped style */ 411 | .qtip-tipped{ 412 | border: 3px solid #959FA9; 413 | 414 | -moz-border-radius: 3px; 415 | -webkit-border-radius: 3px; 416 | border-radius: 3px; 417 | 418 | background-color: #F9F9F9; 419 | color: #454545; 420 | 421 | font-weight: normal; 422 | font-family: serif; 423 | } 424 | 425 | .qtip-tipped .qtip-titlebar{ 426 | border-bottom-width: 0; 427 | 428 | color: white; 429 | background: #3A79B8; 430 | background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D)); 431 | background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D); 432 | background-image: -moz-linear-gradient(top, #3A79B8, #2E629D); 433 | background-image: -ms-linear-gradient(top, #3A79B8, #2E629D); 434 | background-image: -o-linear-gradient(top, #3A79B8, #2E629D); 435 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D); 436 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)"; 437 | } 438 | 439 | .qtip-tipped .qtip-icon{ 440 | border: 2px solid #285589; 441 | background: #285589; 442 | } 443 | 444 | .qtip-tipped .qtip-icon .ui-icon{ 445 | background-color: #FBFBFB; 446 | color: #555; 447 | } 448 | 449 | 450 | /** 451 | * Twitter Bootstrap style. 452 | * 453 | * Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11. 454 | * Does not work with IE 7. 455 | */ 456 | .qtip-bootstrap{ 457 | /** Taken from Bootstrap body */ 458 | font-size: 14px; 459 | line-height: 20px; 460 | color: #333333; 461 | 462 | /** Taken from Bootstrap .popover */ 463 | padding: 1px; 464 | background-color: #ffffff; 465 | border: 1px solid #ccc; 466 | border: 1px solid rgba(0, 0, 0, 0.2); 467 | -webkit-border-radius: 6px; 468 | -moz-border-radius: 6px; 469 | border-radius: 6px; 470 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 471 | -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 472 | box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 473 | -webkit-background-clip: padding-box; 474 | -moz-background-clip: padding; 475 | background-clip: padding-box; 476 | } 477 | 478 | .qtip-bootstrap .qtip-titlebar{ 479 | /** Taken from Bootstrap .popover-title */ 480 | padding: 8px 14px; 481 | margin: 0; 482 | font-size: 14px; 483 | font-weight: normal; 484 | line-height: 18px; 485 | background-color: #f7f7f7; 486 | border-bottom: 1px solid #ebebeb; 487 | -webkit-border-radius: 5px 5px 0 0; 488 | -moz-border-radius: 5px 5px 0 0; 489 | border-radius: 5px 5px 0 0; 490 | } 491 | 492 | .qtip-bootstrap .qtip-titlebar .qtip-close{ 493 | /** 494 | * Overrides qTip2: 495 | * .qtip-titlebar .qtip-close{ 496 | * [...] 497 | * right: 4px; 498 | * top: 50%; 499 | * [...] 500 | * border-style: solid; 501 | * } 502 | */ 503 | right: 11px; 504 | top: 45%; 505 | border-style: none; 506 | } 507 | 508 | .qtip-bootstrap .qtip-content{ 509 | /** Taken from Bootstrap .popover-content */ 510 | padding: 9px 14px; 511 | } 512 | 513 | .qtip-bootstrap .qtip-icon{ 514 | /** 515 | * Overrides qTip2: 516 | * .qtip-default .qtip-icon { 517 | * border-color: #CCC; 518 | * background: #F1F1F1; 519 | * color: #777; 520 | * } 521 | */ 522 | background: transparent; 523 | } 524 | 525 | .qtip-bootstrap .qtip-icon .ui-icon{ 526 | /** 527 | * Overrides qTip2: 528 | * .qtip-icon .ui-icon{ 529 | * width: 18px; 530 | * height: 14px; 531 | * } 532 | */ 533 | width: auto; 534 | height: auto; 535 | 536 | /* Taken from Bootstrap .close */ 537 | float: right; 538 | font-size: 20px; 539 | font-weight: bold; 540 | line-height: 18px; 541 | color: #000000; 542 | text-shadow: 0 1px 0 #ffffff; 543 | opacity: 0.2; 544 | filter: alpha(opacity=20); 545 | } 546 | 547 | .qtip-bootstrap .qtip-icon .ui-icon:hover{ 548 | /* Taken from Bootstrap .close:hover */ 549 | color: #000000; 550 | text-decoration: none; 551 | cursor: pointer; 552 | opacity: 0.4; 553 | filter: alpha(opacity=40); 554 | } 555 | 556 | 557 | /* IE9 fix - removes all filters */ 558 | .qtip:not(.ie9haxors) div.qtip-content, 559 | .qtip:not(.ie9haxors) div.qtip-titlebar{ 560 | filter: none; 561 | -ms-filter: none; 562 | } 563 | 564 | 565 | 566 | .qtip .qtip-tip{ 567 | margin: 0 auto; 568 | overflow: hidden; 569 | z-index: 10; 570 | 571 | } 572 | 573 | /* Opera bug #357 - Incorrect tip position 574 | https://github.com/Craga89/qTip2/issues/367 */ 575 | x:-o-prefocus, .qtip .qtip-tip{ 576 | visibility: hidden; 577 | } 578 | 579 | .qtip .qtip-tip, 580 | .qtip .qtip-tip .qtip-vml, 581 | .qtip .qtip-tip canvas{ 582 | position: absolute; 583 | 584 | color: #123456; 585 | background: transparent; 586 | border: 0 dashed transparent; 587 | } 588 | 589 | .qtip .qtip-tip canvas{ top: 0; left: 0; } 590 | 591 | .qtip .qtip-tip .qtip-vml{ 592 | behavior: url(#default#VML); 593 | display: inline-block; 594 | visibility: visible; 595 | } 596 | 597 | #qtip-overlay{ 598 | position: fixed; 599 | left: 0; top: 0; 600 | width: 100%; height: 100%; 601 | } 602 | 603 | /* Applied to modals with show.modal.blur set to true */ 604 | #qtip-overlay.blurs{ cursor: pointer; } 605 | 606 | /* Change opacity of overlay here */ 607 | #qtip-overlay div{ 608 | position: absolute; 609 | left: 0; top: 0; 610 | width: 100%; height: 100%; 611 | 612 | background-color: black; 613 | 614 | opacity: 0.7; 615 | filter:alpha(opacity=70); 616 | -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; 617 | } 618 | 619 | 620 | 621 | .qtipmodal-ie6fix{ 622 | position: absolute !important; 623 | } -------------------------------------------------------------------------------- /src/sw.js: -------------------------------------------------------------------------------- 1 | import { getFiles, setupPrecaching, setupRouting } from 'preact-cli/sw/'; 2 | 3 | setupRouting(); 4 | setupPrecaching(getFiles()); 5 | -------------------------------------------------------------------------------- /src/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <% preact.title %> 6 | 7 | 8 | 9 | 10 | <% preact.headEnd %> 11 | 12 | 13 | <% preact.bodyEnd %> 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/utils/dataValidator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import Ajv from 'ajv'; 18 | 19 | const ajv = new Ajv(); 20 | 21 | ajv.addFormat("hexcolor", /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i); 22 | 23 | const dataSchema = { 24 | properties: { 25 | title: { type: "string" }, 26 | graphData: { 27 | type: "object", 28 | properties: { 29 | nodes: { 30 | type: "array", 31 | items: { 32 | type: "object", 33 | properties: { 34 | data: { 35 | type: "object", 36 | properties: { 37 | id: { type: "string" }, 38 | zone: { type: "string", format: "hexcolor" } 39 | }, 40 | required: ["id", "zone"] 41 | } 42 | }, 43 | required: ["data"] 44 | } 45 | }, 46 | edges: { 47 | type: "array", 48 | items: { 49 | type: "object", 50 | properties: { 51 | data: { 52 | type: "object", 53 | properties: { 54 | id: { type: "string" }, 55 | source: { type: "string" }, 56 | target: { type: "string" } 57 | }, 58 | required: ["id", "source", "target"] 59 | } 60 | }, 61 | required: ["data"] 62 | } 63 | } 64 | }, 65 | required: ["nodes", "edges"] 66 | }, 67 | stepData: { 68 | type: "array", 69 | minItems: 0, 70 | items: { 71 | type: "object", 72 | properties: { 73 | id: { type: "string" }, 74 | type: { 75 | type: "string", 76 | pattern: "(single|group)" 77 | }, 78 | nodes: { 79 | type: "array", 80 | items: { type: "string" } 81 | }, 82 | steps: { 83 | type: "array", 84 | items: { 85 | type: "object", 86 | properties: { 87 | id: { type: "string" }, 88 | type: { type: "string" }, 89 | nodes: { 90 | type: "array", 91 | items: { type: "string" } 92 | }, 93 | steps: { 94 | type: "array", 95 | items: { 96 | type: "object", 97 | properties: { 98 | id: { type: "string" }, 99 | type: { type: "string" }, 100 | nodes: { 101 | type: "array", 102 | items: { type: "string" } 103 | }, 104 | steps: { 105 | type: "array", 106 | }, 107 | description: { type: "string" } 108 | }, 109 | required: ["id", "nodes", "description"] 110 | } 111 | }, 112 | description: { type: "string" } 113 | }, 114 | required: ["id", "nodes", "description"] 115 | } 116 | }, 117 | description: { type: "string" } 118 | }, 119 | required: ["id", "type", "nodes", "steps", "description"] 120 | } 121 | 122 | } 123 | // zoneData: { 124 | // type: "array", 125 | // items: { 126 | // type: "object", 127 | // properties: { 128 | // name: { type: "string" }, 129 | // color: { type: "string", format: "hexcolor" } 130 | // }, 131 | // required: ["name", "color"] 132 | // } 133 | // } 134 | }, 135 | required: ["title", "graphData", "stepData"/*, "zoneData"*/] 136 | } 137 | 138 | const validator = ajv.compile(dataSchema); 139 | // const stepValidator = ajv.compile(stepSchema); // <- this isn't needed until we want infinite layers 140 | 141 | export default function (json) { 142 | //the result object 143 | const res = {}; 144 | res.errors = []; 145 | 146 | /* 147 | set the validity/error state based on structure 148 | */ 149 | res.valid = validator(json); 150 | if (validator.errors != null) { 151 | res.errors.push(...validator.errors); 152 | return res; 153 | } 154 | 155 | 156 | /* 157 | set the validity/error state based on object property values 158 | */ 159 | 160 | // ===== RULE: there should be distinct ids per declared nodes ===== 161 | let declaredParticipantsSet = new Set(); 162 | let declaredParticipantsArr = []; 163 | for (let node of json.graphData.nodes) { 164 | declaredParticipantsSet.add(node.data.id); 165 | declaredParticipantsArr.push(node.data.id); 166 | } 167 | 168 | let edgeParticipantsSet = new Set(); 169 | for (let edge of json.graphData.edges) { 170 | edgeParticipantsSet.add(edge.data.source); 171 | edgeParticipantsSet.add(edge.data.target); 172 | } 173 | 174 | let distinctNodeIds = declaredParticipantsArr.length === declaredParticipantsSet.size; 175 | 176 | if (!distinctNodeIds) { 177 | res.errors.push({ 178 | keyword: "participants", 179 | message: "you have a duplicate node ID" 180 | }) 181 | } 182 | 183 | // ===== RULE: Declared nodes should be a superset of edge nodes ===== 184 | let nodesAreSupersetOfEdges = true; 185 | let missingParticipant = ""; 186 | 187 | for (let p of edgeParticipantsSet) { 188 | if (!declaredParticipantsSet.has(p)) { 189 | missingParticipant = p; 190 | nodesAreSupersetOfEdges = false; 191 | } 192 | } 193 | 194 | if (!nodesAreSupersetOfEdges) { 195 | res.errors.push({ 196 | keyword: "participants", 197 | message: "there is an missing participant in your nodes, or an extra misspelled participant", 198 | offender: missingParticipant 199 | }) 200 | } 201 | 202 | // ===== RULE: If a step isn't a single, then it must have at least one step in `steps` ===== 203 | 204 | let invalidStepFound = false; 205 | let invalidStep = null; 206 | 207 | const validateStepType = (step) => { 208 | if (step.type === "single") { 209 | if (step.steps.length === 0) { 210 | return true; 211 | } else { 212 | if (!invalidStepFound) { 213 | invalidStep = step; 214 | invalidStepFound = true; 215 | } 216 | return false; 217 | } 218 | } else { 219 | if (step.steps.length > 0 && step.steps.map(validateStepType).every(x => x)) { 220 | return true; 221 | } else { 222 | if (!invalidStepFound) { 223 | invalidStep = step; 224 | invalidStepFound = true; 225 | } 226 | return false; 227 | } 228 | } 229 | } 230 | 231 | let stepsValid = json.stepData.map(validateStepType).every(x => x); 232 | 233 | if (!stepsValid) { 234 | res.errors.push({ 235 | keyword: "step_type", 236 | message: "one of the steps is not valid", 237 | offender: invalidStep, 238 | }) 239 | } 240 | 241 | // ===== RULE: Steps must have distinct ids ===== 242 | 243 | const jsonStepData = { 244 | stepNum: 0, 245 | distinctIDs: new Set(), 246 | stepNodes: new Set() 247 | }; 248 | 249 | let foundNonDistinctStep = false; 250 | let nonDistinctStep = null; 251 | 252 | const getStepData = (stepData, step) => { 253 | 254 | if (stepData.distinctIDs.has(step.id)) { 255 | if (!foundNonDistinctStep) { 256 | nonDistinctStep = step; 257 | foundNonDistinctStep = true; 258 | } 259 | } 260 | 261 | if (step.type === "single") { 262 | 263 | return Object.assign(stepData, { 264 | stepNum: stepData.stepNum + 1, 265 | distinctIDs: stepData.distinctIDs.add(step.id), 266 | stepNodes: stepData.stepNodes.add(...step.nodes) 267 | }); 268 | } else { 269 | // return stepSum + step.steps.reduce(getStepNum, ); 270 | return Object.assign(stepData, step.steps.reduce(getStepData, stepData)); 271 | } 272 | } 273 | 274 | let {stepNum, distinctIDs, stepNodes} = json.stepData.reduce(getStepData, jsonStepData); 275 | 276 | const stepIDsValid = stepNum === distinctIDs.size; 277 | if (!stepIDsValid) { 278 | res.errors.push({ 279 | keyword: "step_ids", 280 | message: "not all steps have distinct IDs", 281 | offender: nonDistinctStep 282 | }) 283 | } 284 | 285 | // ===== RULE: Steps must only refer to declared nodes ===== 286 | 287 | let stepNodesValid = true; 288 | let foundNonexistentNode = false; 289 | let nonexistentNode = null; 290 | 291 | for (let node of stepNodes) { 292 | if (!declaredParticipantsSet.has(node)) { 293 | stepNodesValid = false; 294 | if (!foundNonexistentNode) { 295 | nonexistentNode = node; 296 | foundNonexistentNode = true; 297 | } 298 | } 299 | } 300 | 301 | if (!stepNodesValid) { 302 | res.errors.push({ 303 | keyword: "step_nodes", 304 | message: "some steps refer to nodes that don't exist", 305 | offender: nonexistentNode 306 | }) 307 | } 308 | 309 | // ===== RULE: If the step type is 'group', the step must have a nonempty groupName ===== 310 | let groupStepsValid = true; 311 | let foundInvalidGroupStep = false; 312 | let invalidGroupStep = null; 313 | 314 | for (let step of json.stepData) { 315 | if (step.type === "group" && (step.groupName == undefined || step.groupName == null || step.groupName == "")) { 316 | groupStepsValid = false; 317 | if (!foundInvalidGroupStep) { 318 | invalidGroupStep = step; 319 | foundInvalidGroupStep = true; 320 | } 321 | } 322 | } 323 | 324 | if (!groupStepsValid) { 325 | res.errors.push({ 326 | keyword: "group_step_nodes", 327 | message: "one or more group steps don't have a group name", 328 | offender: invalidGroupStep 329 | }) 330 | } 331 | 332 | return res; 333 | } -------------------------------------------------------------------------------- /src/utils/parser.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // ===== Miscellaneous Utilities ===== 18 | 19 | const peek = (arr) => { 20 | return arr[arr.length - 1]; 21 | } 22 | 23 | const empty = (arr) => { 24 | return arr.length === 0; 25 | } 26 | 27 | const hexToRgb = (hex) => { 28 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 29 | return result ? [ 30 | parseInt(result[1], 16), 31 | parseInt(result[2], 16), 32 | parseInt(result[3], 16) 33 | ] : [0, 0, 0]; 34 | } 35 | 36 | const componentToHex = (c) => { 37 | var hex = c.toString(16); 38 | return hex.length == 1 ? "0" + hex : hex; 39 | } 40 | 41 | const rgbToHex = (r, g, b) => { 42 | return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); 43 | } 44 | 45 | const shadeColor = (color, percent) => { 46 | var f=parseInt(color.slice(1),16),t=percent<0?0:255,p=percent<0?percent*-1:percent,R=f>>16,G=f>>8&0x00FF,B=f&0x0000FF; 47 | return "#"+(0x1000000+(Math.round((t-R)*p)+R)*0x10000+(Math.round((t-G)*p)+G)*0x100+(Math.round((t-B)*p)+B)).toString(16).slice(1); 48 | } 49 | 50 | const convertColor = (c) => { 51 | if (c.length == 7) return c; 52 | return '#' + c[1] + c[1] + c[2] + c[2] + c[3] + c[3]; 53 | } 54 | 55 | const tint = (c) => shadeColor(convertColor(c), .15); 56 | 57 | // ===== REGEXES/STRINGS ===== 58 | 59 | //match the beginning of a plantuml diagram 60 | const START_FLAG = "@startuml"; 61 | 62 | //match the end of a plantuml diagram 63 | const END_FLAG = "@enduml"; 64 | 65 | //match the title of a plantUML diagram 66 | const TITLE = /^title (\"?.+\"?)$/; 67 | 68 | //match a line when a participant is declared 69 | const PARTICIPANT = /^(participant|actor) ((\"?.+\"?) as (\w+)|\"?\w+\"?)\s*(<< \((.,\s*#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}))\) (.+) >>)?$/; 70 | 71 | const PARTICIPANT_INFO = /^\s*note over (\w+)\s*$/; 72 | 73 | //match a line that looks roughly like this: "A -> B: description" 74 | const STEP_FORWARD = /^\s*(\w+)\s*(->|-\\|-\/|->>|-\\\\|-\/\/|-->|--\\\\|--\/\/|-->>)\s*(\w+)\s*:\s*(.+)$/; 75 | 76 | //match a line that looks roughly like this: "A <- B: description" 77 | const STEP_BACKWARD = /^\s*(\w+)\s*(<-|\/-|\\-|<<-|\/\/\/\/-|\\\\-|<--|\/\/--|\\\\--|<<--)\s*(\w+)\s*:\s*(.+)$/; 78 | 79 | //match a note on either side of a step. It looks like this: "note [left|right]: description" 80 | const SINGLE_LINE_NOTE = /^\s*note (left|right|over (\w+)|left of (\w+)|right of (\w+)):\s*(.*)$/; 81 | 82 | //matches the start of a note, looks like this: "note [left|right]" 83 | const MULTI_LINE_NOTE_START = /^\s*note (left|right)$/; 84 | 85 | //matches the content of a line of a note 86 | const NOTE_LINE = /^(\s*)(.*)$/; 87 | 88 | //matches the end of a note 89 | const MULTI_LINE_NOTE_END = /^\s*end note$/; 90 | 91 | // matches the start of a "loop" type of group 92 | const LOOP_START = /^\s*loop (.+)$/; 93 | 94 | // matches the start of a "group" type of group 95 | const GROUP_START = /^\s*group (.+)$/; 96 | 97 | // matches the end of both a loop AND a group 98 | const GROUPING_END = /^\s*end( loop)?$/; 99 | 100 | //matches the declaration of a divider 101 | const DIVIDER = /^\s*==\s*(.+)\s*==$/; 102 | 103 | //matches an alt (TODO: flesh this out into real support or parse it out) 104 | const ALT = /^\s*alt.*$/; 105 | 106 | 107 | // ===== FLAGS/CONSTANTS ===== 108 | const debug = false; 109 | 110 | let processingUML = false; 111 | 112 | //edge/step info 113 | let edgeIndexCounter = 0; 114 | let stepIndexCounter = 0; 115 | 116 | //group/divider info 117 | const NO_GROUPS = 0; 118 | const GROUPS = 1; 119 | const SECTIONS = 2; 120 | 121 | let groupType = NO_GROUPS; 122 | let groupStepStack = []; 123 | let groupIndexCounter = 0; 124 | 125 | let parsingDivider = false; 126 | 127 | let processingParticipantInfo = false; 128 | let participantProcessed = null; 129 | 130 | //note info 131 | let processingNote = false; 132 | let noteContent = []; 133 | let previousNoteStep = null; 134 | 135 | //node/zone tracking 136 | const nodeMap = {}; 137 | const zoneMap = { 138 | main: "#FBDCD6" 139 | }; 140 | 141 | //TODO: flesh this out into real support or parse it out 142 | let altCount = 0; 143 | 144 | 145 | // ===== HELPER FUNCTIONS ===== 146 | const setProcessingFlag = (line) => { 147 | if (line === START_FLAG) { 148 | processingUML = true; 149 | } else if (line === END_FLAG) { 150 | processingUML = false; 151 | } 152 | } 153 | 154 | const detectTitle = (data, line) => { 155 | if (!TITLE.test(line)) return; 156 | 157 | const titleInfo = TITLE 158 | .exec(line)[1] 159 | .replace(/^"(.+)"$/, '$1'); 160 | 161 | data.title = titleInfo; 162 | } 163 | 164 | const detectParticipant = (data, line) => { 165 | if (!PARTICIPANT.test(line)) return; 166 | 167 | const participantInfo = PARTICIPANT 168 | .exec(line) 169 | .slice(2); 170 | 171 | // no alias vs alias 172 | let officialName; 173 | let shortName; 174 | if (participantInfo[1] === undefined) { 175 | const name = participantInfo[0] 176 | .replace(/"/g, "") 177 | .replace(/\\n/g, " "); 178 | nodeMap[name] = name; 179 | officialName = name; 180 | shortName = name; 181 | } else { 182 | shortName = participantInfo[2]; 183 | const longName = participantInfo[1] 184 | .replace(/"/g, "") 185 | .replace(/\\n/g, " "); 186 | 187 | nodeMap[shortName] = longName; 188 | // nodeMap[longName] = shortName; 189 | officialName = longName; 190 | } 191 | 192 | let zone; 193 | let zoneName = null; 194 | if (participantInfo[6] === undefined) { 195 | zone = zoneMap["main"]; 196 | } else { 197 | zoneName = participantInfo[6]; 198 | zoneMap[zoneName] = `#${participantInfo[5]}`; 199 | zone = zoneMap[zoneName]; 200 | } 201 | 202 | let partial_data = { 203 | id: shortName, 204 | fname: officialName, 205 | zone: zone, 206 | } 207 | 208 | if (zoneName != null) { 209 | partial_data.parent = zoneName; 210 | } 211 | 212 | //insert node into data 213 | //TODO: support zones in the future 214 | data.graphData.nodes.push({ 215 | data: partial_data 216 | }) 217 | 218 | } 219 | 220 | const detectParticipantInfo = (data, line) => { 221 | if (!processingParticipantInfo) { 222 | if (PARTICIPANT_INFO.test(line)) { 223 | participantProcessed = PARTICIPANT_INFO.exec(line)[1]; 224 | processingParticipantInfo = true; 225 | } 226 | } else { 227 | if (MULTI_LINE_NOTE_END.test(line)) { 228 | const participant = data.graphData.nodes.filter(n => { 229 | return n.data.id == participantProcessed; 230 | })[0]; 231 | participant.data.info = noteContent.join(" "); 232 | participantProcessed = null; 233 | noteContent = []; 234 | processingParticipantInfo = false; 235 | } else { 236 | if (!NOTE_LINE.test(line)) return; 237 | 238 | const parsed_line = NOTE_LINE.exec(line); 239 | noteContent.push(parsed_line[2]); 240 | } 241 | } 242 | } 243 | 244 | const detectStep = (data, line) => { 245 | if (!STEP_FORWARD.test(line) && !STEP_BACKWARD.test(line)) return; 246 | 247 | let stepInfo; 248 | let source; 249 | let target; 250 | let description; 251 | 252 | if (STEP_FORWARD.test(line)) { 253 | stepInfo = STEP_FORWARD.exec(line); 254 | source = stepInfo[1]; 255 | if (nodeMap[source] == undefined) { 256 | nodeMap[stepInfo[1]] = stepInfo[1]; 257 | source = stepInfo[1]; 258 | data.graphData.nodes.push({ 259 | data: { 260 | id: stepInfo[1], 261 | fname: stepInfo[1], 262 | zone: zoneMap["main"] 263 | } 264 | }) 265 | } 266 | 267 | target = stepInfo[3]; 268 | if (nodeMap[target] == undefined) { 269 | nodeMap[stepInfo[3]] = stepInfo[3]; 270 | target = stepInfo[3]; 271 | data.graphData.nodes.push({ 272 | data: { 273 | id: stepInfo[3], 274 | fname: stepInfo[3], 275 | zone: zoneMap["main"] 276 | } 277 | }) 278 | } 279 | 280 | description = stepInfo[4]; 281 | 282 | } else { 283 | stepInfo = STEP_BACKWARD.exec(line); 284 | source = stepInfo[3]; 285 | if (nodeMap[source] == undefined) { 286 | nodeMap[stepInfo[3]] = stepInfo[3]; 287 | source = stepInfo[3]; 288 | data.graphData.nodes.push({ 289 | data: { 290 | id: stepInfo[3], 291 | fname: stepInfo[3], 292 | zone: zoneMap["main"] 293 | } 294 | }) 295 | } 296 | 297 | target = stepInfo[1]; 298 | if (nodeMap[target] == undefined) { 299 | nodeMap[stepInfo[1]] = stepInfo[1]; 300 | target = stepInfo[1]; 301 | data.graphData.nodes.push({ 302 | data: { 303 | id: stepInfo[1], 304 | fname: stepInfo[1], 305 | zone: zoneMap["main"] 306 | } 307 | }) 308 | } 309 | 310 | description = stepInfo[4]; 311 | } 312 | 313 | const edgeExists = data.graphData.edges.some(edge => { 314 | const data = edge.data; 315 | const src = data.source; 316 | const tar = data.target; 317 | 318 | return (src == source && tar == target) || (src == target && tar == source); 319 | }); 320 | 321 | if (!edgeExists) { 322 | data.graphData.edges.push({ 323 | data: { 324 | id: "e" + edgeIndexCounter, 325 | source: source, 326 | target: target 327 | } 328 | }); 329 | edgeIndexCounter += 1; 330 | } 331 | 332 | const step = { 333 | id: "" + stepIndexCounter, 334 | type: "single", 335 | nodes: [source, target], 336 | steps: [], 337 | description: description, 338 | note: "" 339 | }; 340 | 341 | let prevStep; 342 | 343 | if (empty(groupStepStack)) { 344 | data.stepData.push(step); 345 | prevStep = peek(data.stepData); 346 | } else { 347 | const group = peek(groupStepStack); 348 | group.steps.push(step); 349 | prevStep = peek(group.steps); 350 | } 351 | 352 | previousNoteStep = prevStep; 353 | 354 | stepIndexCounter += 1; 355 | 356 | } 357 | 358 | const detectSingleLineNote = (data, line) => { 359 | if (!SINGLE_LINE_NOTE.test(line)) return; 360 | 361 | const regex_result = SINGLE_LINE_NOTE.exec(line); 362 | 363 | // depending on the regex, could be the second or 5th group 364 | const note = regex_result[2] || regex_result[5]; 365 | 366 | // the note refers to a node 367 | if (regex_result[2] != undefined || regex_result[4] != undefined) { 368 | let node_id = regex_result[2] || regex_result[4]; 369 | let noteNode = null; 370 | for (let i = 0; i < data.graphData.nodes.length; i++) { 371 | let node = data.graphData.nodes[i]; 372 | if (node.data.id === node_id) { 373 | noteNode = node; 374 | } 375 | } 376 | noteNode.data.info = note; 377 | } 378 | // the note refers to a step 379 | else { 380 | previousNoteStep.note = note; 381 | previousNoteStep = null; 382 | } 383 | } 384 | 385 | const detectMultiLineNote = (data, line) => { 386 | if (!processingNote) { 387 | if (MULTI_LINE_NOTE_START.test(line)) { 388 | processingNote = true; 389 | } 390 | } else { 391 | if (MULTI_LINE_NOTE_END.test(line)) { 392 | 393 | previousNoteStep.note = noteContent.join("\n"); 394 | previousNoteStep = null; 395 | noteContent = []; 396 | processingNote = false; 397 | return; 398 | } else { 399 | if (!NOTE_LINE.test(line)) return; 400 | 401 | const parsed_line = NOTE_LINE.exec(line); 402 | noteContent.push(parsed_line[2]); 403 | } 404 | } 405 | } 406 | 407 | const detectLoop = (data, line) => { 408 | if (!LOOP_START.test(line)) return; 409 | 410 | const step = { 411 | id: "g" + groupIndexCounter, 412 | type: "group", 413 | groupName: "loop", 414 | nodes: [], 415 | steps: [], 416 | description: "", 417 | note: "" 418 | }; 419 | 420 | const loopDescription = LOOP_START.exec(line)[1]; 421 | step.description = loopDescription; 422 | 423 | groupStepStack.push(step); 424 | groupIndexCounter++; 425 | } 426 | 427 | const detectGroup = (data, line) => { 428 | if (!GROUP_START.test(line)) return; 429 | 430 | const step = { 431 | id: "g" + groupIndexCounter, 432 | type: "group", 433 | groupName: "group", 434 | nodes: [], 435 | steps: [], 436 | description: "", 437 | note: "" 438 | }; 439 | 440 | const groupDescription = GROUP_START.exec(line)[1]; 441 | step.description = groupDescription; 442 | 443 | groupStepStack.push(step); 444 | groupIndexCounter++; 445 | } 446 | 447 | const detectGroupEnd = (data, line) => { 448 | if (!GROUPING_END.test(line)) return; 449 | 450 | /* 451 | introducing support for the "alt" syntax in PlantUML (basically if statements) 452 | TODO: flesh this out into real support or parse it out 453 | quick support for ALT 454 | */ 455 | if (altCount > 0) { 456 | altCount--; 457 | return; 458 | } 459 | 460 | const finishedGroup = groupStepStack.pop(); 461 | previousNoteStep = finishedGroup; 462 | let parent; 463 | if (empty(groupStepStack)) { 464 | parent = data.stepData; 465 | parent.push(finishedGroup); 466 | } else { 467 | parent = peek(groupStepStack); 468 | parent.steps.push(finishedGroup); 469 | } 470 | 471 | } 472 | 473 | const detectDivider = (data, line) => { 474 | if (!DIVIDER.test(line)) return; 475 | 476 | if (parsingDivider) { 477 | const finishedGroup = groupStepStack.pop(); 478 | previousNoteStep = finishedGroup; 479 | let parent; 480 | if (empty(groupStepStack)) { 481 | parent = data.stepData; 482 | parent.push(finishedGroup); 483 | } else { 484 | parent = peek(groupStepStack); 485 | parent.steps.push(finishedGroup); 486 | } 487 | 488 | } 489 | const step = { 490 | id: "g" + groupIndexCounter, 491 | type: "group", 492 | groupName: "group", 493 | nodes: [], 494 | steps: [], 495 | description: "", 496 | note: "" 497 | }; 498 | 499 | const groupDescription = DIVIDER.exec(line)[1].trim(); 500 | step.description = groupDescription; 501 | 502 | groupStepStack.push(step); 503 | groupIndexCounter++; 504 | parsingDivider = true; 505 | 506 | } 507 | 508 | /* 509 | introducing support for the "alt" syntax in PlantUML (basically if statements) 510 | TODO: flesh this out into real support or parse it out 511 | quick support for ALT 512 | */ 513 | const detectAlt = (data, line) => { 514 | if (!ALT.test(line)) return; 515 | altCount++; 516 | } 517 | 518 | 519 | const parseContents = (contents) => { 520 | //create a skeleton JSON 521 | const result = { 522 | title: "", 523 | graphData: { 524 | nodes: [], 525 | edges: [] 526 | }, 527 | stepData: [], 528 | zoneData: [] 529 | } 530 | 531 | //loop through the file to populate JSON 532 | for (let line of contents) { 533 | setProcessingFlag(line); 534 | if (processingUML) { 535 | detectTitle(result, line); 536 | detectParticipant(result, line); 537 | detectParticipantInfo(result, line); 538 | detectStep(result, line); 539 | detectSingleLineNote(result, line); 540 | detectMultiLineNote(result, line); 541 | detectLoop(result, line); 542 | detectGroup(result, line); 543 | detectDivider(result, line); 544 | detectAlt(result, line); 545 | detectGroupEnd(result, line); 546 | } 547 | } 548 | 549 | //finish off last divider 550 | if (parsingDivider) { 551 | const finishedGroup = groupStepStack.pop(); 552 | previousNoteStep = finishedGroup; 553 | let parent; 554 | if (empty(groupStepStack)) { 555 | parent = result.stepData; 556 | parent.push(finishedGroup); 557 | } else { 558 | parent = peek(groupStepStack); 559 | parent.steps.push(finishedGroup); 560 | } 561 | } 562 | 563 | //generate zone nodes 564 | for (let z of Object.keys(zoneMap)) { 565 | if (z != "main") { 566 | let tintedZone = tint(zoneMap[z]); 567 | result.graphData.nodes.push({ 568 | data: { 569 | id: z, 570 | zone: tintedZone 571 | } 572 | }) 573 | } 574 | } 575 | 576 | //TODO: cleanup so global scope is ok 577 | 578 | //edge/step info 579 | edgeIndexCounter = 0; 580 | stepIndexCounter = 0; 581 | 582 | groupType = NO_GROUPS; 583 | groupStepStack = []; 584 | groupIndexCounter = 0; 585 | 586 | parsingDivider = false; 587 | 588 | //note info 589 | processingNote = false; 590 | noteContent = []; 591 | previousNoteStep = null; 592 | 593 | //node/zone tracking 594 | for (var n in nodeMap) { 595 | delete nodeMap[n]; 596 | } 597 | 598 | for (var z in zoneMap) { 599 | delete zoneMap[z]; 600 | } 601 | zoneMap.main = "#FBDCD6"; 602 | 603 | /* 604 | introducing support for the "alt" syntax in PlantUML (basically if statements) 605 | TODO: flesh this out into real support or parse it out 606 | quick support for ALT 607 | */ 608 | altCount = 0; 609 | 610 | return result; 611 | } 612 | 613 | module.exports = { 614 | utils: { 615 | detectParticipant 616 | }, 617 | flags: { 618 | processingUML, 619 | nodeMap, 620 | zoneMap 621 | }, 622 | parseContents, 623 | } -------------------------------------------------------------------------------- /src/utils/stepUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Capital One Services, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const getCurrentStep = (stepStr, stepArray) => { 18 | const reduceSteps = (foundStep, curStep) => { 19 | if (curStep.type == "single") { 20 | return curStep.id == stepStr ? curStep : foundStep; 21 | } else if (curStep.type == "group") { 22 | return curStep.steps.reduce(reduceSteps, foundStep); 23 | } 24 | } 25 | return stepArray.reduce(reduceSteps, null); 26 | } 27 | 28 | module.exports = { 29 | getCurrentStep 30 | } -------------------------------------------------------------------------------- /tests/__mocks__/browserMocks.js: -------------------------------------------------------------------------------- 1 | // Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage 2 | /** 3 | * An example how to mock localStorage is given below 👇 4 | */ 5 | 6 | /* 7 | // Mocks localStorage 8 | const localStorageMock = (function() { 9 | let store = {}; 10 | 11 | return { 12 | getItem: (key) => store[key] || null, 13 | setItem: (key, value) => store[key] = value.toString(), 14 | clear: () => store = {} 15 | }; 16 | 17 | })(); 18 | 19 | Object.defineProperty(window, 'localStorage', { 20 | value: localStorageMock 21 | }); */ 22 | -------------------------------------------------------------------------------- /tests/__mocks__/fileMocks.js: -------------------------------------------------------------------------------- 1 | // This fixed an error related to the CSS and loading gif breaking my Jest test 2 | // See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets 3 | module.exports = 'test-file-stub'; -------------------------------------------------------------------------------- /tests/__mocks__/setupTests.js: -------------------------------------------------------------------------------- 1 | import { configure } from 'enzyme'; 2 | import Adapter from 'enzyme-adapter-preact-pure'; 3 | 4 | configure({ 5 | adapter: new Adapter() 6 | }); 7 | -------------------------------------------------------------------------------- /tests/testfiles/aliased_participants.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant "B B B" as B 5 | participant C 6 | participant D D D as D 7 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/bigspace.json: -------------------------------------------------------------------------------- 1 | {"title":"","graphData":{"nodes":[{"data":{"id":"Edge","zone":"#FBDCD6"}},{"data":{"id":"DMS","zone":"#FBDCD6"}}],"edges":[{"data":{"id":"e0","source":"Edge","target":"DMS"}}]},"stepData":[{"id":"0","type":"single","nodes":["Edge","DMS"],"steps":[],"description":"Check if deviceToken is present","note":""},{"id":"1","type":"single","nodes":["Edge","DMS"],"steps":[],"description":"another one","note":""}],"zoneData":[]} -------------------------------------------------------------------------------- /tests/testfiles/dividers.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | participant A 3 | participant B 4 | participant C 5 | 6 | == As only == 7 | A -> B: AB 8 | A -> C: AC 9 | 10 | ==Bs only== 11 | B -> A: BA 12 | B -> C: BC 13 | 14 | ==Cs only== 15 | C -> A: CA 16 | C -> B: CB 17 | 18 | @enduml 19 | -------------------------------------------------------------------------------- /tests/testfiles/doubled_names.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | participant A 4 | participant "B" as B 5 | participant "B" as C 6 | 7 | A -> B: result? 8 | A -> C: result 9 | 10 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/empty.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/meta.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | 4 | participant plantuml 5 | participant json 6 | participant parser 7 | participant validator 8 | participant renderer 9 | participant TOC 10 | participant diagram 11 | 12 | plantuml -> parser: a plantUML file is uploaded to the app, and parsed 13 | json -> parser: a JSON file is uploaded to the app, and parsed 14 | parser -> validator: the parsed result is passed to the validator, which is then validated (mostly for user generated JSON) 15 | validator -> renderer: after the data is validated, the data is rendered by the app's renderer 16 | renderer -> TOC: the step data is rendered in a TOC widget located on the right of the app 17 | renderer -> diagram: the diagram is rendered using the graphData, and is located on the left of the app 18 | 19 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/notes_multiline.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | 7 | A -> B: AB 8 | note left: AB note 9 | 10 | A -> C: AC 11 | note right 12 | AC line 1 13 | 14 | AC line 2 15 | end note 16 | 17 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/notes_singleline.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | 7 | A -> B: AB 8 | note left: AB note 9 | 10 | A -> C: AC 11 | note right: AC note 12 | 13 | note over A: this is over A 14 | note right of A: this is right of A 15 | 16 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/parsefile.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant Testing\nmulti\nline as TML 4 | 5 | 6 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/participant_decl.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | actor "B B B" as B 5 | participant C 6 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/participant_info.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | participant A 3 | note over A 4 | this is some info on A
    5 | newlines idk 6 | end note 7 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/readme.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | title "some_title" 3 | participant some_id << (X, #ffb2b2) Z1 >> 4 | participant some_id_2 << (X, #b2b2ff) Z2 >> 5 | 6 | some_id -> some_id_2: an example step 7 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_aliased.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant "AAA" as A 4 | participant "BBB" as B 5 | participant "CCC" as C 6 | 7 | A -> B: AB 8 | B -> C: BC 9 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_group.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | group testgroup1 7 | A -> B: AB 8 | group testgroup2 9 | B -> C: BC 10 | end 11 | note left: group note testgroup2 12 | end 13 | note left 14 | group note testgroup1 15 | end note 16 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_group.json: -------------------------------------------------------------------------------- 1 | {"title":"","graphData":{"nodes":[{"data":{"id":"A","zone":"#FBDCD6"}},{"data":{"id":"B","zone":"#FBDCD6"}},{"data":{"id":"C","zone":"#FBDCD6"}}],"edges":[{"data":{"id":"e0","source":"A","target":"B"}},{"data":{"id":"e1","source":"B","target":"C"}}]},"stepData":[{"id":"g0","type":"group","groupName":"group","nodes":[],"steps":[{"id":"0","type":"single","nodes":["A","B"],"steps":[],"description":"AB","note":""},{"id":"g1","type":"group","groupName":"group","nodes":[],"steps":[{"id":"1","type":"single","nodes":["B","C"],"steps":[],"description":"BC","note":""}],"description":"testgroup2","note":"group note testgroup2"}],"description":"testgroup1","note":"group note testgroup1"}],"zoneData":[]} -------------------------------------------------------------------------------- /tests/testfiles/steps_group_mixed.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | group testgroup1 7 | A -> B: AB 8 | loop testloop2 9 | B -> C: BC 10 | end 11 | note left: loop note testloop2 12 | end 13 | note left 14 | group note testgroup1 15 | end note 16 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_group_mixed.json: -------------------------------------------------------------------------------- 1 | {"title":"","graphData":{"nodes":[{"data":{"id":"A","zone":"#FBDCD6"}},{"data":{"id":"B","zone":"#FBDCD6"}},{"data":{"id":"C","zone":"#FBDCD6"}}],"edges":[{"data":{"id":"e0","source":"A","target":"B"}},{"data":{"id":"e1","source":"B","target":"C"}}]},"stepData":[{"id":"g0","type":"group","groupName":"group","nodes":[],"steps":[{"id":"0","type":"single","nodes":["A","B"],"steps":[],"description":"AB","note":""},{"id":"g1","type":"group","groupName":"loop","nodes":[],"steps":[{"id":"1","type":"single","nodes":["B","C"],"steps":[],"description":"BC","note":""}],"description":"testloop2","note":"loop note testloop2"}],"description":"testgroup1","note":"group note testgroup1"}],"zoneData":[]} -------------------------------------------------------------------------------- /tests/testfiles/steps_loop.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | loop testloop1 7 | A -> B: AB 8 | loop testloop2 9 | B -> C: BC 10 | end 11 | note left: loop note testloop2 12 | end 13 | note left 14 | loop note testloop1 15 | end note 16 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_loop.json: -------------------------------------------------------------------------------- 1 | {"title":"","graphData":{"nodes":[{"data":{"id":"A","zone":"#FBDCD6"}},{"data":{"id":"B","zone":"#FBDCD6"}},{"data":{"id":"C","zone":"#FBDCD6"}}],"edges":[{"data":{"id":"e0","source":"A","target":"B"}},{"data":{"id":"e1","source":"B","target":"C"}}]},"stepData":[{"id":"g0","type":"group","groupName":"loop","nodes":[],"steps":[{"id":"0","type":"single","nodes":["A","B"],"steps":[],"description":"AB","note":""},{"id":"g1","type":"group","groupName":"loop","nodes":[],"steps":[{"id":"1","type":"single","nodes":["B","C"],"steps":[],"description":"BC","note":""}],"description":"testloop2","note":"loop note testloop2"}],"description":"testloop1","note":"loop note testloop1"}],"zoneData":[]} -------------------------------------------------------------------------------- /tests/testfiles/steps_mixed.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant "BBB" as B 5 | participant C 6 | 7 | A -> B: AB 8 | B -> C: BC 9 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_steptest.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | A -> B: AB1 6 | A -\ B: AB2 7 | A -/ B: AB3 8 | A ->> B: AB4 9 | A -\\ B: AB5 10 | A -// B: AB6 11 | A --> B: AB7 12 | A --\\ B: AB8 13 | A --// B: AB9 14 | A -->> B: AB10 15 | B <- A: AB11 16 | A <-> B: AB12 //shouldn't be parsed 17 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/steps_unaliased.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | 7 | A -> B: AB 8 | B -> C: BC 9 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/supernodes.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | participant A << (X,#80ccff) blue! >> 4 | participant B << (X,#80ccff) blue! >> 5 | participant C 6 | 7 | C -> A: whoa 8 | A -> B: inside! 9 | 10 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/unaliased_participants.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant "B" 5 | participant C 6 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/undeclaredparticipant.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | participant "Customer" as cust 3 | participant "Wallet Client" as WC 4 | participant "Edge" as WO 5 | 6 | participant "APNS" as APNS 7 | participant "GCM" as GCM 8 | 9 | participant "DMS" as DMS 10 | 11 | participant "360" as 360 12 | participant "360" as CST 13 | 14 | 15 | WO -> WO: Swallow failure(?) 16 | WO -> WC: return Success/Failure 17 | 18 | WC -> WO: update AlertSubscriptions 19 | WO -> TSYS: tsysAuthUpdate V1 (accountReferenceId, boolean) 20 | TSYS -> WO: return success/failure 21 | 22 | 23 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/xsstest.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | autonumber 3 | participant A 4 | participant B 5 | participant C 6 | 7 | A -> B: AB 8 | note left: AB note 9 | 10 | A -> C: AC 11 | note right 12 | 13 | end note 14 | 15 | @enduml -------------------------------------------------------------------------------- /tests/testfiles/zoned_participants.adoc: -------------------------------------------------------------------------------- 1 | @startuml 2 | participant A << (X, #111) zoneA >> 3 | participant "BBB" as B << (X, #222) zoneB >> 4 | participant C 5 | @enduml -------------------------------------------------------------------------------- /tests/validator.test.js: -------------------------------------------------------------------------------- 1 | import validator from '../src/utils/dataValidator'; 2 | 3 | 4 | //The given example files for users to test out themselves 5 | const base_dir = '../sample_json_data/' 6 | 7 | const simple_structure = require(base_dir + 'simple_structure.json'); 8 | const section_example = require(base_dir + 'section_example.json'); 9 | const readme_example = require(base_dir + 'readme_example.json'); 10 | const zones_example = require(base_dir + 'zones_example.json'); 11 | const large_web = require(base_dir + 'large_web.json'); 12 | 13 | const printErrors = (res) => { 14 | if (res.errors) { 15 | console.error(errors); 16 | } 17 | } 18 | 19 | expect.extend({ 20 | toNotError(received, argument) { 21 | const res = validator(received); 22 | const pass = res.errors.length === 0; 23 | if (pass) { 24 | return { 25 | message: () => (`${received} is a valid json structure`), 26 | pass: true 27 | } 28 | } else { 29 | return { 30 | message: () => (`an error occurred in validation, here it is: \n${JSON.stringify(res.errors, null, 4)}`), 31 | pass: false 32 | } 33 | } 34 | } 35 | }) 36 | 37 | describe('validator', () => { 38 | /* 39 | THE GIVEN JSON FILES IN THE sample_json_data DIRECTORY 40 | */ 41 | it('should validate a simple diagram', () => { 42 | expect(simple_structure).toNotError(); 43 | }); 44 | 45 | it('should validate a diagram with groups', () => { 46 | expect(section_example).toNotError(); 47 | }) 48 | 49 | it('should validate the readme example', () => { 50 | expect(readme_example).toNotError(); 51 | }) 52 | 53 | it('should validate the zones example', () => { 54 | expect(zones_example).toNotError(); 55 | }) 56 | 57 | it('should validate the large web example', () => { 58 | expect(large_web).toNotError(); 59 | }) 60 | 61 | 62 | 63 | }); --------------------------------------------------------------------------------