@things-factory/worklist 6.0.24 → 6.0.26

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 (131) hide show
  1. package/client/activity-summary-generator.ts +132 -0
  2. package/client/bootstrap.ts +37 -0
  3. package/client/components/activity-starter-form.ts +89 -3
  4. package/client/index.ts +1 -0
  5. package/client/pages/activity-approval/activity-approval-page.ts +5 -50
  6. package/client/pages/activity-thread/activity-thread-page.ts +5 -44
  7. package/client/pages/installable-activity/installable-activity-list-page.ts +400 -0
  8. package/client/pages/installable-activity/installable-activity-model-item-list.ts +18 -0
  9. package/client/pages/todo/draft-list-page.ts +9 -0
  10. package/client/route.ts +4 -0
  11. package/client/templates/activity-approval-context-template.ts +67 -0
  12. package/client/templates/activity-thread-context-template.ts +62 -0
  13. package/dist-client/activity-summary-generator.d.ts +2 -0
  14. package/dist-client/activity-summary-generator.js +114 -0
  15. package/dist-client/activity-summary-generator.js.map +1 -0
  16. package/dist-client/bootstrap.d.ts +2 -0
  17. package/dist-client/bootstrap.js +35 -0
  18. package/dist-client/bootstrap.js.map +1 -1
  19. package/dist-client/components/activity-starter-form.d.ts +1 -0
  20. package/dist-client/components/activity-starter-form.js +66 -4
  21. package/dist-client/components/activity-starter-form.js.map +1 -1
  22. package/dist-client/index.d.ts +1 -0
  23. package/dist-client/index.js +1 -0
  24. package/dist-client/index.js.map +1 -1
  25. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +1 -0
  26. package/dist-client/pages/activity-approval/activity-approval-page.js +4 -48
  27. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  28. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -0
  29. package/dist-client/pages/activity-thread/activity-thread-page.js +4 -42
  30. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  31. package/dist-client/pages/installable-activity/installable-activity-list-page.d.ts +45 -0
  32. package/dist-client/pages/installable-activity/installable-activity-list-page.js +404 -0
  33. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -0
  34. package/dist-client/pages/installable-activity/installable-activity-model-item-list.d.ts +1 -0
  35. package/dist-client/pages/installable-activity/installable-activity-model-item-list.js +20 -0
  36. package/dist-client/pages/installable-activity/installable-activity-model-item-list.js.map +1 -0
  37. package/dist-client/pages/installed-activity/installed-activity-list-page.d.ts +45 -0
  38. package/dist-client/pages/installed-activity/installed-activity-list-page.js +412 -0
  39. package/dist-client/pages/installed-activity/installed-activity-list-page.js.map +1 -0
  40. package/dist-client/pages/installed-activity/installed-activity-model-item-list.d.ts +1 -0
  41. package/dist-client/pages/installed-activity/installed-activity-model-item-list.js +20 -0
  42. package/dist-client/pages/installed-activity/installed-activity-model-item-list.js.map +1 -0
  43. package/dist-client/pages/todo/draft-list-page.js +9 -0
  44. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  45. package/dist-client/route.d.ts +1 -1
  46. package/dist-client/route.js +3 -0
  47. package/dist-client/route.js.map +1 -1
  48. package/dist-client/templates/activity-approval-context-template.d.ts +2 -0
  49. package/dist-client/templates/activity-approval-context-template.js +62 -0
  50. package/dist-client/templates/activity-approval-context-template.js.map +1 -0
  51. package/dist-client/templates/activity-context-template.d.ts +2 -0
  52. package/dist-client/templates/activity-context-template.js +62 -0
  53. package/dist-client/templates/activity-context-template.js.map +1 -0
  54. package/dist-client/templates/activity-thread-context-template.d.ts +2 -0
  55. package/dist-client/templates/activity-thread-context-template.js +57 -0
  56. package/dist-client/templates/activity-thread-context-template.js.map +1 -0
  57. package/dist-client/tsconfig.tsbuildinfo +1 -1
  58. package/dist-server/controllers/activity-installation-controller.js +17 -0
  59. package/dist-server/controllers/activity-installation-controller.js.map +1 -0
  60. package/dist-server/controllers/activity-instance/post.js +3 -6
  61. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  62. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  63. package/dist-server/controllers/call-webhook.js +4 -2
  64. package/dist-server/controllers/call-webhook.js.map +1 -1
  65. package/dist-server/controllers/common.js +44 -4
  66. package/dist-server/controllers/common.js.map +1 -1
  67. package/dist-server/controllers/index.js +4 -0
  68. package/dist-server/controllers/index.js.map +1 -1
  69. package/dist-server/index.js +1 -1
  70. package/dist-server/index.js.map +1 -1
  71. package/dist-server/service/activity/activity-model-type.js +1 -1
  72. package/dist-server/service/activity/activity-model-type.js.map +1 -1
  73. package/dist-server/service/activity/activity-query.js +1 -0
  74. package/dist-server/service/activity/activity-query.js.map +1 -1
  75. package/dist-server/service/activity-approval/event-subscriber.js +20 -6
  76. package/dist-server/service/activity-approval/event-subscriber.js.map +1 -1
  77. package/dist-server/service/activity-instance/activity-instance-query.js +40 -0
  78. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  79. package/dist-server/service/activity-instance/activity-instance-type.js +13 -1
  80. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  81. package/dist-server/service/activity-instance/activity-instance.js +25 -1
  82. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  83. package/dist-server/service/index.js +4 -0
  84. package/dist-server/service/index.js.map +1 -1
  85. package/dist-server/service/installable-activity/index.js +10 -0
  86. package/dist-server/service/installable-activity/index.js.map +1 -0
  87. package/dist-server/service/installable-activity/installable-activity-mutation.js +60 -0
  88. package/dist-server/service/installable-activity/installable-activity-mutation.js.map +1 -0
  89. package/dist-server/service/installable-activity/installable-activity-query.js +48 -0
  90. package/dist-server/service/installable-activity/installable-activity-query.js.map +1 -0
  91. package/dist-server/service/installable-activity/installable-activity-type.js +21 -0
  92. package/dist-server/service/installable-activity/installable-activity-type.js.map +1 -0
  93. package/dist-server/service/installable-activity/installable-activity.js +70 -0
  94. package/dist-server/service/installable-activity/installable-activity.js.map +1 -0
  95. package/dist-server/service/installed-activity/index.js +10 -0
  96. package/dist-server/service/installed-activity/index.js.map +1 -0
  97. package/dist-server/service/installed-activity/installed-activity-mutation.js +60 -0
  98. package/dist-server/service/installed-activity/installed-activity-mutation.js.map +1 -0
  99. package/dist-server/service/installed-activity/installed-activity-query.js +48 -0
  100. package/dist-server/service/installed-activity/installed-activity-query.js.map +1 -0
  101. package/dist-server/service/installed-activity/installed-activity-type.js +21 -0
  102. package/dist-server/service/installed-activity/installed-activity-type.js.map +1 -0
  103. package/dist-server/service/installed-activity/installed-activity.js +70 -0
  104. package/dist-server/service/installed-activity/installed-activity.js.map +1 -0
  105. package/dist-server/tsconfig.tsbuildinfo +1 -1
  106. package/package.json +7 -7
  107. package/server/controllers/activity-installation-controller.ts +17 -0
  108. package/server/controllers/activity-instance/post.ts +9 -9
  109. package/server/controllers/activity-thread/submit.ts +1 -1
  110. package/server/controllers/call-webhook.ts +5 -2
  111. package/server/controllers/common.ts +41 -5
  112. package/server/controllers/index.ts +1 -0
  113. package/server/index.ts +1 -1
  114. package/server/service/activity/activity-model-type.ts +3 -3
  115. package/server/service/activity/activity-query.ts +2 -1
  116. package/server/service/activity-approval/event-subscriber.ts +19 -7
  117. package/server/service/activity-instance/activity-instance-query.ts +44 -1
  118. package/server/service/activity-instance/activity-instance-type.ts +12 -4
  119. package/server/service/activity-instance/activity-instance.ts +17 -1
  120. package/server/service/index.ts +7 -0
  121. package/server/service/installable-activity/index.ts +7 -0
  122. package/server/service/installable-activity/installable-activity-mutation.ts +61 -0
  123. package/server/service/installable-activity/installable-activity-query.ts +36 -0
  124. package/server/service/installable-activity/installable-activity-type.ts +12 -0
  125. package/server/service/installable-activity/installable-activity.ts +49 -0
  126. package/things-factory.config.js +1 -0
  127. package/translations/en.json +3 -0
  128. package/translations/ko.json +3 -0
  129. package/translations/ms.json +3 -0
  130. package/translations/zh.json +3 -0
  131. package/server/controllers/activity-extension-controller.ts +0 -12
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-summary-generator.js","sourceRoot":"","sources":["../client/activity-summary-generator.ts"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AACzC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,M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;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B;IACjD,MAAM,yBAAyB,EAAE,CAAA;IACjC,MAAM,uBAAuB,EAAE,CAAA;IAC/B,MAAM,yBAAyB,EAAE,CAAA;IAEjC,oBAAoB,EAAE,CAAA;AACxB,CAAC","sourcesContent":["import debounce from 'lodash-es/debounce'\nimport gql from 'graphql-tag'\nimport { client, subscribe } from '@operato/graphql'\nimport { AsyncLock } from '@operato/utils'\n\nasync function subscribeActivityInstance() {\n return await subscribe(\n {\n query: gql`\n subscription {\n activityInstance {\n name\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n fetchActivitySummary()\n }\n }\n }\n )\n}\n\nasync function subscribeActivityThread() {\n return await subscribe(\n {\n query: gql`\n subscription {\n activityThread {\n transaction\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n fetchActivitySummary()\n }\n }\n }\n )\n}\n\nasync function subscribeActivityApproval() {\n return await subscribe(\n {\n query: gql`\n subscription {\n activityApproval {\n judgment\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n fetchActivitySummary()\n }\n }\n }\n )\n}\n\nvar summary = {}\nvar generatorLocks = {\n numberOfToDos: new AsyncLock(true),\n numberOfApprovalWaitings: new AsyncLock(true),\n numberOfPicks: new AsyncLock(true),\n numberOfDrafts: new AsyncLock(true)\n}\n\nconst fetchActivitySummary = debounce(async () => {\n const response = await client.query({\n query: gql`\n query {\n activitySummary {\n numberOfToDos\n numberOfApprovalWaitings\n numberOfPicks\n numberOfDrafts\n }\n }\n `\n })\n\n if (response.data) {\n const { numberOfToDos, numberOfApprovalWaitings, numberOfPicks, numberOfDrafts } = response.data.activitySummary\n\n summary['numberOfToDos'] = numberOfToDos\n summary['numberOfApprovalWaitings'] = numberOfApprovalWaitings\n summary['numberOfPicks'] = numberOfPicks\n summary['numberOfDrafts'] = numberOfDrafts\n\n generatorLocks['numberOfToDos']?.unlock(numberOfToDos)\n generatorLocks['numberOfApprovalWaitings']?.unlock(numberOfApprovalWaitings)\n generatorLocks['numberOfPicks']?.unlock(numberOfPicks)\n generatorLocks['numberOfDrafts']?.unlock(numberOfDrafts)\n }\n}, 1000)\n\nexport async function* generateActivitySummary(name: string) {\n /* 1. 앞에 사용되었던 generator가 종료될 기회를 준다. */\n generatorLocks[name]?.unlock()\n\n /* 2. 마지막 값을 일단 yield 한다. */\n yield summary[name]\n\n while (true) {\n generatorLocks[name].lock()\n\n let badge = await generatorLocks[name].promise\n if (badge === undefined) {\n /* 새로운 generator가 생성된 경우이면, 기존 generator는 종료한다. */\n return\n }\n\n yield badge\n }\n}\n\nexport async function startSubscribeActivitySummary() {\n await subscribeActivityInstance()\n await subscribeActivityThread()\n await subscribeActivityApproval()\n\n fetchActivitySummary()\n}\n"]}
@@ -1 +1,3 @@
1
+ import './templates/activity-approval-context-template.js';
2
+ import './templates/activity-thread-context-template.js';
1
3
  export default function bootstrap(): void;
