@things-factory/worklist 10.1.5 → 10.1.7

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.
Files changed (130) hide show
  1. package/dist-client/components/activity-approval-ribon.js +17 -2
  2. package/dist-client/components/activity-approval-ribon.js.map +1 -1
  3. package/dist-client/components/activity-instance-preview.js +5 -4
  4. package/dist-client/components/activity-instance-preview.js.map +1 -1
  5. package/dist-client/components/activity-starter-form.js +14 -10
  6. package/dist-client/components/activity-starter-form.js.map +1 -1
  7. package/dist-client/components/activity-thread-timeline.d.ts +2 -2
  8. package/dist-client/components/decision-slots.d.ts +118 -0
  9. package/dist-client/components/decision-slots.js +125 -0
  10. package/dist-client/components/decision-slots.js.map +1 -0
  11. package/dist-client/components/mutation-outcome.d.ts +57 -0
  12. package/dist-client/components/mutation-outcome.js +78 -0
  13. package/dist-client/components/mutation-outcome.js.map +1 -0
  14. package/dist-client/components/say-outcome.d.ts +25 -0
  15. package/dist-client/components/say-outcome.js +51 -0
  16. package/dist-client/components/say-outcome.js.map +1 -0
  17. package/dist-client/pages/activity/activity-list-page.js +28 -12
  18. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  19. package/dist-client/pages/activity/activity-model-item-list.js +4 -3
  20. package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
  21. package/dist-client/pages/activity/activity-page.d.ts +2 -2
  22. package/dist-client/pages/activity/activity-page.js +25 -21
  23. package/dist-client/pages/activity/activity-page.js.map +1 -1
  24. package/dist-client/pages/activity-approval/activity-approval-importer.js +4 -3
  25. package/dist-client/pages/activity-approval/activity-approval-importer.js.map +1 -1
  26. package/dist-client/pages/activity-approval/activity-approval-list-page.js +8 -9
  27. package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -1
  28. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +75 -1
  29. package/dist-client/pages/activity-approval/activity-approval-page.js +487 -57
  30. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  31. package/dist-client/pages/activity-catalog/activity-catalog-page.d.ts +11 -0
  32. package/dist-client/pages/activity-catalog/activity-catalog-page.js +48 -1
  33. package/dist-client/pages/activity-catalog/activity-catalog-page.js.map +1 -1
  34. package/dist-client/pages/activity-instance/activity-instance-start-page.js +24 -18
  35. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  36. package/dist-client/pages/activity-instance/activity-instance-view.js +1 -0
  37. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
  38. package/dist-client/pages/activity-stats/activity-stats-importer.js +4 -3
  39. package/dist-client/pages/activity-stats/activity-stats-importer.js.map +1 -1
  40. package/dist-client/pages/activity-stats/activity-stats-list-page.js +8 -9
  41. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -1
  42. package/dist-client/pages/activity-template/activity-template-importer.js +4 -3
  43. package/dist-client/pages/activity-template/activity-template-importer.js.map +1 -1
  44. package/dist-client/pages/activity-template/activity-template-list-page.js +8 -9
  45. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  46. package/dist-client/pages/activity-template/activity-template-model-item-list.js +4 -3
  47. package/dist-client/pages/activity-template/activity-template-model-item-list.js.map +1 -1
  48. package/dist-client/pages/activity-thread/activity-thread-importer.js +4 -3
  49. package/dist-client/pages/activity-thread/activity-thread-importer.js.map +1 -1
  50. package/dist-client/pages/activity-thread/activity-thread-list-page.js +8 -9
  51. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  52. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -1
  53. package/dist-client/pages/activity-thread/activity-thread-page.js +22 -20
  54. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  55. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +1 -1
  56. package/dist-client/pages/activity-thread/activity-thread-view-page.js +1 -0
  57. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  58. package/dist-client/pages/activity-thread/activity-thread-view.d.ts +1 -1
  59. package/dist-client/pages/installable-activity/installable-activity-list-page.d.ts +27 -0
  60. package/dist-client/pages/installable-activity/installable-activity-list-page.js +70 -11
  61. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  62. package/dist-client/pages/todo/draft-list-page.js +1 -0
  63. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  64. package/dist-client/route.d.ts +1 -1
  65. package/dist-client/tsconfig.tsbuildinfo +1 -1
  66. package/dist-server/controllers/activity-approval/approval-line.d.ts +32 -0
  67. package/dist-server/controllers/activity-approval/approval-line.js +35 -0
  68. package/dist-server/controllers/activity-approval/approval-line.js.map +1 -1
  69. package/dist-server/controllers/activity-approval/approve.js +17 -0
  70. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  71. package/dist-server/controllers/activity-approval/reject.js +21 -1
  72. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  73. package/dist-server/controllers/activity-installation/activity-installation-controller.js +5 -9
  74. package/dist-server/controllers/activity-installation/activity-installation-controller.js.map +1 -1
  75. package/dist-server/controllers/activity-installation/installable-to-activity.d.ts +62 -0
  76. package/dist-server/controllers/activity-installation/installable-to-activity.js +53 -0
  77. package/dist-server/controllers/activity-installation/installable-to-activity.js.map +1 -0
  78. package/dist-server/controllers/activity-installation/registry-conflict.d.ts +32 -0
  79. package/dist-server/controllers/activity-installation/registry-conflict.js +21 -0
  80. package/dist-server/controllers/activity-installation/registry-conflict.js.map +1 -0
  81. package/dist-server/controllers/activity-instance/draft.js +3 -0
  82. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  83. package/dist-server/controllers/activity-instance/entitlement.d.ts +25 -0
  84. package/dist-server/controllers/activity-instance/entitlement.js +108 -0
  85. package/dist-server/controllers/activity-instance/entitlement.js.map +1 -0
  86. package/dist-server/controllers/activity-instance/issue.js +10 -0
  87. package/dist-server/controllers/activity-instance/issue.js.map +1 -1
  88. package/dist-server/controllers/activity-instance/pick.js +8 -0
  89. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  90. package/dist-server/service/activity/activity-decision-key-item-type.d.ts +160 -0
  91. package/dist-server/service/activity/activity-decision-key-item-type.js +176 -0
  92. package/dist-server/service/activity/activity-decision-key-item-type.js.map +1 -0
  93. package/dist-server/service/activity/activity-type.d.ts +3 -0
  94. package/dist-server/service/activity/activity-type.js +8 -0
  95. package/dist-server/service/activity/activity-type.js.map +1 -1
  96. package/dist-server/service/activity/activity.d.ts +30 -0
  97. package/dist-server/service/activity/activity.js +14 -0
  98. package/dist-server/service/activity/activity.js.map +1 -1
  99. package/dist-server/service/activity/decision-key-declaration.d.ts +33 -0
  100. package/dist-server/service/activity/decision-key-declaration.js +67 -0
  101. package/dist-server/service/activity/decision-key-declaration.js.map +1 -0
  102. package/dist-server/service/activity/{credential-guard-subscriber.d.ts → declaration-guard-subscriber.d.ts} +6 -1
  103. package/dist-server/service/activity/declaration-guard-subscriber.js +46 -0
  104. package/dist-server/service/activity/declaration-guard-subscriber.js.map +1 -0
  105. package/dist-server/service/activity/index.d.ts +2 -2
  106. package/dist-server/service/activity/index.js +2 -2
  107. package/dist-server/service/activity/index.js.map +1 -1
  108. package/dist-server/service/activity/search-key-declaration.d.ts +38 -0
  109. package/dist-server/service/activity/search-key-declaration.js +49 -0
  110. package/dist-server/service/activity/search-key-declaration.js.map +1 -0
  111. package/dist-server/service/activity-instance/activity-instance-mutation.js +20 -9
  112. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  113. package/dist-server/service/activity-instance/activity-instance-query.js +25 -2
  114. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  115. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  116. package/dist-server/service/index.d.ts +2 -2
  117. package/dist-server/service/installable-activity/installable-activity-mutation.js +24 -0
  118. package/dist-server/service/installable-activity/installable-activity-mutation.js.map +1 -1
  119. package/dist-server/service/installable-activity/installable-activity.d.ts +9 -0
  120. package/dist-server/service/installable-activity/installable-activity.js +5 -0
  121. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  122. package/dist-server/tsconfig.tsbuildinfo +1 -1
  123. package/package.json +11 -11
  124. package/translations/en.json +33 -6
  125. package/translations/ja.json +27 -0
  126. package/translations/ko.json +33 -6
  127. package/translations/ms.json +27 -0
  128. package/translations/zh.json +27 -0
  129. package/dist-server/service/activity/credential-guard-subscriber.js +0 -35
  130. package/dist-server/service/activity/credential-guard-subscriber.js.map +0 -1
