@things-factory/integration-ui 9.0.20 → 9.0.24
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.ts +59 -1
- package/client/types.ts +9 -0
- package/dist-client/pages/connection.js +48 -1
- package/dist-client/pages/connection.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types.d.ts +13 -0
- package/dist-client/types.js +2 -0
- package/dist-client/types.js.map +1 -0
- package/package.json +6 -6
@@ -16,6 +16,55 @@ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato
|
|
16
16
|
import { isMobileDevice } from '@operato/utils'
|
17
17
|
import { FetchOption } from '@operato/data-grist'
|
18
18
|
import { p13n } from '@operato/p13n'
|
19
|
+
import { PropertySpec } from '../types.js'
|
20
|
+
|
21
|
+
async function copyToClipboard(text: string): Promise<void> {
|
22
|
+
try {
|
23
|
+
await navigator.clipboard.writeText(text)
|
24
|
+
} catch (err) {
|
25
|
+
// fallback: old way
|
26
|
+
const textArea = document.createElement('textarea')
|
27
|
+
textArea.value = text
|
28
|
+
document.body.appendChild(textArea)
|
29
|
+
textArea.select()
|
30
|
+
document.execCommand('copy')
|
31
|
+
document.body.removeChild(textArea)
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function createActionInjector(
|
36
|
+
connectionName: string
|
37
|
+
): (propName: string, propSpec: PropertySpec) => HTMLElement | null {
|
38
|
+
return (propName: string, propSpec: PropertySpec): HTMLElement | null => {
|
39
|
+
if (!propSpec.useDomainAttribute) {
|
40
|
+
return null
|
41
|
+
}
|
42
|
+
|
43
|
+
const attributeName = `Connection::${connectionName}::${propName}`
|
44
|
+
|
45
|
+
const copyIcon = document.createElement('md-icon')
|
46
|
+
copyIcon.textContent = 'dictionary'
|
47
|
+
copyIcon.style.cssText =
|
48
|
+
'cursor: pointer; color: var(--md-sys-color-primary); font-size: 16px; --md-icon-size: 16px;'
|
49
|
+
copyIcon.title = `Copy ${attributeName}`
|
50
|
+
|
51
|
+
copyIcon.addEventListener('click', () => {
|
52
|
+
copyToClipboard(attributeName)
|
53
|
+
|
54
|
+
// 복사 성공 피드백
|
55
|
+
const originalText = copyIcon.textContent
|
56
|
+
copyIcon.textContent = 'check'
|
57
|
+
copyIcon.style.color = 'var(--md-sys-color-tertiary)'
|
58
|
+
|
59
|
+
setTimeout(() => {
|
60
|
+
copyIcon.textContent = originalText
|
61
|
+
copyIcon.style.color = 'var(--md-sys-color-primary)'
|
62
|
+
}, 1000)
|
63
|
+
})
|
64
|
+
|
65
|
+
return copyIcon
|
66
|
+
}
|
67
|
+
}
|
19
68
|
|
20
69
|
@customElement('connection-page')
|
21
70
|
export class Connection extends connect(store)(p13n(localize(i18next)(PageView))) {
|
@@ -219,7 +268,15 @@ export class Connection extends connect(store)(p13n(localize(i18next)(PageView))
|
|
219
268
|
options: async (value, column, record, row, field) => {
|
220
269
|
const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : ({} as any)
|
221
270
|
const context = this.grist
|
222
|
-
|
271
|
+
|
272
|
+
return {
|
273
|
+
name,
|
274
|
+
help,
|
275
|
+
spec,
|
276
|
+
context,
|
277
|
+
objectified: true,
|
278
|
+
actionInjector: createActionInjector(record.name)
|
279
|
+
}
|
223
280
|
},
|
224
281
|
renderer: 'json5'
|
225
282
|
},
|
@@ -334,6 +391,7 @@ export class Connection extends connect(store)(p13n(localize(i18next)(PageView))
|
|
334
391
|
placeholder
|
335
392
|
property
|
336
393
|
styles
|
394
|
+
useDomainAttribute
|
337
395
|
}
|
338
396
|
}
|
339
397
|
}
|
package/client/types.ts
ADDED
@@ -14,6 +14,45 @@ import { PageView, store } from '@operato/shell';
|
|
14
14
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
15
15
|
import { isMobileDevice } from '@operato/utils';
|
16
16
|
import { p13n } from '@operato/p13n';
|
17
|
+
async function copyToClipboard(text) {
|
18
|
+
try {
|
19
|
+
await navigator.clipboard.writeText(text);
|
20
|
+
}
|
21
|
+
catch (err) {
|
22
|
+
// fallback: old way
|
23
|
+
const textArea = document.createElement('textarea');
|
24
|
+
textArea.value = text;
|
25
|
+
document.body.appendChild(textArea);
|
26
|
+
textArea.select();
|
27
|
+
document.execCommand('copy');
|
28
|
+
document.body.removeChild(textArea);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
function createActionInjector(connectionName) {
|
32
|
+
return (propName, propSpec) => {
|
33
|
+
if (!propSpec.useDomainAttribute) {
|
34
|
+
return null;
|
35
|
+
}
|
36
|
+
const attributeName = `Connection::${connectionName}::${propName}`;
|
37
|
+
const copyIcon = document.createElement('md-icon');
|
38
|
+
copyIcon.textContent = 'dictionary';
|
39
|
+
copyIcon.style.cssText =
|
40
|
+
'cursor: pointer; color: var(--md-sys-color-primary); font-size: 16px; --md-icon-size: 16px;';
|
41
|
+
copyIcon.title = `Copy ${attributeName}`;
|
42
|
+
copyIcon.addEventListener('click', () => {
|
43
|
+
copyToClipboard(attributeName);
|
44
|
+
// 복사 성공 피드백
|
45
|
+
const originalText = copyIcon.textContent;
|
46
|
+
copyIcon.textContent = 'check';
|
47
|
+
copyIcon.style.color = 'var(--md-sys-color-tertiary)';
|
48
|
+
setTimeout(() => {
|
49
|
+
copyIcon.textContent = originalText;
|
50
|
+
copyIcon.style.color = 'var(--md-sys-color-primary)';
|
51
|
+
}, 1000);
|
52
|
+
});
|
53
|
+
return copyIcon;
|
54
|
+
};
|
55
|
+
}
|
17
56
|
let Connection = class Connection extends connect(store)(p13n(localize(i18next)(PageView))) {
|
18
57
|
constructor() {
|
19
58
|
super(...arguments);
|
@@ -209,7 +248,14 @@ let Connection = class Connection extends connect(store)(p13n(localize(i18next)(
|
|
209
248
|
options: async (value, column, record, row, field) => {
|
210
249
|
const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : {};
|
211
250
|
const context = this.grist;
|
212
|
-
return {
|
251
|
+
return {
|
252
|
+
name,
|
253
|
+
help,
|
254
|
+
spec,
|
255
|
+
context,
|
256
|
+
objectified: true,
|
257
|
+
actionInjector: createActionInjector(record.name)
|
258
|
+
};
|
213
259
|
},
|
214
260
|
renderer: 'json5'
|
215
261
|
},
|
@@ -321,6 +367,7 @@ let Connection = class Connection extends connect(store)(p13n(localize(i18next)(
|
|
321
367
|
placeholder
|
322
368
|
property
|
323
369
|
styles
|
370
|
+
useDomainAttribute
|
324
371
|
}
|
325
372
|
}
|
326
373
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../client/pages/connection.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,0BAA0B,CAAA;AAEjC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG7B,IAAM,UAAU,GAAhB,MAAM,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C;IAED,KAAK,CAAC,aAAa,CAAC,OAAO;QACzB,SAAS,CACP,IAAI,CAAA;;yBAEe,OAAO;sBACV,GAAG,EAAE;YACf,OAAO,CAAC,IAAI,EAAE,CAAA;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;;OAEJ,EACD;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;SAC5C,CACF,CAAA;IACH,CAAC;;AA/c4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0CAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAgB;AAExB;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;yCAAA;AAvBzB,UAAU;IADtB,aAAa,CAAC,iBAAiB,CAAC;GACpB,UAAU,CAmetB","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport './connection-importer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist } from '@operato/data-grist/ox-grist.js'\nimport { client } from '@operato/graphql'\nimport { HelpDecoratedRenderer } from '@operato/help/help-decorated-renderer.js'\nimport { notify, openPopup } from '@operato/layout'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { FetchOption } from '@operato/data-grist'\nimport { p13n } from '@operato/p13n'\n\n@customElement('connection-page')\nexport class Connection extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n CommonGristStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) gristConfig: any\n @property({ type: Object }) connectors: any\n\n @query('ox-grist') grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.connection list'),\n search: {\n handler: search => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n // 필터가 설정되면, 아래 코멘트 해제\n // filter: {\n // handler: () => {\n // const display = this.headroom.style.display\n // this.headroom.style.display = display !== 'none' ? 'none' : 'flex'\n // }\n // },\n help: 'integration/ui/connection',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateConnectionManager.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteConnections.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('text.connection list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.fetchConnectors()\n\n this.gristConfig = {\n list: { fields: ['name', 'description', 'type', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'state',\n icon: record => (!record ? 'link' : !record.id ? '' : record.state == 'CONNECTED' ? 'link_off' : 'link'),\n iconOnly: false,\n title: record =>\n !record\n ? i18next.t('button.connect')\n : !record.id\n ? ''\n : record.state == 'CONNECTED'\n ? i18next.t('button.disconnect')\n : i18next.t('button.connect'),\n width: 80,\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record || !record.name || record.__dirty__ == '+') {\n return\n }\n if (record.state == 'CONNECTED') {\n this.disconnect(record)\n } else {\n this.connect(record)\n }\n }\n }\n },\n {\n type: 'object',\n name: 'domain',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: i18next.t('field.name'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150,\n validation: function (after, before, record, column) {\n /* connected 상태에서는 이름을 바꿀 수 없다. */\n if (record.state == 'CONNECTED') {\n notify({\n level: 'warn',\n message: 'connection name cannot be changed during connected.'\n })\n return false\n }\n return true\n }\n },\n {\n type: 'string',\n name: 'description',\n label: true,\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true,\n align: 'center'\n },\n sortable: true,\n width: 60\n },\n {\n type: 'connector',\n name: 'type',\n label: true,\n header: i18next.t('field.type'),\n record: {\n renderer: HelpDecoratedRenderer,\n editable: true,\n help: value => this.connectors?.[value]?.help,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'string',\n name: 'endpoint',\n header: i18next.t('field.endpoint'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'parameters',\n name: 'params',\n header: i18next.t('field.params'),\n record: {\n editable: true,\n options: async (value, column, record, row, field) => {\n const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : ({} as any)\n const context = this.grist\n return { name, help, spec, context, objectified: true }\n },\n renderer: 'json5'\n },\n width: 100\n },\n {\n type: 'resource-object',\n name: 'edge',\n header: i18next.t('field.edge-server'),\n record: {\n editable: true,\n options: {\n queryName: 'edges'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: connections(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n domain {\n id\n name\n description\n }\n name\n description\n type\n edge {\n id\n name\n }\n endpoint\n active\n state\n params\n updater {\n id\n name\n description\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async fetchConnectors() {\n const response = await client.query({\n query: gql`\n query {\n connectors {\n items {\n name\n help\n parameterSpec {\n type\n name\n label\n placeholder\n property\n styles\n }\n }\n }\n }\n `\n })\n\n if (!response.errors) {\n this.connectors = response.data.connectors.items.reduce((connectors, connector) => {\n connectors[connector.name] = connector\n return connectors\n }, {})\n } else {\n console.error('fetch connectors error')\n }\n }\n\n async _deleteConnections(name) {\n if (\n confirm(\n i18next.t('text.sure_to_x', {\n x: i18next.t('text.delete')\n })\n )\n ) {\n const names = this.grist.selected.map(record => record.name)\n if (names && names.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($names: [String!]!) {\n deleteConnections(names: $names)\n }\n `,\n variables: {\n names\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('text.delete')\n })\n })\n }\n }\n }\n }\n\n async _updateConnectionManager() {\n var patches = this.grist.dirtyRecords\n\n if (patches && patches.length) {\n patches = patches.map(connection => {\n let patchField: any = connection.id ? { id: connection.id } : {}\n const dirtyFields = connection.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = connection.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ConnectionPatch!]!) {\n updateMultipleConnection(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n }\n\n async connect(record) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n connectConnection(name: $name) {\n state\n }\n }\n `,\n variables: {\n name: record.name\n }\n })\n\n var state = response.data.connectConnection.state\n\n record.state = state\n\n this.grist.refresh()\n\n notify({\n level: 'info',\n message: `${state == 'CONNECTED' ? 'success' : 'fail'} to connect : ${record.name}`\n })\n }\n\n async disconnect(record) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n disconnectConnection(name: $name) {\n state\n }\n }\n `,\n variables: {\n name: record.name\n }\n })\n\n var state = response.data.disconnectConnection.state\n\n record.state = state\n\n this.grist.refresh()\n\n notify({\n level: 'info',\n message: `${state == 'CONNECTED' ? 'fail' : 'success'} to disconnect : ${record.name}`\n })\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'endpoint', 'params'])\n\n return exportTargets.map(connection => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = connection[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n openPopup(\n html`\n <connection-importer\n .connections=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></connection-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import connection')\n }\n )\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../client/pages/connection.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,0BAA0B,CAAA;AAEjC,O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AAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;;OAEJ,EACD;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;SAC5C,CACF,CAAA;IACH,CAAC;;AAxd4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0CAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAgB;AAExB;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;yCAAA;AAvBzB,UAAU;IADtB,aAAa,CAAC,iBAAiB,CAAC;GACpB,UAAU,CA4etB","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport './connection-importer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist } from '@operato/data-grist/ox-grist.js'\nimport { client } from '@operato/graphql'\nimport { HelpDecoratedRenderer } from '@operato/help/help-decorated-renderer.js'\nimport { notify, openPopup } from '@operato/layout'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { FetchOption } from '@operato/data-grist'\nimport { p13n } from '@operato/p13n'\nimport { PropertySpec } from '../types.js'\n\nasync function copyToClipboard(text: string): Promise<void> {\n try {\n await navigator.clipboard.writeText(text)\n } catch (err) {\n // fallback: old way\n const textArea = document.createElement('textarea')\n textArea.value = text\n document.body.appendChild(textArea)\n textArea.select()\n document.execCommand('copy')\n document.body.removeChild(textArea)\n }\n}\n\nfunction createActionInjector(\n connectionName: string\n): (propName: string, propSpec: PropertySpec) => HTMLElement | null {\n return (propName: string, propSpec: PropertySpec): HTMLElement | null => {\n if (!propSpec.useDomainAttribute) {\n return null\n }\n\n const attributeName = `Connection::${connectionName}::${propName}`\n\n const copyIcon = document.createElement('md-icon')\n copyIcon.textContent = 'dictionary'\n copyIcon.style.cssText =\n 'cursor: pointer; color: var(--md-sys-color-primary); font-size: 16px; --md-icon-size: 16px;'\n copyIcon.title = `Copy ${attributeName}`\n\n copyIcon.addEventListener('click', () => {\n copyToClipboard(attributeName)\n\n // 복사 성공 피드백\n const originalText = copyIcon.textContent\n copyIcon.textContent = 'check'\n copyIcon.style.color = 'var(--md-sys-color-tertiary)'\n\n setTimeout(() => {\n copyIcon.textContent = originalText\n copyIcon.style.color = 'var(--md-sys-color-primary)'\n }, 1000)\n })\n\n return copyIcon\n }\n}\n\n@customElement('connection-page')\nexport class Connection extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n CommonGristStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) gristConfig: any\n @property({ type: Object }) connectors: any\n\n @query('ox-grist') grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.connection list'),\n search: {\n handler: search => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n // 필터가 설정되면, 아래 코멘트 해제\n // filter: {\n // handler: () => {\n // const display = this.headroom.style.display\n // this.headroom.style.display = display !== 'none' ? 'none' : 'flex'\n // }\n // },\n help: 'integration/ui/connection',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateConnectionManager.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteConnections.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('text.connection list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.fetchConnectors()\n\n this.gristConfig = {\n list: { fields: ['name', 'description', 'type', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'state',\n icon: record => (!record ? 'link' : !record.id ? '' : record.state == 'CONNECTED' ? 'link_off' : 'link'),\n iconOnly: false,\n title: record =>\n !record\n ? i18next.t('button.connect')\n : !record.id\n ? ''\n : record.state == 'CONNECTED'\n ? i18next.t('button.disconnect')\n : i18next.t('button.connect'),\n width: 80,\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record || !record.name || record.__dirty__ == '+') {\n return\n }\n if (record.state == 'CONNECTED') {\n this.disconnect(record)\n } else {\n this.connect(record)\n }\n }\n }\n },\n {\n type: 'object',\n name: 'domain',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: i18next.t('field.name'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 150,\n validation: function (after, before, record, column) {\n /* connected 상태에서는 이름을 바꿀 수 없다. */\n if (record.state == 'CONNECTED') {\n notify({\n level: 'warn',\n message: 'connection name cannot be changed during connected.'\n })\n return false\n }\n return true\n }\n },\n {\n type: 'string',\n name: 'description',\n label: true,\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true,\n align: 'center'\n },\n sortable: true,\n width: 60\n },\n {\n type: 'connector',\n name: 'type',\n label: true,\n header: i18next.t('field.type'),\n record: {\n renderer: HelpDecoratedRenderer,\n editable: true,\n help: value => this.connectors?.[value]?.help,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'string',\n name: 'endpoint',\n header: i18next.t('field.endpoint'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'parameters',\n name: 'params',\n header: i18next.t('field.params'),\n record: {\n editable: true,\n options: async (value, column, record, row, field) => {\n const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : ({} as any)\n const context = this.grist\n\n return {\n name,\n help,\n spec,\n context,\n objectified: true,\n actionInjector: createActionInjector(record.name)\n }\n },\n renderer: 'json5'\n },\n width: 100\n },\n {\n type: 'resource-object',\n name: 'edge',\n header: i18next.t('field.edge-server'),\n record: {\n editable: true,\n options: {\n queryName: 'edges'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: connections(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n domain {\n id\n name\n description\n }\n name\n description\n type\n edge {\n id\n name\n }\n endpoint\n active\n state\n params\n updater {\n id\n name\n description\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async fetchConnectors() {\n const response = await client.query({\n query: gql`\n query {\n connectors {\n items {\n name\n help\n parameterSpec {\n type\n name\n label\n placeholder\n property\n styles\n useDomainAttribute\n }\n }\n }\n }\n `\n })\n\n if (!response.errors) {\n this.connectors = response.data.connectors.items.reduce((connectors, connector) => {\n connectors[connector.name] = connector\n return connectors\n }, {})\n } else {\n console.error('fetch connectors error')\n }\n }\n\n async _deleteConnections(name) {\n if (\n confirm(\n i18next.t('text.sure_to_x', {\n x: i18next.t('text.delete')\n })\n )\n ) {\n const names = this.grist.selected.map(record => record.name)\n if (names && names.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($names: [String!]!) {\n deleteConnections(names: $names)\n }\n `,\n variables: {\n names\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('text.delete')\n })\n })\n }\n }\n }\n }\n\n async _updateConnectionManager() {\n var patches = this.grist.dirtyRecords\n\n if (patches && patches.length) {\n patches = patches.map(connection => {\n let patchField: any = connection.id ? { id: connection.id } : {}\n const dirtyFields = connection.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = connection.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ConnectionPatch!]!) {\n updateMultipleConnection(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n }\n\n async connect(record) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n connectConnection(name: $name) {\n state\n }\n }\n `,\n variables: {\n name: record.name\n }\n })\n\n var state = response.data.connectConnection.state\n\n record.state = state\n\n this.grist.refresh()\n\n notify({\n level: 'info',\n message: `${state == 'CONNECTED' ? 'success' : 'fail'} to connect : ${record.name}`\n })\n }\n\n async disconnect(record) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n disconnectConnection(name: $name) {\n state\n }\n }\n `,\n variables: {\n name: record.name\n }\n })\n\n var state = response.data.disconnectConnection.state\n\n record.state = state\n\n this.grist.refresh()\n\n notify({\n level: 'info',\n message: `${state == 'CONNECTED' ? 'fail' : 'success'} to disconnect : ${record.name}`\n })\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'endpoint', 'params'])\n\n return exportTargets.map(connection => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = connection[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n openPopup(\n html`\n <connection-importer\n .connections=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></connection-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import connection')\n }\n )\n }\n}\n"]}
|