architecture-viewer 0.0.1-security → 4.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of architecture-viewer might be problematic. Click here for more details.
- package/2/package.json +10 -0
- package/2/postinstall.js +33 -0
- package/New Folder/architecture-viewer/.babelrc +9 -0
- package/New Folder/architecture-viewer/.whitesource +8 -0
- package/New Folder/architecture-viewer/CODEOWNERS +2 -0
- package/New Folder/architecture-viewer/LICENSE.txt +201 -0
- package/New Folder/architecture-viewer/README.md +238 -0
- package/New Folder/architecture-viewer/licenses.csv +40 -0
- package/New Folder/architecture-viewer/package-lock.json +16126 -0
- package/New Folder/architecture-viewer/package.json +60 -0
- package/New Folder/architecture-viewer/preact.config.js +62 -0
- package/New Folder/architecture-viewer/readme_resources/screenrecord_arch_diagram.gif +0 -0
- package/New Folder/architecture-viewer/sample_json_data/large_web.json +289 -0
- package/New Folder/architecture-viewer/sample_json_data/no_steps.json +185 -0
- package/New Folder/architecture-viewer/sample_json_data/readme_example.json +55 -0
- package/New Folder/architecture-viewer/sample_json_data/section_example.json +323 -0
- package/New Folder/architecture-viewer/sample_json_data/simple_structure.json +131 -0
- package/New Folder/architecture-viewer/sample_json_data/zones_example.json +445 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.adoc +65 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.png +0 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.svg +1 -0
- package/New Folder/architecture-viewer/src/assets/data.json +445 -0
- package/New Folder/architecture-viewer/src/assets/favicon.ico +0 -0
- package/New Folder/architecture-viewer/src/assets/grid_data.json +1126 -0
- package/New Folder/architecture-viewer/src/assets/icons/android-chrome-192x192.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/android-chrome-512x512.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/apple-touch-icon.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/favicon-16x16.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/favicon-32x32.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/info.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/mstile-150x150.png +0 -0
- package/New Folder/architecture-viewer/src/assets/test_data.json +32 -0
- package/New Folder/architecture-viewer/src/components/app.js +231 -0
- package/New Folder/architecture-viewer/src/components/controls.js +195 -0
- package/New Folder/architecture-viewer/src/components/diagram.js +362 -0
- package/New Folder/architecture-viewer/src/components/diagramArea.js +68 -0
- package/New Folder/architecture-viewer/src/components/info.js +37 -0
- package/New Folder/architecture-viewer/src/components/infoArea.js +75 -0
- package/New Folder/architecture-viewer/src/components/key.js +42 -0
- package/New Folder/architecture-viewer/src/components/tableOfContents.js +112 -0
- package/New Folder/architecture-viewer/src/components/tocStep.js +100 -0
- package/New Folder/architecture-viewer/src/components/zoneLegend.js +55 -0
- package/New Folder/architecture-viewer/src/index.js +20 -0
- package/New Folder/architecture-viewer/src/manifest.json +19 -0
- package/New Folder/architecture-viewer/src/routes/home/index.js +29 -0
- package/New Folder/architecture-viewer/src/routes/home/style.less +23 -0
- package/New Folder/architecture-viewer/src/routes/profile/index.js +63 -0
- package/New Folder/architecture-viewer/src/routes/profile/style.less +23 -0
- package/New Folder/architecture-viewer/src/style/helpers.less +40 -0
- package/New Folder/architecture-viewer/src/style/index.css +224 -0
- package/New Folder/architecture-viewer/src/style/jquery.qtip.less +623 -0
- package/New Folder/architecture-viewer/src/sw.js +4 -0
- package/New Folder/architecture-viewer/src/template.html +15 -0
- package/New Folder/architecture-viewer/src/utils/dataValidator.js +333 -0
- package/New Folder/architecture-viewer/src/utils/parser.js +623 -0
- package/New Folder/architecture-viewer/src/utils/stepUtils.js +30 -0
- package/New Folder/architecture-viewer/tests/__mocks__/browserMocks.js +21 -0
- package/New Folder/architecture-viewer/tests/__mocks__/fileMocks.js +3 -0
- package/New Folder/architecture-viewer/tests/__mocks__/setupTests.js +6 -0
- package/New Folder/architecture-viewer/tests/parser.test.js +799 -0
- package/New Folder/architecture-viewer/tests/testfiles/aliased_participants.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/bigspace.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/dividers.adoc +18 -0
- package/New Folder/architecture-viewer/tests/testfiles/doubled_names.adoc +10 -0
- package/New Folder/architecture-viewer/tests/testfiles/empty.adoc +2 -0
- package/New Folder/architecture-viewer/tests/testfiles/meta.adoc +19 -0
- package/New Folder/architecture-viewer/tests/testfiles/notes_multiline.adoc +17 -0
- package/New Folder/architecture-viewer/tests/testfiles/notes_singleline.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/parsefile.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/participant_decl.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/participant_info.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/readme.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_aliased.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group_mixed.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group_mixed.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_loop.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_loop.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_mixed.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_steptest.adoc +17 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_unaliased.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/supernodes.adoc +10 -0
- package/New Folder/architecture-viewer/tests/testfiles/unaliased_participants.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/undeclaredparticipant.adoc +23 -0
- package/New Folder/architecture-viewer/tests/testfiles/xsstest.adoc +15 -0
- package/New Folder/architecture-viewer/tests/testfiles/zoned_participants.adoc +5 -0
- package/New Folder/architecture-viewer/tests/validator.test.js +63 -0
- package/New Folder/d_i.txt +1 -0
- package/New Folder/dependency_confution_npm.sh +70 -0
- package/New Folder/licenses.csv +40 -0
- package/New Folder/npm_sub.txt +0 -0
- package/New Folder/package.json.save +12 -0
- package/index.js +39 -0
- package/package.json +9 -3
- package/README.md +0 -5
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,32 @@
|
|
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
|
+
}
|
@@ -0,0 +1,231 @@
|
|
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
|
+
<div id="container">
|
202
|
+
<div id="app">
|
203
|
+
<DiagramArea graphData={this.state.graphData}
|
204
|
+
stepData={this.state.stepData}
|
205
|
+
curStep={this.state.curStep}
|
206
|
+
updateSelectedNode={this.updateSelectedNode}
|
207
|
+
zoneData={this.state.zoneData}></DiagramArea>
|
208
|
+
<InfoArea title={this.state.title}
|
209
|
+
graphData={this.state.graphData}
|
210
|
+
stepData={this.state.stepData}
|
211
|
+
curStep={this.state.curStep}
|
212
|
+
selectedNode={this.state.selectedNode}
|
213
|
+
updateStep={this.updateStep}
|
214
|
+
updateData={this.updateData}
|
215
|
+
flowTitle={this.state.flowTitle}></InfoArea><br />
|
216
|
+
</div>
|
217
|
+
<div id="footer"> <a href={repoUrl}>{repoUrl}</a> </div>
|
218
|
+
</div>
|
219
|
+
);
|
220
|
+
} else {
|
221
|
+
return <div> Loading... </div>
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
/*<Header />
|
227
|
+
<Router onChange={this.handleRoute}>
|
228
|
+
<Home path="/" />
|
229
|
+
<Profile path="/profile/" user="me" />
|
230
|
+
<Profile path="/profile/:user" />
|
231
|
+
</Router>*/
|
@@ -0,0 +1,195 @@
|
|
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 = <div id="move-steps">
|
177
|
+
<button onClick={this.firstStep} className={iframeCheck}>{"<<"}</button>
|
178
|
+
<button onClick={this.decrementStep} className={iframeCheck}>{"<"}</button>
|
179
|
+
<span className="cur-step"> Step: {parseInt(this.props.curStep) + 1} </span>
|
180
|
+
<button onClick={this.incrementStep} className={iframeCheck}>{">"}</button>
|
181
|
+
<button onClick={this.lastStep} className={iframeCheck}>{">>"}</button>
|
182
|
+
</div>;
|
183
|
+
}
|
184
|
+
|
185
|
+
return (
|
186
|
+
<div id="controls" style={controlsStyle} className="sub-container-border">
|
187
|
+
{ stepElems }
|
188
|
+
<div id="upload-plantuml">
|
189
|
+
open a PlantUML file: <br/>
|
190
|
+
<input type="file" onChange={this.updateData}/>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
)
|
194
|
+
}
|
195
|
+
}
|