@@ -7,6 +7,7 @@ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
7
7
  import { customElement, property, query } from 'lit/decorators.js';
8
8
  import { client } from '@operato/graphql';
9
9
  import { i18next, localize } from '@operato/i18n';
10
+ import { ranMutation } from '../../components/say-outcome.js';
10
11
  import { PageView } from '@operato/shell';
11
12
  import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles';
12
13
  import { provider } from '@things-factory/board-ui/dist-client/board-provider.js';
@@ -237,7 +238,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
237
238
  if (uiType === 'board') {
238
239
  output = this.getOutputFromBoard();
239
240
  }
240
- const response = await client.mutate({ mutation: gql `
241
+ const outcome = await ranMutation(() => client.mutate({ mutation: gql `
241
242
  mutation ($id: String!, $output: Object) { startActivityInstance(id: $id, output: $output) { name
242
243
  }
243
244
  }
@@ -245,20 +246,21 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
245
246
  variables: { id,
246
247
  output
247
248
  }
248
- });
249
- if (!response.errors) {
250
- await this.fetchActivityInstance(this.activityInstance.id);
251
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')
252
- }
253
- }));
249
+ }));
250
+ if (!outcome.ok) {
251
+ return;
254
252
  }
253
+ await this.fetchActivityInstance(this.activityInstance.id);
254
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')
255
+ }
256
+ }));
255
257
  }
