@things-factory/worklist-client 8.0.38 → 9.0.0-9.0.0-beta.59.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/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/client/bootstrap.ts +0 -1
- package/client/index.ts +0 -0
- package/client/pages/work-center/work-center-importer.ts +0 -87
- package/client/pages/work-center/work-center-list-page.ts +0 -323
- package/client/pages/work-center/work-center-page.ts +0 -95
- package/client/route.ts +0 -7
- package/client/tsconfig.json +0 -13
- package/server/controllers/activity-registry.ts +0 -17
- package/server/controllers/graphql-client.ts +0 -67
- package/server/controllers/index.ts +0 -4
- package/server/controllers/webhooks/decorators.ts +0 -18
- package/server/controllers/webhooks/index.ts +0 -30
- package/server/controllers/work-center/connect-work-center.ts +0 -15
- package/server/controllers/work-center/get-work-center.ts +0 -9
- package/server/controllers/work-center/index.ts +0 -2
- package/server/controllers/worklist-api/assign-activity-thread.ts +0 -3
- package/server/controllers/worklist-api/draft-activity-instance.ts +0 -3
- package/server/controllers/worklist-api/get-activity-list.ts +0 -3
- package/server/controllers/worklist-api/get-activity.ts +0 -3
- package/server/controllers/worklist-api/get-todo-list.ts +0 -4
- package/server/controllers/worklist-api/index.ts +0 -8
- package/server/controllers/worklist-api/register-activity.ts +0 -3
- package/server/controllers/worklist-api/unregister-activity.ts +0 -3
- package/server/controllers/worklist-api/update-activity.ts +0 -3
- package/server/index.ts +0 -3
- package/server/routes.ts +0 -46
- package/server/service/activity/activity-model-type.ts +0 -106
- package/server/service/activity/activity-mutation.ts +0 -85
- package/server/service/activity/activity-query.ts +0 -64
- package/server/service/activity/activity-type.ts +0 -134
- package/server/service/activity/activity.ts +0 -133
- package/server/service/activity/index.ts +0 -6
- package/server/service/index.ts +0 -36
- package/server/service/work-center/event-subscriber.ts +0 -17
- package/server/service/work-center/index.ts +0 -9
- package/server/service/work-center/work-center-history.ts +0 -120
- package/server/service/work-center/work-center-mutation.ts +0 -198
- package/server/service/work-center/work-center-query.ts +0 -65
- package/server/service/work-center/work-center-type.ts +0 -61
- package/server/service/work-center/work-center.ts +0 -75
- package/server/tsconfig.json +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worklist-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-9.0.0-beta.59.0",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@operato/graphql": "^
|
|
31
|
-
"@operato/shell": "^
|
|
32
|
-
"@things-factory/auth-base": "^
|
|
33
|
-
"@things-factory/oauth2-client": "^
|
|
34
|
-
"@things-factory/shell": "^
|
|
30
|
+
"@operato/graphql": "^9.0.0-beta",
|
|
31
|
+
"@operato/shell": "^9.0.0-beta",
|
|
32
|
+
"@things-factory/auth-base": "^9.0.0-9.0.0-beta.59.0",
|
|
33
|
+
"@things-factory/oauth2-client": "^9.0.0-9.0.0-beta.59.0",
|
|
34
|
+
"@things-factory/shell": "^9.0.0-9.0.0-beta.59.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "cf6ee84b991f469a4e71198b0e6314b45e9e10b8"
|
|
37
37
|
}
|
package/client/bootstrap.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function bootstrap() {}
|
package/client/index.ts
DELETED
|
File without changes
|
|
@@ -1,87 +0,0 @@
|
|
|
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 WorkCenterImporter 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 }) workCenters: 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.workCenters
|
|
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 importWorkCenters($workCenters: [WorkCenterPatch!]!) {
|
|
77
|
-
importWorkCenters(workCenters: $workCenters)
|
|
78
|
-
}
|
|
79
|
-
`,
|
|
80
|
-
variables: { workCenters: this.workCenters }
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
if (response.errors?.length) return
|
|
84
|
-
|
|
85
|
-
this.dispatchEvent(new CustomEvent('imported'))
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import '@operato/data-grist'
|
|
2
|
-
|
|
3
|
-
import { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, 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 { isMobileDevice } from '@operato/utils'
|
|
13
|
-
|
|
14
|
-
import { connect } from 'pwa-helpers/connect-mixin'
|
|
15
|
-
import gql from 'graphql-tag'
|
|
16
|
-
|
|
17
|
-
import { WorkCenterImporter } from './work-center-importer'
|
|
18
|
-
|
|
19
|
-
@customElement('work-center-list-page')
|
|
20
|
-
export class WorkCenterListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
21
|
-
static styles = [
|
|
22
|
-
ScrollbarStyles,
|
|
23
|
-
CommonGristStyles,
|
|
24
|
-
CommonHeaderStyles,
|
|
25
|
-
css`
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
28
|
-
|
|
29
|
-
width: 100%;
|
|
30
|
-
|
|
31
|
-
--grid-record-emphasized-background-color: #8b0000;
|
|
32
|
-
--grid-record-emphasized-color: #ff6b6b;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: auto;
|
|
37
|
-
flex: 1;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
ox-filters-form {
|
|
41
|
-
flex: 1;
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
static get scopedElements() {
|
|
47
|
-
return {
|
|
48
|
-
'work-center-importer': WorkCenterImporter
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@property({ type: Object }) gristConfig: any
|
|
53
|
-
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
54
|
-
|
|
55
|
-
@query('ox-grist') private grist!: DataGrist
|
|
56
|
-
|
|
57
|
-
get context() {
|
|
58
|
-
return {
|
|
59
|
-
title: i18next.t('title.work-center list'),
|
|
60
|
-
search: {
|
|
61
|
-
handler: (search: string) => {
|
|
62
|
-
this.grist.searchText = search
|
|
63
|
-
},
|
|
64
|
-
value: this.grist?.searchText || ''
|
|
65
|
-
},
|
|
66
|
-
filter: {
|
|
67
|
-
handler: () => {
|
|
68
|
-
this.grist.toggleHeadroom()
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
help: 'worklist-client/work-center',
|
|
72
|
-
actions: [
|
|
73
|
-
{
|
|
74
|
-
title: i18next.t('button.save'),
|
|
75
|
-
action: this._updateWorkCenter.bind(this),
|
|
76
|
-
...CommonButtonStyles.save
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
title: i18next.t('button.delete'),
|
|
80
|
-
action: this._deleteWorkCenter.bind(this),
|
|
81
|
-
...CommonButtonStyles.delete
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
exportable: {
|
|
85
|
-
name: i18next.t('title.work-center list'),
|
|
86
|
-
data: this.exportHandler.bind(this)
|
|
87
|
-
},
|
|
88
|
-
importable: {
|
|
89
|
-
handler: this.importHandler.bind(this)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
render() {
|
|
95
|
-
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
96
|
-
|
|
97
|
-
return html`
|
|
98
|
-
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
99
|
-
<div slot="headroom" class="header">
|
|
100
|
-
<div class="filters">
|
|
101
|
-
<ox-filters-form autofocus></ox-filters-form>
|
|
102
|
-
|
|
103
|
-
<div id="modes">
|
|
104
|
-
<md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
|
|
105
|
-
<md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
|
|
106
|
-
<md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</ox-grist>
|
|
111
|
-
`
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
async pageInitialized(lifecycle: any) {
|
|
115
|
-
this.gristConfig = {
|
|
116
|
-
list: {
|
|
117
|
-
fields: ['name', 'description'],
|
|
118
|
-
details: ['active', 'updatedAt']
|
|
119
|
-
},
|
|
120
|
-
columns: [
|
|
121
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
122
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
123
|
-
{
|
|
124
|
-
type: 'string',
|
|
125
|
-
name: 'name',
|
|
126
|
-
header: i18next.t('field.name'),
|
|
127
|
-
record: {
|
|
128
|
-
editable: true
|
|
129
|
-
},
|
|
130
|
-
filter: 'search',
|
|
131
|
-
sortable: true,
|
|
132
|
-
width: 150
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
type: 'string',
|
|
136
|
-
name: 'description',
|
|
137
|
-
header: i18next.t('field.description'),
|
|
138
|
-
record: {
|
|
139
|
-
editable: true
|
|
140
|
-
},
|
|
141
|
-
filter: 'search',
|
|
142
|
-
width: 200
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
type: 'checkbox',
|
|
146
|
-
name: 'active',
|
|
147
|
-
label: true,
|
|
148
|
-
header: i18next.t('field.active'),
|
|
149
|
-
record: {
|
|
150
|
-
editable: true
|
|
151
|
-
},
|
|
152
|
-
filter: true,
|
|
153
|
-
sortable: true,
|
|
154
|
-
width: 60
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
type: 'resource-object',
|
|
158
|
-
name: 'updater',
|
|
159
|
-
header: i18next.t('field.updater'),
|
|
160
|
-
record: {
|
|
161
|
-
editable: false
|
|
162
|
-
},
|
|
163
|
-
sortable: true,
|
|
164
|
-
width: 120
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
type: 'datetime',
|
|
168
|
-
name: 'updatedAt',
|
|
169
|
-
header: i18next.t('field.updated_at'),
|
|
170
|
-
record: {
|
|
171
|
-
editable: false
|
|
172
|
-
},
|
|
173
|
-
sortable: true,
|
|
174
|
-
width: 180
|
|
175
|
-
}
|
|
176
|
-
],
|
|
177
|
-
rows: {
|
|
178
|
-
selectable: {
|
|
179
|
-
multiple: true
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
sorters: [
|
|
183
|
-
{
|
|
184
|
-
name: 'name'
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
async pageUpdated(changes: any, lifecycle: any) {
|
|
191
|
-
if (this.active) {
|
|
192
|
-
// do something here when this page just became as active
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
197
|
-
const response = await client.query({
|
|
198
|
-
query: gql`
|
|
199
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
200
|
-
responses: workCenters(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
201
|
-
items {
|
|
202
|
-
id
|
|
203
|
-
name
|
|
204
|
-
description
|
|
205
|
-
active
|
|
206
|
-
updater {
|
|
207
|
-
id
|
|
208
|
-
name
|
|
209
|
-
}
|
|
210
|
-
updatedAt
|
|
211
|
-
}
|
|
212
|
-
total
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
`,
|
|
216
|
-
variables: {
|
|
217
|
-
filters,
|
|
218
|
-
pagination: { page, limit },
|
|
219
|
-
sortings
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
return {
|
|
224
|
-
total: response.data.responses.total || 0,
|
|
225
|
-
records: response.data.responses.items || []
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
async _deleteWorkCenter() {
|
|
230
|
-
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
231
|
-
const ids = this.grist.selected.map(record => record.id)
|
|
232
|
-
if (ids && ids.length > 0) {
|
|
233
|
-
const response = await client.mutate({
|
|
234
|
-
mutation: gql`
|
|
235
|
-
mutation ($ids: [String!]!) {
|
|
236
|
-
deleteWorkCenters(ids: $ids)
|
|
237
|
-
}
|
|
238
|
-
`,
|
|
239
|
-
variables: {
|
|
240
|
-
ids
|
|
241
|
-
}
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
if (!response.errors) {
|
|
245
|
-
this.grist.fetch()
|
|
246
|
-
notify({
|
|
247
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
248
|
-
})
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
async _updateWorkCenter() {
|
|
255
|
-
let patches = this.grist.dirtyRecords
|
|
256
|
-
if (patches && patches.length) {
|
|
257
|
-
patches = patches.map(patch => {
|
|
258
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
259
|
-
const dirtyFields = patch.__dirtyfields__
|
|
260
|
-
for (let key in dirtyFields) {
|
|
261
|
-
patchField[key] = dirtyFields[key].after
|
|
262
|
-
}
|
|
263
|
-
patchField.cuFlag = patch.__dirty__
|
|
264
|
-
|
|
265
|
-
return patchField
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
const response = await client.mutate({
|
|
269
|
-
mutation: gql`
|
|
270
|
-
mutation ($patches: [WorkCenterPatch!]!) {
|
|
271
|
-
updateMultipleWorkCenter(patches: $patches) {
|
|
272
|
-
name
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
`,
|
|
276
|
-
variables: {
|
|
277
|
-
patches
|
|
278
|
-
}
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
if (!response.errors) {
|
|
282
|
-
this.grist.fetch()
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async exportHandler() {
|
|
288
|
-
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
289
|
-
const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
|
|
290
|
-
|
|
291
|
-
return exportTargets.map(workCenter => {
|
|
292
|
-
let tempObj = {}
|
|
293
|
-
for (const field of targetFieldSet) {
|
|
294
|
-
tempObj[field] = workCenter[field]
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return tempObj
|
|
298
|
-
})
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
async importHandler(records) {
|
|
302
|
-
const popup = openPopup(
|
|
303
|
-
html`
|
|
304
|
-
<work-center-importer
|
|
305
|
-
.workCenters=${records}
|
|
306
|
-
@imported=${() => {
|
|
307
|
-
history.back()
|
|
308
|
-
this.grist.fetch()
|
|
309
|
-
}}
|
|
310
|
-
></work-center-importer>
|
|
311
|
-
`,
|
|
312
|
-
{
|
|
313
|
-
backdrop: true,
|
|
314
|
-
size: 'large',
|
|
315
|
-
title: i18next.t('title.import work-center')
|
|
316
|
-
}
|
|
317
|
-
)
|
|
318
|
-
|
|
319
|
-
popup.onclosed = () => {
|
|
320
|
-
this.grist.fetch()
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { PropertyValues, html, css } from 'lit'
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
4
|
-
import { store, PageView } from '@operato/shell'
|
|
5
|
-
|
|
6
|
-
const logo = new URL('/assets/images/gangsters-512x512.png', import.meta.url).href
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 이 페이지는 Operato-Gangsters에 대한 설정 및 관리, 대시보드 페이지이다.
|
|
10
|
-
* - 연결 상태를 확인한다.
|
|
11
|
-
* - 클라이언트들에 의해서 등록된 Activity들을 확인한다. (예를 들면, 회의록 작성, CVR 작성, 견적서 작성 등)
|
|
12
|
-
* - 기본 대시보드를 제공한다. (Activity 처리 월별 추이, 현재 액티비티 상태별 현황, TOP 5s, Organization 현황)
|
|
13
|
-
* - 관리 기능..
|
|
14
|
-
*/
|
|
15
|
-
@customElement('work-center-page')
|
|
16
|
-
export class WorkCenterPage extends connect(store)(PageView) {
|
|
17
|
-
static styles = [
|
|
18
|
-
css`
|
|
19
|
-
:host {
|
|
20
|
-
display: block;
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
render() {
|
|
26
|
-
return html` <img src=${logo} /> `
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
updated(changes: PropertyValues<this>) {}
|
|
30
|
-
|
|
31
|
-
stateChanged(state: any) {}
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* page lifecycle
|
|
35
|
-
*
|
|
36
|
-
* - pageInitialized(lifecycle)
|
|
37
|
-
* - pageUpdated(changes, lifecycle, changedBefore)
|
|
38
|
-
* - pageDisposed(lifecycle)
|
|
39
|
-
*
|
|
40
|
-
* lifecycle value has
|
|
41
|
-
* - active : this page is activated
|
|
42
|
-
* - page : first path of href
|
|
43
|
-
* - resourceId : second path of href
|
|
44
|
-
* - params : search params object of href
|
|
45
|
-
* - initialized : initialized state of this page
|
|
46
|
-
*
|
|
47
|
-
* you can update lifecycle values, or add custom values
|
|
48
|
-
* by calling this.pageUpdate({ ...values }, force)
|
|
49
|
-
* If lifecycle values changed by this.pageUpdate(...),
|
|
50
|
-
* this.pageUpdated(...) will be called back right after.
|
|
51
|
-
* If you want to invoke this.pageUpdated(...) callback,
|
|
52
|
-
* set force argument to true.
|
|
53
|
-
*
|
|
54
|
-
* you can re-initialize this page
|
|
55
|
-
* by calling this.pageReset().
|
|
56
|
-
* this.pageInitialized(...) followed by this.pageDisposed(...) will be invoked
|
|
57
|
-
* by calling this.pageReset().
|
|
58
|
-
*
|
|
59
|
-
* you can invoke this.pageDisposed()
|
|
60
|
-
* by calling this.pageDispose()
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
pageInitialized(lifecycle: any) {
|
|
64
|
-
/*
|
|
65
|
-
* This page is initialized.
|
|
66
|
-
* It's right time to configure of this page.
|
|
67
|
-
*
|
|
68
|
-
* - called before when this page activated first
|
|
69
|
-
* - called when i18next resource is updated (loaded, changed, ..)
|
|
70
|
-
* - called right after this.pageReset()
|
|
71
|
-
*/
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
pageUpdated(changes: any, lifecycle: any, before: any) {
|
|
75
|
-
if (this.active) {
|
|
76
|
-
/*
|
|
77
|
-
* this page is activated
|
|
78
|
-
*/
|
|
79
|
-
} else {
|
|
80
|
-
/* this page is deactivated */
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
pageDisposed(lifecycle: any) {
|
|
85
|
-
/*
|
|
86
|
-
* This page is disposed.
|
|
87
|
-
* It's right time to release system resources.
|
|
88
|
-
*
|
|
89
|
-
* - called just before (re)pageInitialized
|
|
90
|
-
* - called right after when i18next resource updated (loaded, changed, ..)
|
|
91
|
-
* - called right after this.pageReset()
|
|
92
|
-
* - called right after this.pageDispose()
|
|
93
|
-
*/
|
|
94
|
-
}
|
|
95
|
-
}
|
package/client/route.ts
DELETED
package/client/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig-base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"experimentalDecorators": true,
|
|
5
|
-
"skipLibCheck": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"module": "esnext",
|
|
9
|
-
"outDir": "../dist-client",
|
|
10
|
-
"baseUrl": "./"
|
|
11
|
-
},
|
|
12
|
-
"include": ["./**/*"]
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Activity } from '../service/activity/activity'
|
|
2
|
-
|
|
3
|
-
export class ActivityRegistry {
|
|
4
|
-
static registry = new Map<string, Activity>()
|
|
5
|
-
|
|
6
|
-
static set(id: string, activity: Activity) {
|
|
7
|
-
ActivityRegistry.registry.set(id, activity)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
static get(id: string) {
|
|
11
|
-
return ActivityRegistry.get(id)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static list(): Activity[] {
|
|
15
|
-
return ActivityRegistry.list()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import 'cross-fetch/polyfill'
|
|
2
|
-
|
|
3
|
-
import { ApolloClient, ApolloLink, from, HttpLink, InMemoryCache } from '@apollo/client/core'
|
|
4
|
-
import { onError } from '@apollo/client/link/error'
|
|
5
|
-
import { Oauth2Client } from '@things-factory/oauth2-client'
|
|
6
|
-
import { getRepository } from '@things-factory/shell'
|
|
7
|
-
import { config, logger } from '@things-factory/env'
|
|
8
|
-
|
|
9
|
-
const defaultOptions: any = {
|
|
10
|
-
watchQuery: {
|
|
11
|
-
fetchPolicy: 'no-cache',
|
|
12
|
-
errorPolicy: 'ignore'
|
|
13
|
-
},
|
|
14
|
-
query: {
|
|
15
|
-
fetchPolicy: 'no-cache', //'network-only'
|
|
16
|
-
errorPolicy: 'all'
|
|
17
|
-
},
|
|
18
|
-
mutate: {
|
|
19
|
-
errorPolicy: 'all'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const cache = new InMemoryCache({
|
|
24
|
-
addTypename: false
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const uri = config.get('worklist/endpoint', 'https://gangsters.hatiolab.com/graphql')
|
|
28
|
-
|
|
29
|
-
export async function connect() {
|
|
30
|
-
var ERROR_HANDLER: any = ({ graphQLErrors, networkError }) => {
|
|
31
|
-
if (graphQLErrors)
|
|
32
|
-
graphQLErrors.map(({ message, locations, path }) => {
|
|
33
|
-
logger.error(`[GraphQL error] Message: ${message}, Location: ${locations}, Path: ${path}`)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
if (networkError) {
|
|
37
|
-
logger.error(`[Network error - ${networkError.statusCode}] ${networkError}`)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const oauth2Client: Oauth2Client = await getRepository(Oauth2Client).findOneBy({ name: 'WORKLIST' })
|
|
42
|
-
|
|
43
|
-
const authMiddleware = new ApolloLink((operation, forward) => {
|
|
44
|
-
// add the authorization to the headers
|
|
45
|
-
operation.setContext(({ headers = {} }) => ({
|
|
46
|
-
headers: {
|
|
47
|
-
...headers,
|
|
48
|
-
...oauth2Client.getAuthHeaders()
|
|
49
|
-
}
|
|
50
|
-
}))
|
|
51
|
-
|
|
52
|
-
return forward(operation)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return new ApolloClient({
|
|
56
|
-
defaultOptions,
|
|
57
|
-
cache,
|
|
58
|
-
link: from([
|
|
59
|
-
authMiddleware,
|
|
60
|
-
onError(ERROR_HANDLER),
|
|
61
|
-
new HttpLink({
|
|
62
|
-
uri,
|
|
63
|
-
credentials: 'include'
|
|
64
|
-
})
|
|
65
|
-
])
|
|
66
|
-
})
|
|
67
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { WorkCenter } from '../../service/work-center/work-center'
|
|
2
|
-
|
|
3
|
-
export const webhook = (target: Object, property: string, descriptor: TypedPropertyDescriptor<any>): any => {
|
|
4
|
-
const method = descriptor.value
|
|
5
|
-
|
|
6
|
-
descriptor.value = async function (request) {
|
|
7
|
-
const WorklistWebhook = this
|
|
8
|
-
|
|
9
|
-
var m = WorklistWebhook.handlers[method.name]
|
|
10
|
-
if (!m) {
|
|
11
|
-
throw Error(`Worklist Webhook doesn't have the handler ${method.name}`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return await m.apply(this, [request])
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return descriptor
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getRepository } from '@things-factory/shell'
|
|
2
|
-
|
|
3
|
-
import { WorkCenter } from '../../service/work-center/work-center'
|
|
4
|
-
import { webhook } from './decorators'
|
|
5
|
-
|
|
6
|
-
export class WorklistWebhook {
|
|
7
|
-
static handlers = {}
|
|
8
|
-
|
|
9
|
-
static registerHandlers(handlers) {
|
|
10
|
-
WorklistWebhook.handlers = handlers
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static async getWorkCenter(id: string) {
|
|
14
|
-
return await getRepository(WorkCenter).findOne({
|
|
15
|
-
where: { workCenterId: id }
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@webhook
|
|
20
|
-
static echo(center, req): any {}
|
|
21
|
-
|
|
22
|
-
@webhook
|
|
23
|
-
static onActivityApprovalUpdated(center, req): any {}
|
|
24
|
-
|
|
25
|
-
@webhook
|
|
26
|
-
static onActivityThreadUpdated(center, req): any {}
|
|
27
|
-
|
|
28
|
-
@webhook
|
|
29
|
-
static onActivityInstanceUpdated(center, req): any {}
|
|
30
|
-
}
|