@things-factory/auth-ui 10.1.194 → 10.1.202

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 (65) hide show
  1. package/dist-client/bootstrap.js +4 -1
  2. package/dist-client/bootstrap.js.map +1 -1
  3. package/dist-client/components/access-decision-popup.js +7 -5
  4. package/dist-client/components/access-decision-popup.js.map +1 -1
  5. package/dist-client/components/access-request-popup.d.ts +9 -1
  6. package/dist-client/components/access-request-popup.js +55 -4
  7. package/dist-client/components/access-request-popup.js.map +1 -1
  8. package/dist-client/components/my-login-history.js +14 -10
  9. package/dist-client/components/my-login-history.js.map +1 -1
  10. package/dist-client/components/role-task-edit.d.ts +22 -0
  11. package/dist-client/components/role-task-edit.js +17 -0
  12. package/dist-client/components/role-task-edit.js.map +1 -0
  13. package/dist-client/components/role-task-edit.test.d.ts +1 -0
  14. package/dist-client/components/role-task-edit.test.js +34 -0
  15. package/dist-client/components/role-task-edit.test.js.map +1 -0
  16. package/dist-client/components/role-template-picker.d.ts +5 -0
  17. package/dist-client/components/role-template-picker.js +41 -5
  18. package/dist-client/components/role-template-picker.js.map +1 -1
  19. package/dist-client/components/user-status-renderer.d.ts +9 -0
  20. package/dist-client/components/user-status-renderer.js +36 -0
  21. package/dist-client/components/user-status-renderer.js.map +1 -0
  22. package/dist-client/entity360/person-360.d.ts +13 -0
  23. package/dist-client/entity360/person-360.js +96 -0
  24. package/dist-client/entity360/person-360.js.map +1 -1
  25. package/dist-client/index.d.ts +1 -0
  26. package/dist-client/index.js +14 -1
  27. package/dist-client/index.js.map +1 -1
  28. package/dist-client/pages/access-request/access-requests.js +4 -2
  29. package/dist-client/pages/access-request/access-requests.js.map +1 -1
  30. package/dist-client/pages/access-request/my-access-requests.js +3 -2
  31. package/dist-client/pages/access-request/my-access-requests.js.map +1 -1
  32. package/dist-client/pages/audit/audit-page.d.ts +46 -0
  33. package/dist-client/pages/audit/audit-page.js +417 -0
  34. package/dist-client/pages/audit/audit-page.js.map +1 -0
  35. package/dist-client/pages/role/role-privilege-page.d.ts +46 -0
  36. package/dist-client/pages/role/role-privilege-page.js +500 -5
  37. package/dist-client/pages/role/role-privilege-page.js.map +1 -1
  38. package/dist-client/pages/role/role-task-review.test.d.ts +1 -0
  39. package/dist-client/pages/role/role-task-review.test.js +60 -0
  40. package/dist-client/pages/role/role-task-review.test.js.map +1 -0
  41. package/dist-client/pages/user/user-list-page.js +1 -31
  42. package/dist-client/pages/user/user-list-page.js.map +1 -1
  43. package/dist-client/route.js +3 -0
  44. package/dist-client/route.js.map +1 -1
  45. package/dist-client/tsconfig.tsbuildinfo +1 -1
  46. package/dist-client/utils/access-request.d.ts +15 -1
  47. package/dist-client/utils/access-request.js +19 -2
  48. package/dist-client/utils/access-request.js.map +1 -1
  49. package/dist-client/utils/access-request.test.js +26 -1
  50. package/dist-client/utils/access-request.test.js.map +1 -1
  51. package/dist-client/utils/audit-words.d.ts +30 -0
  52. package/dist-client/utils/audit-words.js +57 -0
  53. package/dist-client/utils/audit-words.js.map +1 -0
  54. package/dist-client/utils/audit-words.test.d.ts +1 -0
  55. package/dist-client/utils/audit-words.test.js +47 -0
  56. package/dist-client/utils/audit-words.test.js.map +1 -0
  57. package/dist-server/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +4 -4
  59. package/things-factory.config.js +1 -0
  60. package/translations/en.json +78 -1
  61. package/translations/es.json +78 -1
  62. package/translations/ja.json +78 -1
  63. package/translations/ko.json +78 -1
  64. package/translations/ms.json +78 -1
  65. package/translations/zh.json +78 -1