@@ -1,9 +1,44 @@
1
+ import { html } from 'lit-html';
2
+ import { store } from '@operato/shell';
3
+ import { openOverlay, TOOL_POSITION } from '@operato/layout';
4
+ import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui';
1
5
  import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist';
2
6
  import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js';
3
7
  import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js';
4
8
  import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js';
5
9
  import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js';
10
+ import './templates/activity-approval-context-template.js';
11
+ import './templates/activity-thread-context-template.js';
6
12
  export default function bootstrap() {
13
+ ;
14
+ [
15
+ {
16
+ template: html ` <activity-approval-context-template></activity-approval-context-template> `,
17
+ context: 'activityApproval'
18
+ },
19
+ {
20
+ template: html ` <activity-thread-context-template></activity-thread-context-template> `,
21
+ context: 'activityThread'
22
+ }
23
+ ].forEach(({ template, context }) => {
24
+ store.dispatch({
25
+ type: APPEND_CONTEXT_TOOL,
26
+ tool: {
27
+ position: TOOL_POSITION.FRONT,
28
+ template: html `
29
+ <mwc-icon
30
+ @click=${async (e) => {
31
+ openOverlay('context-toolbar-overlay', {
32
+ template
33
+ });
34
+ }}
35
+ >info</mwc-icon
36
+ >
37
+ `,
38
+ context
39
+ }
40
+ });
41
+ });
7
42
  registerGristEditor('duration', OxGristEditorDuration);
8
43
  registerGristRenderer('duration', OxGristRendererDuration);
9
44
  registerGristEditor('quantifier', OxGristEditorQuantifier);
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAA;AAEjG,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IACtD,qBAAqB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,qBAAqB,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'\nimport { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'\nimport { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'\nimport { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'\nimport { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'\n\nexport default function bootstrap() {\n registerGristEditor('duration', OxGristEditorDuration)\n registerGristRenderer('duration', OxGristRendererDuration)\n registerGristEditor('quantifier', OxGristEditorQuantifier)\n registerGristRenderer('quantifier', OxGristRendererQuantifier)\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAA;AAEjG,OAAO,mDAAmD,CAAA;AAC1D,OAAO,iDAAiD,CAAA;AAExD,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,CAAC;IAAA;QACC;YACE,QAAQ,EAAE,IAAI,CAAA,6EAA6E;YAC3F,OAAO,EAAE,kBAAkB;SAC5B;QACD;YACE,QAAQ,EAAE,IAAI,CAAA,yEAAyE;YACvF,OAAO,EAAE,gBAAgB;SAC1B;KACF,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAClC,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE;gBACJ,QAAQ,EAAE,aAAa,CAAC,KAAK;gBAC7B,QAAQ,EAAE,IAAI,CAAA;;qBAED,KAAK,EAAC,CAAC,EAAC,EAAE;oBACjB,WAAW,CAAC,yBAAyB,EAAE;wBACrC,QAAQ;qBACT,CAAC,CAAA;gBACJ,CAAC;;;SAGJ;gBACD,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IACtD,qBAAqB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,qBAAqB,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { html } from 'lit-html'\nimport { store } from '@operato/shell'\nimport { openOverlay, TOOL_POSITION } from '@operato/layout'\nimport { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'\n\nimport { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'\nimport { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'\nimport { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'\nimport { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'\nimport { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'\n\nimport './templates/activity-approval-context-template.js'\nimport './templates/activity-thread-context-template.js'\n\nexport default function bootstrap() {\n ;[\n {\n template: html` <activity-approval-context-template></activity-approval-context-template> `,\n context: 'activityApproval'\n },\n {\n template: html` <activity-thread-context-template></activity-thread-context-template> `,\n context: 'activityThread'\n }\n ].forEach(({ template, context }) => {\n store.dispatch({\n type: APPEND_CONTEXT_TOOL,\n tool: {\n position: TOOL_POSITION.FRONT,\n template: html`\n <mwc-icon\n @click=${async e => {\n openOverlay('context-toolbar-overlay', {\n template\n })\n }}\n >info</mwc-icon\n >\n `,\n context\n }\n })\n })\n\n registerGristEditor('duration', OxGristEditorDuration)\n registerGristRenderer('duration', OxGristRendererDuration)\n registerGristEditor('quantifier', OxGristEditorQuantifier)\n registerGristRenderer('quantifier', OxGristRendererQuantifier)\n}\n"]}
@@ -15,6 +15,7 @@ export declare class ActivityStarterForm extends ActivityStarterForm_base {
15
15
  draftActivityInstance(): Promise<void>;
16
16
  updateActivityInstance(): Promise<void>;
17
17
  postActivityInstance(): Promise<void>;
18
+ onClickAssignees(): void;
18
19
  onClickApprovalLine(): void;
19
20
  }
20
21
  export {};
@@ -24,7 +24,7 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
24
24
  .map(item => {
25
25
  return Object.assign(Object.assign({}, item), { label: item.name });
26
26
  });
27
- const { id, name, description, input, state, approvalLine, threadsMin = 0, threadsMax = 0 } = this.activityInstance || {};
27
+ const { id, name, description, input, state, approvalLine, assignees, threadsMin = 0, threadsMax = 0 } = this.activityInstance || {};
28
28
  const draftable = !id;
29
29
  const postable = id && state === 'draft';
30
30
  return html `
@@ -67,6 +67,19 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
67
67
  />
68
68
  </section>
69
69
 
70
+ <section>
71
+ <label>Assignees</label>
72
+ ${assignees
73
+ ? html `
74
+ <assignees-view
75
+ .value=${assignees}
76
+ @click=${this.onClickAssignees.bind(this)}
77
+ @change=${e => (this.activityInstance.assignees = e.currentTarget.value)}
78
+ ></assignees-view>
79
+ `
80
+ : html `<mwc-icon-button icon="group_add" @click=${this.onClickAssignees.bind(this)}></mwc-icon-button>`}
81
+ </section>
82
+
70
83
  <section>
71
84
  <label>Approval Line</label>
72
85
  ${approvalLine
@@ -74,6 +87,7 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
74
87
  <approval-line-view
75
88
  .model=${approvalLine}
76
89
  @click=${this.onClickApprovalLine.bind(this)}
90
+ @change=${e => (this.activityInstance.approvalLine = e.currentTarget.value)}
77
91
  ></approval-line-view>
78
92
  `
79
93
  : html `<mwc-icon-button icon="group_add" @click=${this.onClickApprovalLine.bind(this)}></mwc-icon-button>`}
@@ -157,6 +171,15 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
157
171
  description
158
172
  input
159
173
  state
174
+ assignees {
175
+ type
176
+ assignee {
177
+ id
178
+ name
179
+ description
180
+ controlNo
181
+ }
182
+ }
160
183
  approvalLine {
161
184
  type
162
185
  approver {
@@ -185,13 +208,14 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
185
208
  }
186
209
  }
187
210
  async updateActivityInstance() {
188
- const { id, name, description, input, threadsMin = 0, threadsMax = 0, approvalLine } = this.activityInstance;
211
+ const { id, name, description, input, threadsMin = 0, threadsMax = 0, assignees, approvalLine } = this.activityInstance;
189
212
  const patch = {
190
213
  name: name || this.activity.name,
191
214
  description: description || this.activity.description,
192
215
  input,
193
216
  threadsMin,
194
217
  threadsMax,
218
+ assignees,
195
219
  approvalLine
196
220
  };
197
221
  const response = await client.mutate({
@@ -203,6 +227,15 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
203
227
  description
204
228
  input
205
229
  state
230
+ assignees {
231
+ type
232
+ assignee {
233
+ id
234
+ name
235
+ description
236
+ controlNo
237
+ }
238
+ }
206
239
  approvalLine {
207
240
  type
208
241
  approver {
@@ -232,14 +265,16 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
232
265
  }
233
266
  }
234
267
  async postActivityInstance() {
235
- const { id, name, description, input, threadsMin = 0, threadsMax = 0 } = this.activityInstance;
268
+ const { id, name, description, input, threadsMin = 0, threadsMax = 0, assignees, approvalLine } = this.activityInstance;
236
269
  const activityInstance = {
237
270
  id,
238
271
  name: name || this.activity.name,
239
272
  description: description || this.activity.description,
240
273
  threadsMin,
241
274
  threadsMax,
242
- input
275
+ input,
276
+ assignees,
277
+ approvalLine
243
278
  };
244
279
  const response = await client.mutate({
245
280
  mutation: gql `
@@ -250,6 +285,15 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
250
285
  description
251
286
  input
252
287
  state
288
+ assignees {
289
+ type
290
+ assignee {
291
+ id
292
+ name
293
+ description
294
+ controlNo
295
+ }
296
+ }
253
297
  approvalLine {
254
298
  type
255
299
  approver {
@@ -277,6 +321,24 @@ let ActivityStarterForm = class ActivityStarterForm extends localize(i18next)(Li
277
321
  });
278
322
  }
279
323
  }
324
+ onClickAssignees() {
325
+ const { assignees } = this.activityInstance || {};
326
+ const popup = openPopup(html `
327
+ <assignees-editor-popup
328
+ .value=${assignees}
329
+ .confirmCallback=${value => {
330
+ this.activityInstance.assignees = value;
331
+ this.requestUpdate();
332
+ }}
333
+ ></assignees-editor-popup>
334
+ `, {
335
+ backdrop: true,
336
+ help: 'organization/assignees-editor',
337
+ size: 'large',
338
+ title: i18next.t('title.assignee list')
339
+ });
340
+ popup.onclosed = () => { };
341
+ }
280
342
  onClickApprovalLine() {
281
343
  const { approvalLine } = this.activityInstance || {};
282
344
  const popup = openPopup(html `
@@ -1 +1 @@
1
- {"version":3,"file":"activity-starter-form.js","sourceRoot":"","sources":["../../client/components/activity-starter-form.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,2BAA2B,CAAA;AAClC,OAAO,wDAAwD,CAAA;AAC/D,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE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AE,GAAE,CAAC,CAAA;IAC3B,CAAC;;AA9WM,0BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAA2B;AA1C3C,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAgX/B;SAhXY,mBAAmB","sourcesContent":["import '@material/mwc-button'\nimport '@material/mwc-icon-button'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@things-factory/organization'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('activity-starter-form')\nexport class ActivityStarterForm extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n content {\n flex: 1;\n display: flex;\n flex-direction: column;\n padding: var(--padding-default);\n overflow: auto;\n }\n\n section {\n display: flex;\n flex-direction: column;\n }\n\n #description {\n height: 60px;\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: String }) activityId?: string\n @property({ type: Object }) activity?: any\n @property({ type: Object }) activityInstance: any = {}\n\n render() {\n const { model, thumbnail } = this.activity || {}\n\n const inputSpec = (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n\n const {\n id,\n name,\n description,\n input,\n state,\n approvalLine,\n threadsMin = 0,\n threadsMax = 0\n } = this.activityInstance || {}\n const draftable = !id\n const postable = id && state === 'draft'\n\n return html`\n <content>\n <section>\n <label for=\"name\">title</label>\n <input\n id=\"name\"\n .value=${name || this.activity?.name}\n @change=${e => (this.activityInstance.name = e.currentTarget.value)}\n />\n </section>\n\n <section>\n <label for=\"description\">description</label>\n <textarea\n id=\"description\"\n .value=${description || this.activity?.description}\n @change=${e => {\n this.activityInstance.description = e.currentTarget.value\n }}\n ></textarea>\n </section>\n\n <section>\n <label for=\"threads-min\">Threads Min</label>\n <input\n id=\"threadsMin\"\n type=\"number\"\n .value=${threadsMin || 0}\n @change=${e => (this.activityInstance.threadsMin = e.currentTarget.valueAsNumber)}\n />\n\n <label for=\"threads-max\">Threads Max</label>\n <input\n id=\"threads-max\"\n type=\"number\"\n .value=${threadsMax || 0}\n @change=${e => (this.activityInstance.threadsMax = e.currentTarget.valueAsNumber)}\n />\n </section>\n\n <section>\n <label>Approval Line</label>\n ${approvalLine\n ? html`\n <approval-line-view\n .model=${approvalLine}\n @click=${this.onClickApprovalLine.bind(this)}\n ></approval-line-view>\n `\n : html`<mwc-icon-button icon=\"group_add\" @click=${this.onClickApprovalLine.bind(this)}></mwc-icon-button>`}\n </section>\n\n <section>\n <img src=${thumbnail} />\n </section>\n\n <label>Input</label>\n\n ${!model\n ? html``\n : html`\n <ox-properties-dynamic-view\n .props=${inputSpec}\n .value=${input}\n @property-change=${e => {\n this.activityInstance.input = e.currentTarget.value\n console.log('activity-instance', this.activityInstance.input)\n }}\n ></ox-properties-dynamic-view>\n `}\n </content>\n\n <div class=\"button-container\">\n <mwc-button raised @click=${e => history.back()}>${i18next.t('button.close')}</mwc-button>\n ${when(\n draftable,\n () => html`\n <mwc-button raised @click=${this.draftActivityInstance.bind(this)}>${i18next.t('button.draft')}</mwc-button>\n `\n )}\n ${when(\n postable,\n () => html`\n <mwc-button raised @click=${this.updateActivityInstance.bind(this)}>${i18next.t('button.save')}</mwc-button>\n <mwc-button raised @click=${this.postActivityInstance.bind(this)}>${i18next.t('button.post')}</mwc-button>\n `\n )}\n </div>\n `\n }\n\n firstUpdated() {\n this.fetchActivity(this.activityId)\n }\n\n async fetchActivity(id) {\n const response = await client.query({\n query: gql`\n query activity($id: String!) {\n activity(id: $id) {\n id\n name\n description\n state\n thumbnail\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.activity = response.data.activity\n }\n\n async draftActivityInstance() {\n const { activityId } = this\n\n const activityInstance = {\n activityId,\n name: this.activity.name,\n description: this.activity.description,\n ...this.activityInstance\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: NewActivityInstance!) {\n draftActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n state\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.draftActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.draft')}`\n })\n })\n }\n }\n\n async updateActivityInstance() {\n const { id, name, description, input, threadsMin = 0, threadsMax = 0, approvalLine } = this.activityInstance\n\n const patch = {\n name: name || this.activity.name,\n description: description || this.activity.description,\n input,\n threadsMin,\n threadsMax,\n approvalLine\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ActivityInstancePatch!) {\n updateActivityInstance(id: $id, patch: $patch) {\n id\n name\n description\n input\n state\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n id,\n patch\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.updateActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.save')}`\n })\n })\n }\n }\n\n async postActivityInstance() {\n const { id, name, description, input, threadsMin = 0, threadsMax = 0 } = this.activityInstance\n\n const activityInstance = {\n id,\n name: name || this.activity.name,\n description: description || this.activity.description,\n threadsMin,\n threadsMax,\n input\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: ActivityInstancePost!) {\n postActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n state\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.postActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.assign')}`\n })\n })\n }\n }\n\n onClickApprovalLine() {\n const { approvalLine } = this.activityInstance || {}\n\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .value=${approvalLine}\n .confirmCallback=${value => {\n this.activityInstance.approvalLine = value\n this.requestUpdate()\n }}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {}\n }\n}\n"]}
1
+ {"version":3,"file":"activity-starter-form.js","sourceRoot":"","sources":["../../client/components/activity-starter-form.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,2BAA2B,CAAA;AAClC,OAAO,wDAAwD,CAAA;AAC/D,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBA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AC,CAAA;IAC3B,CAAC;;AApcM,0BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAA2B;AA1C3C,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAsc/B;SAtcY,mBAAmB","sourcesContent":["import '@material/mwc-button'\nimport '@material/mwc-icon-button'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@things-factory/organization'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('activity-starter-form')\nexport class ActivityStarterForm extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n content {\n flex: 1;\n display: flex;\n flex-direction: column;\n padding: var(--padding-default);\n overflow: auto;\n }\n\n section {\n display: flex;\n flex-direction: column;\n }\n\n #description {\n height: 60px;\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: String }) activityId?: string\n @property({ type: Object }) activity?: any\n @property({ type: Object }) activityInstance: any = {}\n\n render() {\n const { model, thumbnail } = this.activity || {}\n\n const inputSpec = (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n\n const {\n id,\n name,\n description,\n input,\n state,\n approvalLine,\n assignees,\n threadsMin = 0,\n threadsMax = 0\n } = this.activityInstance || {}\n const draftable = !id\n const postable = id && state === 'draft'\n\n return html`\n <content>\n <section>\n <label for=\"name\">title</label>\n <input\n id=\"name\"\n .value=${name || this.activity?.name}\n @change=${e => (this.activityInstance.name = e.currentTarget.value)}\n />\n </section>\n\n <section>\n <label for=\"description\">description</label>\n <textarea\n id=\"description\"\n .value=${description || this.activity?.description}\n @change=${e => {\n this.activityInstance.description = e.currentTarget.value\n }}\n ></textarea>\n </section>\n\n <section>\n <label for=\"threads-min\">Threads Min</label>\n <input\n id=\"threadsMin\"\n type=\"number\"\n .value=${threadsMin || 0}\n @change=${e => (this.activityInstance.threadsMin = e.currentTarget.valueAsNumber)}\n />\n\n <label for=\"threads-max\">Threads Max</label>\n <input\n id=\"threads-max\"\n type=\"number\"\n .value=${threadsMax || 0}\n @change=${e => (this.activityInstance.threadsMax = e.currentTarget.valueAsNumber)}\n />\n </section>\n\n <section>\n <label>Assignees</label>\n ${assignees\n ? html`\n <assignees-view\n .value=${assignees}\n @click=${this.onClickAssignees.bind(this)}\n @change=${e => (this.activityInstance.assignees = e.currentTarget.value)}\n ></assignees-view>\n `\n : html`<mwc-icon-button icon=\"group_add\" @click=${this.onClickAssignees.bind(this)}></mwc-icon-button>`}\n </section>\n\n <section>\n <label>Approval Line</label>\n ${approvalLine\n ? html`\n <approval-line-view\n .model=${approvalLine}\n @click=${this.onClickApprovalLine.bind(this)}\n @change=${e => (this.activityInstance.approvalLine = e.currentTarget.value)}\n ></approval-line-view>\n `\n : html`<mwc-icon-button icon=\"group_add\" @click=${this.onClickApprovalLine.bind(this)}></mwc-icon-button>`}\n </section>\n\n <section>\n <img src=${thumbnail} />\n </section>\n\n <label>Input</label>\n\n ${!model\n ? html``\n : html`\n <ox-properties-dynamic-view\n .props=${inputSpec}\n .value=${input}\n @property-change=${e => {\n this.activityInstance.input = e.currentTarget.value\n console.log('activity-instance', this.activityInstance.input)\n }}\n ></ox-properties-dynamic-view>\n `}\n </content>\n\n <div class=\"button-container\">\n <mwc-button raised @click=${e => history.back()}>${i18next.t('button.close')}</mwc-button>\n ${when(\n draftable,\n () => html`\n <mwc-button raised @click=${this.draftActivityInstance.bind(this)}>${i18next.t('button.draft')}</mwc-button>\n `\n )}\n ${when(\n postable,\n () => html`\n <mwc-button raised @click=${this.updateActivityInstance.bind(this)}>${i18next.t('button.save')}</mwc-button>\n <mwc-button raised @click=${this.postActivityInstance.bind(this)}>${i18next.t('button.post')}</mwc-button>\n `\n )}\n </div>\n `\n }\n\n firstUpdated() {\n this.fetchActivity(this.activityId)\n }\n\n async fetchActivity(id) {\n const response = await client.query({\n query: gql`\n query activity($id: String!) {\n activity(id: $id) {\n id\n name\n description\n state\n thumbnail\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.activity = response.data.activity\n }\n\n async draftActivityInstance() {\n const { activityId } = this\n\n const activityInstance = {\n activityId,\n name: this.activity.name,\n description: this.activity.description,\n ...this.activityInstance\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: NewActivityInstance!) {\n draftActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n state\n assignees {\n type\n assignee {\n id\n name\n description\n controlNo\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.draftActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.draft')}`\n })\n })\n }\n }\n\n async updateActivityInstance() {\n const {\n id,\n name,\n description,\n input,\n threadsMin = 0,\n threadsMax = 0,\n assignees,\n approvalLine\n } = this.activityInstance\n\n const patch = {\n name: name || this.activity.name,\n description: description || this.activity.description,\n input,\n threadsMin,\n threadsMax,\n assignees,\n approvalLine\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ActivityInstancePatch!) {\n updateActivityInstance(id: $id, patch: $patch) {\n id\n name\n description\n input\n state\n assignees {\n type\n assignee {\n id\n name\n description\n controlNo\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n id,\n patch\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.updateActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.save')}`\n })\n })\n }\n }\n\n async postActivityInstance() {\n const {\n id,\n name,\n description,\n input,\n threadsMin = 0,\n threadsMax = 0,\n assignees,\n approvalLine\n } = this.activityInstance\n\n const activityInstance = {\n id,\n name: name || this.activity.name,\n description: description || this.activity.description,\n threadsMin,\n threadsMax,\n input,\n assignees,\n approvalLine\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: ActivityInstancePost!) {\n postActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n state\n assignees {\n type\n assignee {\n id\n name\n description\n controlNo\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.postActivityInstance\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.assign')}`\n })\n })\n }\n }\n\n onClickAssignees() {\n const { assignees } = this.activityInstance || {}\n\n const popup = openPopup(\n html`\n <assignees-editor-popup\n .value=${assignees}\n .confirmCallback=${value => {\n this.activityInstance.assignees = value\n this.requestUpdate()\n }}\n ></assignees-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/assignees-editor',\n size: 'large',\n title: i18next.t('title.assignee list')\n }\n )\n popup.onclosed = () => {}\n }\n\n onClickApprovalLine() {\n const { approvalLine } = this.activityInstance || {}\n\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .value=${approvalLine}\n .confirmCallback=${value => {\n this.activityInstance.approvalLine = value\n this.requestUpdate()\n }}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {}\n }\n}\n"]}
@@ -1 +1,2 @@
1
1
  export * from './pages/activity/activity-page.js';
2
+ export * from './activity-summary-generator';
@@ -1,2 +1,3 @@
1
1
  export * from './pages/activity/activity-page.js';
2
+ export * from './activity-summary-generator';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA","sourcesContent":["export * from './pages/activity/activity-page.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './pages/activity/activity-page.js'\nexport * from './activity-summary-generator'\n"]}
@@ -35,6 +35,7 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
35
35
  title: string;
36
36
  action: () => Promise<void>;
37
37
  }[];
38
+ activityApproval: any;
38
39
  };
39
40
  render(): import("lit-html").TemplateResult<1>;
40
41
  activityContent(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html.js").UnsafeHTMLDirective>;
@@ -13,7 +13,6 @@ import { i18next, localize } from '@operato/i18n';
13
13
  import { PageView, store } from '@operato/shell';
14
14
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
15
15
  import { provider } from '@things-factory/board-ui';
16
- const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
17
16
  const ActivityApprovalFetchResult = `\
18
17
  {
19
18
  id
@@ -93,39 +92,12 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
93
92
  Object.assign({ title: i18next.t('button.reject'), action: this._rejectActivityApproval.bind(this) }, CommonButtonStyles.play),
94
93
  Object.assign({ title: i18next.t('button.approve'), action: this._approveActivityApproval.bind(this) }, CommonButtonStyles.save),
95
94
  Object.assign({ title: i18next.t('button.save'), action: this._saveActivityApproval.bind(this) }, CommonButtonStyles.save)
96
- ]
95
+ ],
96
+ activityApproval: this.activityApproval
97
97
  };
98
98
  }
99
99
  render() {
100
- const { round, order, approver, createdAt } = this.activityApproval || {};
101
- const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
102
- const { name, description, thumbnail, approvalLine } = activityInstance || {};
103
- return html `
104
- <div header>
105
- <div>
106
- <div>name: ${name}</div>
107
- <div>description: ${description}</div>
108
- <div>state: ${state}</div>
109
- <div>round: ${round}</div>
110
- <div>order: ${order}</div>
111
- <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
112
- <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
113
- <div>assignee: ${assignee === null || assignee === void 0 ? void 0 : assignee.name}</div>
114
- <div>approver: ${approver === null || approver === void 0 ? void 0 : approver.name}</div>
115
- <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
116
- </div>
117
- <div>
118
- <div approval-line>
119
- ${approvalLine
120
- ? html ` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
121
- : html ``}
122
- </div>
123
- <img src=${thumbnail} />
124
- </div>
125
- </div>
126
-
127
- <div content>${this.activityContent()}</div>
128
- `;
100
+ return html ` ${this.activityContent()}`;
129
101
  }
130
102
  activityContent() {
131
103
  var _a, _b;
@@ -249,6 +221,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
249
221
  });
250
222
  this.activityApproval = response.data.activityApproval;
251
223
  this.activityThread = this.activityApproval.activityThread;
224
+ this.updateContext();
252
225
  }
253
226
  async _rejectActivityApproval() {
254
227
  var { id } = this.activityApproval;
@@ -333,23 +306,6 @@ ActivityApprovalPage.styles = [
333
306
  overflow: auto;
334
307
  }
335
308
 
336
- [header] {
337
- display: flex;
338
- padding: 5px;
339
- }
340
-
341
- [header] > div {
342
- flex: 1;
343
- }
344
-
345
- [content] {
346
- clear: left;
347
-
348
- flex: 1;
349
- display: block;
350
- padding: 5px;
351
- }
352
-
353
309
  ox-board-viewer {
354
310
  width: 100%;
355
311
  height: 100%;
@@ -1 +1 @@
1
- {"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,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,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ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M,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;6DAE0C,2BAA2B;;OAEjF;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,OAAO;aACR;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAA;YAE1D,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;iBACtD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AArVM,2BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAsB;AACjD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AAiLtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AAzNjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAuVhC;SAvVY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] {\n display: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\n flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ]\n }\n }\n\n render() {\n const { round, order, approver, createdAt } = this.activityApproval || {}\n const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>round: ${round}</div>\n <div>order: ${order}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n <div>approver: ${approver?.name}</div>\n <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine\n ? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `\n : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.activityInstance?.uiType) {\n 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() {\n const { uiSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,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,EA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AAC;iBACtD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AA1SM,2BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;KAcF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAsB;AACjD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AAqJtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AA5KjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA4ShC;SA5SY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ],\n activityApproval: this.activityApproval\n }\n }\n\n render() {\n return html` ${this.activityContent()}`\n }\n\n activityContent() {\n switch (this.activityThread?.activityInstance?.uiType) {\n 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() {\n const { uiSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
@@ -35,6 +35,7 @@ export declare class ActivityThreadPage extends ActivityThreadPage_base {
35
35
  title: string;
36
36
  action: () => Promise<void>;
37
37
  })[];
38
+ activityThread: any;
38
39
  };
39
40
  render(): import("lit-html").TemplateResult<1>;
40
41
  activityContent(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html.js").UnsafeHTMLDirective>;
@@ -13,7 +13,6 @@ import { i18next, localize } from '@operato/i18n';
13
13
  import { PageView, store } from '@operato/shell';
14
14
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
15
15
  import { provider } from '@things-factory/board-ui';
16
- const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
17
16
  const ActivityThreadFetchResult = `\
18
17
  {
19
18
  id
@@ -91,33 +90,12 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
91
90
  delegatable && Object.assign({ title: i18next.t('button.delegate'), action: this._delegateActivityThread.bind(this) }, CommonButtonStyles.save),
92
91
  restartable && Object.assign({ title: i18next.t('button.restart'), action: this._restartActivityThread.bind(this) }, CommonButtonStyles.save),
93
92
  abortable && Object.assign({ title: i18next.t('button.abort'), action: this._abortActivityThread.bind(this) }, CommonButtonStyles.cancel)
94
- ].filter(Boolean /* truthy only */)
93
+ ].filter(Boolean /* truthy only */),
94
+ activityThread: this.activityThread
95
95
  };
96
96
  }
97
97
  render() {
98
- const { state, round, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
99
- const { name, description, thumbnail, approvalLine } = activityInstance || {};
100
- return html `
101
- <div header>
102
- <div>
103
- <div>name: ${name}</div>
104
- <div>description: ${description}</div>
105
- <div>state: ${state}</div>
106
- <div>round: ${round}</div>
107
- <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
108
- <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
109
- <div>assignee: ${assignee === null || assignee === void 0 ? void 0 : assignee.name}</div>
110
- </div>
111
- <div>
112
- <div approval-line>
113
- ${approvalLine ? html ` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html ``}
114
- </div>
115
- <img src=${thumbnail} />
116
- </div>
117
- </div>
118
-
119
- <div content>${this.activityContent()}</div>
120
- `;
98
+ return html ` ${this.activityContent()}`;
121
99
  }
122
100
  activityContent() {
123
101
  var _a, _b;
@@ -240,6 +218,7 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
240
218
  }
241
219
  });
242
220
  this.activityThread = response.data.activityThread;
221
+ this.updateContext();
243
222
  }
244
223
  async _startActivityThread() {
245
224
  var { id, output, reason, activityInstance } = this.activityThread;
@@ -387,23 +366,6 @@ ActivityThreadPage.styles = [
387
366
  overflow: auto;
388
367
  }
389
368
 
390
- [header] {
391
- display: flex;
392
- padding: 5px;
393
- }
394
-
395
- [header] > div {
396
- flex: 1;
397
- }
398
-
399
- [content] {
400
- clear: left;
401
-
402
- flex: 1;
403
- display: block;
404
- padding: 5px;
405
- }
406
-
407
369
  ox-board-viewer {
408
370
  width: 100%;
409
371
  height: 100%;