@things-factory/integration-ui 9.0.0-beta.27 → 9.0.0-beta.29

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.
Files changed (120) hide show
  1. package/dist-client/analysis/graph-data.d.ts +36 -0
  2. package/dist-client/analysis/graph-data.js +2 -0
  3. package/dist-client/analysis/graph-data.js.map +1 -0
  4. package/dist-client/analysis/graph-viewer-style.d.ts +1 -0
  5. package/dist-client/analysis/graph-viewer-style.js +121 -0
  6. package/dist-client/analysis/graph-viewer-style.js.map +1 -0
  7. package/dist-client/analysis/graph-viewer.d.ts +36 -0
  8. package/dist-client/analysis/graph-viewer.js +294 -0
  9. package/dist-client/analysis/graph-viewer.js.map +1 -0
  10. package/dist-client/analysis/node.d.ts +4 -0
  11. package/dist-client/analysis/node.js +59 -0
  12. package/dist-client/analysis/node.js.map +1 -0
  13. package/dist-client/analysis/relationship.d.ts +4 -0
  14. package/dist-client/analysis/relationship.js +13 -0
  15. package/dist-client/analysis/relationship.js.map +1 -0
  16. package/dist-client/analysis/utils.d.ts +20 -0
  17. package/dist-client/analysis/utils.js +31 -0
  18. package/dist-client/analysis/utils.js.map +1 -0
  19. package/dist-client/bootstrap.d.ts +3 -0
  20. package/dist-client/bootstrap.js +30 -0
  21. package/dist-client/bootstrap.js.map +1 -0
  22. package/dist-client/editors/entity-editor.d.ts +10 -0
  23. package/dist-client/editors/entity-editor.js +46 -0
  24. package/dist-client/editors/entity-editor.js.map +1 -0
  25. package/dist-client/editors/entity-selector.d.ts +31 -0
  26. package/dist-client/editors/entity-selector.js +301 -0
  27. package/dist-client/editors/entity-selector.js.map +1 -0
  28. package/dist-client/editors/property-editor.d.ts +30 -0
  29. package/dist-client/editors/property-editor.js +105 -0
  30. package/dist-client/editors/property-editor.js.map +1 -0
  31. package/dist-client/editors/things-editor-db-procedure.d.ts +52 -0
  32. package/dist-client/editors/things-editor-db-procedure.js +495 -0
  33. package/dist-client/editors/things-editor-db-procedure.js.map +1 -0
  34. package/dist-client/editors/things-editor-entity-selector.d.ts +15 -0
  35. package/dist-client/editors/things-editor-entity-selector.js +94 -0
  36. package/dist-client/editors/things-editor-entity-selector.js.map +1 -0
  37. package/dist-client/editors/things-editor-http-body.d.ts +22 -0
  38. package/dist-client/editors/things-editor-http-body.js +137 -0
  39. package/dist-client/editors/things-editor-http-body.js.map +1 -0
  40. package/dist-client/editors/things-editor-http-headers.d.ts +29 -0
  41. package/dist-client/editors/things-editor-http-headers.js +167 -0
  42. package/dist-client/editors/things-editor-http-headers.js.map +1 -0
  43. package/dist-client/editors/things-editor-http-parameters.d.ts +29 -0
  44. package/dist-client/editors/things-editor-http-parameters.js +167 -0
  45. package/dist-client/editors/things-editor-http-parameters.js.map +1 -0
  46. package/dist-client/editors/things-editor-tag-scenarios.d.ts +32 -0
  47. package/dist-client/editors/things-editor-tag-scenarios.js +226 -0
  48. package/dist-client/editors/things-editor-tag-scenarios.js.map +1 -0
  49. package/dist-client/grist/connection-selector.d.ts +4 -0
  50. package/dist-client/grist/connection-selector.js +30 -0
  51. package/dist-client/grist/connection-selector.js.map +1 -0
  52. package/dist-client/grist/connector-selector.d.ts +4 -0
  53. package/dist-client/grist/connector-selector.js +30 -0
  54. package/dist-client/grist/connector-selector.js.map +1 -0
  55. package/dist-client/grist/dynamic-selector.d.ts +10 -0
  56. package/dist-client/grist/dynamic-selector.js +32 -0
  57. package/dist-client/grist/dynamic-selector.js.map +1 -0
  58. package/dist-client/grist/task-type-selector.d.ts +7 -0
  59. package/dist-client/grist/task-type-selector.js +58 -0
  60. package/dist-client/grist/task-type-selector.js.map +1 -0
  61. package/dist-client/index.d.ts +2 -0
  62. package/dist-client/index.js +3 -0
  63. package/dist-client/index.js.map +1 -0
  64. package/dist-client/pages/connection-importer.d.ts +10 -0
  65. package/dist-client/pages/connection-importer.js +102 -0
  66. package/dist-client/pages/connection-importer.js.map +1 -0
  67. package/dist-client/pages/connection.d.ts +64 -0
  68. package/dist-client/pages/connection.js +478 -0
  69. package/dist-client/pages/connection.js.map +1 -0
  70. package/dist-client/pages/integration-analysis.d.ts +24 -0
  71. package/dist-client/pages/integration-analysis.js +238 -0
  72. package/dist-client/pages/integration-analysis.js.map +1 -0
  73. package/dist-client/pages/integration-monitor.d.ts +28 -0
  74. package/dist-client/pages/integration-monitor.js +343 -0
  75. package/dist-client/pages/integration-monitor.js.map +1 -0
  76. package/dist-client/pages/scenario-detail.d.ts +2 -0
  77. package/dist-client/pages/scenario-detail.js +298 -0
  78. package/dist-client/pages/scenario-detail.js.map +1 -0
  79. package/dist-client/pages/scenario-importer.d.ts +10 -0
  80. package/dist-client/pages/scenario-importer.js +108 -0
  81. package/dist-client/pages/scenario-importer.js.map +1 -0
  82. package/dist-client/pages/scenario.d.ts +69 -0
  83. package/dist-client/pages/scenario.js +632 -0
  84. package/dist-client/pages/scenario.js.map +1 -0
  85. package/dist-client/pages/state-register.d.ts +50 -0
  86. package/dist-client/pages/state-register.js +278 -0
  87. package/dist-client/pages/state-register.js.map +1 -0
  88. package/dist-client/route.d.ts +1 -0
  89. package/dist-client/route.js +20 -0
  90. package/dist-client/route.js.map +1 -0
  91. package/dist-client/tsconfig.tsbuildinfo +1 -0
  92. package/dist-client/viewparts/connections-monitor.d.ts +10 -0
  93. package/dist-client/viewparts/connections-monitor.js +172 -0
  94. package/dist-client/viewparts/connections-monitor.js.map +1 -0
  95. package/dist-client/viewparts/monitoring-summary.d.ts +13 -0
  96. package/dist-client/viewparts/monitoring-summary.js +142 -0
  97. package/dist-client/viewparts/monitoring-summary.js.map +1 -0
  98. package/dist-client/viewparts/pending-q-monitor.d.ts +18 -0
  99. package/dist-client/viewparts/pending-q-monitor.js +248 -0
  100. package/dist-client/viewparts/pending-q-monitor.js.map +1 -0
  101. package/dist-client/viewparts/scenario-instance-log-view.d.ts +24 -0
  102. package/dist-client/viewparts/scenario-instance-log-view.js +141 -0
  103. package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -0
  104. package/dist-client/viewparts/scenario-instance-monitor.d.ts +15 -0
  105. package/dist-client/viewparts/scenario-instance-monitor.js +173 -0
  106. package/dist-client/viewparts/scenario-instance-monitor.js.map +1 -0
  107. package/dist-client/viewparts/scenario-instance-view.d.ts +29 -0
  108. package/dist-client/viewparts/scenario-instance-view.js +263 -0
  109. package/dist-client/viewparts/scenario-instance-view.js.map +1 -0
  110. package/dist-client/viewparts/scenario-monitor.d.ts +16 -0
  111. package/dist-client/viewparts/scenario-monitor.js +285 -0
  112. package/dist-client/viewparts/scenario-monitor.js.map +1 -0
  113. package/dist-client/viewparts/scenarios-monitor.d.ts +16 -0
  114. package/dist-client/viewparts/scenarios-monitor.js +170 -0
  115. package/dist-client/viewparts/scenarios-monitor.js.map +1 -0
  116. package/dist-server/index.d.ts +0 -0
  117. package/dist-server/index.js +1 -0
  118. package/dist-server/index.js.map +1 -0
  119. package/dist-server/tsconfig.tsbuildinfo +1 -0
  120. package/package.json +6 -6