@@ -1 +1 @@
1
- {"version":3,"file":"access-requests.js","sourceRoot":"","sources":["../../../client/pages/access-request/access-requests.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,2CAA2C,CAAA;AAElD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA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;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAoE;AAClE;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;kDAAwB;AAEzB;IAA1B,KAAK,CAAC,UAAU,CAAC;;iDAA0B;AApBjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA0L9B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '../../components/access-decision-popup.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\nimport { privilegeWords } from '../../utils/access-request.js'\nimport { listOutcome, pageFromResponse } from '../../utils/list-result.js'\n\n/**\n * Who asked for what in this domain, and what became of it (ADR-0103).\n *\n * This list is where the people deciding receive requests - in every product, worklist or not. A\n * notification may point here; when none went out the request is here all the same. The rows are the\n * record and are never deleted: who decided, which role, why not.\n */\n@customElement('access-requests-page')\nexport class AccessRequestsPage extends p13n(localize(i18next)(PageView)) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n [failed] {\n padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n font: var(--label-font, inherit);\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'\n @property({ type: Boolean }) failed: boolean = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('access-request.title.access requests'),\n help: 'auth/user',\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n actions: [{ title: i18next.t('text.users'), action: () => navigate('users'), icon: 'group' }]\n }\n }\n\n render() {\n return html`\n <ox-grist\n class=\"page-fill\"\n .mode=${this.mode}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ></ox-grist>\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized() {\n const t = i18next.t.bind(i18next)\n this.config = {\n rows: { appendable: false, selectable: { multiple: false } },\n sorters: [{ name: 'createdAt', desc: true }],\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n /* Deciding means something only while it waits - offered only there. */\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'gavel',\n title: t('access-request.button.decide'),\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record?.state === 'PENDING' && this.decide(record) }\n },\n { type: 'string', name: 'requesterName', header: t('access-request.field.requester'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'needed', header: t('access-request.field.needed'), record: { editable: false }, width: 260 },\n { type: 'string', name: 'reason', header: t('access-request.field.reason'), record: { editable: false }, filter: 'search', width: 200 },\n { type: 'string', name: 'stateWords', header: t('field.state'), record: { align: 'center', editable: false }, width: 100 },\n { type: 'integer', name: 'count', header: t('access-request.field.count'), record: { align: 'right', editable: false }, width: 70 },\n { type: 'datetime', name: 'createdAt', header: t('field.created at'), sortable: true, width: 170 },\n { type: 'string', name: 'deciderName', header: t('access-request.field.decided by'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'grantedRoleName', header: t('access-request.field.granted role'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'decisionReason', header: t('access-request.field.decision reason'), record: { editable: false }, width: 200 },\n { type: 'datetime', name: 'decidedAt', header: t('access-request.field.decided at'), sortable: true, width: 170 }\n ]\n }\n }\n\n private decide(record: any) {\n openPopup(\n html`<access-decision-popup .request=${record} @access-request-decided=${() => this.grist.fetch()}></access-decision-popup>`,\n { size: 'medium', title: i18next.t('access-request.title.decide') }\n )\n }\n\n async pageUpdated(_changes: any, lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist.fetch()\n /* A notification links here with the request's id - its decision opens at once, if it still waits. */\n const id = lifecycle?.params?.id\n if (id && id !== this.opened) {\n this.opened = id\n await this.openById(id)\n }\n }\n }\n\n /** The request a link named, opened only while it waits - a decided one is just a row in the list. */\n private opened?: string\n\n private async openById(id: string) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n accessRequests(filters: $filters) {\n items {\n id\n category\n privilege\n reason\n state\n requester {\n id\n name\n email\n }\n }\n }\n }\n `,\n variables: { filters: [{ name: 'id', operator: 'eq', value: id }] },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const request = pageFromResponse(response, 'accessRequests')?.items?.[0]\n if (request?.state === 'PENDING') this.decide(request)\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n accessRequests(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n category\n privilege\n operationName\n reason\n count\n state\n expiresAt\n createdAt\n decidedAt\n decisionReason\n requester {\n id\n name\n email\n }\n decidedBy {\n id\n name\n }\n grantedRole {\n id\n name\n }\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n\n const { items, total, failed } = listOutcome(pageFromResponse(response, 'accessRequests'))\n this.failed = failed\n const t = i18next.t.bind(i18next)\n\n return {\n total,\n records: items.map((item: any) => ({\n ...item,\n /* A pending row past its time is expired - the same reading the review makes. */\n state: item.state === 'PENDING' && item.expiresAt && new Date(item.expiresAt).getTime() <= Date.now() ? 'EXPIRED' : item.state,\n requesterName: item.requester?.name || item.requester?.email || '',\n needed: privilegeWords(t, item.category, item.privilege),\n deciderName: item.decidedBy?.name || '',\n grantedRoleName: item.grantedRole?.name || ''\n })).map((record: any) => ({ ...record, stateWords: t(`access-request.state.${record.state.toLowerCase()}`) }))\n }\n }\n}\n"]}
1
+ {"version":3,"file":"access-requests.js","sourceRoot":"","sources":["../../../client/pages/access-request/access-requests.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,2CAA2C,CAAA;AAElD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE1E;;;;;;GAMG;AAEI,IAAM,kBAAkB,GA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,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;gBAClE,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;gBAC5B,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE;gBACvC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE;aAC9C,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,wBAAwB,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;SAC/G,CAAA;IACH,CAAC;;AA5K4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;kDAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAoE;AAClE;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;kDAAwB;AAEzB;IAA1B,KAAK,CAAC,UAAU,CAAC;;iDAA0B;AApBjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA4L9B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '../../components/access-decision-popup.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\nimport { neededWords } from '../../utils/access-request.js'\nimport { listOutcome, pageFromResponse } from '../../utils/list-result.js'\n\n/**\n * Who asked for what in this domain, and what became of it (ADR-0103).\n *\n * This list is where the people deciding receive requests - in every product, worklist or not. A\n * notification may point here; when none went out the request is here all the same. The rows are the\n * record and are never deleted: who decided, which role, why not.\n */\n@customElement('access-requests-page')\nexport class AccessRequestsPage extends p13n(localize(i18next)(PageView)) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n [failed] {\n padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n font: var(--label-font, inherit);\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'\n @property({ type: Boolean }) failed: boolean = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('access-request.title.access requests'),\n help: 'auth/user',\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n actions: [{ title: i18next.t('text.users'), action: () => navigate('users'), icon: 'group' }]\n }\n }\n\n render() {\n return html`\n <ox-grist\n class=\"page-fill\"\n .mode=${this.mode}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ></ox-grist>\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized() {\n const t = i18next.t.bind(i18next)\n this.config = {\n rows: { appendable: false, selectable: { multiple: false } },\n sorters: [{ name: 'createdAt', desc: true }],\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n /* Deciding means something only while it waits - offered only there. */\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'gavel',\n title: t('access-request.button.decide'),\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record?.state === 'PENDING' && this.decide(record) }\n },\n { type: 'string', name: 'requesterName', header: t('access-request.field.requester'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'needed', header: t('access-request.field.needed'), record: { editable: false }, width: 260 },\n { type: 'string', name: 'reason', header: t('access-request.field.reason'), record: { editable: false }, filter: 'search', width: 200 },\n { type: 'string', name: 'stateWords', header: t('field.state'), record: { align: 'center', editable: false }, width: 100 },\n { type: 'integer', name: 'count', header: t('access-request.field.count'), record: { align: 'right', editable: false }, width: 70 },\n { type: 'datetime', name: 'createdAt', header: t('field.created at'), sortable: true, width: 170 },\n { type: 'string', name: 'deciderName', header: t('access-request.field.decided by'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'grantedRoleName', header: t('access-request.field.granted role'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'decisionReason', header: t('access-request.field.decision reason'), record: { editable: false }, width: 200 },\n { type: 'datetime', name: 'decidedAt', header: t('access-request.field.decided at'), sortable: true, width: 170 }\n ]\n }\n }\n\n private decide(record: any) {\n openPopup(\n html`<access-decision-popup .request=${record} @access-request-decided=${() => this.grist.fetch()}></access-decision-popup>`,\n { size: 'medium', title: i18next.t('access-request.title.decide') }\n )\n }\n\n async pageUpdated(_changes: any, lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist.fetch()\n /* A notification links here with the request's id - its decision opens at once, if it still waits. */\n const id = lifecycle?.params?.id\n if (id && id !== this.opened) {\n this.opened = id\n await this.openById(id)\n }\n }\n }\n\n /** The request a link named, opened only while it waits - a decided one is just a row in the list. */\n private opened?: string\n\n private async openById(id: string) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n accessRequests(filters: $filters) {\n items {\n id\n category\n privilege\n taskId\n reason\n state\n requester {\n id\n name\n email\n }\n }\n }\n }\n `,\n variables: { filters: [{ name: 'id', operator: 'eq', value: id }] },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const request = pageFromResponse(response, 'accessRequests')?.items?.[0]\n if (request?.state === 'PENDING') this.decide(request)\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n accessRequests(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n category\n privilege\n taskId\n operationName\n reason\n count\n state\n expiresAt\n createdAt\n decidedAt\n decisionReason\n requester {\n id\n name\n email\n }\n decidedBy {\n id\n name\n }\n grantedRole {\n id\n name\n }\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n\n const { items, total, failed } = listOutcome(pageFromResponse(response, 'accessRequests'))\n this.failed = failed\n const t = i18next.t.bind(i18next)\n\n return {\n total,\n records: items.map((item: any) => ({\n ...item,\n /* A pending row past its time is expired - the same reading the review makes. */\n state: item.state === 'PENDING' && item.expiresAt && new Date(item.expiresAt).getTime() <= Date.now() ? 'EXPIRED' : item.state,\n requesterName: item.requester?.name || item.requester?.email || '',\n needed: neededWords(t, item),\n deciderName: item.decidedBy?.name || '',\n grantedRoleName: item.grantedRole?.name || ''\n })).map((record: any) => ({ ...record, stateWords: t(`access-request.state.${record.state.toLowerCase()}`) }))\n }\n }\n}\n"]}
@@ -9,7 +9,7 @@ import { OxPrompt } from '@operato/popup/ox-prompt.js';
9
9
  import { PageView } from '@operato/shell';
