Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit ae337d9

Browse files
mbarekhfredericcarre
authored andcommitted
Issue 41 (#46)
* allow no graphical file * remove unused dependeny
1 parent 3a8e651 commit ae337d9

6 files changed

Lines changed: 73 additions & 47 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"react-intl": "^2.2.3",
3030
"react-redux": "^5.0.2",
3131
"react-router-dom": "^4.0.0-beta.8",
32-
"reactivexcomponent.js": "3.1.5",
32+
"reactivexcomponent.js": "^3.1.7",
3333
"redux": "^3.6.0",
3434
"redux-logger": "^3.0.0",
3535
"redux-thunk": "^2.2.0"

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { getLocalizedResources } from "./locales/localeConfiguration";
2828
import { ComponentClass } from "react";
2929
import registerServiceWorker from "./registerServiceWorker";
3030

31-
const middleware = applyMiddleware(thunk, logger());
31+
const middleware = applyMiddleware(thunk, logger.createLogger());
3232
const store = createStore(RootReducer, middleware);
3333
const locale = "en";
3434

src/utils/configurationParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const modelTags: { [key: string]: string } = {
1818
FromKey: "FromKey",
1919
ToKey: "ToKey",
2020
TransversalTransitionData: "TransversalTransitionData",
21+
Type: "Type",
2122
// state
2223
IsEntryPoint: "IsEntryPoint",
2324
State: "State",

src/utils/graphicColors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export const stateMachineColor = "rgba(0,0,128,0.45)";
22
export const backgroundColor = "LightGrey";
33
export const finalStateColor = "Green";
44
export const forkTransitionColor = "Green";
5+
export const TimeoutTransitionColor = "Orange";
56
export const transitionColor = "Black";
67
export const stateColor = "White";
78
export const activeStateColor = "Red";

src/utils/parser.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { graphicalTags, modelTags, fatalErrorState } from "./configurationParser";
22
import { LinkLabelTemplate, TransitionTemplate, TriggerableTransitionTemplate, StateMachineTemplate, StateTemplate, LinkDataArrayTemplate, NodeDataArrayTemplate } from "./gojsTemplates";
33
import { Point, Curve, StateMachine, State, ComponentGraphicalModel } from "./parserObjects";
4-
import { finalStateColor, stateColor, transitionPatternStateColor, entryPointStateColor, fatalErrorStateColor, transitionColor, forkTransitionColor } from "./graphicColors";
4+
import { finalStateColor, stateColor, transitionPatternStateColor, entryPointStateColor, fatalErrorStateColor, transitionColor, forkTransitionColor, TimeoutTransitionColor } from "./graphicColors";
55

66
export class Parser {
77
private locations: { [key: string]: Point };
@@ -20,13 +20,17 @@ export class Parser {
2020
private stateMachineNames: Array<string>;
2121
private linkDataArray: Array<LinkDataArrayTemplate>;
2222
private nodeDataArray: Array<NodeDataArrayTemplate>;
23+
private graphical: boolean;
2324

2425
constructor(componentGraphicalModel: ComponentGraphicalModel) {
2526
this.componentGraphicalModel = componentGraphicalModel;
2627
}
2728

2829
parse() {
29-
this.parseGraphical();
30+
this.graphical = this.componentGraphicalModel.graphical !== undefined;
31+
if (this.graphical) {
32+
this.parseGraphical();
33+
}
3034
this.parseModel();
3135
}
3236

@@ -72,7 +76,9 @@ export class Parser {
7276
this.entryPointState = this.getEntyPointState();
7377
this.nodeDataArray = this.setNodeDataArray();
7478
this.nodeDataArray = this.nodeDataArray.concat(this.linksLabel);
75-
this.addControlPoint();
79+
if (this.graphical) {
80+
this.addControlPoint();
81+
}
7682
}
7783

7884
private setComponentName(scxmlDom: Document): void {
@@ -118,13 +124,13 @@ export class Parser {
118124
let loc, color, text;
119125
if (!this.states[ids[j]]) {
120126
id = ids[j].substring(modelTags.TP_State.length, ids[j].length);
121-
loc = this.locations[id].x + " " + this.locations[id].y;
127+
loc = (this.locations && this.locations[id]) ? this.locations[id].x + " " + this.locations[id].y : undefined;
122128
color = transitionPatternStateColor;
123129
state = this.transitionPatternStates[ids[j]];
124130
text = state.name;
125131
} else {
126132
id = ids[j].substring(modelTags.State.length, ids[j].length);
127-
loc = this.locations[id].x + " " + this.locations[id].y;
133+
loc = (this.locations && this.locations[id]) ? this.locations[id].x + " " + this.locations[id].y : undefined;
128134
text = state.name + " (0)";
129135
if (state.isFinal) {
130136
color = finalStateColor;
@@ -236,8 +242,14 @@ export class Parser {
236242
to = this.states[linksDom[i].getAttribute(modelTags.ToKey)];
237243
text = linksDom[i].getAttribute(modelTags.Name);
238244
key = linksDom[i].getAttribute(modelTags.Id);
239-
const isForkTransition = from.group === to.key.split(modelTags.Separator)[0];
240-
const color = (isForkTransition) ? transitionColor : forkTransitionColor;
245+
const isForkTransition = from.group !== to.key.split(modelTags.Separator)[0];
246+
let color = transitionColor;
247+
if (isForkTransition) {
248+
color = forkTransitionColor;
249+
} else if (linksDom[i].getAttribute(modelTags.Type) === "TimeOut") {
250+
color = TimeoutTransitionColor;
251+
}
252+
241253
this.linkDataArray.push({
242254
"key": key,
243255
"from": from.key,

yarn.lock

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44

55
"@types/es6-shim@^0.31.32":
6-
version "0.31.35"
7-
resolved "https://registry.yarnpkg.com/@types/es6-shim/-/es6-shim-0.31.35.tgz#d11920d8d4c938ad912c51e699ed7ba2505ba1eb"
6+
version "0.31.37"
7+
resolved "https://registry.yarnpkg.com/@types/es6-shim/-/es6-shim-0.31.37.tgz#d01fa9b61a6692e57387dde5483b0255659ba70f"
88

9-
"@types/jest@^18.1.1":
10-
version "18.1.1"
11-
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-18.1.1.tgz#6f63488c64726900885ab9cd5697bb7fa1b416cc"
9+
"@types/events@*":
10+
version "1.2.0"
11+
resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86"
1212

1313
"@types/jest@^23.0.0":
1414
version "23.0.0"
1515
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.0.0.tgz#760cac74f00bb9c3075587716d2b3b4435663bc0"
1616

17+
"@types/node@*":
18+
version "10.5.2"
19+
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707"
20+
1721
"@types/node@^10.0.0":
1822
version "10.3.0"
1923
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.0.tgz#078516315a84d56216b5d4fed8f75d59d3b16cac"
2024

21-
"@types/node@^9.3.0":
22-
version "9.6.5"
23-
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.5.tgz#ee700810fdf49ac1c399fc5980b7559b3e5a381d"
24-
25-
"@types/pako@^0.2.31":
26-
version "0.2.31"
27-
resolved "https://registry.yarnpkg.com/@types/pako/-/pako-0.2.31.tgz#dbeff0274ae7b782046fe2b7d45f7285ae3d37bc"
25+
"@types/pako@^1.0.0":
26+
version "1.0.0"
27+
resolved "https://registry.yarnpkg.com/@types/pako/-/pako-1.0.0.tgz#eaae8364d1b7f752e263bc3fd68dfec98e6136c5"
2828

2929
"@types/react@^16.0.0":
3030
version "16.0.10"
@@ -118,9 +118,12 @@
118118
"@types/rx-lite-time" "*"
119119
"@types/rx-lite-virtualtime" "*"
120120

121-
"@types/xml2js@0.0.32":
122-
version "0.0.32"
123-
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.32.tgz#9f7e98cf0adcca085a35cdead0319b5ac19c9fd9"
121+
"@types/xml2js@0.4.3":
122+
version "0.4.3"
123+
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.4.3.tgz#2f41bfc74d5a4022511721f872ed395a210ad3b7"
124+
dependencies:
125+
"@types/events" "*"
126+
"@types/node" "*"
124127

125128
"@types/xmldom@^0.1.28":
126129
version "0.1.29"
@@ -385,8 +388,8 @@ asynckit@^0.4.0:
385388
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
386389

387390
atob@^2.0.3:
388-
version "2.0.3"
389-
resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d"
391+
version "2.1.1"
392+
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a"
390393

391394
autoprefixer@7.1.2:
392395
version "7.1.2"
@@ -4945,21 +4948,22 @@ react@^16.0.0:
49454948
object-assign "^4.1.1"
49464949
prop-types "^15.6.0"
49474950

4948-
reactivexcomponent.js@3.1.5:
4949-
version "3.1.5"
4950-
resolved "https://registry.yarnpkg.com/reactivexcomponent.js/-/reactivexcomponent.js-3.1.5.tgz#f2e1d8f2b2d4385f12505239b673f6a090e80354"
4951+
reactivexcomponent.js@^3.1.7:
4952+
version "3.1.7"
4953+
resolved "https://registry.yarnpkg.com/reactivexcomponent.js/-/reactivexcomponent.js-3.1.7.tgz#053337e98b4e7fdcae075a63a56478fe46fbe709"
49514954
dependencies:
49524955
"@types/es6-shim" "^0.31.32"
4953-
"@types/jest" "^18.1.1"
4954-
"@types/node" "^9.3.0"
4955-
"@types/pako" "^0.2.31"
4956+
"@types/jest" "^23.0.0"
4957+
"@types/node" "^10.0.0"
4958+
"@types/pako" "^1.0.0"
49564959
"@types/rx" "^4.1.1"
4957-
"@types/xml2js" "0.0.32"
4960+
"@types/xml2js" "0.4.3"
49584961
"@types/xmldom" "^0.1.28"
49594962
atob "^2.0.3"
49604963
log4ts "^0.4.2"
49614964
pako "^1.0.3"
4962-
rxjs "^5.3.0"
4965+
rxjs "^6.0.0"
4966+
rxjs-compat "^6"
49634967
uuid "^3.0.1"
49644968
websocket "^1.0.25"
49654969
xml2js "^0.4.17"
@@ -5336,11 +5340,15 @@ rx-lite@*, rx-lite@^4.0.8:
53365340
version "4.0.8"
53375341
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
53385342

5339-
rxjs@^5.3.0:
5340-
version "5.5.6"
5341-
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.6.tgz#e31fb96d6fd2ff1fd84bcea8ae9c02d007179c02"
5343+
rxjs-compat@^6:
5344+
version "6.2.2"
5345+
resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.2.2.tgz#3c0fcdb46130cc70aa55412c2b1147905ab4680a"
5346+
5347+
rxjs@^6.0.0:
5348+
version "6.2.2"
5349+
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9"
53425350
dependencies:
5343-
symbol-observable "1.0.1"
5351+
tslib "^1.9.0"
53445352

53455353
safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
53465354
version "5.1.1"
@@ -5826,10 +5834,6 @@ sw-toolbox@^3.4.0:
58265834
path-to-regexp "^1.0.1"
58275835
serviceworker-cache-polyfill "^4.0.0"
58285836

5829-
symbol-observable@1.0.1:
5830-
version "1.0.1"
5831-
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
5832-
58335837
symbol-observable@^1.0.3:
58345838
version "1.0.4"
58355839
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
@@ -5993,6 +5997,10 @@ tslib@^1.8.0:
59935997
version "1.9.0"
59945998
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
59955999

6000+
tslib@^1.9.0:
6001+
version "1.9.3"
6002+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
6003+
59966004
tslint-loader@^3.5.3:
59976005
version "3.5.3"
59986006
resolved "https://registry.yarnpkg.com/tslint-loader/-/tslint-loader-3.5.3.tgz#343f74122d94f356b689457d3f59f64a69ab606f"
@@ -6272,10 +6280,14 @@ uuid@^2.0.1, uuid@^2.0.2:
62726280
version "2.0.3"
62736281
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
62746282

6275-
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0:
6283+
uuid@^3.0.0, uuid@^3.1.0:
62766284
version "3.1.0"
62776285
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
62786286

6287+
uuid@^3.0.1:
6288+
version "3.3.2"
6289+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
6290+
62796291
validate-npm-package-license@^3.0.1:
62806292
version "3.0.1"
62816293
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc"
@@ -6450,8 +6462,8 @@ websocket-extensions@>=0.1.1:
64506462
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.2.tgz#0e18781de629a18308ce1481650f67ffa2693a5d"
64516463

64526464
websocket@^1.0.25:
6453-
version "1.0.25"
6454-
resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.25.tgz#998ec790f0a3eacb8b08b50a4350026692a11958"
6465+
version "1.0.26"
6466+
resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.26.tgz#a03a01299849c35268c83044aa919c6374be8194"
64556467
dependencies:
64566468
debug "^2.2.0"
64576469
nan "^2.3.3"
@@ -6577,8 +6589,8 @@ xml2js@^0.4.17:
65776589
xmlbuilder "~9.0.1"
65786590

65796591
xmlbuilder@~9.0.1:
6580-
version "9.0.4"
6581-
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.4.tgz#519cb4ca686d005a8420d3496f3f0caeecca580f"
6592+
version "9.0.7"
6593+
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
65826594

65836595
xmldom@^0.1.22:
65846596
version "0.1.27"

0 commit comments

Comments
 (0)