@things-factory/integration-ui 6.1.101 → 6.1.104

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.
@@ -0,0 +1,148 @@
1
+ import '../analysis/graph-viewer'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html } from 'lit'
5
+ import { customElement, query, state } from 'lit/decorators.js'
6
+
7
+ import { client } from '@operato/graphql'
8
+ import { i18next, localize } from '@operato/i18n'
9
+ import { PageView } from '@operato/shell'
10
+ import { ScrollbarStyles } from '@operato/styles'
11
+ import { GraphViewer } from '../analysis/graph-viewer'
12
+ import { GraphViewerStyles } from '../analysis/graph-viewer-style'
13
+
14
+ @customElement('integration-analysis')
15
+ export class IntegrationAnalysis extends localize(i18next)(PageView) {
16
+ static styles = [
17
+ GraphViewerStyles,
18
+ ScrollbarStyles,
19
+ css`
20
+ :host {
21
+ display: flex;
22
+ flex-direction: column;
23
+
24
+ overflow: hidden;
25
+ background-color: var(--main-section-background-color);
26
+ padding: 0;
27
+ }
28
+
29
+ [graph-container] {
30
+ flex: 1;
31
+ margin: 0;
32
+ padding: 0;
33
+ }
34
+ `
35
+ ]
36
+
37
+ @state() analysis: any
38
+ @state() graphViewer?: GraphViewer
39
+
40
+ @query('[graph-container]') container!: HTMLDivElement
41
+
42
+ get context() {
43
+ return {
44
+ title: i18next.t('text.integration analysis'),
45
+ help: 'integration/ui/integration-analysis'
46
+ }
47
+ }
48
+
49
+ render() {
50
+ return html`<div graph-container></div>`
51
+ }
52
+
53
+ updated(changes) {
54
+ if (changes.has('analysis')) {
55
+ this.graphViewer = new GraphViewer(this.container, {
56
+ highlight: [
57
+ {
58
+ class: 'Connection',
59
+ property: 'name',
60
+ value: 'corona-api'
61
+ },
62
+ {
63
+ class: 'Scenario',
64
+ property: 'name',
65
+ value: 'monitor-simple'
66
+ },
67
+ {
68
+ class: 'Tag',
69
+ property: 'tag',
70
+ value: 'count'
71
+ }
72
+ ],
73
+ icons: {
74
+ Connection: 'gear',
75
+ Scenario: 'birthday-cake',
76
+ Tag: 'paw'
77
+ },
78
+ // images: {
79
+ // Address: 'img/twemoji/1f3e0.svg',
80
+ // BirthDate: 'img/twemoji/1f5d3.svg',
81
+ // Cookie: 'img/twemoji/1f36a.svg',
82
+ // CreditCard: 'img/twemoji/1f4b3.svg',
83
+ // Device: 'img/twemoji/1f4bb.svg',
84
+ // Email: 'img/twemoji/2709.svg',
85
+ // Git: 'img/twemoji/1f5c3.svg',
86
+ // Github: 'img/twemoji/1f5c4.svg',
87
+ // icons: 'img/twemoji/1f38f.svg',
88
+ // Ip: 'img/twemoji/1f4cd.svg',
89
+ // Issues: 'img/twemoji/1f4a9.svg',
90
+ // Language: 'img/twemoji/1f1f1-1f1f7.svg',
91
+ // Options: 'img/twemoji/2699.svg',
92
+ // Password: 'img/twemoji/1f511.svg',
93
+ // 'Project|name|d3': 'img/twemoji/32-20e3.svg',
94
+ // User: 'img/twemoji/1f600.svg'
95
+ // },
96
+ minCollision: 60,
97
+ graphData: {
98
+ results: [
99
+ {
100
+ columns: ['Connection', 'Scenario', 'Tag'],
101
+ data: [
102
+ {
103
+ graph: this.analysis
104
+ }
105
+ ]
106
+ }
107
+ ],
108
+ errors: []
109
+ },
110
+ nodeRadius: 25,
111
+ onNodeDoubleClick: node => {
112
+ switch (node.id) {
113
+ case '25':
114
+ // Google
115
+ window.open(node.properties.url, '_blank')
116
+ break
117
+ default:
118
+ var maxNodes = 5,
119
+ data = this.graphViewer!.randomD3Data(node, maxNodes)
120
+ this.graphViewer!.updateWithD3Data(data)
121
+ break
122
+ }
123
+ },
124
+ zoomFit: true
125
+ })
126
+ }
127
+ }
128
+
129
+ async pageUpdated(changes) {
130
+ if ('active' in changes) {
131
+ if (this.active) {
132
+ await this.fetchIntegrationAnalysis()
133
+ }
134
+ }
135
+ }
136
+
137
+ async fetchIntegrationAnalysis() {
138
+ const response = await client.query({
139
+ query: gql`
140
+ query {
141
+ integrationAnalysis
142
+ }
143
+ `
144
+ })
145
+
146
+ this.analysis = response.data.integrationAnalysis
147
+ }
148
+ }
package/client/route.ts CHANGED
@@ -11,5 +11,9 @@ export default function route(page) {
11
11
  case 'integration-monitor':
12
12
  import('./pages/integration-monitor')
13
13
  return page
14
+
15
+ case 'integration-analysis':
16
+ import('./pages/integration-analysis')
17
+ return page
14
18
  }
15
19
  }
