@things-factory/integration-ui 6.1.145 → 6.1.150
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.
- package/client/pages/connection-importer.ts +97 -0
- package/client/pages/connection.ts +59 -32
- package/client/pages/scenario-importer.ts +4 -8
- package/client/pages/scenario.ts +1 -1
- package/dist-client/pages/connection-importer.d.ts +9 -0
- package/dist-client/pages/connection-importer.js +106 -0
- package/dist-client/pages/connection-importer.js.map +1 -0
- package/dist-client/pages/connection.d.ts +10 -0
- package/dist-client/pages/connection.js +52 -25
- package/dist-client/pages/connection.js.map +1 -1
- package/dist-client/pages/scenario-importer.js +4 -8
- package/dist-client/pages/scenario-importer.js.map +1 -1
- package/dist-client/pages/scenario.js +1 -1
- package/dist-client/pages/scenario.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/translations/en.json +2 -1
- package/translations/ja.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +6 -5
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { client } from '@operato/graphql'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { isMobileDevice } from '@operato/utils'
|
|
10
|
+
import { CommonGristStyles } from '@operato/styles'
|
|
11
|
+
|
|
12
|
+
@customElement('connection-importer')
|
|
13
|
+
export class ConnectionImporter extends LitElement {
|
|
14
|
+
static styles = [
|
|
15
|
+
CommonGristStyles,
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
}
|
|
23
|
+
ox-grist {
|
|
24
|
+
flex: 1;
|
|
25
|
+
}
|
|
26
|
+
.button-container {
|
|
27
|
+
display: flex;
|
|
28
|
+
margin-left: auto;
|
|
29
|
+
padding: var(--padding-default);
|
|
30
|
+
}
|
|
31
|
+
mwc-button {
|
|
32
|
+
margin-left: var(--margin-default);
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
@property({ type: Array }) connections: any
|
|
38
|
+
@property({ type: Object }) columns: any = {
|
|
39
|
+
list: { fields: ['name', 'description'] },
|
|
40
|
+
pagination: { infinite: true },
|
|
41
|
+
columns: [
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
name: 'name',
|
|
45
|
+
header: i18next.t('field.name'),
|
|
46
|
+
width: 150
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'string',
|
|
50
|
+
name: 'description',
|
|
51
|
+
header: i18next.t('field.description'),
|
|
52
|
+
width: 200
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'string',
|
|
56
|
+
name: 'type',
|
|
57
|
+
header: i18next.t('field.type'),
|
|
58
|
+
width: 100
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'string',
|
|
62
|
+
name: 'endpoint',
|
|
63
|
+
header: i18next.t('field.endpoint'),
|
|
64
|
+
width: 120
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
render() {
|
|
70
|
+
return html`
|
|
71
|
+
<ox-grist
|
|
72
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
73
|
+
.config=${this.columns}
|
|
74
|
+
.data=${{ records: this.connections }}
|
|
75
|
+
></ox-grist>
|
|
76
|
+
|
|
77
|
+
<div class="button-container">
|
|
78
|
+
<mwc-button raised @click=${this.save.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
|
79
|
+
</div>
|
|
80
|
+
`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async save() {
|
|
84
|
+
const response = await client.mutate({
|
|
85
|
+
mutation: gql`
|
|
86
|
+
mutation importConnections($connections: [ConnectionPatch!]!) {
|
|
87
|
+
importConnections(connections: $connections)
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
variables: { connections: this.connections }
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
if (response.errors?.length) return
|
|
94
|
+
|
|
95
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@operato/data-grist/ox-grist.js'
|
|
2
|
+
import './connection-importer'
|
|
2
3
|
|
|
3
4
|
import gql from 'graphql-tag'
|
|
4
5
|
import { css, html } from 'lit'
|
|
@@ -8,6 +9,7 @@ import { connect } from 'pwa-helpers/connect-mixin'
|
|
|
8
9
|
import { DataGrist } from '@operato/data-grist/ox-grist.js'
|
|
9
10
|
import { client } from '@operato/graphql'
|
|
10
11
|
import { HelpDecoratedRenderer } from '@operato/help/help-decorated-renderer.js'
|
|
12
|
+
import { notify, openPopup } from '@operato/layout'
|
|
11
13
|
import { i18next, localize } from '@operato/i18n'
|
|
12
14
|
import { PageView, store } from '@operato/shell'
|
|
13
15
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
@@ -79,7 +81,14 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
79
81
|
action: this._deleteConnections.bind(this),
|
|
80
82
|
...CommonButtonStyles.delete
|
|
81
83
|
}
|
|
82
|
-
]
|
|
84
|
+
],
|
|
85
|
+
exportable: {
|
|
86
|
+
name: i18next.t('text.connection list'),
|
|
87
|
+
data: this.exportHandler.bind(this)
|
|
88
|
+
},
|
|
89
|
+
importable: {
|
|
90
|
+
handler: this.importHandler.bind(this)
|
|
91
|
+
}
|
|
83
92
|
}
|
|
84
93
|
}
|
|
85
94
|
|
|
@@ -139,14 +148,10 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
139
148
|
validation: function (after, before, record, column) {
|
|
140
149
|
/* connected 상태에서는 이름을 바꿀 수 없다. */
|
|
141
150
|
if (record.state == 'CONNECTED') {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
message: 'connection name cannot be changed during connected.'
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
)
|
|
151
|
+
notify({
|
|
152
|
+
level: 'warn',
|
|
153
|
+
message: 'connection name cannot be changed during connected.'
|
|
154
|
+
})
|
|
150
155
|
return false
|
|
151
156
|
}
|
|
152
157
|
return true
|
|
@@ -345,15 +350,12 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
345
350
|
|
|
346
351
|
if (!response.errors) {
|
|
347
352
|
this.grist.fetch()
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
x: i18next.t('text.delete')
|
|
353
|
-
})
|
|
354
|
-
}
|
|
353
|
+
|
|
354
|
+
notify({
|
|
355
|
+
message: i18next.t('text.info_x_successfully', {
|
|
356
|
+
x: i18next.t('text.delete')
|
|
355
357
|
})
|
|
356
|
-
)
|
|
358
|
+
})
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
361
|
}
|
|
@@ -411,14 +413,10 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
411
413
|
|
|
412
414
|
this.grist.refresh()
|
|
413
415
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
message: `${state == 'CONNECTED' ? 'success' : 'fail'} to connect : ${record.name}`
|
|
419
|
-
}
|
|
420
|
-
})
|
|
421
|
-
)
|
|
416
|
+
notify({
|
|
417
|
+
level: 'info',
|
|
418
|
+
message: `${state == 'CONNECTED' ? 'success' : 'fail'} to connect : ${record.name}`
|
|
419
|
+
})
|
|
422
420
|
}
|
|
423
421
|
|
|
424
422
|
async disconnect(record) {
|
|
@@ -441,13 +439,42 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
441
439
|
|
|
442
440
|
this.grist.refresh()
|
|
443
441
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
442
|
+
notify({
|
|
443
|
+
level: 'info',
|
|
444
|
+
message: `${state == 'CONNECTED' ? 'fail' : 'success'} to disconnect : ${record.name}`
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
async exportHandler() {
|
|
449
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
450
|
+
const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'endpoint', 'params'])
|
|
451
|
+
|
|
452
|
+
return exportTargets.map(connection => {
|
|
453
|
+
let tempObj = {}
|
|
454
|
+
for (const field of targetFieldSet) {
|
|
455
|
+
tempObj[field] = connection[field]
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return tempObj
|
|
459
|
+
})
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
async importHandler(records) {
|
|
463
|
+
openPopup(
|
|
464
|
+
html`
|
|
465
|
+
<connection-importer
|
|
466
|
+
.connections=${records}
|
|
467
|
+
@imported=${() => {
|
|
468
|
+
history.back()
|
|
469
|
+
this.grist.fetch()
|
|
470
|
+
}}
|
|
471
|
+
></connection-importer>
|
|
472
|
+
`,
|
|
473
|
+
{
|
|
474
|
+
backdrop: true,
|
|
475
|
+
size: 'large',
|
|
476
|
+
title: i18next.t('title.import connection')
|
|
477
|
+
}
|
|
451
478
|
)
|
|
452
479
|
}
|
|
453
480
|
}
|
|
@@ -7,10 +7,12 @@ import { customElement, property, query, state } from 'lit/decorators.js'
|
|
|
7
7
|
import { client } from '@operato/graphql'
|
|
8
8
|
import { i18next } from '@operato/i18n'
|
|
9
9
|
import { isMobileDevice } from '@operato/utils'
|
|
10
|
+
import { CommonGristStyles } from '@operato/styles'
|
|
10
11
|
|
|
11
12
|
@customElement('scenario-importer')
|
|
12
13
|
export class ScenarioImporter extends LitElement {
|
|
13
14
|
static styles = [
|
|
15
|
+
CommonGristStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
16
18
|
display: flex;
|
|
@@ -66,12 +68,6 @@ export class ScenarioImporter extends LitElement {
|
|
|
66
68
|
name: 'timezone',
|
|
67
69
|
header: i18next.t('field.timezone'),
|
|
68
70
|
width: 120
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: 'checkbox',
|
|
72
|
-
name: 'active',
|
|
73
|
-
header: i18next.t('field.active'),
|
|
74
|
-
width: 60
|
|
75
71
|
}
|
|
76
72
|
]
|
|
77
73
|
}
|
|
@@ -81,11 +77,11 @@ export class ScenarioImporter extends LitElement {
|
|
|
81
77
|
<ox-grist
|
|
82
78
|
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
83
79
|
.config=${this.columns}
|
|
84
|
-
.data
|
|
80
|
+
.data=${{ records: this.scenarios }}
|
|
85
81
|
></ox-grist>
|
|
86
82
|
|
|
87
83
|
<div class="button-container">
|
|
88
|
-
<mwc-button raised @click
|
|
84
|
+
<mwc-button raised @click=${this.save.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
|
89
85
|
</div>
|
|
90
86
|
`
|
|
91
87
|
}
|
package/client/pages/scenario.ts
CHANGED
|
@@ -582,7 +582,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
582
582
|
|
|
583
583
|
async exportHandler() {
|
|
584
584
|
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
585
|
-
const targetFieldSet = new Set(['id', 'name', 'type', 'description', '
|
|
585
|
+
const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'schedule', 'timezone', 'steps'])
|
|
586
586
|
|
|
587
587
|
return exportTargets.map(scenario => {
|
|
588
588
|
let tempObj = {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
export declare class ConnectionImporter extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
connections: any;
|
|
6
|
+
columns: any;
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
save(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/data-grist';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
import { client } from '@operato/graphql';
|
|
7
|
+
import { i18next } from '@operato/i18n';
|
|
8
|
+
import { isMobileDevice } from '@operato/utils';
|
|
9
|
+
import { CommonGristStyles } from '@operato/styles';
|
|
10
|
+
let ConnectionImporter = class ConnectionImporter extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.columns = {
|
|
14
|
+
list: { fields: ['name', 'description'] },
|
|
15
|
+
pagination: { infinite: true },
|
|
16
|
+
columns: [
|
|
17
|
+
{
|
|
18
|
+
type: 'string',
|
|
19
|
+
name: 'name',
|
|
20
|
+
header: i18next.t('field.name'),
|
|
21
|
+
width: 150
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'string',
|
|
25
|
+
name: 'description',
|
|
26
|
+
header: i18next.t('field.description'),
|
|
27
|
+
width: 200
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'string',
|
|
31
|
+
name: 'type',
|
|
32
|
+
header: i18next.t('field.type'),
|
|
33
|
+
width: 100
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'string',
|
|
37
|
+
name: 'endpoint',
|
|
38
|
+
header: i18next.t('field.endpoint'),
|
|
39
|
+
width: 120
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return html `
|
|
46
|
+
<ox-grist
|
|
47
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
48
|
+
.config=${this.columns}
|
|
49
|
+
.data=${{ records: this.connections }}
|
|
50
|
+
></ox-grist>
|
|
51
|
+
|
|
52
|
+
<div class="button-container">
|
|
53
|
+
<mwc-button raised @click=${this.save.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
async save() {
|
|
58
|
+
var _a;
|
|
59
|
+
const response = await client.mutate({
|
|
60
|
+
mutation: gql `
|
|
61
|
+
mutation importConnections($connections: [ConnectionPatch!]!) {
|
|
62
|
+
importConnections(connections: $connections)
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
variables: { connections: this.connections }
|
|
66
|
+
});
|
|
67
|
+
if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)
|
|
68
|
+
return;
|
|
69
|
+
this.dispatchEvent(new CustomEvent('imported'));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
ConnectionImporter.styles = [
|
|
73
|
+
CommonGristStyles,
|
|
74
|
+
css `
|
|
75
|
+
:host {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
|
|
79
|
+
background-color: #fff;
|
|
80
|
+
}
|
|
81
|
+
ox-grist {
|
|
82
|
+
flex: 1;
|
|
83
|
+
}
|
|
84
|
+
.button-container {
|
|
85
|
+
display: flex;
|
|
86
|
+
margin-left: auto;
|
|
87
|
+
padding: var(--padding-default);
|
|
88
|
+
}
|
|
89
|
+
mwc-button {
|
|
90
|
+
margin-left: var(--margin-default);
|
|
91
|
+
}
|
|
92
|
+
`
|
|
93
|
+
];
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: Array }),
|
|
96
|
+
__metadata("design:type", Object)
|
|
97
|
+
], ConnectionImporter.prototype, "connections", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: Object }),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], ConnectionImporter.prototype, "columns", void 0);
|
|
102
|
+
ConnectionImporter = __decorate([
|
|
103
|
+
customElement('connection-importer')
|
|
104
|
+
], ConnectionImporter);
|
|
105
|
+
export { ConnectionImporter };
|
|
106
|
+
//# sourceMappingURL=connection-importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-importer.js","sourceRoot":"","sources":["../../client/pages/connection-importer.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAG5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAyBuB,YAAO,GAAQ;YACzC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE;YACzC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC9B,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;oBAC/B,KAAK,EAAE,GAAG;iBACX;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,aAAa;oBACnB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC;oBACtC,KAAK,EAAE,GAAG;iBACX;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;oBAC/B,KAAK,EAAE,GAAG;iBACX;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,UAAU;oBAChB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;oBACnC,KAAK,EAAE,GAAG;iBACX;aACF;SACF,CAAA;IA8BH,CAAC;IA5BC,MAAM;QACJ,OAAO,IAAI,CAAA;;gBAEC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;kBAChC,IAAI,CAAC,OAAO;gBACd,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE;;;;oCAIT,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;;KAE/E,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;;QACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SAC7C,CAAC,CAAA;QAEF,IAAI,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM;YAAE,OAAM;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,CAAC;;AAlFM,yBAAM,GAAG;IACd,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;uDAAiB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDA6B1B;AAtDU,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CAoF9B;SApFY,kBAAkB","sourcesContent":["import '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { CommonGristStyles } from '@operato/styles'\n\n@customElement('connection-importer')\nexport class ConnectionImporter extends LitElement {\n static styles = [\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n ox-grist {\n flex: 1;\n }\n .button-container {\n display: flex;\n margin-left: auto;\n padding: var(--padding-default);\n }\n mwc-button {\n margin-left: var(--margin-default);\n }\n `\n ]\n\n @property({ type: Array }) connections: any\n @property({ type: Object }) columns: any = {\n list: { fields: ['name', 'description'] },\n pagination: { infinite: true },\n columns: [\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n width: 200\n },\n {\n type: 'string',\n name: 'type',\n header: i18next.t('field.type'),\n width: 100\n },\n {\n type: 'string',\n name: 'endpoint',\n header: i18next.t('field.endpoint'),\n width: 120\n }\n ]\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{ records: this.connections }}\n ></ox-grist>\n\n <div class=\"button-container\">\n <mwc-button raised @click=${this.save.bind(this)}>${i18next.t('button.save')}</mwc-button>\n </div>\n `\n }\n\n async save() {\n const response = await client.mutate({\n mutation: gql`\n mutation importConnections($connections: [ConnectionPatch!]!) {\n importConnections(connections: $connections)\n }\n `,\n variables: { connections: this.connections }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@operato/data-grist/ox-grist.js';
|
|
2
|
+
import './connection-importer';
|
|
2
3
|
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
3
4
|
import { PageView } from '@operato/shell';
|
|
4
5
|
declare const Connection_base: (new (...args: any[]) => {
|
|
@@ -32,6 +33,13 @@ export declare class Connection extends Connection_base {
|
|
|
32
33
|
title: string;
|
|
33
34
|
action: (name: any) => Promise<void>;
|
|
34
35
|
}[];
|
|
36
|
+
exportable: {
|
|
37
|
+
name: string;
|
|
38
|
+
data: () => Promise<{}[]>;
|
|
39
|
+
};
|
|
40
|
+
importable: {
|
|
41
|
+
handler: (records: any) => Promise<void>;
|
|
42
|
+
};
|
|
35
43
|
};
|
|
36
44
|
render(): import("lit-html").TemplateResult<1>;
|
|
37
45
|
pageInitialized(): Promise<void>;
|
|
@@ -49,5 +57,7 @@ export declare class Connection extends Connection_base {
|
|
|
49
57
|
_updateConnectionManager(): Promise<void>;
|
|
50
58
|
connect(record: any): Promise<void>;
|
|
51
59
|
disconnect(record: any): Promise<void>;
|
|
60
|
+
exportHandler(): Promise<{}[]>;
|
|
61
|
+
importHandler(records: any): Promise<void>;
|
|
52
62
|
}
|
|
53
63
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist/ox-grist.js';
|
|
3
|
+
import './connection-importer';
|
|
3
4
|
import gql from 'graphql-tag';
|
|
4
5
|
import { css, html } from 'lit';
|
|
5
6
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
@@ -7,6 +8,7 @@ import { connect } from 'pwa-helpers/connect-mixin';
|
|
|
7
8
|
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
8
9
|
import { client } from '@operato/graphql';
|
|
9
10
|
import { HelpDecoratedRenderer } from '@operato/help/help-decorated-renderer.js';
|
|
11
|
+
import { notify, openPopup } from '@operato/layout';
|
|
10
12
|
import { i18next, localize } from '@operato/i18n';
|
|
11
13
|
import { PageView, store } from '@operato/shell';
|
|
12
14
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
@@ -37,7 +39,14 @@ let Connection = class Connection extends connect(store)(localize(i18next)(PageV
|
|
|
37
39
|
actions: [
|
|
38
40
|
Object.assign({ title: i18next.t('button.save'), action: this._updateConnectionManager.bind(this) }, CommonButtonStyles.save),
|
|
39
41
|
Object.assign({ title: i18next.t('button.delete'), action: this._deleteConnections.bind(this) }, CommonButtonStyles.delete)
|
|
40
|
-
]
|
|
42
|
+
],
|
|
43
|
+
exportable: {
|
|
44
|
+
name: i18next.t('text.connection list'),
|
|
45
|
+
data: this.exportHandler.bind(this)
|
|
46
|
+
},
|
|
47
|
+
importable: {
|
|
48
|
+
handler: this.importHandler.bind(this)
|
|
49
|
+
}
|
|
41
50
|
};
|
|
42
51
|
}
|
|
43
52
|
render() {
|
|
@@ -95,12 +104,10 @@ let Connection = class Connection extends connect(store)(localize(i18next)(PageV
|
|
|
95
104
|
validation: function (after, before, record, column) {
|
|
96
105
|
/* connected 상태에서는 이름을 바꿀 수 없다. */
|
|
97
106
|
if (record.state == 'CONNECTED') {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
107
|
+
notify({
|
|
108
|
+
level: 'warn',
|
|
109
|
+
message: 'connection name cannot be changed during connected.'
|
|
110
|
+
});
|
|
104
111
|
return false;
|
|
105
112
|
}
|
|
106
113
|
return true;
|
|
@@ -291,13 +298,11 @@ let Connection = class Connection extends connect(store)(localize(i18next)(PageV
|
|
|
291
298
|
});
|
|
292
299
|
if (!response.errors) {
|
|
293
300
|
this.grist.fetch();
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
}));
|
|
301
|
+
notify({
|
|
302
|
+
message: i18next.t('text.info_x_successfully', {
|
|
303
|
+
x: i18next.t('text.delete')
|
|
304
|
+
})
|
|
305
|
+
});
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
}
|
|
@@ -346,12 +351,10 @@ let Connection = class Connection extends connect(store)(localize(i18next)(PageV
|
|
|
346
351
|
var state = response.data.connectConnection.state;
|
|
347
352
|
record.state = state;
|
|
348
353
|
this.grist.refresh();
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
}));
|
|
354
|
+
notify({
|
|
355
|
+
level: 'info',
|
|
356
|
+
message: `${state == 'CONNECTED' ? 'success' : 'fail'} to connect : ${record.name}`
|
|
357
|
+
});
|
|
355
358
|
}
|
|
356
359
|
async disconnect(record) {
|
|
357
360
|
var response = await client.mutate({
|
|
@@ -369,12 +372,36 @@ let Connection = class Connection extends connect(store)(localize(i18next)(PageV
|
|
|
369
372
|
var state = response.data.disconnectConnection.state;
|
|
370
373
|
record.state = state;
|
|
371
374
|
this.grist.refresh();
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
notify({
|
|
376
|
+
level: 'info',
|
|
377
|
+
message: `${state == 'CONNECTED' ? 'fail' : 'success'} to disconnect : ${record.name}`
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
async exportHandler() {
|
|
381
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
|
|
382
|
+
const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'endpoint', 'params']);
|
|
383
|
+
return exportTargets.map(connection => {
|
|
384
|
+
let tempObj = {};
|
|
385
|
+
for (const field of targetFieldSet) {
|
|
386
|
+
tempObj[field] = connection[field];
|
|
376
387
|
}
|
|
377
|
-
|
|
388
|
+
return tempObj;
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
async importHandler(records) {
|
|
392
|
+
openPopup(html `
|
|
393
|
+
<connection-importer
|
|
394
|
+
.connections=${records}
|
|
395
|
+
@imported=${() => {
|
|
396
|
+
history.back();
|
|
397
|
+
this.grist.fetch();
|
|
398
|
+
}}
|
|
399
|
+
></connection-importer>
|
|
400
|
+
`, {
|
|
401
|
+
backdrop: true,
|
|
402
|
+
size: 'large',
|
|
403
|
+
title: i18next.t('title.import connection')
|
|
404
|
+
});
|
|
378
405
|
}
|
|
379
406
|
};
|
|
380
407
|
Connection.styles = [
|