@things-factory/worklist 5.0.0-zeta.0
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/CHANGELOG.md +8 -0
- package/LICENSE.md +21 -0
- package/client/bootstrap.js +1 -0
- package/client/index.js +0 -0
- package/client/pages/activity/activity-list-page.js +374 -0
- package/client/pages/activity-instance/activity-instance-list-page.js +184 -0
- package/client/pages/todo/assigned-list-page.js +231 -0
- package/client/pages/todo/starter-list-page.js +239 -0
- package/client/pages/todo/todo-list-page.js +247 -0
- package/client/pages/worklist-home.js +20 -0
- package/client/route.js +27 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.js +21 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/activity/activity-mutation.js +136 -0
- package/dist-server/service/activity/activity-mutation.js.map +1 -0
- package/dist-server/service/activity/activity-query.js +137 -0
- package/dist-server/service/activity/activity-query.js.map +1 -0
- package/dist-server/service/activity/activity-type.js +151 -0
- package/dist-server/service/activity/activity-type.js.map +1 -0
- package/dist-server/service/activity/activity.js +175 -0
- package/dist-server/service/activity/activity.js.map +1 -0
- package/dist-server/service/activity/index.js +9 -0
- package/dist-server/service/activity/index.js.map +1 -0
- package/dist-server/service/activity-instance/activity-instance-mutation.js +189 -0
- package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -0
- package/dist-server/service/activity-instance/activity-instance-query.js +135 -0
- package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -0
- package/dist-server/service/activity-instance/activity-instance-type.js +87 -0
- package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -0
- package/dist-server/service/activity-instance/activity-instance.js +135 -0
- package/dist-server/service/activity-instance/activity-instance.js.map +1 -0
- package/dist-server/service/activity-instance/index.js +9 -0
- package/dist-server/service/activity-instance/index.js.map +1 -0
- package/dist-server/service/index.js +36 -0
- package/dist-server/service/index.js.map +1 -0
- package/package.json +33 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +5 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +28 -0
- package/server/service/activity/activity-mutation.ts +129 -0
- package/server/service/activity/activity-query.ts +91 -0
- package/server/service/activity/activity-type.ts +101 -0
- package/server/service/activity/activity.ts +148 -0
- package/server/service/activity/index.ts +6 -0
- package/server/service/activity-instance/activity-instance-mutation.ts +208 -0
- package/server/service/activity-instance/activity-instance-query.ts +88 -0
- package/server/service/activity-instance/activity-instance-type.ts +53 -0
- package/server/service/activity-instance/activity-instance.ts +114 -0
- package/server/service/activity-instance/index.ts +6 -0
- package/server/service/index.ts +22 -0
- package/things-factory.config.js +14 -0
- package/translations/en.json +17 -0
- package/translations/ko.json +17 -0
- package/translations/ms.json +17 -0
- package/translations/zh.json +17 -0
- package/tsconfig.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- ## [Unreleased] -->
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Hatiolab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function bootstrap() {}
|
package/client/index.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html } from 'lit'
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
6
|
+
|
|
7
|
+
import { getEditor, getRenderer } from '@operato/data-grist'
|
|
8
|
+
import { client } from '@operato/graphql'
|
|
9
|
+
import { i18next, localize } from '@operato/i18n'
|
|
10
|
+
import { PageView, store } from '@operato/shell'
|
|
11
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
12
|
+
import { isMobileDevice } from '@operato/utils'
|
|
13
|
+
|
|
14
|
+
const ActivityUITypes = [
|
|
15
|
+
{ display: '', value: '' },
|
|
16
|
+
{ display: 'Generated', value: 'generated' },
|
|
17
|
+
{ display: 'Board', value: 'board' },
|
|
18
|
+
{ display: 'Page', value: 'page' },
|
|
19
|
+
{ display: 'External URL', value: 'external' }
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const ActivityTypes = [
|
|
23
|
+
{ display: '', value: '' },
|
|
24
|
+
{ display: 'Task', value: 'task' },
|
|
25
|
+
{ display: 'Service', value: 'service' },
|
|
26
|
+
{ display: 'Send', value: 'send' },
|
|
27
|
+
{ display: 'Receive', value: 'receive' },
|
|
28
|
+
{ display: 'User', value: 'user' },
|
|
29
|
+
{ display: 'Manual', value: 'manual' },
|
|
30
|
+
{ display: 'BusinessRule', value: 'business-rule' },
|
|
31
|
+
{ display: 'Script', value: 'script' },
|
|
32
|
+
{ display: 'Subprocess', value: 'sub-process' },
|
|
33
|
+
{ display: 'Call', value: 'call' }
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
export class ActivityListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
37
|
+
static get properties() {
|
|
38
|
+
return {
|
|
39
|
+
gristConfig: Object,
|
|
40
|
+
mode: String
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static get styles() {
|
|
45
|
+
return [
|
|
46
|
+
ScrollbarStyles,
|
|
47
|
+
CommonGristStyles,
|
|
48
|
+
css`
|
|
49
|
+
:host {
|
|
50
|
+
display: flex;
|
|
51
|
+
|
|
52
|
+
width: 100%;
|
|
53
|
+
|
|
54
|
+
--grid-record-emphasized-background-color: red;
|
|
55
|
+
--grid-record-emphasized-color: yellow;
|
|
56
|
+
}
|
|
57
|
+
`
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get context() {
|
|
62
|
+
return {
|
|
63
|
+
title: i18next.t('title.activity list'),
|
|
64
|
+
help: 'worklist/activity',
|
|
65
|
+
actions: [
|
|
66
|
+
{
|
|
67
|
+
title: i18next.t('button.save'),
|
|
68
|
+
action: this._updateActivity.bind(this),
|
|
69
|
+
...CommonButtonStyles.save
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
render() {
|
|
76
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
77
|
+
|
|
78
|
+
return html`
|
|
79
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
80
|
+
<div slot="headroom">
|
|
81
|
+
<div id="filters">
|
|
82
|
+
<ox-filters-form></ox-filters-form>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div id="sorters">
|
|
86
|
+
Sort
|
|
87
|
+
<mwc-icon
|
|
88
|
+
@click=${e => {
|
|
89
|
+
const target = e.currentTarget
|
|
90
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
|
91
|
+
right: 0,
|
|
92
|
+
top: target.offsetTop + target.offsetHeight
|
|
93
|
+
})
|
|
94
|
+
}}
|
|
95
|
+
>expand_more</mwc-icon
|
|
96
|
+
>
|
|
97
|
+
<ox-popup id="sorter-control">
|
|
98
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
99
|
+
</ox-popup>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div id="modes">
|
|
103
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
104
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
105
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</ox-grist>
|
|
109
|
+
`
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get grist() {
|
|
113
|
+
return this.renderRoot.querySelector('ox-grist')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async pageInitialized(lifecycle) {
|
|
117
|
+
this.gristConfig = {
|
|
118
|
+
list: {
|
|
119
|
+
thumbnail: 'uiSource',
|
|
120
|
+
fields: ['name', 'description'],
|
|
121
|
+
details: ['updatedAt']
|
|
122
|
+
},
|
|
123
|
+
columns: [
|
|
124
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
125
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
126
|
+
{
|
|
127
|
+
type: 'string',
|
|
128
|
+
name: 'name',
|
|
129
|
+
header: i18next.t('field.name'),
|
|
130
|
+
record: {
|
|
131
|
+
editable: true
|
|
132
|
+
},
|
|
133
|
+
filter: 'search',
|
|
134
|
+
sortable: true,
|
|
135
|
+
width: 150
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: 'string',
|
|
139
|
+
name: 'description',
|
|
140
|
+
header: i18next.t('field.description'),
|
|
141
|
+
record: {
|
|
142
|
+
editable: true
|
|
143
|
+
},
|
|
144
|
+
filter: 'search',
|
|
145
|
+
width: 200
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'select',
|
|
149
|
+
name: 'activityType',
|
|
150
|
+
label: true,
|
|
151
|
+
header: i18next.t('field.activity-type'),
|
|
152
|
+
record: {
|
|
153
|
+
editable: true,
|
|
154
|
+
options: ActivityTypes
|
|
155
|
+
},
|
|
156
|
+
sortable: true,
|
|
157
|
+
filter: true,
|
|
158
|
+
width: 60
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: 'object',
|
|
162
|
+
name: 'model',
|
|
163
|
+
label: true,
|
|
164
|
+
header: i18next.t('field.model'),
|
|
165
|
+
record: {
|
|
166
|
+
editable: true
|
|
167
|
+
},
|
|
168
|
+
width: 120
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'boolean',
|
|
172
|
+
name: 'startable',
|
|
173
|
+
label: true,
|
|
174
|
+
header: i18next.t('field.startable'),
|
|
175
|
+
record: {
|
|
176
|
+
editable: true
|
|
177
|
+
},
|
|
178
|
+
width: 80
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'resource-object',
|
|
182
|
+
name: 'assigneeRole',
|
|
183
|
+
header: i18next.t('field.assignee-role'),
|
|
184
|
+
record: {
|
|
185
|
+
editable: true,
|
|
186
|
+
options: {
|
|
187
|
+
queryName: 'roles'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
filter: 'like',
|
|
191
|
+
width: 120
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'select',
|
|
195
|
+
name: 'uiType',
|
|
196
|
+
label: true,
|
|
197
|
+
header: i18next.t('field.ui-type'),
|
|
198
|
+
record: {
|
|
199
|
+
editable: true,
|
|
200
|
+
options: ActivityUITypes
|
|
201
|
+
},
|
|
202
|
+
width: 80
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: 'string',
|
|
206
|
+
name: 'uiSource',
|
|
207
|
+
header: i18next.t('field.ui-source'),
|
|
208
|
+
record: {
|
|
209
|
+
editable: true,
|
|
210
|
+
editor: function (value, column, record, rowIndex, field) {
|
|
211
|
+
var type = record.uiType !== 'board' ? 'string' : 'board'
|
|
212
|
+
return getEditor(type)(value, column, record, rowIndex, field)
|
|
213
|
+
},
|
|
214
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
215
|
+
var type = record.uiType !== 'board' ? 'string' : 'board'
|
|
216
|
+
return getRenderer(type)(value, column, record, rowIndex, field)
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
width: 140
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: 'number',
|
|
223
|
+
name: 'standardTime',
|
|
224
|
+
header: i18next.t('field.standard-time'),
|
|
225
|
+
record: {
|
|
226
|
+
editable: true
|
|
227
|
+
},
|
|
228
|
+
sortable: true,
|
|
229
|
+
width: 80
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
type: 'number',
|
|
233
|
+
name: 'cycleTime',
|
|
234
|
+
header: i18next.t('field.cycle-time'),
|
|
235
|
+
record: {
|
|
236
|
+
editable: true
|
|
237
|
+
},
|
|
238
|
+
sortable: true,
|
|
239
|
+
width: 80
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: 'number',
|
|
243
|
+
name: 'tactTime',
|
|
244
|
+
header: i18next.t('field.tact-time'),
|
|
245
|
+
record: {
|
|
246
|
+
editable: true
|
|
247
|
+
},
|
|
248
|
+
sortable: true,
|
|
249
|
+
width: 80
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
type: 'number',
|
|
253
|
+
name: 'leadTime',
|
|
254
|
+
header: i18next.t('field.lead-time'),
|
|
255
|
+
record: {
|
|
256
|
+
editable: true
|
|
257
|
+
},
|
|
258
|
+
sortable: true,
|
|
259
|
+
width: 80
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'resource-object',
|
|
263
|
+
name: 'updater',
|
|
264
|
+
header: i18next.t('field.updater'),
|
|
265
|
+
record: {
|
|
266
|
+
editable: false
|
|
267
|
+
},
|
|
268
|
+
sortable: true,
|
|
269
|
+
width: 120
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
type: 'datetime',
|
|
273
|
+
name: 'updatedAt',
|
|
274
|
+
header: i18next.t('field.updated_at'),
|
|
275
|
+
record: {
|
|
276
|
+
editable: false
|
|
277
|
+
},
|
|
278
|
+
sortable: true,
|
|
279
|
+
width: 180
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
rows: {
|
|
283
|
+
selectable: {
|
|
284
|
+
multiple: true
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
sorters: [
|
|
288
|
+
{
|
|
289
|
+
name: 'name'
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
296
|
+
const response = await client.query({
|
|
297
|
+
query: gql`
|
|
298
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
299
|
+
responses: activities(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
300
|
+
items {
|
|
301
|
+
id
|
|
302
|
+
name
|
|
303
|
+
description
|
|
304
|
+
activityType
|
|
305
|
+
model
|
|
306
|
+
assigneeRole {
|
|
307
|
+
id
|
|
308
|
+
name
|
|
309
|
+
}
|
|
310
|
+
uiType
|
|
311
|
+
uiSource
|
|
312
|
+
startable
|
|
313
|
+
standardTime
|
|
314
|
+
leadTime
|
|
315
|
+
cycleTime
|
|
316
|
+
tactTime
|
|
317
|
+
updater {
|
|
318
|
+
id
|
|
319
|
+
name
|
|
320
|
+
}
|
|
321
|
+
updatedAt
|
|
322
|
+
}
|
|
323
|
+
total
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
`,
|
|
327
|
+
variables: {
|
|
328
|
+
filters,
|
|
329
|
+
pagination: { page, limit },
|
|
330
|
+
sortings
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
total: response.data.responses.total || 0,
|
|
336
|
+
records: response.data.responses.items || []
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async _updateActivity() {
|
|
341
|
+
let patches = this.grist.dirtyRecords
|
|
342
|
+
if (patches && patches.length) {
|
|
343
|
+
patches = patches.map(patch => {
|
|
344
|
+
let patchField = patch.id ? { id: patch.id } : {}
|
|
345
|
+
const dirtyFields = patch.__dirtyfields__
|
|
346
|
+
for (let key in dirtyFields) {
|
|
347
|
+
patchField[key] = dirtyFields[key].after
|
|
348
|
+
}
|
|
349
|
+
patchField.cuFlag = patch.__dirty__
|
|
350
|
+
|
|
351
|
+
return patchField
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
const response = await client.mutate({
|
|
355
|
+
mutation: gql`
|
|
356
|
+
mutation ($patches: [ActivityPatch!]!) {
|
|
357
|
+
updateMultipleActivity(patches: $patches) {
|
|
358
|
+
name
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
`,
|
|
362
|
+
variables: {
|
|
363
|
+
patches
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
if (!response.errors) {
|
|
368
|
+
this.grist.fetch()
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
window.customElements.define('activity-list-page', ActivityListPage)
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html } from 'lit'
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
6
|
+
|
|
7
|
+
import { client } from '@operato/graphql'
|
|
8
|
+
import { i18next, localize } from '@operato/i18n'
|
|
9
|
+
import { PageView, store } from '@operato/shell'
|
|
10
|
+
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
11
|
+
import { isMobileDevice } from '@operato/utils'
|
|
12
|
+
|
|
13
|
+
export class ActivityInstanceListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
gristConfig: Object,
|
|
17
|
+
mode: String
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static get styles() {
|
|
22
|
+
return [
|
|
23
|
+
ScrollbarStyles,
|
|
24
|
+
CommonGristStyles,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
display: flex;
|
|
28
|
+
|
|
29
|
+
width: 100%;
|
|
30
|
+
|
|
31
|
+
--grid-record-emphasized-background-color: red;
|
|
32
|
+
--grid-record-emphasized-color: yellow;
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get context() {
|
|
39
|
+
return {
|
|
40
|
+
title: i18next.t('title.activity instance list'),
|
|
41
|
+
help: 'worklist/activity-instance-list',
|
|
42
|
+
actions: []
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
|
|
48
|
+
|
|
49
|
+
return html`
|
|
50
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
51
|
+
<div slot="headroom">
|
|
52
|
+
<div id="filters">
|
|
53
|
+
<ox-filters-form></ox-filters-form>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div id="sorters">
|
|
57
|
+
Sort
|
|
58
|
+
<mwc-icon
|
|
59
|
+
@click=${e => {
|
|
60
|
+
const target = e.currentTarget
|
|
61
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
|
62
|
+
right: 0,
|
|
63
|
+
top: target.offsetTop + target.offsetHeight
|
|
64
|
+
})
|
|
65
|
+
}}
|
|
66
|
+
>expand_more</mwc-icon
|
|
67
|
+
>
|
|
68
|
+
<ox-popup id="sorter-control">
|
|
69
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
70
|
+
</ox-popup>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div id="modes">
|
|
74
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
75
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
76
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</ox-grist>
|
|
80
|
+
`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get grist() {
|
|
84
|
+
return this.renderRoot.querySelector('ox-grist')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async pageInitialized(lifecycle) {
|
|
88
|
+
this.gristConfig = {
|
|
89
|
+
list: {
|
|
90
|
+
fields: ['name', 'description'],
|
|
91
|
+
details: ['updatedAt']
|
|
92
|
+
},
|
|
93
|
+
columns: [
|
|
94
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
95
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
96
|
+
{
|
|
97
|
+
type: 'string',
|
|
98
|
+
name: 'name',
|
|
99
|
+
header: i18next.t('field.name'),
|
|
100
|
+
record: {
|
|
101
|
+
editable: false
|
|
102
|
+
},
|
|
103
|
+
filter: 'search',
|
|
104
|
+
sortable: true,
|
|
105
|
+
width: 150
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'string',
|
|
109
|
+
name: 'description',
|
|
110
|
+
header: i18next.t('field.description'),
|
|
111
|
+
record: {
|
|
112
|
+
editable: false
|
|
113
|
+
},
|
|
114
|
+
filter: 'search',
|
|
115
|
+
width: 200
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'resource-object',
|
|
119
|
+
name: 'updater',
|
|
120
|
+
header: i18next.t('field.updater'),
|
|
121
|
+
record: {
|
|
122
|
+
editable: false
|
|
123
|
+
},
|
|
124
|
+
sortable: true,
|
|
125
|
+
width: 120
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'datetime',
|
|
129
|
+
name: 'updatedAt',
|
|
130
|
+
header: i18next.t('field.updated_at'),
|
|
131
|
+
record: {
|
|
132
|
+
editable: false
|
|
133
|
+
},
|
|
134
|
+
sortable: true,
|
|
135
|
+
width: 180
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
rows: {
|
|
139
|
+
selectable: {
|
|
140
|
+
multiple: true
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
sorters: [
|
|
144
|
+
{
|
|
145
|
+
name: 'name'
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
152
|
+
const response = await client.query({
|
|
153
|
+
query: gql`
|
|
154
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
155
|
+
responses: activityInstances(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
156
|
+
items {
|
|
157
|
+
id
|
|
158
|
+
name
|
|
159
|
+
description
|
|
160
|
+
updater {
|
|
161
|
+
id
|
|
162
|
+
name
|
|
163
|
+
}
|
|
164
|
+
updatedAt
|
|
165
|
+
}
|
|
166
|
+
total
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`,
|
|
170
|
+
variables: {
|
|
171
|
+
filters,
|
|
172
|
+
pagination: { page, limit },
|
|
173
|
+
sortings
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
total: response.data.responses.total || 0,
|
|
179
|
+
records: response.data.responses.items || []
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
window.customElements.define('activity-instance-list-page', ActivityInstanceListPage)
|