@things-factory/worklist 6.0.8 → 6.0.12
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/activity-approval/activity-approval-importer.ts +97 -0
- package/client/pages/activity-approval/activity-approval-list-page.ts +348 -0
- package/client/pages/activity-approval/activity-approval-page.ts +418 -0
- package/client/pages/activity-thread/activity-thread-page.ts +5 -5
- package/client/pages/todo/approval-waiting-list-page.ts +376 -0
- package/client/route.ts +12 -0
- package/dist-client/pages/activity-approval/activity-approval-importer.d.ts +22 -0
- package/dist-client/pages/activity-approval/activity-approval-importer.js +100 -0
- package/dist-client/pages/activity-approval/activity-approval-importer.js.map +1 -0
- package/dist-client/pages/activity-approval/activity-approval-list-page.d.ts +62 -0
- package/dist-client/pages/activity-approval/activity-approval-list-page.js +326 -0
- package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -0
- package/dist-client/pages/activity-approval/activity-approval-page.d.ts +55 -0
- package/dist-client/pages/activity-approval/activity-approval-page.js +365 -0
- package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -0
- package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.js +4 -4
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/pages/todo/approval-waiting-list-page.d.ts +45 -0
- package/dist-client/pages/todo/approval-waiting-list-page.js +371 -0
- package/dist-client/pages/todo/approval-waiting-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +9 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/activity-approval/abort.js +20 -0
- package/dist-server/controllers/activity-approval/abort.js.map +1 -0
- package/dist-server/controllers/activity-approval/approve.js +50 -0
- package/dist-server/controllers/activity-approval/approve.js.map +1 -0
- package/dist-server/controllers/activity-approval/delegate.js +20 -0
- package/dist-server/controllers/activity-approval/delegate.js.map +1 -0
- package/dist-server/controllers/activity-approval/escalate.js +20 -0
- package/dist-server/controllers/activity-approval/escalate.js.map +1 -0
- package/dist-server/controllers/activity-approval/reject.js +21 -0
- package/dist-server/controllers/activity-approval/reject.js.map +1 -0
- package/dist-server/controllers/activity-instance/abort.js +2 -3
- package/dist-server/controllers/activity-instance/abort.js.map +1 -1
- package/dist-server/controllers/activity-instance/delegate.js +2 -3
- package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
- package/dist-server/controllers/activity-instance/draft.js +1 -2
- package/dist-server/controllers/activity-instance/draft.js.map +1 -1
- package/dist-server/controllers/activity-instance/end.js +2 -3
- package/dist-server/controllers/activity-instance/end.js.map +1 -1
- package/dist-server/controllers/activity-instance/pick.js +2 -3
- package/dist-server/controllers/activity-instance/pick.js.map +1 -1
- package/dist-server/controllers/activity-instance/terminate.js +2 -3
- package/dist-server/controllers/activity-instance/terminate.js.map +1 -1
- package/dist-server/controllers/activity-thread/abort.js +2 -3
- package/dist-server/controllers/activity-thread/abort.js.map +1 -1
- package/dist-server/controllers/activity-thread/delegate.js +2 -3
- package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
- package/dist-server/controllers/activity-thread/end.js +2 -3
- package/dist-server/controllers/activity-thread/end.js.map +1 -1
- package/dist-server/controllers/activity-thread/index.js +1 -0
- package/dist-server/controllers/activity-thread/index.js.map +1 -1
- package/dist-server/controllers/activity-thread/submit.js +46 -0
- package/dist-server/controllers/activity-thread/submit.js.map +1 -0
- package/dist-server/controllers/activity-thread/terminate.js +2 -3
- package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
- package/dist-server/controllers/common.js +24 -1
- package/dist-server/controllers/common.js.map +1 -1
- package/dist-server/service/activity/activity-query.js +1 -1
- package/dist-server/service/activity/activity-query.js.map +1 -1
- package/dist-server/service/activity-approval/activity-approval-mutation.js +79 -0
- package/dist-server/service/activity-approval/activity-approval-mutation.js.map +1 -0
- package/dist-server/service/activity-approval/activity-approval-query.js +128 -0
- package/dist-server/service/activity-approval/activity-approval-query.js.map +1 -0
- package/dist-server/service/activity-approval/activity-approval-type.js +39 -0
- package/dist-server/service/activity-approval/activity-approval-type.js.map +1 -0
- package/dist-server/service/activity-approval/activity-approval.js +135 -0
- package/dist-server/service/activity-approval/activity-approval.js.map +1 -0
- package/dist-server/service/activity-approval/event-subscriber.js +29 -0
- package/dist-server/service/activity-approval/event-subscriber.js.map +1 -0
- package/dist-server/service/activity-approval/index.js +11 -0
- package/dist-server/service/activity-approval/index.js.map +1 -0
- package/dist-server/service/activity-instance/activity-instance-query.js +1 -1
- package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
- package/dist-server/service/activity-template/activity-template-query.js +1 -1
- package/dist-server/service/activity-template/activity-template-query.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-mutation.js +14 -0
- package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-query.js +7 -2
- package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-type.js +1 -23
- package/dist-server/service/activity-thread/activity-thread-type.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread.js +31 -2
- package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/worklist/activity-approval.md +160 -0
- package/package.json +7 -7
- package/server/controllers/activity-approval/abort.ts +33 -0
- package/server/controllers/activity-approval/approve.ts +80 -0
- package/server/controllers/activity-approval/delegate.ts +33 -0
- package/server/controllers/activity-approval/escalate.ts +33 -0
- package/server/controllers/activity-approval/reject.ts +35 -0
- package/server/controllers/activity-instance/abort.ts +2 -4
- package/server/controllers/activity-instance/delegate.ts +2 -4
- package/server/controllers/activity-instance/draft.ts +1 -3
- package/server/controllers/activity-instance/end.ts +2 -4
- package/server/controllers/activity-instance/pick.ts +2 -4
- package/server/controllers/activity-instance/terminate.ts +2 -4
- package/server/controllers/activity-thread/abort.ts +2 -4
- package/server/controllers/activity-thread/delegate.ts +2 -4
- package/server/controllers/activity-thread/end.ts +2 -4
- package/server/controllers/activity-thread/index.ts +1 -0
- package/server/controllers/activity-thread/submit.ts +71 -0
- package/server/controllers/activity-thread/terminate.ts +2 -4
- package/server/controllers/common.ts +28 -0
- package/server/service/activity/activity-query.ts +1 -1
- package/server/service/activity-approval/activity-approval-mutation.ts +71 -0
- package/server/service/activity-approval/activity-approval-query.ts +90 -0
- package/server/service/activity-approval/activity-approval-type.ts +28 -0
- package/server/service/activity-approval/activity-approval.ts +118 -0
- package/server/service/activity-approval/event-subscriber.ts +28 -0
- package/server/service/activity-approval/index.ts +8 -0
- package/server/service/activity-instance/activity-instance-query.ts +1 -1
- package/server/service/activity-template/activity-template-query.ts +1 -1
- package/server/service/activity-thread/activity-thread-mutation.ts +12 -1
- package/server/service/activity-thread/activity-thread-query.ts +7 -2
- package/server/service/activity-thread/activity-thread-type.ts +1 -15
- package/server/service/activity-thread/activity-thread.ts +24 -0
- package/server/service/index.ts +5 -0
- package/things-factory.config.js +4 -1
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +4 -1
- package/translations/zh.json +3 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
import '@operato/input/ox-input-select-buttons.js'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
7
|
+
import { asyncReplace } from 'lit/directives/async-replace.js'
|
|
8
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
9
|
+
|
|
10
|
+
import { DataGrist, getRenderer } from '@operato/data-grist'
|
|
11
|
+
import { client } from '@operato/graphql'
|
|
12
|
+
import { i18next, localize } from '@operato/i18n'
|
|
13
|
+
import { navigate, PageView, store } from '@operato/shell'
|
|
14
|
+
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
15
|
+
import { isMobileDevice, sleep } from '@operato/utils'
|
|
16
|
+
|
|
17
|
+
import { ActivityInstanceStatus, Priorities } from '../../types.js'
|
|
18
|
+
|
|
19
|
+
const MIN = 60
|
|
20
|
+
const HOUR = 60 * MIN
|
|
21
|
+
const DAY = 24 * HOUR
|
|
22
|
+
|
|
23
|
+
const FILTERS = [
|
|
24
|
+
{
|
|
25
|
+
display: 'Important',
|
|
26
|
+
value: 'Important'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
display: 'Imminent',
|
|
30
|
+
value: 'Imminent'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
display: 'Disapproved',
|
|
34
|
+
value: 'Disapproved'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
@customElement('approval-waiting-list-page')
|
|
39
|
+
export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
40
|
+
static styles = [
|
|
41
|
+
ScrollbarStyles,
|
|
42
|
+
CommonGristStyles,
|
|
43
|
+
css`
|
|
44
|
+
:host {
|
|
45
|
+
display: flex;
|
|
46
|
+
|
|
47
|
+
width: 100%;
|
|
48
|
+
|
|
49
|
+
--grid-record-emphasized-background-color: red;
|
|
50
|
+
--grid-record-emphasized-color: yellow;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#modes {
|
|
54
|
+
margin-left: auto;
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
@property({ type: Object }) gristConfig?: any
|
|
60
|
+
@property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
61
|
+
|
|
62
|
+
@query('ox-grist') grist!: DataGrist
|
|
63
|
+
|
|
64
|
+
@state() filters?: string[]
|
|
65
|
+
|
|
66
|
+
get context() {
|
|
67
|
+
return {
|
|
68
|
+
search: {
|
|
69
|
+
handler: (search: string) => {
|
|
70
|
+
this.grist.searchText = search
|
|
71
|
+
},
|
|
72
|
+
placeholder: i18next.t('title.approval waiting list'),
|
|
73
|
+
value: this.grist.searchText
|
|
74
|
+
},
|
|
75
|
+
filter: {
|
|
76
|
+
handler: () => {
|
|
77
|
+
this.grist.toggleHeadroom()
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
help: 'worklist/approval-waiting-list',
|
|
81
|
+
actions: []
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
87
|
+
|
|
88
|
+
return html`
|
|
89
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
90
|
+
<div slot="headroom">
|
|
91
|
+
<div id="filters">
|
|
92
|
+
<ox-input-select-buttons
|
|
93
|
+
.value=${this.filters}
|
|
94
|
+
.options=${FILTERS}
|
|
95
|
+
@change=${(e: CustomEvent) => {
|
|
96
|
+
this.filters = (e.currentTarget as any)?.value
|
|
97
|
+
}}
|
|
98
|
+
multiple
|
|
99
|
+
></ox-input-select-buttons>
|
|
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
|
+
async pageInitialized(lifecycle) {
|
|
113
|
+
this.gristConfig = {
|
|
114
|
+
list: {
|
|
115
|
+
thumbnail: 'thumbnail',
|
|
116
|
+
fields: ['name', 'description'],
|
|
117
|
+
details: ['createdAt', 'due']
|
|
118
|
+
},
|
|
119
|
+
columns: [
|
|
120
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
121
|
+
{
|
|
122
|
+
type: 'gutter',
|
|
123
|
+
gutterName: 'button',
|
|
124
|
+
name: 'start',
|
|
125
|
+
icon: 'play_arrow',
|
|
126
|
+
handlers: {
|
|
127
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
128
|
+
const { id } = record
|
|
129
|
+
this.openActivityApproval(record)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'string',
|
|
135
|
+
name: 'name',
|
|
136
|
+
header: i18next.t('field.name'),
|
|
137
|
+
record: {
|
|
138
|
+
editable: false
|
|
139
|
+
},
|
|
140
|
+
filter: 'search',
|
|
141
|
+
sortable: true,
|
|
142
|
+
width: 150
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: 'string',
|
|
146
|
+
name: 'description',
|
|
147
|
+
header: i18next.t('field.description'),
|
|
148
|
+
record: {
|
|
149
|
+
editable: false
|
|
150
|
+
},
|
|
151
|
+
filter: 'search',
|
|
152
|
+
width: 200
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: 'string',
|
|
156
|
+
name: 'uiSource',
|
|
157
|
+
header: i18next.t('field.ui-source'),
|
|
158
|
+
record: {
|
|
159
|
+
editable: false,
|
|
160
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
161
|
+
const { uiType, uiSource } = record.activity || {}
|
|
162
|
+
var type = uiType !== 'board' ? 'string' : 'board'
|
|
163
|
+
return getRenderer(type)(uiSource, column, record, rowIndex, field)
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
width: 140,
|
|
167
|
+
hidden: true
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'select',
|
|
171
|
+
name: 'priority',
|
|
172
|
+
header: i18next.t('field.priority'),
|
|
173
|
+
record: {
|
|
174
|
+
editable: false,
|
|
175
|
+
options: Priorities
|
|
176
|
+
},
|
|
177
|
+
// filter: true,
|
|
178
|
+
width: 60
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'select',
|
|
182
|
+
name: 'state',
|
|
183
|
+
header: i18next.t('field.status'),
|
|
184
|
+
record: {
|
|
185
|
+
editable: false,
|
|
186
|
+
options: ActivityInstanceStatus
|
|
187
|
+
},
|
|
188
|
+
// filter: true,
|
|
189
|
+
width: 60
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
type: 'datetime',
|
|
193
|
+
name: 'dueAt',
|
|
194
|
+
header: i18next.t('field.due-at'),
|
|
195
|
+
record: {
|
|
196
|
+
editable: false,
|
|
197
|
+
options: {
|
|
198
|
+
year: 'numeric',
|
|
199
|
+
month: 'numeric',
|
|
200
|
+
day: 'numeric'
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
// sortable: true,
|
|
204
|
+
// filter: {
|
|
205
|
+
// type: 'date',
|
|
206
|
+
// operator: 'between'
|
|
207
|
+
// },
|
|
208
|
+
// filter: {
|
|
209
|
+
// type: 'select',
|
|
210
|
+
// operator: 'between',
|
|
211
|
+
// options: (column, owner) => {
|
|
212
|
+
// const now = Date.now()
|
|
213
|
+
// return [
|
|
214
|
+
// {
|
|
215
|
+
// display: '1일 이내 처리',
|
|
216
|
+
// value: [now, Date.now() + 60 * 60 * 3600 * 1000]
|
|
217
|
+
// },
|
|
218
|
+
// {
|
|
219
|
+
// display: '2일 이내 처리',
|
|
220
|
+
// value: [now, Date.now() + 2 * 60 * 60 * 3600 * 1000]
|
|
221
|
+
// },
|
|
222
|
+
// {
|
|
223
|
+
// display: '3일 이내 처리',
|
|
224
|
+
// value: [now, Date.now() + 3 * 60 * 60 * 3600 * 1000]
|
|
225
|
+
// }
|
|
226
|
+
// ]
|
|
227
|
+
// }
|
|
228
|
+
// },
|
|
229
|
+
width: 100
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
type: 'string',
|
|
233
|
+
name: 'dueIn',
|
|
234
|
+
header: i18next.t('field.due-in'),
|
|
235
|
+
record: {
|
|
236
|
+
editable: false,
|
|
237
|
+
renderer: (value, column, record, rowIndex, field) => {
|
|
238
|
+
return html` <span>${asyncReplace(this.dueTimer(record.dueAt))}</span>`
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
sortable: false,
|
|
242
|
+
width: 140
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
type: 'resource-object',
|
|
246
|
+
name: 'creator',
|
|
247
|
+
header: i18next.t('field.issuer'),
|
|
248
|
+
record: {
|
|
249
|
+
editable: false
|
|
250
|
+
},
|
|
251
|
+
sortable: true,
|
|
252
|
+
width: 120
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'datetime',
|
|
256
|
+
name: 'createdAt',
|
|
257
|
+
header: i18next.t('field.posted-at'),
|
|
258
|
+
record: {
|
|
259
|
+
editable: false
|
|
260
|
+
},
|
|
261
|
+
sortable: true,
|
|
262
|
+
filter: false,
|
|
263
|
+
width: 180
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: 'image',
|
|
267
|
+
name: 'thumbnail',
|
|
268
|
+
header: i18next.t('field.thumbnail'),
|
|
269
|
+
record: { editable: false },
|
|
270
|
+
hidden: true
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
rows: {
|
|
274
|
+
appendable: false
|
|
275
|
+
}
|
|
276
|
+
// sorters: [
|
|
277
|
+
// {
|
|
278
|
+
// name: 'dueAt',
|
|
279
|
+
// desc: false
|
|
280
|
+
// }
|
|
281
|
+
// ]
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async pageUpdated(changes, lifecycle, changedBefore) {
|
|
286
|
+
if (this.active) {
|
|
287
|
+
this.grist?.fetch()
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
292
|
+
const response = await client.query({
|
|
293
|
+
query: gql`
|
|
294
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
295
|
+
responses: approvalWaitingList(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
296
|
+
items {
|
|
297
|
+
id
|
|
298
|
+
activityThread {
|
|
299
|
+
activityInstance {
|
|
300
|
+
activityId: id
|
|
301
|
+
name
|
|
302
|
+
description
|
|
303
|
+
priority
|
|
304
|
+
input
|
|
305
|
+
refBy
|
|
306
|
+
activityType
|
|
307
|
+
uiType
|
|
308
|
+
uiSource
|
|
309
|
+
thumbnail
|
|
310
|
+
updatedAt
|
|
311
|
+
createdAt
|
|
312
|
+
creator {
|
|
313
|
+
id
|
|
314
|
+
name
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
state
|
|
318
|
+
output
|
|
319
|
+
dueAt
|
|
320
|
+
assignedAt
|
|
321
|
+
}
|
|
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 || []).map(item => {
|
|
337
|
+
let thread = item.activityThread
|
|
338
|
+
return {
|
|
339
|
+
id: item.id,
|
|
340
|
+
state: thread.state,
|
|
341
|
+
output: thread.output,
|
|
342
|
+
dueAt: thread.dueAt,
|
|
343
|
+
assignedAt: thread.assignedAt,
|
|
344
|
+
...thread.activityInstance
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
openActivityApproval(activityApproval) {
|
|
351
|
+
navigate(`activity-approval/${activityApproval.id}?title=${activityApproval.name}`)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async *dueTimer(exp) {
|
|
355
|
+
while (exp) {
|
|
356
|
+
var secs = Math.round((Number(exp) - Date.now()) / 1000)
|
|
357
|
+
var positive = secs >= 0
|
|
358
|
+
|
|
359
|
+
secs = Math.abs(secs)
|
|
360
|
+
const days = Math.floor(secs / DAY)
|
|
361
|
+
secs -= days * DAY
|
|
362
|
+
const hours = Math.floor(secs / HOUR)
|
|
363
|
+
secs -= hours * HOUR
|
|
364
|
+
const minutes = Math.floor(secs / MIN)
|
|
365
|
+
const seconds = secs - minutes * MIN
|
|
366
|
+
|
|
367
|
+
yield `${positive ? '' : '- '}${days ? `${days}${i18next.t('label.days')} ` : ''}${
|
|
368
|
+
hours ? `${hours}${i18next.t('label.hours')} ` : ''
|
|
369
|
+
}${minutes ? `${minutes}${i18next.t('label.minutes')} ` : ''}`
|
|
370
|
+
|
|
371
|
+
do {
|
|
372
|
+
await sleep(60 * 1000)
|
|
373
|
+
} while (!this.active)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
package/client/route.ts
CHANGED
|
@@ -16,6 +16,10 @@ export default function route(page: string) {
|
|
|
16
16
|
import('./pages/todo/todo-list-page.js')
|
|
17
17
|
return page
|
|
18
18
|
|
|
19
|
+
case 'approval-waiting-list':
|
|
20
|
+
import('./pages/todo/approval-waiting-list-page.js')
|
|
21
|
+
return page
|
|
22
|
+
|
|
19
23
|
case 'draft-list':
|
|
20
24
|
import('./pages/todo/draft-list-page.js')
|
|
21
25
|
return page
|
|
@@ -48,6 +52,10 @@ export default function route(page: string) {
|
|
|
48
52
|
import('./pages/activity-thread/activity-thread-page.js')
|
|
49
53
|
return page
|
|
50
54
|
|
|
55
|
+
case 'activity-approval':
|
|
56
|
+
import('./pages/activity-approval/activity-approval-page.js')
|
|
57
|
+
return page
|
|
58
|
+
|
|
51
59
|
case 'activity-instance-list':
|
|
52
60
|
import('./pages/activity-instance/activity-instance-list-page.js')
|
|
53
61
|
return page
|
|
@@ -63,5 +71,9 @@ export default function route(page: string) {
|
|
|
63
71
|
case 'activity-thread-list':
|
|
64
72
|
import('./pages/activity-thread/activity-thread-list-page.js')
|
|
65
73
|
return page
|
|
74
|
+
|
|
75
|
+
case 'activity-approval-list':
|
|
76
|
+
import('./pages/activity-approval/activity-approval-list-page')
|
|
77
|
+
return page
|
|
66
78
|
}
|
|
67
79
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
export declare class ActivityApprovalImporter extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
activityApprovals: any[];
|
|
6
|
+
columns: {
|
|
7
|
+
list: {
|
|
8
|
+
fields: string[];
|
|
9
|
+
};
|
|
10
|
+
pagination: {
|
|
11
|
+
infinite: boolean;
|
|
12
|
+
};
|
|
13
|
+
columns: {
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
header: string;
|
|
17
|
+
width: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
save(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { property } from 'lit/decorators.js';
|
|
6
|
+
import { client } from '@operato/graphql';
|
|
7
|
+
import { i18next } from '@operato/i18n';
|
|
8
|
+
import { isMobileDevice } from '@operato/utils';
|
|
9
|
+
export class ActivityApprovalImporter extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.activityApprovals = [];
|
|
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: 'checkbox',
|
|
31
|
+
name: 'active',
|
|
32
|
+
header: i18next.t('field.active'),
|
|
33
|
+
width: 60
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return html `
|
|
40
|
+
<ox-grist
|
|
41
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
42
|
+
.config=${this.columns}
|
|
43
|
+
.data=${{
|
|
44
|
+
records: this.activityApprovals
|
|
45
|
+
}}
|
|
46
|
+
></ox-grist>
|
|
47
|
+
|
|
48
|
+
<div class="button-container">
|
|
49
|
+
<mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
async save() {
|
|
54
|
+
var _a;
|
|
55
|
+
const response = await client.mutate({
|
|
56
|
+
mutation: gql `
|
|
57
|
+
mutation importActivityApprovals($activityApprovals: [ActivityApprovalPatch!]!) {
|
|
58
|
+
importActivityApprovals(activityApprovals: $activityApprovals)
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
variables: { activityApprovals: this.activityApprovals }
|
|
62
|
+
});
|
|
63
|
+
if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)
|
|
64
|
+
return;
|
|
65
|
+
this.dispatchEvent(new CustomEvent('imported'));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
ActivityApprovalImporter.styles = [
|
|
69
|
+
css `
|
|
70
|
+
:host {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
|
|
74
|
+
background-color: #fff;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ox-grist {
|
|
78
|
+
flex: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.button-container {
|
|
82
|
+
display: flex;
|
|
83
|
+
margin-left: auto;
|
|
84
|
+
padding: var(--padding-default);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
mwc-button {
|
|
88
|
+
margin-left: var(--margin-default);
|
|
89
|
+
}
|
|
90
|
+
`
|
|
91
|
+
];
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Array }),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], ActivityApprovalImporter.prototype, "activityApprovals", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Object }),
|
|
98
|
+
__metadata("design:type", Object)
|
|
99
|
+
], ActivityApprovalImporter.prototype, "columns", void 0);
|
|
100
|
+
//# sourceMappingURL=activity-approval-importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-approval-importer.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-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,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IAAxD;;QA0B6B,sBAAiB,GAAU,EAAE,CAAA;QAC5B,YAAO,GAAG;YACpC,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,UAAU;oBAChB,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC;oBACjC,KAAK,EAAE,EAAE;iBACV;aACF;SACF,CAAA;IAmCH,CAAC;IAhCC,MAAM;QACJ,OAAO,IAAI,CAAA;;gBAEC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;kBAChC,IAAI,CAAC,OAAO;gBAEpB;YACE,OAAO,EAAE,IAAI,CAAC,iBAAiB;SAEnC;;;;qCAI6B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;;KAEjF,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,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE;SACzD,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;;AAnFM,+BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mEAA8B;AACxD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAuB1B","sourcesContent":["import '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\n\nexport class ActivityApprovalImporter extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n padding: var(--padding-default);\n }\n\n mwc-button {\n margin-left: var(--margin-default);\n }\n `\n ]\n\n @property({ type: Array }) activityApprovals: any[] = []\n @property({ type: Object }) columns = {\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: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n width: 60\n }\n ]\n }\n\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${\n { \n records: this.activityApprovals \n }\n }\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 importActivityApprovals($activityApprovals: [ActivityApprovalPatch!]!) {\n importActivityApprovals(activityApprovals: $activityApprovals)\n }\n `,\n variables: { activityApprovals: this.activityApprovals }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import { PageView } from '@operato/shell';
|
|
3
|
+
import { FetchOption } from '@operato/data-grist';
|
|
4
|
+
import { ActivityApprovalImporter } from './activity-approval-importer';
|
|
5
|
+
declare const ActivityApprovalListPage_base: (new (...args: any[]) => {
|
|
6
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
stateChanged(_state: unknown): void;
|
|
10
|
+
readonly isConnected: boolean;
|
|
11
|
+
}) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
12
|
+
export declare class ActivityApprovalListPage extends ActivityApprovalListPage_base {
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
static get scopedElements(): {
|
|
15
|
+
'activity-approval-importer': typeof ActivityApprovalImporter;
|
|
16
|
+
};
|
|
17
|
+
gristConfig: any;
|
|
18
|
+
mode: 'CARD' | 'GRID' | 'LIST';
|
|
19
|
+
private grist;
|
|
20
|
+
private sortersControl;
|
|
21
|
+
get context(): {
|
|
22
|
+
search: {
|
|
23
|
+
handler: (search: string) => void;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
filter: {
|
|
28
|
+
handler: () => void;
|
|
29
|
+
};
|
|
30
|
+
help: string;
|
|
31
|
+
actions: {
|
|
32
|
+
icon: string;
|
|
33
|
+
emphasis: {
|
|
34
|
+
raised: boolean;
|
|
35
|
+
outlined: boolean;
|
|
36
|
+
dense: boolean;
|
|
37
|
+
danger: boolean;
|
|
38
|
+
};
|
|
39
|
+
title: string;
|
|
40
|
+
action: () => Promise<void>;
|
|
41
|
+
}[];
|
|
42
|
+
exportable: {
|
|
43
|
+
name: string;
|
|
44
|
+
data: () => Promise<{}[]>;
|
|
45
|
+
};
|
|
46
|
+
importable: {
|
|
47
|
+
handler: (records: any) => Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
51
|
+
pageInitialized(lifecycle: any): Promise<void>;
|
|
52
|
+
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
53
|
+
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
54
|
+
total: any;
|
|
55
|
+
records: any;
|
|
56
|
+
}>;
|
|
57
|
+
_deleteActivityApproval(): Promise<void>;
|
|
58
|
+
_updateActivityApproval(): Promise<void>;
|
|
59
|
+
exportHandler(): Promise<{}[]>;
|
|
60
|
+
importHandler(records: any): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export {};
|