10
10
  import { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
11
11
  import { isMobileDevice } from '@operato/utils';
12
- import { privilegeWords } from '../../utils/access-request.js';
12
+ import { neededWords } from '../../utils/access-request.js';
13
13
  import { arrayFromResponse, listOutcome } from '../../utils/list-result.js';
14
14
  /**
15
15
  * The person's own access requests - what became of each (ADR-0103). A notification may not reach them;
@@ -99,6 +99,7 @@ let MyAccessRequestsPage = class MyAccessRequestsPage extends localize(i18next)(
99
99
  id
100
100
  category
101
101
  privilege
102
+ taskId
102
103
  state
103
104
  expiresAt
104
105
  createdAt
@@ -121,7 +122,7 @@ let MyAccessRequestsPage = class MyAccessRequestsPage extends localize(i18next)(
121
122
  ...item,
122
123
  state,
123
124
  stateWords: t(`access-request.state.${state.toLowerCase()}`),
124
- needed: privilegeWords(t, item.category, item.privilege),
125
+ needed: neededWords(t, item),
125
126
  grantedRoleName: item.grantedRole?.name || ''
126
127
  };
127
128
  });
@@ -1 +1 @@
1
- {"version":3,"file":"my-access-requests.js","sourceRoot":"","sources":["../../../client/pages/access-request/my-access-requests.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE3E;;;GAGG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAA9D;;QAawB,WAAM,GAAY,KAAK,CAAA;QAEvB,WAAM,GAAY,KAAK,CAAA;IA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BACL,GAAG,IAAI;gBACP,KAAK;gBACL,UAAU,EAAE,CAAC,CAAC,wBAAwB,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC5D,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBACxD,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE;aAC9C,CAAA;QACH,CAAC,CAAC,CAAA;QACF,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;IAC3C,CAAC;;AAzG4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAY;AACV;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAwB;AAEzB;IAA1B,KAAK,CAAC,UAAU,CAAC;;mDAA0B;AAjBjC,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAuHhC","sourcesContent":["import '@operato/data-grist/ox-grist.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport type { DataGrist } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { privilegeWords } from '../../utils/access-request.js'\nimport { arrayFromResponse, listOutcome } from '../../utils/list-result.js'\n\n/**\n * The person's own access requests - what became of each (ADR-0103). A notification may not reach them;\n * this does.\n */\n@customElement('my-access-requests-page')\nexport class MyAccessRequestsPage extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n ScrollbarStyles,\n css`\n [failed] {\n padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: Boolean }) failed: boolean = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return { title: i18next.t('access-request.title.my access requests') }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized() {\n const t = i18next.t.bind(i18next)\n this.config = {\n pagination: { infinite: true },\n rows: { appendable: false, selectable: false },\n columns: [\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'undo',\n title: t('access-request.button.withdraw'),\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record?.state === 'PENDING' && this.withdraw(record) }\n },\n { type: 'string', name: 'needed', header: t('access-request.field.needed'), record: { editable: false }, width: 260 },\n { type: 'string', name: 'stateWords', header: t('field.state'), record: { align: 'center', editable: false }, width: 100 },\n { type: 'string', name: 'grantedRoleName', header: t('access-request.field.granted role'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'decisionReason', header: t('access-request.field.decision reason'), record: { editable: false }, width: 220 },\n { type: 'datetime', name: 'createdAt', header: t('field.created at'), width: 170 }\n ]\n }\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist.fetch()\n }\n }\n\n private async withdraw(record: any) {\n const confirmed = await OxPrompt.open({\n type: 'warning',\n title: i18next.t('access-request.button.withdraw'),\n text: record.needed,\n confirmButton: { text: i18next.t('access-request.button.withdraw') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n\n await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n withdrawAccessRequest(id: $id) {\n id\n }\n }\n `,\n variables: { id: record.id },\n context: gqlContext()\n })\n this.grist.fetch()\n }\n\n async fetchHandler() {\n const response = await client.query({\n query: gql`\n query {\n myAccessRequests {\n id\n category\n privilege\n state\n expiresAt\n createdAt\n decisionReason\n grantedRole {\n name\n }\n }\n }\n `,\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const { items, failed } = listOutcome(arrayFromResponse(response, 'myAccessRequests'))\n this.failed = failed\n const t = i18next.t.bind(i18next)\n const records = items.map((item: any) => {\n const state = item.state === 'PENDING' && item.expiresAt && new Date(item.expiresAt).getTime() <= Date.now() ? 'EXPIRED' : item.state\n return {\n ...item,\n state,\n stateWords: t(`access-request.state.${state.toLowerCase()}`),\n needed: privilegeWords(t, item.category, item.privilege),\n grantedRoleName: item.grantedRole?.name || ''\n }\n })\n return { total: records.length, records }\n }\n}\n"]}
1
+ {"version":3,"file":"my-access-requests.js","sourceRoot":"","sources":["../../../client/pages/access-request/my-access-requests.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,WAAW,EAA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,IAAS,EAAE,EAAE;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;YACrI,OAAO;gBACL,GAAG,IAAI;gBACP,KAAK;gBACL,UAAU,EAAE,CAAC,CAAC,wBAAwB,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC5D,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;gBAC5B,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE;aAC9C,CAAA;QACH,CAAC,CAAC,CAAA;QACF,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;IAC3C,CAAC;;AA1G4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAY;AACV;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAwB;AAEzB;IAA1B,KAAK,CAAC,UAAU,CAAC;;mDAA0B;AAjBjC,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwHhC","sourcesContent":["import '@operato/data-grist/ox-grist.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport type { DataGrist } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { neededWords } from '../../utils/access-request.js'\nimport { arrayFromResponse, listOutcome } from '../../utils/list-result.js'\n\n/**\n * The person's own access requests - what became of each (ADR-0103). A notification may not reach them;\n * this does.\n */\n@customElement('my-access-requests-page')\nexport class MyAccessRequestsPage extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n ScrollbarStyles,\n css`\n [failed] {\n padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: Boolean }) failed: boolean = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return { title: i18next.t('access-request.title.my access requests') }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized() {\n const t = i18next.t.bind(i18next)\n this.config = {\n pagination: { infinite: true },\n rows: { appendable: false, selectable: false },\n columns: [\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'undo',\n title: t('access-request.button.withdraw'),\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record?.state === 'PENDING' && this.withdraw(record) }\n },\n { type: 'string', name: 'needed', header: t('access-request.field.needed'), record: { editable: false }, width: 260 },\n { type: 'string', name: 'stateWords', header: t('field.state'), record: { align: 'center', editable: false }, width: 100 },\n { type: 'string', name: 'grantedRoleName', header: t('access-request.field.granted role'), record: { editable: false }, width: 140 },\n { type: 'string', name: 'decisionReason', header: t('access-request.field.decision reason'), record: { editable: false }, width: 220 },\n { type: 'datetime', name: 'createdAt', header: t('field.created at'), width: 170 }\n ]\n }\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist.fetch()\n }\n }\n\n private async withdraw(record: any) {\n const confirmed = await OxPrompt.open({\n type: 'warning',\n title: i18next.t('access-request.button.withdraw'),\n text: record.needed,\n confirmButton: { text: i18next.t('access-request.button.withdraw') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n\n await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n withdrawAccessRequest(id: $id) {\n id\n }\n }\n `,\n variables: { id: record.id },\n context: gqlContext()\n })\n this.grist.fetch()\n }\n\n async fetchHandler() {\n const response = await client.query({\n query: gql`\n query {\n myAccessRequests {\n id\n category\n privilege\n taskId\n state\n expiresAt\n createdAt\n decisionReason\n grantedRole {\n name\n }\n }\n }\n `,\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const { items, failed } = listOutcome(arrayFromResponse(response, 'myAccessRequests'))\n this.failed = failed\n const t = i18next.t.bind(i18next)\n const records = items.map((item: any) => {\n const state = item.state === 'PENDING' && item.expiresAt && new Date(item.expiresAt).getTime() <= Date.now() ? 'EXPIRED' : item.state\n return {\n ...item,\n state,\n stateWords: t(`access-request.state.${state.toLowerCase()}`),\n needed: neededWords(t, item),\n grantedRoleName: item.grantedRole?.name || ''\n }\n })\n return { total: records.length, records }\n }\n}\n"]}
@@ -0,0 +1,46 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@operato/data-grist';
3
+ import type { CSSResultGroup } from 'lit';
4
+ import { PageView } from '@operato/shell';
5
+ import type { FetchOption } from '@operato/data-grist';
6
+ declare const AuditPageBase: (new (...args: any[]) => {
7
+ __preferenceProviders: {
8
+ [element: string]: import("@operato/p13n").PagePreferenceProvider;
9
+ };
10
+ getPagePreferenceProvider(element: string): import("@operato/p13n").PagePreferenceProvider | undefined;
11
+ }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
12
+ export declare class AuditPage extends AuditPageBase {
13
+ static styles: CSSResultGroup;
14
+ mode: 'CARD' | 'GRID' | 'LIST';
15
+ private view;
16
+ private days;
17
+ private from;
18
+ private to;
19
+ private actor?;
20
+ private door?;
21
+ private outcome;
22
+ private health?;
23
+ private grist;
24
+ get context(): {
25
+ title: string;
26
+ help: string;
27
+ filter: {
28
+ handler: () => void;
29
+ };
30
+ };
31
+ render(): import("lit-html").TemplateResult<1>;
32
+ private renderControls;
33
+ private renderHealth;
34
+ private show;
35
+ private lastDays;
36
+ private pick;
37
+ private narrow;
38
+ pageUpdated(_changes: any, _lifecycle: any): Promise<void>;
39
+ private readHealth;
40
+ private configOf;
41
+ fetchHandler({ page, limit }: FetchOption): Promise<{
42
+ total: any;
43
+ records: any;
44
+ }>;
45
+ }
46
+ export {};
@@ -0,0 +1,417 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@operato/data-grist';
4
+ import gql from 'graphql-tag';
5
+ import { css, html, nothing } from 'lit';
6
+ import { customElement, property, query, state } from 'lit/decorators.js';
7
+ import { keyed } from 'lit/directives/keyed.js';
8
+ import { client } from '@operato/graphql';
9
+ import { i18next, localize } from '@operato/i18n';
10
+ import { p13n } from '@operato/p13n';
11
+ import { PageView } from '@operato/shell';
12
+ import { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
13
+ import { isMobileDevice } from '@operato/utils';
14
+ import { statusRenderer } from '../../components/user-status-renderer.js';
15
+ import { doorWords, lastDays, recordWords } from '../../utils/audit-words.js';
16
+ const PERIODS = [7, 30, 90];
17
+ const VIEWS = ['people', 'doors', 'records'];
18
+ const OUTCOMES = ['', 'denied', 'error', 'failed'];
19
+ const AuditPageBase = p13n(localize(i18next)(PageView));
20
+ function dateInputValue(date) {
21
+ const pad = (n) => String(n).padStart(2, '0');
22
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
23
+ }
24
+ let AuditPage = class AuditPage extends AuditPageBase {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.mode = isMobileDevice() ? 'LIST' : 'GRID';
28
+ this.view = 'people';
29
+ this.days = 30;
30
+ this.from = lastDays(30).from;
31
+ this.to = new Date();
32
+ this.outcome = '';
33
+ }
34
+ static { this.styles = [
35
+ WorkSurfacePageStyles,
36
+ ScrollbarStyles,
37
+ CommonGristStyles,
38
+ CommonHeaderStyles,
39
+ ButtonStyles,
40
+ css `
41
+ .filters {
42
+ flex-wrap: wrap;
43
+ }
44
+
45
+ [group] {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: var(--spacing-tiny, 2px);
49
+ }
50
+
51
+ button[aria-pressed='true'] {
52
+ background-color: var(--md-sys-color-secondary-container);
53
+ color: var(--md-sys-color-on-secondary-container);
54
+ }
55
+
56
+ input[type='date'] {
57
+ height: var(--context-action-height, 28px);
58
+ box-sizing: border-box;
59
+ border: 1px solid var(--md-sys-color-outline-variant);
60
+ border-radius: var(--md-sys-shape-corner-small, 4px);
61
+ background: var(--md-sys-color-surface-container-lowest);
62
+ color: var(--md-sys-color-on-surface);
63
+ font: inherit;
64
+ font-size: var(--ui-t-body, 13px);
65
+ padding: 0 var(--spacing-small, 4px);
66
+ }
67
+
68
+ [narrowed] {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: var(--spacing-small, 4px);
72
+ font-size: var(--ui-t-body, 13px);
73
+ color: var(--md-sys-color-on-surface);
74
+ }
75
+
76
+ [health] {
77
+ margin-left: auto;
78
+ font-size: var(--ui-t-body, 13px);
79
+ color: var(--ui-crit, var(--md-sys-color-error));
80
+ }
81
+ `
82
+ ]; }
83
+ get context() {
84
+ return {
85
+ title: i18next.t('audit.title'),
86
+ help: 'auth/audit',
87
+ filter: {
88
+ handler: () => this.grist.toggleHeadroom()
89
+ }
90
+ };
91
+ }
92
+ render() {
93
+ return html `${keyed(this.view, html `<ox-grist class="page-fill" .mode=${this.mode} .config=${this.configOf(this.view)} .fetchHandler=${this.fetchHandler.bind(this)}>
94
+ <div slot="headroom" class="header">
95
+ <div class="filters">${this.renderControls()}</div>
96
+ </div>
97
+ </ox-grist>`)}`;
98
+ }
99
+ renderControls() {
100
+ const t = i18next.t.bind(i18next);
101
+ const pressed = (on) => (on ? 'true' : 'false');
102
+ return html `
103
+ <div group>
104
+ ${VIEWS.map(view => html `<button quiet aria-pressed=${pressed(this.view === view)} @click=${() => this.show(view)}>${t(`audit.view.${view}`)}</button>`)}
105
+ </div>
106
+
107
+ <div group>
108
+ ${PERIODS.map(days => html `<button quiet aria-pressed=${pressed(this.days === days)} @click=${() => this.lastDays(days)}>${t('audit.period.days', { count: days })}</button>`)}
109
+ <input type="date" aria-label=${t('audit.period.from')} .value=${dateInputValue(this.from)} @change=${(e) => this.pick('from', e)} />
110
+ <span>~</span>
111
+ <input type="date" aria-label=${t('audit.period.to')} .value=${dateInputValue(this.to)} @change=${(e) => this.pick('to', e)} />
112
+ </div>
113
+
114
+ ${this.view === 'records'
115
+ ? html `<div group>
116
+ ${OUTCOMES.map(outcome => html `<button quiet aria-pressed=${pressed(this.outcome === outcome)} @click=${() => this.narrow({ outcome })}>${t(outcome ? `audit.outcome.${outcome}` : 'audit.outcome.all')}</button>`)}
117
+ </div>`
118
+ : nothing}
119
+ ${this.view === 'records' && this.actor
120
+ ? html `<span narrowed>${this.actor.name}<button quiet small @click=${() => this.narrow({ actor: undefined })}>${t('audit.button.all-people')}</button></span>`
121
+ : nothing}
122
+ ${this.view === 'records' && this.door
123
+ ? html `<span narrowed>${doorWords(t, this.door)}<button quiet small @click=${() => this.narrow({ door: undefined })}>${t('audit.button.all-privileges')}</button></span>`
124
+ : nothing}
125
+ ${this.renderHealth()}
126
+ `;
127
+ }
128
+ /* Only what is wrong is said: failures, or that they could not be counted. Never a 0 for "unknown". */
129
+ renderHealth() {
130
+ const health = this.health;
131
+ if (health === 'unknown')
132
+ return html `<span health>${i18next.t('audit.health.unknown')}</span>`;
133
+ if (!health?.failures)
134
+ return nothing;
135
+ return html `<span health>${i18next.t('audit.health.failures', { count: health.failures, since: new Date(health.since).toLocaleString() })}</span>`;
136
+ }
137
+ show(view) {
138
+ this.view = view;
139
+ }
140
+ lastDays(days) {
141
+ const { from, to } = lastDays(days);
142
+ this.days = days;
143
+ this.from = from;
144
+ this.to = to;
145
+ this.grist?.fetch();
146
+ }
147
+ pick(which, event) {
148
+ const value = event.target.value;
149
+ if (!value)
150
+ return;
151
+ const [year, month, day] = value.split('-').map(Number);
152
+ this[which] = which === 'from' ? new Date(year, month - 1, day, 0, 0, 0) : new Date(year, month - 1, day, 23, 59, 59, 999);
153
+ this.days = null;
154
+ this.grist?.fetch();
155
+ }
156
+ narrow(change) {
157
+ Object.assign(this, change);
158
+ if (this.view !== 'records')
159
+ this.view = 'records';
160
+ else
161
+ this.grist?.fetch();
162
+ }
163
+ async pageUpdated(_changes, _lifecycle) {
164
+ if (this.active) {
165
+ await this.updateComplete;
166
+ this.grist?.fetch();
167
+ this.readHealth();
168
+ }
169
+ }
170
+ async readHealth() {
171
+ try {
172
+ const response = await client.query({ query: gql `{ auditHealth { failures since } }`, fetchPolicy: 'no-cache' });
173
+ this.health = response.errors?.length || !response.data?.auditHealth ? 'unknown' : response.data.auditHealth;
174
+ }
175
+ catch {
176
+ this.health = 'unknown';
177
+ }
178
+ }
179
+ configOf(view) {
180
+ const t = i18next.t.bind(i18next);
181
+ const number = (name, header, click) => ({
182
+ type: 'integer',
183
+ name,
184
+ header,
185
+ record: { align: 'right', editable: false },
186
+ width: 90,
187
+ ...(click ? { handlers: { click: (_c, _d, _col, record) => record && click(record) } } : {})
188
+ });
189
+ if (view === 'people') {
190
+ const person = (record) => ({ id: record.id, name: record.name || record.email });
191
+ return {
192
+ rows: { appendable: false, selectable: false },
193
+ pagination: { infinite: true },
194
+ columns: [
195
+ { type: 'gutter', gutterName: 'sequence' },
196
+ {
197
+ type: 'string',
198
+ name: 'name',
199
+ header: t('field.name'),
200
+ record: { editable: false },
201
+ width: 140,
202
+ handlers: { click: (_c, _d, _col, record) => record && this.narrow({ actor: person(record), door: undefined, outcome: '' }) }
203
+ },
204
+ { type: 'string', name: 'email', header: t('field.email'), record: { editable: false }, width: 200 },
205
+ { type: 'string', name: 'roles', header: t('field.roles'), record: { editable: false }, width: 200 },
206
+ { type: 'string', name: 'status', header: t('field.status'), record: { editable: false, align: 'center', renderer: statusRenderer(() => 0) }, width: 80 },
207
+ { type: 'datetime', name: 'lastCheckinAt', header: t('audit.field.last-checkin'), record: { editable: false }, width: 160 },
208
+ number('checkins', t('audit.field.checkins')),
209
+ number('failedSignins', t('audit.field.failed-signins'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'failed' })),
210
+ number('granted', t('audit.field.granted'), record => this.narrow({ actor: person(record), door: undefined, outcome: '' })),
211
+ number('denied', t('audit.field.denied'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'denied' }))
212
+ ]
213
+ };
214
+ }
215
+ if (view === 'doors') {
216
+ return {
217
+ rows: { appendable: false, selectable: false },
218
+ pagination: { infinite: true },
219
+ columns: [
220
+ { type: 'gutter', gutterName: 'sequence' },
221
+ {
222
+ type: 'string',
223
+ name: 'doorWords',
224
+ header: t('audit.field.privilege'),
225
+ record: { editable: false },
226
+ width: 240,
227
+ handlers: { click: (_c, _d, _col, record) => record && this.narrow({ door: record.door, actor: undefined, outcome: '' }) }
228
+ },
229
+ number('people', t('audit.field.people')),
230
+ number('granted', t('audit.field.granted'), record => this.narrow({ door: record.door, actor: undefined, outcome: '' })),
231
+ number('denied', t('audit.field.denied'), record => this.narrow({ door: record.door, actor: undefined, outcome: 'denied' }))
232
+ ]
233
+ };
234
+ }
235
+ return {
236
+ rows: { appendable: false, selectable: false },
237
+ pagination: { pages: [50, 100, 200] },
238
+ columns: [
239
+ { type: 'gutter', gutterName: 'sequence' },
240
+ { type: 'datetime', name: 'createdAt', header: t('audit.field.time'), record: { editable: false }, width: 160 },
241
+ { type: 'string', name: 'actorName', header: t('audit.field.actor'), record: { editable: false }, width: 120 },
242
+ { type: 'string', name: 'operation', header: t('audit.field.request'), record: { editable: false }, width: 200 },
243
+ { type: 'string', name: 'what', header: t('audit.field.actions'), record: { editable: false }, width: 360 },
244
+ { type: 'string', name: 'ip', header: t('audit.field.address'), record: { editable: false }, width: 120 },
245
+ { type: 'integer', name: 'durationMs', header: t('audit.field.duration'), record: { editable: false, align: 'right' }, width: 80 }
246
+ ]
247
+ };
248
+ }
249
+ async fetchHandler({ page, limit }) {
250
+ const t = i18next.t.bind(i18next);
251
+ const period = { from: this.from.toISOString(), to: this.to.toISOString() };
252
+ if (this.view === 'people') {
253
+ const response = await client.query({
254
+ query: gql `
255
+ query ($from: DateTimeISO!, $to: DateTimeISO!) {
256
+ auditPeople(from: $from, to: $to) {
257
+ user {
258
+ id
259
+ name
260
+ email
261
+ status
262
+ }
263
+ roles
264
+ lastCheckinAt
265
+ checkins
266
+ failedSignins
267
+ granted
268
+ denied
269
+ }
270
+ }
271
+ `,
272
+ variables: period,
273
+ fetchPolicy: 'no-cache'
274
+ });
275
+ const people = response.data?.auditPeople || [];
276
+ const records = people
277
+ .map((one) => ({
278
+ ...one,
279
+ id: one.user.id,
280
+ name: one.user.name,
281
+ email: one.user.email,
282
+ roles: one.roles.join(', '),
283
+ status: one.user.status
284
+ }))
285
+ .sort((a, b) => String(b.lastCheckinAt || '').localeCompare(String(a.lastCheckinAt || '')));
286
+ return { total: records.length, records };
287
+ }
288
+ if (this.view === 'doors') {
289
+ const response = await client.query({
290
+ query: gql `
291
+ query ($from: DateTimeISO!, $to: DateTimeISO!) {
292
+ auditDoors(from: $from, to: $to) {
293
+ door
294
+ people
295
+ granted
296
+ denied
297
+ }
298
+ }
299
+ `,
300
+ variables: period,
301
+ fetchPolicy: 'no-cache'
302
+ });
303
+ /* The doors used come first; the rest keep the server's order. */
304
+ const used = (one) => one.granted + one.denied;
305
+ const records = (response.data?.auditDoors || [])
306
+ .map((one) => ({ ...one, doorWords: doorWords(t, one.door) }))
307
+ .sort((a, b) => used(b) - used(a));
308
+ return { total: records.length, records };
309
+ }
310
+ const response = await client.query({
311
+ query: gql `
312
+ query ($filter: AuditRecordFilter!) {
313
+ auditRecords(filter: $filter) {
314
+ items {
315
+ request {
316
+ id
317
+ createdAt
318
+ actor {
319
+ id
320
+ name
321
+ email
322
+ }
323
+ ip
324
+ channel
325
+ operationType
326
+ operationName
327
+ fields
328
+ route
329
+ durationMs
330
+ }
331
+ actions {
332
+ kind
333
+ door
334
+ decision
335
+ outcome
336
+ code
337
+ count
338
+ objectId
339
+ detail
340
+ }
341
+ }
342
+ total
343
+ }
344
+ }
345
+ `,
346
+ variables: {
347
+ filter: {
348
+ ...period,
349
+ actorId: this.actor?.id,
350
+ door: this.door,
351
+ outcome: this.outcome || undefined,
352
+ page,
353
+ limit
354
+ }
355
+ },
356
+ fetchPolicy: 'no-cache'
357
+ });
358
+ const list = response.data?.auditRecords;
359
+ return {
360
+ total: list?.total || 0,
361
+ records: (list?.items || []).map(({ request, actions }) => ({
362
+ id: request.id,
363
+ createdAt: request.createdAt,
364
+ actorName: request.actor?.name || request.actor?.email || '',
365
+ what: recordWords(t, actions),
366
+ operation: request.channel === 'graphql' ? [request.operationType, request.fields || request.operationName].filter(Boolean).join(' ') : request.route || '',
367
+ ip: request.ip,
368
+ durationMs: request.durationMs
369
+ }))
370
+ };
371
+ }
372
+ };
373
+ __decorate([
374
+ property({ type: String }),
375
+ __metadata("design:type", String)
376
+ ], AuditPage.prototype, "mode", void 0);
377
+ __decorate([
378
+ state(),
379
+ __metadata("design:type", String)
380
+ ], AuditPage.prototype, "view", void 0);
381
+ __decorate([
382
+ state(),
383
+ __metadata("design:type", Object)
384
+ ], AuditPage.prototype, "days", void 0);
385
+ __decorate([
386
+ state(),
387
+ __metadata("design:type", Date)
388
+ ], AuditPage.prototype, "from", void 0);
389
+ __decorate([
390
+ state(),
391
+ __metadata("design:type", Date)
392
+ ], AuditPage.prototype, "to", void 0);
393
+ __decorate([
394
+ state(),
395
+ __metadata("design:type", Object)
396
+ ], AuditPage.prototype, "actor", void 0);
397
+ __decorate([
398
+ state(),
399
+ __metadata("design:type", String)
400
+ ], AuditPage.prototype, "door", void 0);
401
+ __decorate([
402
+ state(),
403
+ __metadata("design:type", String)
404
+ ], AuditPage.prototype, "outcome", void 0);
405
+ __decorate([
406
+ state(),
407
+ __metadata("design:type", Object)
408
+ ], AuditPage.prototype, "health", void 0);
409
+ __decorate([
410
+ query('ox-grist'),
411
+ __metadata("design:type", Function)
412
+ ], AuditPage.prototype, "grist", void 0);
413
+ AuditPage = __decorate([
414
+ customElement('audit-page')
415
+ ], AuditPage);
416
+ export { AuditPage };
417
+ //# sourceMappingURL=audit-page.js.map