256
258
  async _saveActivityInstance() {
257
259
  var { id, output, reason, uiType } = this.activityInstance;
258
260
  if (uiType === 'board') {
259
261
  output = this.getOutputFromBoard();
260
262
  }
261
- const response = await client.mutate({ mutation: gql `
263
+ const outcome = await ranMutation(() => client.mutate({ mutation: gql `
262
264
  mutation ($id: String!, $save: ActivityInstanceSave!) { draftActivityInstance(id: $id, save: $save) { id
263
265
  name
264
266
  description
@@ -289,20 +291,21 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
289
291
  save: { output
290
292
  }
291
293
  }
292
- });
293
- if (!response.errors) {
294
- this.activityInstance = response.data.saveActivityInstance;
295
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')
296
- }
297
- }));
294
+ }));
295
+ if (!outcome.ok) {
296
+ return;
298
297
  }
298
+ this.activityInstance = outcome.data.saveActivityInstance;
299
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')
300
+ }
301
+ }));
299
302
  }
300
303
  async _endActivityInstance() {
301
304
  var { id, output, reason, uiType } = this.activityInstance;
302
305
  if (uiType === 'board') {
303
306
  output = this.getOutputFromBoard();
304
307
  }
305
- const response = await client.mutate({ mutation: gql `
308
+ const outcome = await ranMutation(() => client.mutate({ mutation: gql `
306
309
  mutation ($id: String!, $output: Object, $reason: String) { endActivityInstance(id: $id, output: $output, reason: $reason) { id
307
310
  name
308
311
  description
@@ -333,13 +336,14 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
333
336
  output,
334
337
  reason
335
338
  }
336
- });
337
- if (!response.errors) {
338
- this.activityInstance = response.data.endActivityInstance;
339
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')
340
- }
341
- }));
339
+ }));
340
+ if (!outcome.ok) {
341
+ return;
342
342
  }
343
+ this.activityInstance = outcome.data.endActivityInstance;
344
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')
345
+ }
346
+ }));
343
347
  }
344
348
  };
