@things-factory/process 8.0.0-beta.9 → 8.0.2
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/actions/main.ts +1 -0
- package/client/bootstrap.ts +8 -0
- package/client/index.ts +1 -0
- package/client/pages/event/event-importer.ts +86 -0
- package/client/pages/event/event-list-page.ts +324 -0
- package/client/pages/gateway/gateway-importer.ts +87 -0
- package/client/pages/gateway/gateway-list-page.ts +323 -0
- package/client/pages/main.ts +25 -0
- package/client/pages/process/process-importer.ts +87 -0
- package/client/pages/process/process-list-page.ts +324 -0
- package/client/pages/process-instance/process-instance-importer.ts +87 -0
- package/client/pages/process-instance/process-instance-list-page.ts +323 -0
- package/client/pages/process-thread/process-thread-importer.ts +87 -0
- package/client/pages/process-thread/process-thread-list-page.ts +323 -0
- package/client/reducers/main.ts +17 -0
- package/client/route.ts +27 -0
- package/client/tsconfig.json +13 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/server/controllers/common.ts +90 -0
- package/server/controllers/index.ts +0 -0
- package/server/controllers/process-instance/abort.ts +75 -0
- package/server/controllers/process-instance/end.ts +74 -0
- package/server/controllers/process-instance/index.ts +2 -0
- package/server/controllers/process-thread/_abort.ts +20 -0
- package/server/controllers/process-thread/abort.ts +48 -0
- package/server/controllers/process-thread/end.ts +54 -0
- package/server/controllers/process-thread/index.ts +3 -0
- package/server/controllers/process-thread/start.ts +49 -0
- package/server/index.ts +4 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +80 -0
- package/server/service/index.ts +44 -0
- package/server/service/process/event-subscriber.ts +17 -0
- package/server/service/process/index.ts +9 -0
- package/server/service/process/process-history.ts +108 -0
- package/server/service/process/process-mutation.ts +210 -0
- package/server/service/process/process-query.ts +120 -0
- package/server/service/process/process-search-key-item-type.ts +16 -0
- package/server/service/process/process-type.ts +65 -0
- package/server/service/process/process.ts +97 -0
- package/server/service/process-instance/event-subscriber.ts +44 -0
- package/server/service/process-instance/index.ts +10 -0
- package/server/service/process-instance/process-instance-history.ts +154 -0
- package/server/service/process-instance/process-instance-mutation.ts +33 -0
- package/server/service/process-instance/process-instance-query.ts +141 -0
- package/server/service/process-instance/process-instance-subscription.ts +46 -0
- package/server/service/process-instance/process-instance-type.ts +71 -0
- package/server/service/process-instance/process-instance.ts +147 -0
- package/server/service/process-stats/index.ts +3 -0
- package/server/service/process-stats/process-stats-query.ts +57 -0
- package/server/service/process-stats/process-stats-type.ts +31 -0
- package/server/service/process-thread/event-subscriber.ts +31 -0
- package/server/service/process-thread/index.ts +9 -0
- package/server/service/process-thread/process-thread-mutation.ts +34 -0
- package/server/service/process-thread/process-thread-query.ts +61 -0
- package/server/service/process-thread/process-thread-subscription.ts +42 -0
- package/server/service/process-thread/process-thread-type.ts +15 -0
- package/server/service/process-thread/process-thread.ts +90 -0
- package/server/tsconfig.json +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const UPDATE_PROCESS = 'UPDATE_PROCESS'
|
package/client/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './actions/main'
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '@operato/data-grist'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { property } from 'lit/decorators.js'
|
|
7
|
+
|
|
8
|
+
import { client } from '@operato/graphql'
|
|
9
|
+
import { i18next } from '@operato/i18n'
|
|
10
|
+
import { isMobileDevice } from '@operato/utils'
|
|
11
|
+
import { CommonHeaderStyles } from '@operato/styles'
|
|
12
|
+
export class EventImporter extends LitElement {
|
|
13
|
+
static styles = [
|
|
14
|
+
CommonHeaderStyles,
|
|
15
|
+
css`
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
|
|
20
|
+
background-color: var(--md-sys-color-surface);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ox-grist {
|
|
24
|
+
flex: 1;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
@property({ type: Array }) events: any[] = []
|
|
30
|
+
@property({ type: Object }) columns = {
|
|
31
|
+
list: { fields: ['name', 'description'] },
|
|
32
|
+
pagination: { infinite: true },
|
|
33
|
+
columns: [
|
|
34
|
+
{
|
|
35
|
+
type: 'string',
|
|
36
|
+
name: 'name',
|
|
37
|
+
header: i18next.t('field.name'),
|
|
38
|
+
width: 150
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'string',
|
|
42
|
+
name: 'description',
|
|
43
|
+
header: i18next.t('field.description'),
|
|
44
|
+
width: 200
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'checkbox',
|
|
48
|
+
name: 'active',
|
|
49
|
+
header: i18next.t('field.active'),
|
|
50
|
+
width: 60
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
render() {
|
|
56
|
+
return html`
|
|
57
|
+
<ox-grist
|
|
58
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
59
|
+
.config=${this.columns}
|
|
60
|
+
.data=${{
|
|
61
|
+
records: this.events
|
|
62
|
+
}}
|
|
63
|
+
></ox-grist>
|
|
64
|
+
|
|
65
|
+
<div class="footer">
|
|
66
|
+
<div filler></div>
|
|
67
|
+
<button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
|
68
|
+
</div>
|
|
69
|
+
`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async save() {
|
|
73
|
+
const response = await client.mutate({
|
|
74
|
+
mutation: gql`
|
|
75
|
+
mutation importEvents($events: [EventPatch!]!) {
|
|
76
|
+
importEvents(events: $events)
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
variables: { events: this.events }
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
if (response.errors?.length) return
|
|
83
|
+
|
|
84
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
4
|
+
import { PageView, store } from '@operato/shell'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
|
+
import { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'
|
|
9
|
+
import { client } from '@operato/graphql'
|
|
10
|
+
import { i18next, localize } from '@operato/i18n'
|
|
11
|
+
import { notify, openPopup } from '@operato/layout'
|
|
12
|
+
import { OxPopup } from '@operato/popup'
|
|
13
|
+
import { isMobileDevice } from '@operato/utils'
|
|
14
|
+
|
|
15
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
16
|
+
import gql from 'graphql-tag'
|
|
17
|
+
|
|
18
|
+
import { EventImporter } from './event-importer'
|
|
19
|
+
|
|
20
|
+
@customElement('event-list-page')
|
|
21
|
+
export class EventListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
22
|
+
static styles = [
|
|
23
|
+
ScrollbarStyles,
|
|
24
|
+
CommonGristStyles,
|
|
25
|
+
CommonHeaderStyles,
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: flex;
|
|
29
|
+
|
|
30
|
+
width: 100%;
|
|
31
|
+
|
|
32
|
+
--grid-record-emphasized-background-color: #8b0000;
|
|
33
|
+
--grid-record-emphasized-color: #ff6b6b;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
ox-grist {
|
|
37
|
+
overflow-y: auto;
|
|
38
|
+
flex: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ox-filters-form {
|
|
42
|
+
flex: 1;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
static get scopedElements() {
|
|
48
|
+
return {
|
|
49
|
+
'event-importer': EventImporter
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@property({ type: Object }) gristConfig: any
|
|
54
|
+
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
55
|
+
|
|
56
|
+
@query('ox-grist') private grist!: DataGrist
|
|
57
|
+
|
|
58
|
+
get context() {
|
|
59
|
+
return {
|
|
60
|
+
title: i18next.t('title.event list'),
|
|
61
|
+
search: {
|
|
62
|
+
handler: (search: string) => {
|
|
63
|
+
this.grist.searchText = search
|
|
64
|
+
},
|
|
65
|
+
value: this.grist?.searchText || ''
|
|
66
|
+
},
|
|
67
|
+
filter: {
|
|
68
|
+
handler: () => {
|
|
69
|
+
this.grist.toggleHeadroom()
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
help: 'process/event',
|
|
73
|
+
actions: [
|
|
74
|
+
{
|
|
75
|
+
title: i18next.t('button.save'),
|
|
76
|
+
action: this._updateEvent.bind(this),
|
|
77
|
+
...CommonButtonStyles.save
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: i18next.t('button.delete'),
|
|
81
|
+
action: this._deleteEvent.bind(this),
|
|
82
|
+
...CommonButtonStyles.delete
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
exportable: {
|
|
86
|
+
name: i18next.t('title.event list'),
|
|
87
|
+
data: this.exportHandler.bind(this)
|
|
88
|
+
},
|
|
89
|
+
importable: {
|
|
90
|
+
handler: this.importHandler.bind(this)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
97
|
+
|
|
98
|
+
return html`
|
|
99
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
100
|
+
<div slot="headroom" class="header">
|
|
101
|
+
<div class="filters">
|
|
102
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
103
|
+
|
|
104
|
+
<div id="modes">
|
|
105
|
+
<md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
|
|
106
|
+
<md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
|
|
107
|
+
<md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</ox-grist>
|
|
112
|
+
`
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async pageInitialized(lifecycle: any) {
|
|
116
|
+
this.gristConfig = {
|
|
117
|
+
list: {
|
|
118
|
+
fields: ['name', 'description'],
|
|
119
|
+
details: ['active', 'updatedAt']
|
|
120
|
+
},
|
|
121
|
+
columns: [
|
|
122
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
123
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
124
|
+
{
|
|
125
|
+
type: 'string',
|
|
126
|
+
name: 'name',
|
|
127
|
+
header: i18next.t('field.name'),
|
|
128
|
+
record: {
|
|
129
|
+
editable: true
|
|
130
|
+
},
|
|
131
|
+
filter: 'search',
|
|
132
|
+
sortable: true,
|
|
133
|
+
width: 150
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'string',
|
|
137
|
+
name: 'description',
|
|
138
|
+
header: i18next.t('field.description'),
|
|
139
|
+
record: {
|
|
140
|
+
editable: true
|
|
141
|
+
},
|
|
142
|
+
filter: 'search',
|
|
143
|
+
width: 200
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'checkbox',
|
|
147
|
+
name: 'active',
|
|
148
|
+
label: true,
|
|
149
|
+
header: i18next.t('field.active'),
|
|
150
|
+
record: {
|
|
151
|
+
editable: true
|
|
152
|
+
},
|
|
153
|
+
filter: true,
|
|
154
|
+
sortable: true,
|
|
155
|
+
width: 60
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'resource-object',
|
|
159
|
+
name: 'updater',
|
|
160
|
+
header: i18next.t('field.updater'),
|
|
161
|
+
record: {
|
|
162
|
+
editable: false
|
|
163
|
+
},
|
|
164
|
+
sortable: true,
|
|
165
|
+
width: 120
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'datetime',
|
|
169
|
+
name: 'updatedAt',
|
|
170
|
+
header: i18next.t('field.updated_at'),
|
|
171
|
+
record: {
|
|
172
|
+
editable: false
|
|
173
|
+
},
|
|
174
|
+
sortable: true,
|
|
175
|
+
width: 180
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
rows: {
|
|
179
|
+
selectable: {
|
|
180
|
+
multiple: true
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
sorters: [
|
|
184
|
+
{
|
|
185
|
+
name: 'name'
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async pageUpdated(changes: any, lifecycle: any) {
|
|
192
|
+
if (this.active) {
|
|
193
|
+
// do something here when this page just became as active
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
198
|
+
const response = await client.query({
|
|
199
|
+
query: gql`
|
|
200
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
201
|
+
responses: events(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
202
|
+
items {
|
|
203
|
+
id
|
|
204
|
+
name
|
|
205
|
+
description
|
|
206
|
+
active
|
|
207
|
+
updater {
|
|
208
|
+
id
|
|
209
|
+
name
|
|
210
|
+
}
|
|
211
|
+
updatedAt
|
|
212
|
+
}
|
|
213
|
+
total
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
`,
|
|
217
|
+
variables: {
|
|
218
|
+
filters,
|
|
219
|
+
pagination: { page, limit },
|
|
220
|
+
sortings
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
total: response.data.responses.total || 0,
|
|
226
|
+
records: response.data.responses.items || []
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async _deleteEvent() {
|
|
231
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
232
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
233
|
+
if (ids && ids.length > 0) {
|
|
234
|
+
const response = await client.mutate({
|
|
235
|
+
mutation: gql`
|
|
236
|
+
mutation ($ids: [String!]!) {
|
|
237
|
+
deleteEvents(ids: $ids)
|
|
238
|
+
}
|
|
239
|
+
`,
|
|
240
|
+
variables: {
|
|
241
|
+
ids
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
if (!response.errors) {
|
|
246
|
+
this.grist.fetch()
|
|
247
|
+
notify({
|
|
248
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async _updateEvent() {
|
|
256
|
+
let patches = this.grist.dirtyRecords
|
|
257
|
+
if (patches && patches.length) {
|
|
258
|
+
patches = patches.map(patch => {
|
|
259
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
260
|
+
const dirtyFields = patch.__dirtyfields__
|
|
261
|
+
for (let key in dirtyFields) {
|
|
262
|
+
patchField[key] = dirtyFields[key].after
|
|
263
|
+
}
|
|
264
|
+
patchField.cuFlag = patch.__dirty__
|
|
265
|
+
|
|
266
|
+
return patchField
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
const response = await client.mutate({
|
|
270
|
+
mutation: gql`
|
|
271
|
+
mutation ($patches: [EventPatch!]!) {
|
|
272
|
+
updateMultipleEvent(patches: $patches) {
|
|
273
|
+
name
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
`,
|
|
277
|
+
variables: {
|
|
278
|
+
patches
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
if (!response.errors) {
|
|
283
|
+
this.grist.fetch()
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
async exportHandler() {
|
|
289
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
290
|
+
const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
|
|
291
|
+
|
|
292
|
+
return exportTargets.map(event => {
|
|
293
|
+
let tempObj = {}
|
|
294
|
+
for (const field of targetFieldSet) {
|
|
295
|
+
tempObj[field] = event[field]
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return tempObj
|
|
299
|
+
})
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async importHandler(records) {
|
|
303
|
+
const popup = openPopup(
|
|
304
|
+
html`
|
|
305
|
+
<event-importer
|
|
306
|
+
.events=${records}
|
|
307
|
+
@imported=${() => {
|
|
308
|
+
history.back()
|
|
309
|
+
this.grist.fetch()
|
|
310
|
+
}}
|
|
311
|
+
></event-importer>
|
|
312
|
+
`,
|
|
313
|
+
{
|
|
314
|
+
backdrop: true,
|
|
315
|
+
size: 'large',
|
|
316
|
+
title: i18next.t('title.import event')
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
popup.onclosed = () => {
|
|
321
|
+
this.grist.fetch()
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '@operato/data-grist'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { property } from 'lit/decorators.js'
|
|
7
|
+
|
|
8
|
+
import { client } from '@operato/graphql'
|
|
9
|
+
import { i18next } from '@operato/i18n'
|
|
10
|
+
import { isMobileDevice } from '@operato/utils'
|
|
11
|
+
import { CommonHeaderStyles } from '@operato/styles'
|
|
12
|
+
|
|
13
|
+
export class GatewayImporter extends LitElement {
|
|
14
|
+
static styles = [
|
|
15
|
+
CommonHeaderStyles,
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
background-color: var(--md-sys-color-surface);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
ox-grist {
|
|
25
|
+
flex: 1;
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
@property({ type: Array }) gateways: any[] = []
|
|
31
|
+
@property({ type: Object }) columns = {
|
|
32
|
+
list: { fields: ['name', 'description'] },
|
|
33
|
+
pagination: { infinite: true },
|
|
34
|
+
columns: [
|
|
35
|
+
{
|
|
36
|
+
type: 'string',
|
|
37
|
+
name: 'name',
|
|
38
|
+
header: i18next.t('field.name'),
|
|
39
|
+
width: 150
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'string',
|
|
43
|
+
name: 'description',
|
|
44
|
+
header: i18next.t('field.description'),
|
|
45
|
+
width: 200
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'checkbox',
|
|
49
|
+
name: 'active',
|
|
50
|
+
header: i18next.t('field.active'),
|
|
51
|
+
width: 60
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
return html`
|
|
58
|
+
<ox-grist
|
|
59
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
60
|
+
.config=${this.columns}
|
|
61
|
+
.data=${{
|
|
62
|
+
records: this.gateways
|
|
63
|
+
}}
|
|
64
|
+
></ox-grist>
|
|
65
|
+
|
|
66
|
+
<div class="footer">
|
|
67
|
+
<div filler></div>
|
|
68
|
+
<button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
|
69
|
+
</div>
|
|
70
|
+
`
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async save() {
|
|
74
|
+
const response = await client.mutate({
|
|
75
|
+
mutation: gql`
|
|
76
|
+
mutation importGateways($gateways: [GatewayPatch!]!) {
|
|
77
|
+
importGateways(gateways: $gateways)
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
variables: { gateways: this.gateways }
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
if (response.errors?.length) return
|
|
84
|
+
|
|
85
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
|
86
|
+
}
|
|
87
|
+
}
|