├── tests
├── testfiles
│ ├── empty.adoc
│ ├── parsefile.adoc
│ ├── participant_decl.adoc
│ ├── unaliased_participants.adoc
│ ├── participant_info.adoc
│ ├── zoned_participants.adoc
│ ├── aliased_participants.adoc
│ ├── steps_unaliased.adoc
│ ├── steps_mixed.adoc
│ ├── doubled_names.adoc
│ ├── steps_aliased.adoc
│ ├── readme.adoc
│ ├── supernodes.adoc
│ ├── dividers.adoc
│ ├── xsstest.adoc
│ ├── notes_multiline.adoc
│ ├── notes_singleline.adoc
│ ├── steps_loop.adoc
│ ├── steps_group.adoc
│ ├── steps_group_mixed.adoc
│ ├── steps_steptest.adoc
│ ├── bigspace.json
│ ├── undeclaredparticipant.adoc
│ ├── steps_loop.json
│ ├── steps_group.json
│ ├── steps_group_mixed.json
│ └── meta.adoc
├── __mocks__
│ ├── setupTests.js
│ ├── fileMocks.js
│ └── browserMocks.js
└── validator.test.js
├── CODEOWNERS
├── .gitignore
├── src
├── assets
│ ├── favicon.ico
│ ├── icons
│ │ ├── info.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── mstile-150x150.png
│ │ ├── apple-touch-icon.png
│ │ ├── android-chrome-192x192.png
│ │ └── android-chrome-512x512.png
│ ├── test_data.json
│ └── data.json
├── sw.js
├── template.html
├── manifest.json
├── index.js
├── routes
│ ├── home
│ │ ├── style.less
│ │ └── index.js
│ └── profile
│ │ ├── style.less
│ │ └── index.js
├── style
│ ├── helpers.less
│ ├── index.css
│ └── jquery.qtip.less
├── utils
│ ├── stepUtils.js
│ ├── dataValidator.js
│ └── parser.js
└── components
│ ├── info.js
│ ├── key.js
│ ├── zoneLegend.js
│ ├── diagramArea.js
│ ├── infoArea.js
│ ├── tocStep.js
│ ├── tableOfContents.js
│ ├── app.js
│ ├── controls.js
│ └── diagram.js
├── sample_plantuml_data
├── example.png
└── example.adoc
├── readme_resources
└── screenrecord_arch_diagram.gif
├── .babelrc
├── .whitesource
├── sample_json_data
├── readme_example.json
├── simple_structure.json
├── no_steps.json
├── large_web.json
├── section_example.json
└── zones_example.json
├── package.json
├── preact.config.js
├── licenses.csv
├── README.md
└── LICENSE.txt
/tests/testfiles/empty.adoc:
--------------------------------------------------------------------------------
1 | @startuml
2 | @enduml
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Owner: https://github.com/daj
2 | * @daj @handstandsam
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .DS_Store
3 | scripts/repo/
4 | scripts-output/*
5 | build/
6 | size-plugin.json
7 |
--------------------------------------------------------------------------------
/src/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/favicon.ico
--------------------------------------------------------------------------------
/src/assets/icons/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/info.png
--------------------------------------------------------------------------------
/tests/testfiles/parsefile.adoc:
--------------------------------------------------------------------------------
1 | @startuml
2 | autonumber
3 | participant Testing\nmulti\nline as TML
4 |
5 |
6 | @enduml
--------------------------------------------------------------------------------
/sample_plantuml_data/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/sample_plantuml_data/example.png
--------------------------------------------------------------------------------
/tests/testfiles/participant_decl.adoc:
--------------------------------------------------------------------------------
1 | @startuml
2 | autonumber
3 | participant A
4 | actor "B B B" as B
5 | participant C
6 | @enduml
--------------------------------------------------------------------------------
/src/assets/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/src/assets/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/src/assets/icons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/mstile-150x150.png
--------------------------------------------------------------------------------
/tests/testfiles/unaliased_participants.adoc:
--------------------------------------------------------------------------------
1 | @startuml
2 | autonumber
3 | participant A
4 | participant "B"
5 | participant C
6 | @enduml
--------------------------------------------------------------------------------
/src/assets/icons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/apple-touch-icon.png
--------------------------------------------------------------------------------
/src/sw.js:
--------------------------------------------------------------------------------
1 | import { getFiles, setupPrecaching, setupRouting } from 'preact-cli/sw/';
2 |
3 | setupRouting();
4 | setupPrecaching(getFiles());
5 |
--------------------------------------------------------------------------------
/src/assets/icons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/src/assets/icons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/src/assets/icons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/readme_resources/screenrecord_arch_diagram.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capitalone/architecture-viewer/HEAD/readme_resources/screenrecord_arch_diagram.gif
--------------------------------------------------------------------------------
/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/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/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/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
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "test": {
4 | "presets": [
5 | ["preact-cli/babel", { "modules": "commonjs" }]
6 | ]
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/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/__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 |
--------------------------------------------------------------------------------
/.whitesource:
--------------------------------------------------------------------------------
1 | {
2 | "checkRunSettings": {
3 | "vulnerableCheckRunConclusionLevel": "failure"
4 | },
5 | "issueSettings": {
6 | "minSeverityLevel": "NONE"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/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/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/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/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/__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/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/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/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/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_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_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_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/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":[]}
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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/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_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.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":[]}
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/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/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/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/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/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/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | });
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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