345
349
  __decorate([
@@ -1 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AAC;QAEE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAQ,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BvD;YACD,SAAS,EAAE,EAAU,EAAE;gBACrB,MAAM;gBACN,MAAM;aACZ;SACA,CAAC,CAAA;QAEC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAAO,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAA;YAErF,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAY,MAAM,EAAE,EAAc,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC;iBAC1H;aACA,CAAC,CACI,CAAA;QACN,CAAC;IACD,CAAC;;AA/S4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAAW;AAsIZ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AAjK/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA0UxB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui/dist-client/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat { try { const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) { console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = { Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) { static styles = [\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] { display: block;\n padding: 5px;\n }\n\n [content] { flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer { width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityInstance: any\n @property({ type: Object }) board: any\n\n get context() { const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && { title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && { title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && { title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() { const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() { switch (this.activityInstance?.uiType) { case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() { const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n getOutputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n generatedContent() { var { input, output } = this.activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) { output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => { inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() { const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) { this.board = { id: boardId\n }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() { const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => { output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) { if (changes.has('activityInstance')) { this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active) { this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) { const response = await client.query({ query: gql`\n query activityInstance($id: String!) { activityInstance(id: $id) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n }\n\n async _startActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object) { startActivityInstance(id: $id, output: $output) { name\n }\n }\n `,\n variables: { id,\n output\n }\n })\n\n if (!response.errors) { await this.fetchActivityInstance(this.activityInstance.id)\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) { draftActivityInstance(id: $id, save: $save) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n save: { output\n }\n }\n })\n\n if (!response.errors) { this.activityInstance = response.data.saveActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n\n async _endActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) { endActivityInstance(id: $id, output: $output, reason: $reason) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n output,\n reason\n }\n })\n\n if (!response.errors) { this.activityInstance = response.data.endActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-page.js","sourceRoot":"","sources":["../../../client/pages/activity/activity-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAA;AAEjF,SAAS,gBAAgB,CAAC,MAAc,EAAE,OAAmC;IAA2B,IAAI,CAAC;QAAK,MAAM,UAAU,GAAG,MAAM,IAAI,OAAO,CAAA;QAClJ,OAAO,IAAI,IAAI,CA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C;;2CAAW;AAsIZ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AAjK/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAgVxB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ranMutation } from '../../components/say-outcome.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui/dist-client/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat { try { const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) { console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = { Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) { static styles = [\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] { display: block;\n padding: 5px;\n }\n\n [content] { flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer { width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityInstance: any\n @property({ type: Object }) board: any\n\n get context() { const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && { title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && { title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && { title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() { const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() { switch (this.activityInstance?.uiType) { case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() { const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n getOutputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n generatedContent() { var { input, output } = this.activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) { output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => { inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() { const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) { this.board = { id: boardId\n }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() { const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => { output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) { if (changes.has('activityInstance')) { this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active) { this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) { const response = await client.query({ query: gql`\n query activityInstance($id: String!) { activityInstance(id: $id) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n }\n\n async _startActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object) { startActivityInstance(id: $id, output: $output) { name\n }\n }\n `,\n variables: { id,\n output\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n await this.fetchActivityInstance(this.activityInstance.id)\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n\n async _saveActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) { draftActivityInstance(id: $id, save: $save) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n save: { output\n }\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n this.activityInstance = outcome.data.saveActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n\n async _endActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) { endActivityInstance(id: $id, output: $output, reason: $reason) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n output,\n reason\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n this.activityInstance = outcome.data.endActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n}\n"]}
@@ -6,6 +6,7 @@ import { css, html, LitElement } from 'lit';
6
6
  import { property } from 'lit/decorators.js';
7
7
  import { client } from '@operato/graphql';
8
8
  import { i18next } from '@operato/i18n';
9
+ import { ranMutation } from '../../components/say-outcome.js';
9
10
  import { isMobileDevice } from '@operato/utils';
10
11
  import { CommonHeaderStyles } from '@operato/styles';
11
12
  export class ActivityApprovalImporter extends LitElement {
@@ -69,15 +70,15 @@ export class ActivityApprovalImporter extends LitElement {
69
70
  `;
70
71
  }
71
72
  async save() {
72
- const response = await client.mutate({
73
+ const outcome = await ranMutation(() => client.mutate({
73
74
  mutation: gql `
74
75
  mutation importActivityApprovals($activityApprovals: [ActivityApprovalPatch!]!) {
75
76
  importActivityApprovals(activityApprovals: $activityApprovals)
76
77
  }
77
78
  `,
78
79
  variables: { activityApprovals: this.activityApprovals }
79
- });
80
- if (response.errors?.length)
80
+ }));
81
+ if (!outcome.ok)
81
82
  return;
82
83
  this.dispatchEvent(new CustomEvent('imported'));
83
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"activity-approval-importer.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-importer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IAAxD;;QAiB6B,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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AAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mEAA8B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAuB1B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@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'\nimport { CommonHeaderStyles } from '@operato/styles'\n\nexport class ActivityApprovalImporter extends LitElement {\n static styles = [\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n ox-grist {\n flex: 1;\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 render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{\n records: this.activityApprovals\n }}\n ></ox-grist>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</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"]}
1
+ {"version":3,"file":"activity-approval-importer.js","sourceRoot":"","sources":["../../../client/pages/activity-approval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BAAkB;QAClB,GAAG,CAAA;;;;;;;;;;;KAWF;KACF,AAdY,CAcZ;IA4BD,MAAM;QACJ,OAAO,IAAI,CAAA;;gBAEC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;kBAChC,IAAI,CAAC,OAAO;gBACd;YACN,OAAO,EAAE,IAAI,CAAC,iBAAiB;SAChC;;;;;yBAKgB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;;KAEhG,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;YACpD,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE;SACzD,CAAC,CAAC,CAAA;QAEH,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,OAAM;QAEvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,CAAC;;AAxD0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mEAA8B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAuB1B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@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 { ranMutation } from '../../components/say-outcome.js'\nimport { isMobileDevice } from '@operato/utils'\nimport { CommonHeaderStyles } from '@operato/styles'\n\nexport class ActivityApprovalImporter extends LitElement {\n static styles = [\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n ox-grist {\n flex: 1;\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 render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{\n records: this.activityApprovals\n }}\n ></ox-grist>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n </div>\n `\n }\n\n async save() {\n const outcome = await ranMutation(() => 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 (!outcome.ok) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n"]}
@@ -8,6 +8,7 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
8
8
  import { DataGrist } from '@operato/data-grist';
9
9
  import { client } from '@operato/graphql';
10
10
  import { i18next, localize } from '@operato/i18n';
11
+ import { ranMutation } from '../../components/say-outcome.js';
11
12
  import { notify, openPopup } from '@operato/layout';
12
13
  import { isMobileDevice } from '@operato/utils';
13
14
  import gql from 'graphql-tag';
@@ -170,15 +171,15 @@ let ActivityApprovalListPage = class ActivityApprovalListPage extends localize(i
170
171
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
171
172
  const ids = this.grist.selected.map(record => record.id);
172
173
  if (ids && ids.length > 0) {
173
- const response = await client.mutate({ mutation: gql `
174
+ const outcome = await ranMutation(() => client.mutate({ mutation: gql `
174
175
  mutation ($ids: [String!]!) { deleteActivityApprovals(ids: $ids)
175
176
  }
176
177
  `,
177
178
  variables: { ids
178
179
  }
179
- });
180
- if (!response.errors) {
181
- this.grist.fetch();
180
+ }));
181
+ this.grist.fetch();
182
+ if (outcome.ok) {
182
183
  notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
183
184
  });
184
185
  }
@@ -197,17 +198,15 @@ let ActivityApprovalListPage = class ActivityApprovalListPage extends localize(i
197
198
  patchField.cuFlag = patch.__dirty__;
198
199
  return patchField;
199
200
  });
200
- const response = await client.mutate({ mutation: gql `
201
+ const outcome = await ranMutation(() => client.mutate({ mutation: gql `
201
202
  mutation ($patches: [ActivityApprovalPatch!]!) { updateMultipleActivityApproval(patches: $patches) { name
202
203
  }
203
204
  }
204
205
  `,
205
206
  variables: { patches
206
207
  }
207
- });
208
- if (!response.errors) {
209
- this.grist.fetch();
210
- }
208
+ }));
209
+ this.grist.fetch();
211
210
  }
212
211
  }
213
212
  async exportHandler() {
@@ -1 +1 @@
1
- {"version":3,"file":"activity-approval-list-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAA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,SAAS;uDAAA;AAzBjC,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAmOpC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { ActivityApprovalImporter } from './activity-approval-importer.js'\n\n@customElement('activity-approval-list-page')\nexport class ActivityApprovalListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'activity-approval-importer': ActivityApprovalImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.activity approval list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'worklist/activity-approval',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteActivityApproval.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.activity approval list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <!-- 검색은 제목 줄이 갖는다(context.search). 여기 폼은 컬럼 필터만 그린다. -->\n <ox-filters-form without-search></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: activityApprovals(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteActivityApproval() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteActivityApprovals(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateActivityApproval() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [ActivityApprovalPatch!]!) { updateMultipleActivityApproval(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(activityApproval => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = activityApproval[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <activity-approval-importer\n .activityApprovals=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></activity-approval-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import activity-approval')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-approval-list-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAA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EAAE,CAAA;YAC5C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAC7B,CAAC;;OAEK,EACD,EAAU,QAAQ,EAAE,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;SACxD,CACG,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpD,CAAC,CAAA;IACD,CAAC;;AA7M4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;uDAAA;AAzBjC,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAoOpC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ranMutation } from '../../components/say-outcome.js'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { ActivityApprovalImporter } from './activity-approval-importer.js'\n\n@customElement('activity-approval-list-page')\nexport class ActivityApprovalListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'activity-approval-importer': ActivityApprovalImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.activity approval list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'worklist/activity-approval',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteActivityApproval.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.activity approval list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <!-- 검색은 제목 줄이 갖는다(context.search). 여기 폼은 컬럼 필터만 그린다. -->\n <ox-filters-form without-search></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: activityApprovals(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteActivityApproval() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteActivityApprovals(ids: $ids)\n }\n `,\n variables: { ids\n }\n }))\n\n this.grist.fetch()\n\n if (outcome.ok) {\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateActivityApproval() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($patches: [ActivityApprovalPatch!]!) { updateMultipleActivityApproval(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n }))\n\n this.grist.fetch()\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(activityApproval => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = activityApproval[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <activity-approval-importer\n .activityApprovals=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></activity-approval-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import activity-approval')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js';
1
2
  import '@operato/property-editor/ox-properties-dynamic-view.js';
2
3
  import '@operato/board/ox-board-viewer.js';
3
4
  import '../../components/activity-approval-ribon.js';
@@ -30,6 +31,20 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
30
31
  activityThread: any;
31
32
  board: any;
32
33
  commentInput: HTMLTextAreaElement;
34
+ /**
35
+ * Is the reader seated here as a reference — someone who comments and does not decide?
36
+ *
37
+ * The rule comes from organization's client types, the same function its own approval-line editor
38
+ * and list use, so the two wire spellings of the enum are handled in one place. The approval line
39
+ * answers rather than ActivityApproval.participation, matching what the server refuses on
40
+ * (isReferenceOrder in approval-line.ts): the line decides who comes next, so letting the row
41
+ * decide who may judge would leave two authorities with nothing to settle a disagreement.
42
+ *
43
+ * The value comes back false while the query is still out. That is the same answer as for an
44
+ * approver, so the buttons show for a moment on a reference's screen — pressing one is refused by
45
+ * the server, which is why the server closed first.
46
+ */
47
+ get isReference(): boolean;
33
48
  get context(): {
34
49
  title: any;
35
50
  help: string;
@@ -46,7 +61,7 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
46
61
  action: () => void;
47
62
  }[];
48
63
  };
49
- render(): TemplateResult<1> | typeof nothing;
64
+ render(): typeof nothing | TemplateResult<1>;
50
65
  /** 화면에 낼 항목이 하나라도 있나. 타임라인을 펴 둘지 정하는 자리가 쓴다. */
51
66
  hasFields(): boolean;
52
67
  activityContent(): DirectiveResult<import("lit-html/directive.js").DirectiveClass>;
@@ -72,9 +87,68 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
72
87
  * approveActivityApproval / rejectActivityApproval 은 id 와 comment 만 보낸다 — 그 값은 어디에도
73
88
  * 가지 않는다. 결재자가 적을 수 있는 것은 의견 하나이고, 그것은 화면 아래 칸이 받는다.
74
89
  */
90
+ /**
91
+ * The decision the activity declared, or nothing when it declared none.
92
+ *
93
+ * Returning nothing is how generatedContent knows to fall back to the model. An activity with no
94
+ * decisionKeys draws exactly what it drew before.
95
+ *
96
+ * A slot whose path led nowhere is skipped rather than drawn empty. Older instances of an activity
97
+ * predate a field the declaration names — plant hit that with its `policy` value — and an empty
98
+ * bar on the screen would read as "there is no reason" when the truth is that this record has no
99
+ * such value. What cannot be shown is left out; what is shown is only what the payload actually
100
+ * carries.
101
+ *
102
+ * `reason` is the exception. Missing and blank mean the same thing to whoever is reading — nobody
103
+ * wrote one — so both draw the grey line rather than disappearing. A reason that silently vanishes
104
+ * would let an approver assume it was never asked for.
105
+ */
106
+ decisionContent(): DirectiveResult<{
107
+ new (_partInfo: import("lit-html/directive.js").PartInfo): import("lit-html/directives/keyed.js").Keyed<TemplateResult<1>>;
108
+ }>;
109
+ /**
110
+ * Whether approving can be undone, drawn as the frame around the decision.
111
+ *
112
+ * Only an explicit true or false draws. Anything else — the path led nowhere, or the value is not
113
+ * a boolean — draws nothing, because saying "this can be undone" on a screen that does not know is
114
+ * the one mistake this line must never make.
115
+ *
116
+ * This is not rejectionIsFinal. That one says whether **rejecting** ends the case for good; this
117
+ * says whether **approving** can be taken back. The twin actuation carries both, which is exactly
118
+ * why they must not share a sentence.
119
+ */
120
+ private renderReversibility;
121
+ /**
122
+ * One slot's value as something to read.
123
+ *
124
+ * A scalar prints with its unit when one was declared. Anything shaped — an object, a list — goes
125
+ * through fieldValue, the same laying-out the model sections use, so a payload reads the same way
126
+ * wherever it appears and a four-level object does not become one long line.
127
+ */
128
+ private slotText;
129
+ /** Did a person actually write something here. Whitespace is not words. */
130
+ private hasWords;
75
131
  generatedContent(): DirectiveResult;
76
132
  boardContent(): DirectiveResult;
133
+ /**
134
+ * The element the activity names, or a plain statement that it could not be loaded.
135
+ *
136
+ * document.createElement answers something for any name, so an activity pointing at an element
137
+ * nobody registered used to produce an empty card. The approver got a screen with nothing on it
138
+ * and the approve button still worked — plant shipped two such forms in one day and found them by
139
+ * reading the file list, not by opening the screen.
140
+ *
141
+ * The reader is told what to judge by instead. Same shape as the empty generated screen: what is
142
+ * missing, and where to look — the submission reason and the history in the timeline below.
143
+ *
144
+ * ── Waiting for a late definition ─────────────────────────────────────────
145
+ * An element can be registered after this page renders, and answering "not loaded" forever in
146
+ * that case would be a screen inventing a defect. whenDefined resolves whenever it arrives and
147
+ * the page redraws; a name nobody ever registers simply never resolves, and the statement stands.
148
+ */
77
149
  customElementContent(): any;
150
+ /** The activity names a screen and nothing registered it. Says what to judge by instead. */
151
+ private screenNotLoaded;
78
152
  oxBoardViewer: any;
79
153
  getOutputFromBoard(): any;
80
154
  /**