@@ -0,0 +1,238 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '../analysis/graph-viewer.js';
3
+ import gql from 'graphql-tag';
4
+ import { css, html, nothing } from 'lit';
5
+ import { customElement, query, state } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import { i18next, localize } from '@operato/i18n';
8
+ import { PageView } from '@operato/shell';
9
+ import { ScrollbarStyles } from '@operato/styles';
10
+ import { GraphViewer } from '../analysis/graph-viewer.js';
11
+ import { GraphViewerStyles } from '../analysis/graph-viewer-style';
12
+ let IntegrationAnalysis = class IntegrationAnalysis extends localize(i18next)(PageView) {
13
+ get context() {
14
+ return {
15
+ title: i18next.t('text.integration analysis'),
16
+ search: {
17
+ handler: search => this.onSearch(search)
18
+ },
19
+ help: 'integration/ui/integration-analysis'
20
+ };
21
+ }
22
+ render() {
23
+ const info = this.info;
24
+ return html `
25
+ <div
26
+ graph-container
27
+ @node-mouseenter=${(e) => console.log(e.detail)}
28
+ @node-mouseleave=${(e) => console.log(e.detail)}
29
+ ></div>
30
+ <div class="graph-info">
31
+ ${info
32
+ ? html `<a href="#" class="${info.cls}" node-info><strong>${info.property}</strong>${info.value}</a>`
33
+ : nothing}
34
+ </div>
35
+ `;
36
+ }
37
+ updated(changes) {
38
+ if (changes.has('analysis')) {
39
+ if (!this.graphViewer) {
40
+ this.graphViewer = new GraphViewer(this.container, {
41
+ highlight: [
42
+ {
43
+ class: 'Connection',
44
+ property: 'missing',
45
+ value: true
46
+ },
47
+ {
48
+ class: 'Scenario',
49
+ property: 'missing',
50
+ value: true
51
+ },
52
+ {
53
+ class: 'Tag',
54
+ property: 'missing',
55
+ value: true
56
+ }
57
+ ],
58
+ minCollision: 60,
59
+ graphData: {
60
+ results: [
61
+ {
62
+ columns: [],
63
+ data: [
64
+ {
65
+ graph: this.analysis
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ errors: []
71
+ },
72
+ nodeRadius: 25,
73
+ onNodeDoubleClick: node => {
74
+ switch (node.id) {
75
+ case '25':
76
+ // Google
77
+ window.open(node.properties.url, '_blank');
78
+ break;
79
+ default:
80
+ break;
81
+ }
82
+ },
83
+ zoomFit: true
84
+ });
85
+ }
86
+ else {
87
+ this.graphViewer.updateWithGraphData({
88
+ results: [{ columns: [], data: [{ graph: this.analysis }] }],
89
+ errors: []
90
+ });
91
+ }
92
+ }
93
+ if (changes.has('info') && this.info) {
94
+ }
95
+ }
96
+ async pageUpdated(changes) {
97
+ var _a, _b;
98
+ if ('active' in changes) {
99
+ if (this.active) {
100
+ await this.fetchIntegrationAnalysis();
101
+ (_a = this.graphViewer) === null || _a === void 0 ? void 0 : _a.simulation.restart();
102
+ }
103
+ else {
104
+ (_b = this.graphViewer) === null || _b === void 0 ? void 0 : _b.simulation.stop();
105
+ }
106
+ }
107
+ }
108
+ async fetchIntegrationAnalysis() {
109
+ const response = await client.query({
110
+ query: gql `
111
+ query {
112
+ integrationAnalysis
113
+ }
114
+ `
115
+ });
116
+ this.analysis = response.data.integrationAnalysis;
117
+ }
118
+ async onSearch(search) {
119
+ if (!this.graphViewer) {
120
+ return;
121
+ }
122
+ if (!search) {
123
+ this.graphViewer.updateWithGraphData({
124
+ results: [{ columns: [], data: [{ graph: this.analysis }] }],
125
+ errors: []
126
+ });
127
+ return;
128
+ }
129
+ const { nodes = [], relationships = [] } = this.analysis || {};
130
+ // 검색어와 일치하는 노드를 필터링
131
+ const matchingNodes = nodes.filter(node => {
132
+ return node.properties.name && node.properties.name.toLowerCase().includes(search.toLowerCase());
133
+ });
134
+ if (matchingNodes.length === 0) {
135
+ this.graphViewer.updateWithGraphData({
136
+ results: [{ columns: [], data: [{ graph: { nodes: [], relationships: [] } }] }],
137
+ errors: []
138
+ });
139
+ return;
140
+ }
141
+ // 1차로 연결된 노드와 관계를 찾기 위해 관련된 노드 ID를 추적
142
+ const relatedNodeIds = new Set();
143
+ const filteredNodes = [];
144
+ const filteredRelationships = [];
145
+ matchingNodes.forEach(node => {
146
+ relatedNodeIds.add(node.id);
147
+ filteredNodes.push(node);
148
+ relationships.forEach(relationship => {
149
+ const { source, target } = relationship || {};
150
+ if (source.id === node.id || target.id === node.id) {
151
+ relatedNodeIds.add(source.id);
152
+ relatedNodeIds.add(target.id);
153
+ filteredRelationships.push(relationship);
154
+ }
155
+ });
156
+ });
157
+ // 관련된 노드 추가
158
+ relatedNodeIds.forEach(nodeId => {
159
+ const node = nodes.find(n => n.id === nodeId);
160
+ if (node) {
161
+ filteredNodes.push(node);
162
+ }
163
+ });
164
+ // 새로운 GraphData 구성
165
+ const filteredGraphData = {
166
+ results: [
167
+ {
168
+ columns: [],
169
+ data: [
170
+ {
171
+ graph: {
172
+ nodes: filteredNodes,
173
+ relationships: filteredRelationships
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ ],
179
+ errors: []
180
+ };
181
+ // GraphViewer 업데이트
182
+ this.graphViewer.updateWithGraphData(filteredGraphData);
183
+ }
184
+ };
185
+ IntegrationAnalysis.styles = [
186
+ GraphViewerStyles,
187
+ ScrollbarStyles,
188
+ css `
189
+ :host {
190
+ position: relative;
191
+
192
+ display: flex;
193
+ flex-direction: column;
194
+
195
+ overflow: hidden;
196
+ background-color: var(--md-sys-color-background);
197
+ padding: 0;
198
+ }
199
+
200
+ [graph-container] {
201
+ flex: 1;
202
+ margin: 0;
203
+ padding: 0;
204
+ }
205
+
206
+ .graph-info {
207
+ position: absolute;
208
+ top: 10px;
209
+ left: 10px;
210
+ opacity: 0.8;
211
+ }
212
+ `
213
+ ];
214
+ __decorate([
215
+ state(),
216
+ __metadata("design:type", GraphViewer)
217
+ ], IntegrationAnalysis.prototype, "graphViewer", void 0);
218
+ __decorate([
219
+ state(),
220
+ __metadata("design:type", Object)
221
+ ], IntegrationAnalysis.prototype, "analysis", void 0);
222
+ __decorate([
223
+ state(),
224
+ __metadata("design:type", Object)
225
+ ], IntegrationAnalysis.prototype, "info", void 0);
226
+ __decorate([
227
+ query('[graph-container]'),
228
+ __metadata("design:type", HTMLDivElement)
229
+ ], IntegrationAnalysis.prototype, "container", void 0);
230
+ __decorate([
231
+ query('[node-info]'),
232
+ __metadata("design:type", HTMLAnchorElement)
233
+ ], IntegrationAnalysis.prototype, "nodeInfo", void 0);
234
+ IntegrationAnalysis = __decorate([
235
+ customElement('integration-analysis')
236
+ ], IntegrationAnalysis);
237
+ export { IntegrationAnalysis };
238
+ //# sourceMappingURL=integration-analysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-analysis.js","sourceRoot":"","sources":["../../client/pages/integration-analysis.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAA;AAEpC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,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GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAA;YAC7C,IAAI,IAAI,EAAE,CAAC;gBACT,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,mBAAmB;QACnB,MAAM,iBAAiB,GAAc;YACnC,OAAO,EAAE;gBACP;oBACE,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE;wBACJ;4BACE,KAAK,EAAE;gCACL,KAAK,EAAE,aAAa;gCACpB,aAAa,EAAE,qBAAqB;6BACrC;yBACF;qBACF;iBACF;aACF;YACD,MAAM,EAAE,EAAE;SACX,CAAA;QAED,mBAAmB;QACnB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAA;IACzD,CAAC;;AA9NM,0BAAM,GAAG;IACd,iBAAiB;IACjB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;KAwBF;CACF,AA5BY,CA4BZ;AAEgB;IAAhB,KAAK,EAAE;8BAAuB,WAAW;wDAAA;AACzB;IAAhB,KAAK,EAAE;;qDAAoE;AAC3D;IAAhB,KAAK,EAAE;;iDAAuE;AAEnD;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8BAAa,cAAc;sDAAA;AAChC;IAArB,KAAK,CAAC,aAAa,CAAC;8BAAY,iBAAiB;qDAAA;AApCvC,mBAAmB;IAD/B,aAAa,CAAC,sBAAsB,CAAC;GACzB,mBAAmB,CAgO/B","sourcesContent":["import '../analysis/graph-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { GraphData, Node, Relationship } from '../analysis/graph-data.js'\nimport { GraphViewer } from '../analysis/graph-viewer.js'\nimport { GraphViewerStyles } from '../analysis/graph-viewer-style'\n\n@customElement('integration-analysis')\nexport class IntegrationAnalysis extends localize(i18next)(PageView) {\n static styles = [\n GraphViewerStyles,\n ScrollbarStyles,\n css`\n :host {\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n background-color: var(--md-sys-color-background);\n padding: 0;\n }\n\n [graph-container] {\n flex: 1;\n margin: 0;\n padding: 0;\n }\n\n .graph-info {\n position: absolute;\n top: 10px;\n left: 10px;\n opacity: 0.8;\n }\n `\n ]\n\n @state() private graphViewer?: GraphViewer\n @state() private analysis?: { nodes: Node[]; relationships: Relationship[] }\n @state() private info?: { cls: string; property: string; value: string } | null\n\n @query('[graph-container]') container!: HTMLDivElement\n @query('[node-info]') nodeInfo!: HTMLAnchorElement\n\n get context() {\n return {\n title: i18next.t('text.integration analysis'),\n search: {\n handler: search => this.onSearch(search)\n },\n help: 'integration/ui/integration-analysis'\n }\n }\n\n render() {\n const info = this.info\n\n return html`\n <div\n graph-container\n @node-mouseenter=${(e: CustomEvent) => console.log(e.detail)}\n @node-mouseleave=${(e: CustomEvent) => console.log(e.detail)}\n ></div>\n <div class=\"graph-info\">\n ${info\n ? html`<a href=\"#\" class=\"${info.cls}\" node-info><strong>${info.property}</strong>${info.value}</a>`\n : nothing}\n </div>\n `\n }\n\n updated(changes) {\n if (changes.has('analysis')) {\n if (!this.graphViewer) {\n this.graphViewer = new GraphViewer(this.container, {\n highlight: [\n {\n class: 'Connection',\n property: 'missing',\n value: true\n },\n {\n class: 'Scenario',\n property: 'missing',\n value: true\n },\n {\n class: 'Tag',\n property: 'missing',\n value: true\n }\n ],\n minCollision: 60,\n graphData: {\n results: [\n {\n columns: [],\n data: [\n {\n graph: this.analysis\n }\n ]\n }\n ],\n errors: []\n },\n nodeRadius: 25,\n onNodeDoubleClick: node => {\n switch (node.id) {\n case '25':\n // Google\n window.open(node.properties.url, '_blank')\n break\n default:\n break\n }\n },\n zoomFit: true\n })\n } else {\n this.graphViewer.updateWithGraphData({\n results: [{ columns: [], data: [{ graph: this.analysis! }] }],\n errors: []\n })\n }\n }\n\n if (changes.has('info') && this.info) {\n }\n }\n\n async pageUpdated(changes) {\n if ('active' in changes) {\n if (this.active) {\n await this.fetchIntegrationAnalysis()\n this.graphViewer?.simulation.restart()\n } else {\n this.graphViewer?.simulation.stop()\n }\n }\n }\n\n async fetchIntegrationAnalysis() {\n const response = await client.query({\n query: gql`\n query {\n integrationAnalysis\n }\n `\n })\n\n this.analysis = response.data.integrationAnalysis\n }\n\n async onSearch(search: string) {\n if (!this.graphViewer) {\n return\n }\n\n if (!search) {\n this.graphViewer.updateWithGraphData({\n results: [{ columns: [], data: [{ graph: this.analysis! }] }],\n errors: []\n })\n return\n }\n\n const { nodes = [], relationships = [] } = this.analysis || {}\n\n // 검색어와 일치하는 노드를 필터링\n const matchingNodes = nodes.filter(node => {\n return node.properties.name && node.properties.name.toLowerCase().includes(search.toLowerCase())\n })\n\n if (matchingNodes.length === 0) {\n this.graphViewer.updateWithGraphData({\n results: [{ columns: [], data: [{ graph: { nodes: [], relationships: [] } }] }],\n errors: []\n })\n return\n }\n\n // 1차로 연결된 노드와 관계를 찾기 위해 관련된 노드 ID를 추적\n const relatedNodeIds = new Set<string>()\n const filteredNodes = [] as Node[]\n const filteredRelationships = [] as Relationship[]\n\n matchingNodes.forEach(node => {\n relatedNodeIds.add(node.id)\n filteredNodes.push(node)\n\n relationships.forEach(relationship => {\n const { source, target } = relationship || {}\n if (source!.id === node.id || target!.id === node.id) {\n relatedNodeIds.add(source!.id)\n relatedNodeIds.add(target!.id)\n filteredRelationships.push(relationship!)\n }\n })\n })\n\n // 관련된 노드 추가\n relatedNodeIds.forEach(nodeId => {\n const node = nodes.find(n => n.id === nodeId)\n if (node) {\n filteredNodes.push(node)\n }\n })\n\n // 새로운 GraphData 구성\n const filteredGraphData: GraphData = {\n results: [\n {\n columns: [],\n data: [\n {\n graph: {\n nodes: filteredNodes,\n relationships: filteredRelationships\n }\n }\n ]\n }\n ],\n errors: []\n }\n\n // GraphViewer 업데이트\n this.graphViewer.updateWithGraphData(filteredGraphData)\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import '../viewparts/monitoring-summary.js';
2
+ import '../viewparts/pending-q-monitor.js';
3
+ import '../viewparts/scenarios-monitor.js';
4
+ import '../viewparts/connections-monitor.js';
5
+ import { PageView } from '@operato/shell';
6
+ declare const IntegrationMonitor_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
7
+ export declare class IntegrationMonitor extends IntegrationMonitor_base {
8
+ static ScenarioInstanceStatus: string[];
9
+ static styles: import("lit").CSSResult[];
10
+ scenarios: any;
11
+ pendings: any;
12
+ connections: any;
13
+ colorIndex: any;
14
+ scenarioInstanceStateSubscription: any;
15
+ scenarioQueueStateSubscription: any;
16
+ connectionStateSubscription: any;
17
+ get context(): {
18
+ title: string;
19
+ help: string;
20
+ };
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ pageUpdated(changes: any): Promise<void>;
23
+ fetchScenarios(): Promise<void>;
24
+ fetchConnections(): Promise<void>;
25
+ startSubscribe(): Promise<void>;
26
+ stopSubscribe(): Promise<void>;
27
+ }
28
+ export {};
@@ -0,0 +1,343 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '../viewparts/monitoring-summary.js';
3
+ import '../viewparts/pending-q-monitor.js';
4
+ import '../viewparts/scenarios-monitor.js';
5
+ import '../viewparts/connections-monitor.js';
6
+ import gql from 'graphql-tag';
7
+ import { css, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { client, subscribe } from '@operato/graphql';
10
+ import { i18next, localize } from '@operato/i18n';
11
+ import { PageView, InheritedValueType } from '@operato/shell';
12
+ import { ScrollbarStyles } from '@operato/styles';
13
+ function IS_SCENARIO_RUNNING(state) {
14
+ return state && state !== 'UNLOADED';
15
+ }
16
+ function toColor(string) {
17
+ var hash = 0;
18
+ if (string.length === 0)
19
+ return hash;
20
+ for (var i = 0; i < string.length; i++) {
21
+ hash = string.charCodeAt(i) + ((hash << 5) - hash);
22
+ hash = hash & hash;
23
+ }
24
+ var color = '#';
25
+ for (var i = 0; i < 3; i++) {
26
+ var value = (hash >> (i * 8)) & 255;
27
+ color += ('00' + value.toString(16)).substr(-2);
28
+ }
29
+ return color;
30
+ }
31
+ let IntegrationMonitor = class IntegrationMonitor extends localize(i18next)(PageView) {
32
+ get context() {
33
+ return {
34
+ title: i18next.t('text.integration monitor'),
35
+ help: 'integration/ui/integration-monitor'
36
+ };
37
+ }
38
+ render() {
39
+ return html `
40
+ <integration-summary
41
+ .pendings=${this.pendings}
42
+ .scenarios=${this.scenarios}
43
+ .connections=${this.connections}
44
+ ></integration-summary>
45
+ <content>
46
+ <scenarios-monitor
47
+ .scenarios=${this.scenarios}
48
+ .pendings=${this.pendings}
49
+ .colorIndex=${this.colorIndex || {}}
50
+ .running=${!!this.active}
51
+ ></scenarios-monitor>
52
+ <connections-monitor .connections=${this.connections}></connections-monitor>
53
+ </content>
54
+ `;
55
+ }
56
+ async pageUpdated(changes) {
57
+ if ('active' in changes) {
58
+ if (this.active) {
59
+ await this.fetchScenarios();
60
+ await this.fetchConnections();
61
+ await this.startSubscribe();
62
+ }
63
+ else {
64
+ await this.stopSubscribe();
65
+ }
66
+ }
67
+ }
68
+ async fetchScenarios() {
69
+ const response = await client.query({
70
+ query: gql `
71
+ query ($inherited: InheritedValueType) {
72
+ responses: scenarios(inherited: $inherited) {
73
+ items {
74
+ id
75
+ name
76
+ description
77
+ active
78
+ state
79
+ schedule
80
+ timezone
81
+ instances {
82
+ instanceName
83
+ scenarioName
84
+ state
85
+ progress {
86
+ rate
87
+ steps
88
+ step
89
+ rounds
90
+ }
91
+ variables
92
+ data
93
+ message
94
+ }
95
+ updater {
96
+ id
97
+ name
98
+ }
99
+ updatedAt
100
+ }
101
+ total
102
+ }
103
+ }
104
+ `,
105
+ variables: {
106
+ inherited: InheritedValueType.Include
107
+ }
108
+ });
109
+ var colorIndex = {};
110
+ this.scenarios = (response.data.responses.items || []).map(scenario => {
111
+ var color = toColor(scenario.id);
112
+ colorIndex[scenario.id] = color;
113
+ return Object.assign(Object.assign({}, scenario), { color });
114
+ });
115
+ this.colorIndex = colorIndex;
116
+ }
117
+ async fetchConnections() {
118
+ const response = await client.query({
119
+ query: gql `
120
+ query {
121
+ responses: connections {
122
+ items {
123
+ id
124
+ name
125
+ description
126
+ type
127
+ state
128
+ }
129
+ total
130
+ }
131
+ }
132
+ `
133
+ });
134
+ this.connections = response.data.responses.items || [];
135
+ // .map(connection => {
136
+ // var color = toColor(scenario.id)
137
+ // colorIndex[scenario.id] = color
138
+ // return {
139
+ // ...scenario,
140
+ // color
141
+ // }
142
+ // })
143
+ // this.colorIndex = colorIndex
144
+ }
145
+ async startSubscribe() {
146
+ if (this.scenarioInstanceStateSubscription) {
147
+ return;
148
+ }
149
+ this.scenarioInstanceStateSubscription = await subscribe({
150
+ query: gql `
151
+ subscription {
152
+ scenarioInstanceState {
153
+ instanceName
154
+ scenarioName
155
+ state
156
+ progress {
157
+ rate
158
+ steps
159
+ step
160
+ rounds
161
+ }
162
+ }
163
+ }
164
+ `
165
+ }, {
166
+ next: async ({ data }) => {
167
+ if (data) {
168
+ var { scenarioName, instanceName, state } = data.scenarioInstanceState;
169
+ this.scenarios = this.scenarios || [];
170
+ var scenario = this.scenarios.find(scenario => scenario.name === scenarioName);
171
+ if (scenario) {
172
+ var idx = scenario.instances.findIndex(instance => instance.instanceName === instanceName);
173
+ if (idx == -1) {
174
+ if (IS_SCENARIO_RUNNING(state)) {
175
+ scenario.instances.push(data.scenarioInstanceState);
176
+ }
177
+ }
178
+ else {
179
+ if (!IS_SCENARIO_RUNNING(state)) {
180
+ scenario.instances.splice(idx, 1);
181
+ }
182
+ else {
183
+ scenario.instances.splice(idx, 1, data.scenarioInstanceState);
184
+ }
185
+ }
186
+ }
187
+ else {
188
+ this.scenarios = [];
189
+ await this.stopSubscribe();
190
+ await this.fetchScenarios();
191
+ await this.startSubscribe();
192
+ return;
193
+ }
194
+ /* change object intentionally to force to refresh scenario */
195
+ this.scenarios.splice(this.scenarios.indexOf(scenario), 1, Object.assign({}, scenario));
196
+ this.scenarios = [...this.scenarios];
197
+ }
198
+ },
199
+ start: subscription => {
200
+ console.log(subscription);
201
+ },
202
+ error: error => {
203
+ console.log(error);
204
+ },
205
+ complete: () => {
206
+ console.log('complete');
207
+ }
208
+ });
209
+ this.scenarioQueueStateSubscription = await subscribe({
210
+ query: gql `
211
+ subscription {
212
+ scenarioQueueState {
213
+ queue {
214
+ stuff
215
+ due
216
+ priority
217
+ tag
218
+ }
219
+ }
220
+ }
221
+ `
222
+ }, {
223
+ next: ({ data }) => {
224
+ if (data) {
225
+ this.pendings = data.scenarioQueueState.queue;
226
+ }
227
+ }
228
+ });
229
+ this.connectionStateSubscription = await subscribe({
230
+ query: gql `
231
+ subscription {
232
+ connectionState {
233
+ id
234
+ name
235
+ description
236
+ type
237
+ state
238
+ }
239
+ }
240
+ `
241
+ }, {
242
+ next: async ({ data }) => {
243
+ if (data) {
244
+ var state = data.connectionState;
245
+ this.connections = this.connections || [];
246
+ var idx = this.connections.findIndex(connection => connection.id === state.id);
247
+ if (idx !== -1) {
248
+ this.connections[idx] = data.connectionState;
249
+ this.connections = [...this.connections];
250
+ }
251
+ else {
252
+ this.connections = [...this.connections, data.connectionState];
253
+ }
254
+ }
255
+ }
256
+ });
257
+ }
258
+ async stopSubscribe() {
259
+ var _a, _b, _c;
260
+ await ((_a = this.scenarioInstanceStateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe());
261
+ await ((_b = this.scenarioQueueStateSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe());
262
+ await ((_c = this.connectionStateSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe());
263
+ delete this.scenarioInstanceStateSubscription;
264
+ delete this.scenarioQueueStateSubscription;
265
+ delete this.connectionStateSubscription;
266
+ }
267
+ };
268
+ IntegrationMonitor.ScenarioInstanceStatus = ['READY', 'STARTED', 'STOPPED', 'HALTED'];
269
+ IntegrationMonitor.styles = [
270
+ ScrollbarStyles,
271
+ css `
272
+ :host {
273
+ display: flex;
274
+ flex-direction: column;
275
+
276
+ overflow: hidden;
277
+ background-color: var(--md-sys-color-background);
278
+ padding: var(--spacing-large);
279
+ }
280
+
281
+ integration-summary {
282
+ margin-bottom: var(--spacing-large);
283
+ }
284
+
285
+ content {
286
+ flex: 1;
287
+ display: flex;
288
+ flex-direction: row;
289
+
290
+ overflow: hidden;
291
+ }
292
+
293
+ connections-monitor {
294
+ width: 180px;
295
+ }
296
+
297
+ scenarios-monitor {
298
+ flex: 1;
299
+ margin: 0 var(--spacing-large) 0 0;
300
+ }
301
+
302
+ @media screen and (max-width: 480px) {
303
+ :host {
304
+ padding: var(--spacing-medium);
305
+ }
306
+ integration-summary {
307
+ margin-bottom: var(--spacing-medium);
308
+ }
309
+ content {
310
+ display: block;
311
+ overflow: auto;
312
+ }
313
+ scenarios-monitor {
314
+ min-height: 350px;
315
+ margin: 0 0 var(--spacing-medium) 0;
316
+ }
317
+ connections-monitor {
318
+ width: initial;
319
+ }
320
+ }
321
+ `
322
+ ];
323
+ __decorate([
324
+ property({ type: Array }),
325
+ __metadata("design:type", Object)
326
+ ], IntegrationMonitor.prototype, "scenarios", void 0);
327
+ __decorate([
328
+ property({ type: Array }),
329
+ __metadata("design:type", Object)
330
+ ], IntegrationMonitor.prototype, "pendings", void 0);
331
+ __decorate([
332
+ property({ type: Array }),
333
+ __metadata("design:type", Object)
334
+ ], IntegrationMonitor.prototype, "connections", void 0);
335
+ __decorate([
336
+ property({ type: Object }),
337
+ __metadata("design:type", Object)
338
+ ], IntegrationMonitor.prototype, "colorIndex", void 0);
339
+ IntegrationMonitor = __decorate([
340
+ customElement('integration-monitor')
341
+ ], IntegrationMonitor);
342
+ export { IntegrationMonitor };
343
+ //# sourceMappingURL=integration-monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":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,EAAE,CAAC;;sDAAgB;AA7DhC,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CAyU9B","sourcesContent":["import '../viewparts/monitoring-summary.js'\nimport '../viewparts/pending-q-monitor.js'\nimport '../viewparts/scenarios-monitor.js'\nimport '../viewparts/connections-monitor.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, subscribe } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, InheritedValueType } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nfunction IS_SCENARIO_RUNNING(state) {\n return state && state !== 'UNLOADED'\n}\n\nfunction toColor(string) {\n var hash = 0\n if (string.length === 0) return hash\n for (var i = 0; i < string.length; i++) {\n hash = string.charCodeAt(i) + ((hash << 5) - hash)\n hash = hash & hash\n }\n var color = '#'\n for (var i = 0; i < 3; i++) {\n var value = (hash >> (i * 8)) & 255\n color += ('00' + value.toString(16)).substr(-2)\n }\n return color\n}\n\n@customElement('integration-monitor')\nexport class IntegrationMonitor extends localize(i18next)(PageView) {\n static ScenarioInstanceStatus = ['READY', 'STARTED', 'STOPPED', 'HALTED']\n\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n }\n\n integration-summary {\n margin-bottom: var(--spacing-large);\n }\n\n content {\n flex: 1;\n display: flex;\n flex-direction: row;\n\n overflow: hidden;\n }\n\n connections-monitor {\n width: 180px;\n }\n\n scenarios-monitor {\n flex: 1;\n margin: 0 var(--spacing-large) 0 0;\n }\n\n @media screen and (max-width: 480px) {\n :host {\n padding: var(--spacing-medium);\n }\n integration-summary {\n margin-bottom: var(--spacing-medium);\n }\n content {\n display: block;\n overflow: auto;\n }\n scenarios-monitor {\n min-height: 350px;\n margin: 0 0 var(--spacing-medium) 0;\n }\n connections-monitor {\n width: initial;\n }\n }\n `\n ]\n\n @property({ type: Array }) scenarios: any\n @property({ type: Array }) pendings: any\n @property({ type: Array }) connections: any\n @property({ type: Object }) colorIndex: any\n\n scenarioInstanceStateSubscription: any\n scenarioQueueStateSubscription: any\n connectionStateSubscription: any\n\n get context() {\n return {\n title: i18next.t('text.integration monitor'),\n help: 'integration/ui/integration-monitor'\n }\n }\n\n render() {\n return html`\n <integration-summary\n .pendings=${this.pendings}\n .scenarios=${this.scenarios}\n .connections=${this.connections}\n ></integration-summary>\n <content>\n <scenarios-monitor\n .scenarios=${this.scenarios}\n .pendings=${this.pendings}\n .colorIndex=${this.colorIndex || {}}\n .running=${!!this.active}\n ></scenarios-monitor>\n <connections-monitor .connections=${this.connections}></connections-monitor>\n </content>\n `\n }\n\n async pageUpdated(changes) {\n if ('active' in changes) {\n if (this.active) {\n await this.fetchScenarios()\n await this.fetchConnections()\n await this.startSubscribe()\n } else {\n await this.stopSubscribe()\n }\n }\n }\n\n async fetchScenarios() {\n const response = await client.query({\n query: gql`\n query ($inherited: InheritedValueType) {\n responses: scenarios(inherited: $inherited) {\n items {\n id\n name\n description\n active\n state\n schedule\n timezone\n instances {\n instanceName\n scenarioName\n state\n progress {\n rate\n steps\n step\n rounds\n }\n variables\n data\n message\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n inherited: InheritedValueType.Include\n }\n })\n\n var colorIndex = {}\n this.scenarios = (response.data.responses.items || []).map(scenario => {\n var color = toColor(scenario.id)\n colorIndex[scenario.id] = color\n\n return {\n ...scenario,\n color\n }\n })\n this.colorIndex = colorIndex\n }\n\n async fetchConnections() {\n const response = await client.query({\n query: gql`\n query {\n responses: connections {\n items {\n id\n name\n description\n type\n state\n }\n total\n }\n }\n `\n })\n\n this.connections = response.data.responses.items || []\n // .map(connection => {\n // var color = toColor(scenario.id)\n // colorIndex[scenario.id] = color\n\n // return {\n // ...scenario,\n // color\n // }\n // })\n // this.colorIndex = colorIndex\n }\n\n async startSubscribe() {\n if (this.scenarioInstanceStateSubscription) {\n return\n }\n\n this.scenarioInstanceStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n scenarioInstanceState {\n instanceName\n scenarioName\n state\n progress {\n rate\n steps\n step\n rounds\n }\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n var { scenarioName, instanceName, state } = data.scenarioInstanceState\n\n this.scenarios = this.scenarios || []\n var scenario = this.scenarios.find(scenario => scenario.name === scenarioName)\n\n if (scenario) {\n var idx = scenario.instances.findIndex(instance => instance.instanceName === instanceName)\n if (idx == -1) {\n if (IS_SCENARIO_RUNNING(state)) {\n scenario.instances.push(data.scenarioInstanceState)\n }\n } else {\n if (!IS_SCENARIO_RUNNING(state)) {\n scenario.instances.splice(idx, 1)\n } else {\n scenario.instances.splice(idx, 1, data.scenarioInstanceState)\n }\n }\n } else {\n this.scenarios = []\n\n await this.stopSubscribe()\n await this.fetchScenarios()\n await this.startSubscribe()\n\n return\n }\n\n /* change object intentionally to force to refresh scenario */\n this.scenarios.splice(this.scenarios.indexOf(scenario), 1, { ...scenario })\n this.scenarios = [...this.scenarios]\n }\n },\n start: subscription => {\n console.log(subscription)\n },\n error: error => {\n console.log(error)\n },\n complete: () => {\n console.log('complete')\n }\n }\n )\n\n this.scenarioQueueStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n scenarioQueueState {\n queue {\n stuff\n due\n priority\n tag\n }\n }\n }\n `\n },\n {\n next: ({ data }) => {\n if (data) {\n this.pendings = data.scenarioQueueState.queue\n }\n }\n }\n )\n\n this.connectionStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n connectionState {\n id\n name\n description\n type\n state\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n var state = data.connectionState\n\n this.connections = this.connections || []\n var idx = this.connections.findIndex(connection => connection.id === state.id)\n\n if (idx !== -1) {\n this.connections[idx] = data.connectionState\n this.connections = [...this.connections]\n } else {\n this.connections = [...this.connections, data.connectionState]\n }\n }\n }\n }\n )\n }\n\n async stopSubscribe() {\n await this.scenarioInstanceStateSubscription?.unsubscribe()\n await this.scenarioQueueStateSubscription?.unsubscribe()\n await this.connectionStateSubscription?.unsubscribe()\n\n delete this.scenarioInstanceStateSubscription\n delete this.scenarioQueueStateSubscription\n delete this.connectionStateSubscription\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@operato/data-grist/ox-grist.js';