@@ -0,0 +1 @@
1
+ export declare const GraphViewerStyles: import("lit").CSSResult;
@@ -0,0 +1,117 @@
1
+ import { css } from 'lit';
2
+ export const GraphViewerStyles = css `
3
+ * {
4
+ margin: 0;
5
+ padding: 0;
6
+ }
7
+
8
+ .graph-viewer {
9
+ border: 1px solid #ddd;
10
+ border-radius: 5px;
11
+ }
12
+
13
+ .graph-info {
14
+ font-size: 16px;
15
+ padding: 10px;
16
+ position: absolute;
17
+ }
18
+
19
+ .graph-info a {
20
+ border: 1px solid;
21
+ display: inline-block;
22
+ font-size: 14px;
23
+ line-height: 1.428571429;
24
+ margin-left: 5px;
25
+ margin-top: 5px;
26
+ padding: 6px 12px;
27
+ }
28
+
29
+ .graph-info a.class {
30
+ color: #fff;
31
+ }
32
+
33
+ .graph-info a.property {
34
+ background-color: #fff;
35
+ border-color: #ccc;
36
+ color: #333;
37
+ }
38
+
39
+ .graph-info a.btn {
40
+ margin-left: 5px;
41
+ margin-top: 5px;
42
+ opacity: 1;
43
+ }
44
+
45
+ .graph-info a.info {
46
+ background-color: #a5abb6;
47
+ border: 1px solid #9aa1ac;
48
+ color: #fff;
49
+ }
50
+
51
+ .node.node-highlighted .ring {
52
+ filter: alpha(opacity=50);
53
+ opacity: 0.5;
54
+ stroke: #888;
55
+ stroke-width: 12px;
56
+ }
57
+
58
+ .node .outline {
59
+ cursor: pointer;
60
+ fill: #a5abb6;
61
+ pointer-events: all;
62
+ stroke: #9aa1ac;
63
+ stroke-width: 2px;
64
+ }
65
+
66
+ .node .ring {
67
+ fill: none;
68
+ filter: alpha(opacity=0);
69
+ opacity: 0;
70
+ stroke: #6ac6ff;
71
+ stroke-width: 8px;
72
+ }
73
+
74
+ .node .text.icon {
75
+ font-family: FontAwesome;
76
+ }
77
+
78
+ .node.selected .ring,
79
+ .node:hover .ring {
80
+ filter: alpha(opacity=30);
81
+ opacity: 0.3;
82
+ }
83
+
84
+ .relationship {
85
+ cursor: default;
86
+ }
87
+
88
+ .relationship line {
89
+ stroke: #aaa;
90
+ }
91
+
92
+ .relationship .outline {
93
+ cursor: default;
94
+ }
95
+
96
+ .relationship .overlay {
97
+ cursor: default;
98
+ fill: #6ac6ff;
99
+ filter: alpha(opacity=0);
100
+ opacity: 0;
101
+ }
102
+
103
+ .relationship text {
104
+ cursor: default;
105
+ }
106
+
107
+ .relationship.selected .overlay,
108
+ .relationship:hover .overlay {
109
+ filter: alpha(opacity=30);
110
+ opacity: 0.3;
111
+ }
112
+
113
+ svg {
114
+ cursor: move;
115
+ }
116
+ `;
117
+ //# sourceMappingURL=graph-viewer-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-viewer-style.js","sourceRoot":"","sources":["../../client/analysis/graph-viewer-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHnC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const GraphViewerStyles = css`\n * {\n margin: 0;\n padding: 0;\n }\n\n .graph-viewer {\n border: 1px solid #ddd;\n border-radius: 5px;\n }\n\n .graph-info {\n font-size: 16px;\n padding: 10px;\n position: absolute;\n }\n\n .graph-info a {\n border: 1px solid;\n display: inline-block;\n font-size: 14px;\n line-height: 1.428571429;\n margin-left: 5px;\n margin-top: 5px;\n padding: 6px 12px;\n }\n\n .graph-info a.class {\n color: #fff;\n }\n\n .graph-info a.property {\n background-color: #fff;\n border-color: #ccc;\n color: #333;\n }\n\n .graph-info a.btn {\n margin-left: 5px;\n margin-top: 5px;\n opacity: 1;\n }\n\n .graph-info a.info {\n background-color: #a5abb6;\n border: 1px solid #9aa1ac;\n color: #fff;\n }\n\n .node.node-highlighted .ring {\n filter: alpha(opacity=50);\n opacity: 0.5;\n stroke: #888;\n stroke-width: 12px;\n }\n\n .node .outline {\n cursor: pointer;\n fill: #a5abb6;\n pointer-events: all;\n stroke: #9aa1ac;\n stroke-width: 2px;\n }\n\n .node .ring {\n fill: none;\n filter: alpha(opacity=0);\n opacity: 0;\n stroke: #6ac6ff;\n stroke-width: 8px;\n }\n\n .node .text.icon {\n font-family: FontAwesome;\n }\n\n .node.selected .ring,\n .node:hover .ring {\n filter: alpha(opacity=30);\n opacity: 0.3;\n }\n\n .relationship {\n cursor: default;\n }\n\n .relationship line {\n stroke: #aaa;\n }\n\n .relationship .outline {\n cursor: default;\n }\n\n .relationship .overlay {\n cursor: default;\n fill: #6ac6ff;\n filter: alpha(opacity=0);\n opacity: 0;\n }\n\n .relationship text {\n cursor: default;\n }\n\n .relationship.selected .overlay,\n .relationship:hover .overlay {\n filter: alpha(opacity=30);\n opacity: 0.3;\n }\n\n svg {\n cursor: move;\n }\n`\n"]}