@things-factory/auth-ui 10.1.202 → 10.1.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/components/access-request-popup.js +6 -1
- package/dist-client/components/access-request-popup.js.map +1 -1
- package/dist-client/entity360/person-360.js +2 -1
- package/dist-client/entity360/person-360.js.map +1 -1
- package/dist-client/pages/audit/audit-page.js +2 -1
- package/dist-client/pages/audit/audit-page.js.map +1 -1
- package/dist-client/pages/role/role-privilege-page.js +1 -1
- package/dist-client/pages/role/role-privilege-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/translations/en.json +0 -1
- package/translations/es.json +0 -1
- package/translations/ja.json +0 -1
- package/translations/ko.json +1 -2
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
|
@@ -60,11 +60,16 @@ let AccessRequestPopup = class AccessRequestPopup extends localize(i18next)(LitE
|
|
|
60
60
|
font: var(--title-font, inherit);
|
|
61
61
|
color: var(--md-sys-color-on-surface);
|
|
62
62
|
}
|
|
63
|
+
/* A choice is a line like the decision popup's role candidates - body size; the one task alone is the title. */
|
|
63
64
|
label[task] {
|
|
64
65
|
display: flex;
|
|
65
66
|
align-items: flex-start;
|
|
66
67
|
gap: var(--spacing-small);
|
|
67
68
|
}
|
|
69
|
+
label[task] [choice] {
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
color: var(--md-sys-color-on-surface);
|
|
72
|
+
}
|
|
68
73
|
[says] {
|
|
69
74
|
font: var(--label-font, inherit);
|
|
70
75
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -178,7 +183,7 @@ let AccessRequestPopup = class AccessRequestPopup extends localize(i18next)(LitE
|
|
|
178
183
|
<label task>
|
|
179
184
|
<md-radio name="task" .checked=${task.taskId === this.taskId} @change=${() => (this.taskId = task.taskId)}></md-radio>
|
|
180
185
|
<span>
|
|
181
|
-
<div
|
|
186
|
+
<div choice>${taskName(t, task.taskId)}</div>
|
|
182
187
|
${taskSays(t, task.taskId) ? html `<div says>${taskSays(t, task.taskId)}</div>` : ''}
|
|
183
188
|
</span>
|
|
184
189
|
</label>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-request-popup.js","sourceRoot":"","sources":["../../client/components/access-request-popup.ts"],"names":[],"mappings":";AAAA,OAAO,oCAAoC,CAAA;AAC3C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAEvD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEtG;;;;;;;;;GASG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA9D;;QAiDuB,aAAQ,GAAW,EAAE,CAAA;QACrB,cAAS,GAAW,EAAE,CAAA;QAGlD,8EAA8E;QAC7D,YAAO,GAAQ,IAAI,CAAA;QACpC,+GAA+G;QAC9F,WAAM,GAAQ,IAAI,CAAA;QACnC,wEAAwE;QACvD,aAAQ,GAAkB,IAAI,CAAA;QAC9B,WAAM,GAAG,EAAE,CAAA;QACX,YAAO,GAAG,K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aAAa,EAAE,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;gBAC7D,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;oBACxB,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE;iBAC5H,CAAC,CACH,CAAA;gBACD,OAAO,CAAC,IAAI,EAAE,CAAA;YAChB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACtB,CAAC;IACH,CAAC;;AA5J2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAuB;AAGjC;IAAhB,KAAK,EAAE;;mDAA4B;AAEnB;IAAhB,KAAK,EAAE;;kDAA2B;AAElB;IAAhB,KAAK,EAAE;;oDAAuC;AAC9B;IAAhB,KAAK,EAAE;;kDAAoB;AACX;IAAhB,KAAK,EAAE;;mDAAwB;AAEf;IAAhB,KAAK,EAAE;;iDAAyC;AAChC;IAAhB,KAAK,EAAE;;kDAAwB;AA/DrB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA8M9B","sourcesContent":["import '@operato/popup/ox-popup-actions.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/textfield/outlined-text-field.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonPopupStyles } from '@operato/styles'\n\nimport '@material/web/radio/radio.js'\n\nimport { maySend, privilegeWords, recentDenial, taskName, taskSays } from '../utils/access-request.js'\n\n/**\n * Asking for a privilege the person was just refused (ADR-0103, docs/design/access-request.md §3-2).\n *\n * What was needed comes from the refusal - the person writes only why, and must (questions Q9). It is said as the work\n * it belongs to: every task holding the refused privilege is listed, fewest privileges first, the first picked, and the\n * person picks the one they were doing (ADR-0103 decision 9). A privilege no task holds is said as itself. Before sending\n * the popup says the request is recorded and how many people it reaches; a denial of the last days is shown with\n * its reason, and the same words are not sent again. A request already waiting is shown instead of a blank form:\n * pressing again adds to it, the people deciding are not told twice.\n */\n@customElement('access-request-popup')\nexport class AccessRequestPopup extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background-color: var(--md-sys-color-surface);\n }\n /* min-height: 0 lets the body scroll inside the popup, so the send button below it stays in view. */\n [body] {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium);\n padding: var(--spacing-large);\n }\n [needed] {\n font: var(--title-font, inherit);\n color: var(--md-sys-color-on-surface);\n }\n label[task] {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-small);\n }\n [says] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-on-surface-variant);\n }\n [operation],\n [waiting],\n [recorded] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-on-surface-variant);\n }\n [denied] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-error);\n }\n md-outlined-text-field {\n width: 100%;\n }\n `\n ]\n\n @property({ type: String }) category: string = ''\n @property({ type: String }) privilege: string = ''\n @property({ type: String }) operationName?: string\n\n /** The request of this person and privilege that is still waiting, if any. */\n @state() private waiting: any = null\n /** A denial of the same privilege in the last days - its reason is shown before the person writes (Q9 · 5). */\n @state() private denied: any = null\n /** How many people a request reaches - said before sending (Q9 · 2). */\n @state() private deciders: number | null = null\n @state() private reason = ''\n @state() private sending = false\n /** The tasks that hold the refused privilege, fewest privileges first - the server's order (tasksGranting). */\n @state() private tasks: { taskId: string }[] = []\n @state() private taskId?: string\n\n async firstUpdated() {\n const response = await client.query({\n query: gql`\n query ($category: String!, $privilege: String!) {\n myAccessRequests {\n id\n category\n privilege\n taskId\n state\n reason\n count\n lastRequestedAt\n decidedAt\n decisionReason\n }\n accessRequestDeciderCount\n tasksGranting(category: $category, privilege: $privilege) {\n taskId\n }\n }\n `,\n variables: { category: this.category, privilege: this.privilege },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const mine = response.data?.myAccessRequests || []\n this.waiting = mine.find((r: any) => r.state === 'PENDING' && r.category === this.category && r.privilege === this.privilege) || null\n this.denied = this.waiting ? null : recentDenial(mine, this.category, this.privilege) || null\n this.deciders = typeof response.data?.accessRequestDeciderCount === 'number' ? response.data.accessRequestDeciderCount : null\n this.reason = this.waiting?.reason || ''\n this.tasks = response.data?.tasksGranting || []\n /* A request already waiting keeps the work it named - asking again adds to it and does not change it. */\n this.taskId = this.tasks.find(task => task.taskId === this.waiting?.taskId)?.taskId ?? this.tasks[0]?.taskId\n }\n\n render() {\n return html`\n <div body>\n ${this.renderNeeded()}\n ${this.operationName\n ? html`<div operation>${i18next.t('access-request.text.refused at', { operation: this.operationName })}</div>`\n : ''}\n ${this.waiting\n ? html`<div waiting>\n ${i18next.t('access-request.text.already waiting', { at: new Date(this.waiting.lastRequestedAt).toLocaleString() })}\n </div>`\n : ''}\n ${this.denied\n ? html`<div denied>\n ${i18next.t('access-request.text.denied lately', {\n at: new Date(this.denied.decidedAt).toLocaleDateString(),\n reason: this.denied.decisionReason || ''\n })}\n </div>`\n : ''}\n <md-outlined-text-field\n label=${i18next.t('access-request.field.reason')}\n required\n type=\"textarea\"\n rows=\"2\"\n .value=${this.reason}\n @input=${(e: any) => (this.reason = e.target.value)}\n ></md-outlined-text-field>\n ${this.deciders === null\n ? ''\n : html`<div recorded>\n ${this.deciders > 0\n ? i18next.t('access-request.text.recorded and told', { count: this.deciders })\n : i18next.t('access-request.text.nobody to tell')}\n </div>`}\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => history.back()}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${this.sending || !maySend(this.reason, this.denied) || this.deciders === 0} @click=${this.send}>\n ${i18next.t('access-request.button.send')}\n </md-filled-button>\n </ox-popup-actions>\n `\n }\n\n /** The work the refused privilege belongs to - one line for one task, a choice for several, the privilege for none. */\n private renderNeeded() {\n const t = i18next.t.bind(i18next)\n if (this.tasks.length === 0) return html`<div needed>${privilegeWords(t, this.category, this.privilege)}</div>`\n if (this.tasks.length === 1) {\n const says = taskSays(t, this.tasks[0].taskId)\n return html`<div needed>${taskName(t, this.tasks[0].taskId)}</div>\n ${says ? html`<div says>${says}</div>` : ''}`\n }\n return this.tasks.map(\n task => html`\n <label task>\n <md-radio name=\"task\" .checked=${task.taskId === this.taskId} @change=${() => (this.taskId = task.taskId)}></md-radio>\n <span>\n <div needed>${taskName(t, task.taskId)}</div>\n ${taskSays(t, task.taskId) ? html`<div says>${taskSays(t, task.taskId)}</div>` : ''}\n </span>\n </label>\n `\n )\n }\n\n private async send() {\n this.sending = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($request: NewAccessRequest!) {\n requestAccess(request: $request) {\n id\n count\n }\n }\n `,\n variables: {\n request: {\n category: this.category,\n privilege: this.privilege,\n operationName: this.operationName,\n taskId: this.taskId,\n reason: this.reason.trim()\n }\n },\n context: gqlContext()\n })\n\n if (!response.errors?.length) {\n const merged = (response.data?.requestAccess?.count || 1) > 1\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: { level: 'info', message: i18next.t(merged ? 'access-request.text.added to waiting' : 'access-request.text.sent') }\n })\n )\n history.back()\n }\n } finally {\n this.sending = false\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"access-request-popup.js","sourceRoot":"","sources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,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE;iBAC5H,CAAC,CACH,CAAA;gBACD,OAAO,CAAC,IAAI,EAAE,CAAA;YAChB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACtB,CAAC;IACH,CAAC;;AA5J2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAuB;AAGjC;IAAhB,KAAK,EAAE;;mDAA4B;AAEnB;IAAhB,KAAK,EAAE;;kDAA2B;AAElB;IAAhB,KAAK,EAAE;;oDAAuC;AAC9B;IAAhB,KAAK,EAAE;;kDAAoB;AACX;IAAhB,KAAK,EAAE;;mDAAwB;AAEf;IAAhB,KAAK,EAAE;;iDAAyC;AAChC;IAAhB,KAAK,EAAE;;kDAAwB;AApErB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAmN9B","sourcesContent":["import '@operato/popup/ox-popup-actions.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/textfield/outlined-text-field.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonPopupStyles } from '@operato/styles'\n\nimport '@material/web/radio/radio.js'\n\nimport { maySend, privilegeWords, recentDenial, taskName, taskSays } from '../utils/access-request.js'\n\n/**\n * Asking for a privilege the person was just refused (ADR-0103, docs/design/access-request.md §3-2).\n *\n * What was needed comes from the refusal - the person writes only why, and must (questions Q9). It is said as the work\n * it belongs to: every task holding the refused privilege is listed, fewest privileges first, the first picked, and the\n * person picks the one they were doing (ADR-0103 decision 9). A privilege no task holds is said as itself. Before sending\n * the popup says the request is recorded and how many people it reaches; a denial of the last days is shown with\n * its reason, and the same words are not sent again. A request already waiting is shown instead of a blank form:\n * pressing again adds to it, the people deciding are not told twice.\n */\n@customElement('access-request-popup')\nexport class AccessRequestPopup extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background-color: var(--md-sys-color-surface);\n }\n /* min-height: 0 lets the body scroll inside the popup, so the send button below it stays in view. */\n [body] {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium);\n padding: var(--spacing-large);\n }\n [needed] {\n font: var(--title-font, inherit);\n color: var(--md-sys-color-on-surface);\n }\n /* A choice is a line like the decision popup's role candidates - body size; the one task alone is the title. */\n label[task] {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-small);\n }\n label[task] [choice] {\n font-weight: 600;\n color: var(--md-sys-color-on-surface);\n }\n [says] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-on-surface-variant);\n }\n [operation],\n [waiting],\n [recorded] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-on-surface-variant);\n }\n [denied] {\n font: var(--label-font, inherit);\n color: var(--md-sys-color-error);\n }\n md-outlined-text-field {\n width: 100%;\n }\n `\n ]\n\n @property({ type: String }) category: string = ''\n @property({ type: String }) privilege: string = ''\n @property({ type: String }) operationName?: string\n\n /** The request of this person and privilege that is still waiting, if any. */\n @state() private waiting: any = null\n /** A denial of the same privilege in the last days - its reason is shown before the person writes (Q9 · 5). */\n @state() private denied: any = null\n /** How many people a request reaches - said before sending (Q9 · 2). */\n @state() private deciders: number | null = null\n @state() private reason = ''\n @state() private sending = false\n /** The tasks that hold the refused privilege, fewest privileges first - the server's order (tasksGranting). */\n @state() private tasks: { taskId: string }[] = []\n @state() private taskId?: string\n\n async firstUpdated() {\n const response = await client.query({\n query: gql`\n query ($category: String!, $privilege: String!) {\n myAccessRequests {\n id\n category\n privilege\n taskId\n state\n reason\n count\n lastRequestedAt\n decidedAt\n decisionReason\n }\n accessRequestDeciderCount\n tasksGranting(category: $category, privilege: $privilege) {\n taskId\n }\n }\n `,\n variables: { category: this.category, privilege: this.privilege },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n const mine = response.data?.myAccessRequests || []\n this.waiting = mine.find((r: any) => r.state === 'PENDING' && r.category === this.category && r.privilege === this.privilege) || null\n this.denied = this.waiting ? null : recentDenial(mine, this.category, this.privilege) || null\n this.deciders = typeof response.data?.accessRequestDeciderCount === 'number' ? response.data.accessRequestDeciderCount : null\n this.reason = this.waiting?.reason || ''\n this.tasks = response.data?.tasksGranting || []\n /* A request already waiting keeps the work it named - asking again adds to it and does not change it. */\n this.taskId = this.tasks.find(task => task.taskId === this.waiting?.taskId)?.taskId ?? this.tasks[0]?.taskId\n }\n\n render() {\n return html`\n <div body>\n ${this.renderNeeded()}\n ${this.operationName\n ? html`<div operation>${i18next.t('access-request.text.refused at', { operation: this.operationName })}</div>`\n : ''}\n ${this.waiting\n ? html`<div waiting>\n ${i18next.t('access-request.text.already waiting', { at: new Date(this.waiting.lastRequestedAt).toLocaleString() })}\n </div>`\n : ''}\n ${this.denied\n ? html`<div denied>\n ${i18next.t('access-request.text.denied lately', {\n at: new Date(this.denied.decidedAt).toLocaleDateString(),\n reason: this.denied.decisionReason || ''\n })}\n </div>`\n : ''}\n <md-outlined-text-field\n label=${i18next.t('access-request.field.reason')}\n required\n type=\"textarea\"\n rows=\"2\"\n .value=${this.reason}\n @input=${(e: any) => (this.reason = e.target.value)}\n ></md-outlined-text-field>\n ${this.deciders === null\n ? ''\n : html`<div recorded>\n ${this.deciders > 0\n ? i18next.t('access-request.text.recorded and told', { count: this.deciders })\n : i18next.t('access-request.text.nobody to tell')}\n </div>`}\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => history.back()}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${this.sending || !maySend(this.reason, this.denied) || this.deciders === 0} @click=${this.send}>\n ${i18next.t('access-request.button.send')}\n </md-filled-button>\n </ox-popup-actions>\n `\n }\n\n /** The work the refused privilege belongs to - one line for one task, a choice for several, the privilege for none. */\n private renderNeeded() {\n const t = i18next.t.bind(i18next)\n if (this.tasks.length === 0) return html`<div needed>${privilegeWords(t, this.category, this.privilege)}</div>`\n if (this.tasks.length === 1) {\n const says = taskSays(t, this.tasks[0].taskId)\n return html`<div needed>${taskName(t, this.tasks[0].taskId)}</div>\n ${says ? html`<div says>${says}</div>` : ''}`\n }\n return this.tasks.map(\n task => html`\n <label task>\n <md-radio name=\"task\" .checked=${task.taskId === this.taskId} @change=${() => (this.taskId = task.taskId)}></md-radio>\n <span>\n <div choice>${taskName(t, task.taskId)}</div>\n ${taskSays(t, task.taskId) ? html`<div says>${taskSays(t, task.taskId)}</div>` : ''}\n </span>\n </label>\n `\n )\n }\n\n private async send() {\n this.sending = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($request: NewAccessRequest!) {\n requestAccess(request: $request) {\n id\n count\n }\n }\n `,\n variables: {\n request: {\n category: this.category,\n privilege: this.privilege,\n operationName: this.operationName,\n taskId: this.taskId,\n reason: this.reason.trim()\n }\n },\n context: gqlContext()\n })\n\n if (!response.errors?.length) {\n const merged = (response.data?.requestAccess?.count || 1) > 1\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: { level: 'info', message: i18next.t(merged ? 'access-request.text.added to waiting' : 'access-request.text.sent') }\n })\n )\n history.back()\n }\n } finally {\n this.sending = false\n }\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
4
4
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
5
|
import { client } from '@operato/graphql';
|
|
6
6
|
import { i18next } from '@operato/i18n';
|
|
7
|
+
import { formatWhen } from '@operato/utils/when.js';
|
|
7
8
|
import { lastDays, recordWords } from '../utils/audit-words.js';
|
|
8
9
|
import { readEntity360Door, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
|
|
9
10
|
/**
|
|
@@ -105,7 +106,7 @@ let PersonAuditSection = class PersonAuditSection extends LitElement {
|
|
|
105
106
|
.message=${answer?.message ?? ''}
|
|
106
107
|
>
|
|
107
108
|
<ul>
|
|
108
|
-
${(answer?.data || []).map(line => html `<li><time>${
|
|
109
|
+
${(answer?.data || []).map(line => html `<li><time>${formatWhen(line.at, { lang: i18next.language, style: 'datetime' }) ?? ''}</time><span>${line.what}</span></li>`)}
|
|
109
110
|
</ul>
|
|
110
111
|
</ox-entity360-section>`;
|
|
111
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person-360.js","sourceRoot":"","sources":["../../client/entity360/person-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EAGzB,MAAM,iBAAiB,CAAA;AAExB;;;;;;;GAOG;AAEH,MAAM,UAAU,kBAAkB;IAChC,qBAAqB,CAAC;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,I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E,OAAO,EAAE,CAAC;eACrD,MAAM,EAAE,KAAK,IAAI,SAAS;iBACxB,MAAM,EAAE,OAAO,IAAI,EAAE;;;UAG5B,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC;;4BAE3C,CAAA;IAC1B,CAAC;;AAzC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;mDAA2B;AACjD;IAAR,KAAK,EAAE;;kDAA6D;AApB1D,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA6D9B","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\n\nimport { lastDays, recordWords } from '../utils/audit-words.js'\nimport {\n readEntity360Door,\n registerEntity360Kind,\n registerEntity360Section,\n type Entity360DoorAnswer,\n type Entity360Subject\n} from '@operato/layout'\n\n/**\n * The person 360 (ADR-0067, design/ui/entity360-person.md): a `User` value anywhere - a grid's\n * `updater`, a request's author - opens it. auth-ui declares the kind because the account is its\n * fact; organization and worklist hang their own sections on it with their own doors.\n *\n * This section is identity and the roles held on this site. `userRoles` answers this domain's roles\n * only (and its parent's) - `User.roles` answers every domain's and must not be used here.\n */\n\nexport function registerPersonKind() {\n registerEntity360Kind({\n kind: 'person',\n typenames: ['User'],\n title: ({ value }) => value.name || value.email || '',\n context: ({ value }) => (value.name && value.email ? value.email : '')\n })\n\n registerEntity360Section('person', {\n name: 'roles',\n order: 30,\n render: subject => html`<person-roles-section .subject=${subject}></person-roles-section>`\n })\n}\n\n/** The person's last requests in this domain - for those who hold `audit:query` (ADR-0141 §6.1). */\nexport function registerPersonAuditSection() {\n registerEntity360Section('person', {\n name: 'audit',\n order: 40,\n render: subject => html`<person-audit-section .subject=${subject}></person-audit-section>`\n })\n}\n\nconst AUDIT_SHOWN = 10\n\n@customElement('person-audit-section')\nexport class PersonAuditSection extends LitElement {\n static styles = css`\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 4px 12px;\n font: 13px/1.5 sans-serif;\n color: var(--md-sys-color-on-surface);\n }\n li {\n display: contents;\n }\n time {\n color: var(--md-sys-color-on-surface-variant);\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<{ at: string; what: string }[]>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const { from, to } = lastDays(30)\n const response = await client.query({\n query: gql`\n query ($filter: AuditRecordFilter!) {\n auditRecords(filter: $filter) {\n items {\n request {\n createdAt\n }\n actions {\n kind\n door\n decision\n outcome\n code\n count\n detail\n }\n }\n }\n }\n `,\n variables: { filter: { from: from.toISOString(), to: to.toISOString(), actorId: id, limit: AUDIT_SHOWN } },\n fetchPolicy: 'no-cache'\n })\n\n if (this.subject?.id !== id) return\n const t = i18next.t.bind(i18next)\n this.answer = readEntity360Door(response, data =>\n (data?.auditRecords?.items || [])\n .map((item: any) => ({ at: item.request.createdAt, what: recordWords(t, item.actions) }))\n .filter((line: any) => line.what)\n )\n }\n\n render() {\n const answer = this.answer\n return html`<ox-entity360-section\n .heading=${i18next.t('audit.title')}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n <ul>\n ${(answer?.data || []).map(line => html`<li><time>${new Date(line.at).toLocaleString()}</time><span>${line.what}</span></li>`)}\n </ul>\n </ox-entity360-section>`\n }\n}\n\n@customElement('person-roles-section')\nexport class PersonRolesSection extends LitElement {\n static styles = css`\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n }\n li {\n padding: 2px 8px;\n border-radius: var(--md-sys-shape-corner-small, 8px);\n background: var(--md-sys-color-surface-container-high);\n color: var(--md-sys-color-on-surface);\n font: 13px/1.5 sans-serif;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<{ id: string; name: string }[]>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const response = await client.query({\n query: gql`\n query ($userId: String!) {\n userRoles(userId: $userId) {\n id\n name\n assigned\n }\n }\n `,\n variables: { userId: id }\n })\n\n /* A later subject may have arrived while this one was being read. */\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => (data?.userRoles || []).filter((role: any) => role.assigned))\n }\n\n render() {\n const answer = this.answer\n return html`<ox-entity360-section\n .heading=${i18next.t('field.roles', { defaultValue: 'roles' })}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n <ul>\n ${(answer?.data || []).map(role => html`<li>${role.name}</li>`)}\n </ul>\n </ox-entity360-section>`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"person-360.js","sourceRoot":"","sources":["../../client/entity360/person-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,qBAAqB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G,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;IACjH,CAAC;IAED,MAAM;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC1B,OAAO,IAAI,CAAA;iBACE,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;eACrD,MAAM,EAAE,KAAK,IAAI,SAAS;iBACxB,MAAM,EAAE,OAAO,IAAI,EAAE;;;UAG5B,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC;;4BAE3C,CAAA;IAC1B,CAAC;;AAzC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;mDAA2B;AACjD;IAAR,KAAK,EAAE;;kDAA6D;AApB1D,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA6D9B","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { formatWhen } from '@operato/utils/when.js'\n\nimport { lastDays, recordWords } from '../utils/audit-words.js'\nimport {\n readEntity360Door,\n registerEntity360Kind,\n registerEntity360Section,\n type Entity360DoorAnswer,\n type Entity360Subject\n} from '@operato/layout'\n\n/**\n * The person 360 (ADR-0067, design/ui/entity360-person.md): a `User` value anywhere - a grid's\n * `updater`, a request's author - opens it. auth-ui declares the kind because the account is its\n * fact; organization and worklist hang their own sections on it with their own doors.\n *\n * This section is identity and the roles held on this site. `userRoles` answers this domain's roles\n * only (and its parent's) - `User.roles` answers every domain's and must not be used here.\n */\n\nexport function registerPersonKind() {\n registerEntity360Kind({\n kind: 'person',\n typenames: ['User'],\n title: ({ value }) => value.name || value.email || '',\n context: ({ value }) => (value.name && value.email ? value.email : '')\n })\n\n registerEntity360Section('person', {\n name: 'roles',\n order: 30,\n render: subject => html`<person-roles-section .subject=${subject}></person-roles-section>`\n })\n}\n\n/** The person's last requests in this domain - for those who hold `audit:query` (ADR-0141 §6.1). */\nexport function registerPersonAuditSection() {\n registerEntity360Section('person', {\n name: 'audit',\n order: 40,\n render: subject => html`<person-audit-section .subject=${subject}></person-audit-section>`\n })\n}\n\nconst AUDIT_SHOWN = 10\n\n@customElement('person-audit-section')\nexport class PersonAuditSection extends LitElement {\n static styles = css`\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 4px 12px;\n font: 13px/1.5 sans-serif;\n color: var(--md-sys-color-on-surface);\n }\n li {\n display: contents;\n }\n time {\n color: var(--md-sys-color-on-surface-variant);\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<{ at: string; what: string }[]>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const { from, to } = lastDays(30)\n const response = await client.query({\n query: gql`\n query ($filter: AuditRecordFilter!) {\n auditRecords(filter: $filter) {\n items {\n request {\n createdAt\n }\n actions {\n kind\n door\n decision\n outcome\n code\n count\n detail\n }\n }\n }\n }\n `,\n variables: { filter: { from: from.toISOString(), to: to.toISOString(), actorId: id, limit: AUDIT_SHOWN } },\n fetchPolicy: 'no-cache'\n })\n\n if (this.subject?.id !== id) return\n const t = i18next.t.bind(i18next)\n this.answer = readEntity360Door(response, data =>\n (data?.auditRecords?.items || [])\n .map((item: any) => ({ at: item.request.createdAt, what: recordWords(t, item.actions) }))\n .filter((line: any) => line.what)\n )\n }\n\n render() {\n const answer = this.answer\n return html`<ox-entity360-section\n .heading=${i18next.t('audit.title')}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n <ul>\n ${(answer?.data || []).map(line => html`<li><time>${formatWhen(line.at, { lang: i18next.language, style: 'datetime' }) ?? ''}</time><span>${line.what}</span></li>`)}\n </ul>\n </ox-entity360-section>`\n }\n}\n\n@customElement('person-roles-section')\nexport class PersonRolesSection extends LitElement {\n static styles = css`\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n }\n li {\n padding: 2px 8px;\n border-radius: var(--md-sys-shape-corner-small, 8px);\n background: var(--md-sys-color-surface-container-high);\n color: var(--md-sys-color-on-surface);\n font: 13px/1.5 sans-serif;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<{ id: string; name: string }[]>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const response = await client.query({\n query: gql`\n query ($userId: String!) {\n userRoles(userId: $userId) {\n id\n name\n assigned\n }\n }\n `,\n variables: { userId: id }\n })\n\n /* A later subject may have arrived while this one was being read. */\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => (data?.userRoles || []).filter((role: any) => role.assigned))\n }\n\n render() {\n const answer = this.answer\n return html`<ox-entity360-section\n .heading=${i18next.t('field.roles', { defaultValue: 'roles' })}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n <ul>\n ${(answer?.data || []).map(role => html`<li>${role.name}</li>`)}\n </ul>\n </ox-entity360-section>`\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { customElement, property, query, state } from 'lit/decorators.js';
|
|
|
7
7
|
import { keyed } from 'lit/directives/keyed.js';
|
|
8
8
|
import { client } from '@operato/graphql';
|
|
9
9
|
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { formatWhen } from '@operato/utils/when.js';
|
|
10
11
|
import { p13n } from '@operato/p13n';
|
|
11
12
|
import { PageView } from '@operato/shell';
|
|
12
13
|
import { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
@@ -132,7 +133,7 @@ let AuditPage = class AuditPage extends AuditPageBase {
|
|
|
132
133
|
return html `<span health>${i18next.t('audit.health.unknown')}</span>`;
|
|
133
134
|
if (!health?.failures)
|
|
134
135
|
return nothing;
|
|
135
|
-
return html `<span health>${i18next.t('audit.health.failures', { count: health.failures, since:
|
|
136
|
+
return html `<span health>${i18next.t('audit.health.failures', { count: health.failures, since: formatWhen(health.since, { lang: i18next.language, style: 'datetime' }) ?? '' })}</span>`;
|
|
136
137
|
}
|
|
137
138
|
show(view) {
|
|
138
139
|
this.view = view;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-page.js","sourceRoot":"","sources":["../../../client/pages/audit/audit-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,iBAA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{ css, html, nothing } from 'lit'\nimport type { CSSResultGroup } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { p13n } from '@operato/p13n'\nimport { PageView } from '@operato/shell'\nimport { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\n\nimport { statusRenderer } from '../../components/user-status-renderer.js'\nimport { doorWords, lastDays, recordWords } from '../../utils/audit-words.js'\n\n/**\n * 감사 기록 (ADR-0141 §6.1) - who did what in this domain, read three ways: by person, by privilege,\n * and the requests one by one. A person's or a privilege's numbers open the requests behind them.\n *\n * Reading only. The audit has no door that changes a row (§4-6), so this screen has no action.\n */\n\ntype View = 'people' | 'doors' | 'records'\ntype Outcome = '' | 'denied' | 'error' | 'failed'\n\nconst PERIODS = [7, 30, 90]\nconst VIEWS: View[] = ['people', 'doors', 'records']\nconst OUTCOMES: Outcome[] = ['', 'denied', 'error', 'failed']\n\nconst AuditPageBase = p13n(localize(i18next)(PageView))\n\nfunction dateInputValue(date: Date) {\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n}\n\n@customElement('audit-page')\nexport class AuditPage extends AuditPageBase {\n static styles: CSSResultGroup = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ButtonStyles,\n css`\n .filters {\n flex-wrap: wrap;\n }\n\n [group] {\n display: flex;\n align-items: center;\n gap: var(--spacing-tiny, 2px);\n }\n\n button[aria-pressed='true'] {\n background-color: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n\n input[type='date'] {\n height: var(--context-action-height, 28px);\n box-sizing: border-box;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container-lowest);\n color: var(--md-sys-color-on-surface);\n font: inherit;\n font-size: var(--ui-t-body, 13px);\n padding: 0 var(--spacing-small, 4px);\n }\n\n [narrowed] {\n display: flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n font-size: var(--ui-t-body, 13px);\n color: var(--md-sys-color-on-surface);\n }\n\n [health] {\n margin-left: auto;\n font-size: var(--ui-t-body, 13px);\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n ]\n\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'LIST' : 'GRID'\n\n @state() private view: View = 'people'\n @state() private days: number | null = 30\n @state() private from: Date = lastDays(30).from\n @state() private to: Date = new Date()\n @state() private actor?: { id: string; name: string }\n @state() private door?: string\n @state() private outcome: Outcome = ''\n @state() private health?: { failures: number; since: string } | 'unknown'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('audit.title'),\n help: 'auth/audit',\n filter: {\n handler: () => this.grist.toggleHeadroom()\n }\n }\n }\n\n render() {\n return html`${keyed(\n this.view,\n html`<ox-grist class=\"page-fill\" .mode=${this.mode} .config=${this.configOf(this.view)} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">${this.renderControls()}</div>\n </div>\n </ox-grist>`\n )}`\n }\n\n private renderControls() {\n const t = i18next.t.bind(i18next)\n const pressed = (on: boolean) => (on ? 'true' : 'false')\n\n return html`\n <div group>\n ${VIEWS.map(view => html`<button quiet aria-pressed=${pressed(this.view === view)} @click=${() => this.show(view)}>${t(`audit.view.${view}`)}</button>`)}\n </div>\n\n <div group>\n ${PERIODS.map(days => html`<button quiet aria-pressed=${pressed(this.days === days)} @click=${() => this.lastDays(days)}>${t('audit.period.days', { count: days })}</button>`)}\n <input type=\"date\" aria-label=${t('audit.period.from')} .value=${dateInputValue(this.from)} @change=${(e: Event) => this.pick('from', e)} />\n <span>~</span>\n <input type=\"date\" aria-label=${t('audit.period.to')} .value=${dateInputValue(this.to)} @change=${(e: Event) => this.pick('to', e)} />\n </div>\n\n ${this.view === 'records'\n ? html`<div group>\n ${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>`)}\n </div>`\n : nothing}\n ${this.view === 'records' && this.actor\n ? html`<span narrowed>${this.actor.name}<button quiet small @click=${() => this.narrow({ actor: undefined })}>${t('audit.button.all-people')}</button></span>`\n : nothing}\n ${this.view === 'records' && this.door\n ? html`<span narrowed>${doorWords(t, this.door)}<button quiet small @click=${() => this.narrow({ door: undefined })}>${t('audit.button.all-privileges')}</button></span>`\n : nothing}\n ${this.renderHealth()}\n `\n }\n\n /* Only what is wrong is said: failures, or that they could not be counted. Never a 0 for \"unknown\". */\n private renderHealth() {\n const health = this.health\n if (health === 'unknown') return html`<span health>${i18next.t('audit.health.unknown')}</span>`\n if (!health?.failures) return nothing\n return html`<span health>${i18next.t('audit.health.failures', { count: health.failures, since: new Date(health.since).toLocaleString() })}</span>`\n }\n\n private show(view: View) {\n this.view = view\n }\n\n private lastDays(days: number) {\n const { from, to } = lastDays(days)\n this.days = days\n this.from = from\n this.to = to\n this.grist?.fetch()\n }\n\n private pick(which: 'from' | 'to', event: Event) {\n const value = (event.target as HTMLInputElement).value\n if (!value) return\n const [year, month, day] = value.split('-').map(Number)\n this[which] = which === 'from' ? new Date(year, month - 1, day, 0, 0, 0) : new Date(year, month - 1, day, 23, 59, 59, 999)\n this.days = null\n this.grist?.fetch()\n }\n\n private narrow(change: { actor?: { id: string; name: string }; door?: string; outcome?: Outcome }) {\n Object.assign(this, change)\n if (this.view !== 'records') this.view = 'records'\n else this.grist?.fetch()\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist?.fetch()\n this.readHealth()\n }\n }\n\n private async readHealth() {\n try {\n const response = await client.query({ query: gql`{ auditHealth { failures since } }`, fetchPolicy: 'no-cache' })\n this.health = response.errors?.length || !response.data?.auditHealth ? 'unknown' : response.data.auditHealth\n } catch {\n this.health = 'unknown'\n }\n }\n\n private configOf(view: View) {\n const t = i18next.t.bind(i18next)\n const number = (name: string, header: string, click?: (record: any) => void) => ({\n type: 'integer',\n name,\n header,\n record: { align: 'right', editable: false },\n width: 90,\n ...(click ? { handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && click(record) } } : {})\n })\n\n if (view === 'people') {\n const person = (record: any) => ({ id: record.id, name: record.name || record.email })\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'name',\n header: t('field.name'),\n record: { editable: false },\n width: 140,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ actor: person(record), door: undefined, outcome: '' }) }\n },\n { type: 'string', name: 'email', header: t('field.email'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'roles', header: t('field.roles'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'status', header: t('field.status'), record: { editable: false, align: 'center', renderer: statusRenderer(() => 0) }, width: 80 },\n { type: 'datetime', name: 'lastCheckinAt', header: t('audit.field.last-checkin'), record: { editable: false }, width: 160 },\n number('checkins', t('audit.field.checkins')),\n number('failedSignins', t('audit.field.failed-signins'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'failed' })),\n number('granted', t('audit.field.granted'), record => this.narrow({ actor: person(record), door: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n if (view === 'doors') {\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'doorWords',\n header: t('audit.field.privilege'),\n record: { editable: false },\n width: 240,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ door: record.door, actor: undefined, outcome: '' }) }\n },\n number('people', t('audit.field.people')),\n number('granted', t('audit.field.granted'), record => this.narrow({ door: record.door, actor: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ door: record.door, actor: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n return {\n rows: { appendable: false, selectable: false },\n pagination: { pages: [50, 100, 200] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'datetime', name: 'createdAt', header: t('audit.field.time'), record: { editable: false }, width: 160 },\n { type: 'string', name: 'actorName', header: t('audit.field.actor'), record: { editable: false }, width: 120 },\n { type: 'string', name: 'operation', header: t('audit.field.request'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'what', header: t('audit.field.actions'), record: { editable: false }, width: 360 },\n { type: 'string', name: 'ip', header: t('audit.field.address'), record: { editable: false }, width: 120 },\n { type: 'integer', name: 'durationMs', header: t('audit.field.duration'), record: { editable: false, align: 'right' }, width: 80 }\n ]\n }\n }\n\n async fetchHandler({ page, limit }: FetchOption) {\n const t = i18next.t.bind(i18next)\n const period = { from: this.from.toISOString(), to: this.to.toISOString() }\n\n if (this.view === 'people') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditPeople(from: $from, to: $to) {\n user {\n id\n name\n email\n status\n }\n roles\n lastCheckinAt\n checkins\n failedSignins\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n const people = response.data?.auditPeople || []\n const records = people\n .map((one: any) => ({\n ...one,\n id: one.user.id,\n name: one.user.name,\n email: one.user.email,\n roles: one.roles.join(', '),\n status: one.user.status\n }))\n .sort((a: any, b: any) => String(b.lastCheckinAt || '').localeCompare(String(a.lastCheckinAt || '')))\n return { total: records.length, records }\n }\n\n if (this.view === 'doors') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditDoors(from: $from, to: $to) {\n door\n people\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n /* The doors used come first; the rest keep the server's order. */\n const used = (one: any) => one.granted + one.denied\n const records = (response.data?.auditDoors || [])\n .map((one: any) => ({ ...one, doorWords: doorWords(t, one.door) }))\n .sort((a: any, b: any) => used(b) - used(a))\n return { total: records.length, records }\n }\n\n const response = await client.query({\n query: gql`\n query ($filter: AuditRecordFilter!) {\n auditRecords(filter: $filter) {\n items {\n request {\n id\n createdAt\n actor {\n id\n name\n email\n }\n ip\n channel\n operationType\n operationName\n fields\n route\n durationMs\n }\n actions {\n kind\n door\n decision\n outcome\n code\n count\n objectId\n detail\n }\n }\n total\n }\n }\n `,\n variables: {\n filter: {\n ...period,\n actorId: this.actor?.id,\n door: this.door,\n outcome: this.outcome || undefined,\n page,\n limit\n }\n },\n fetchPolicy: 'no-cache'\n })\n\n const list = response.data?.auditRecords\n return {\n total: list?.total || 0,\n records: (list?.items || []).map(({ request, actions }: any) => ({\n id: request.id,\n createdAt: request.createdAt,\n actorName: request.actor?.name || request.actor?.email || '',\n what: recordWords(t, actions),\n operation: request.channel === 'graphql' ? [request.operationType, request.fields || request.operationName].filter(Boolean).join(' ') : request.route || '',\n ip: request.ip,\n durationMs: request.durationMs\n }))\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"audit-page.js","sourceRoot":"","sources":["../../../client/pages/audit/audit-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;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AAhB,KAAK,EAAE;8BAAa,IAAI;qCAAa;AACrB;IAAhB,KAAK,EAAE;;wCAA6C;AACpC;IAAhB,KAAK,EAAE;;uCAAsB;AACb;IAAhB,KAAK,EAAE;;0CAA8B;AACrB;IAAhB,KAAK,EAAE;;yCAAiE;AAE9C;IAA1B,KAAK,CAAC,UAAU,CAAC;;wCAA0B;AA9DjC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAiXrB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport type { CSSResultGroup } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { formatWhen } from '@operato/utils/when.js'\nimport { p13n } from '@operato/p13n'\nimport { PageView } from '@operato/shell'\nimport { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\n\nimport { statusRenderer } from '../../components/user-status-renderer.js'\nimport { doorWords, lastDays, recordWords } from '../../utils/audit-words.js'\n\n/**\n * 감사 기록 (ADR-0141 §6.1) - who did what in this domain, read three ways: by person, by privilege,\n * and the requests one by one. A person's or a privilege's numbers open the requests behind them.\n *\n * Reading only. The audit has no door that changes a row (§4-6), so this screen has no action.\n */\n\ntype View = 'people' | 'doors' | 'records'\ntype Outcome = '' | 'denied' | 'error' | 'failed'\n\nconst PERIODS = [7, 30, 90]\nconst VIEWS: View[] = ['people', 'doors', 'records']\nconst OUTCOMES: Outcome[] = ['', 'denied', 'error', 'failed']\n\nconst AuditPageBase = p13n(localize(i18next)(PageView))\n\nfunction dateInputValue(date: Date) {\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n}\n\n@customElement('audit-page')\nexport class AuditPage extends AuditPageBase {\n static styles: CSSResultGroup = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ButtonStyles,\n css`\n .filters {\n flex-wrap: wrap;\n }\n\n [group] {\n display: flex;\n align-items: center;\n gap: var(--spacing-tiny, 2px);\n }\n\n button[aria-pressed='true'] {\n background-color: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n\n input[type='date'] {\n height: var(--context-action-height, 28px);\n box-sizing: border-box;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container-lowest);\n color: var(--md-sys-color-on-surface);\n font: inherit;\n font-size: var(--ui-t-body, 13px);\n padding: 0 var(--spacing-small, 4px);\n }\n\n [narrowed] {\n display: flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n font-size: var(--ui-t-body, 13px);\n color: var(--md-sys-color-on-surface);\n }\n\n [health] {\n margin-left: auto;\n font-size: var(--ui-t-body, 13px);\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n ]\n\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'LIST' : 'GRID'\n\n @state() private view: View = 'people'\n @state() private days: number | null = 30\n @state() private from: Date = lastDays(30).from\n @state() private to: Date = new Date()\n @state() private actor?: { id: string; name: string }\n @state() private door?: string\n @state() private outcome: Outcome = ''\n @state() private health?: { failures: number; since: string } | 'unknown'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('audit.title'),\n help: 'auth/audit',\n filter: {\n handler: () => this.grist.toggleHeadroom()\n }\n }\n }\n\n render() {\n return html`${keyed(\n this.view,\n html`<ox-grist class=\"page-fill\" .mode=${this.mode} .config=${this.configOf(this.view)} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">${this.renderControls()}</div>\n </div>\n </ox-grist>`\n )}`\n }\n\n private renderControls() {\n const t = i18next.t.bind(i18next)\n const pressed = (on: boolean) => (on ? 'true' : 'false')\n\n return html`\n <div group>\n ${VIEWS.map(view => html`<button quiet aria-pressed=${pressed(this.view === view)} @click=${() => this.show(view)}>${t(`audit.view.${view}`)}</button>`)}\n </div>\n\n <div group>\n ${PERIODS.map(days => html`<button quiet aria-pressed=${pressed(this.days === days)} @click=${() => this.lastDays(days)}>${t('audit.period.days', { count: days })}</button>`)}\n <input type=\"date\" aria-label=${t('audit.period.from')} .value=${dateInputValue(this.from)} @change=${(e: Event) => this.pick('from', e)} />\n <span>~</span>\n <input type=\"date\" aria-label=${t('audit.period.to')} .value=${dateInputValue(this.to)} @change=${(e: Event) => this.pick('to', e)} />\n </div>\n\n ${this.view === 'records'\n ? html`<div group>\n ${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>`)}\n </div>`\n : nothing}\n ${this.view === 'records' && this.actor\n ? html`<span narrowed>${this.actor.name}<button quiet small @click=${() => this.narrow({ actor: undefined })}>${t('audit.button.all-people')}</button></span>`\n : nothing}\n ${this.view === 'records' && this.door\n ? html`<span narrowed>${doorWords(t, this.door)}<button quiet small @click=${() => this.narrow({ door: undefined })}>${t('audit.button.all-privileges')}</button></span>`\n : nothing}\n ${this.renderHealth()}\n `\n }\n\n /* Only what is wrong is said: failures, or that they could not be counted. Never a 0 for \"unknown\". */\n private renderHealth() {\n const health = this.health\n if (health === 'unknown') return html`<span health>${i18next.t('audit.health.unknown')}</span>`\n if (!health?.failures) return nothing\n return html`<span health>${i18next.t('audit.health.failures', { count: health.failures, since: formatWhen(health.since, { lang: i18next.language, style: 'datetime' }) ?? '' })}</span>`\n }\n\n private show(view: View) {\n this.view = view\n }\n\n private lastDays(days: number) {\n const { from, to } = lastDays(days)\n this.days = days\n this.from = from\n this.to = to\n this.grist?.fetch()\n }\n\n private pick(which: 'from' | 'to', event: Event) {\n const value = (event.target as HTMLInputElement).value\n if (!value) return\n const [year, month, day] = value.split('-').map(Number)\n this[which] = which === 'from' ? new Date(year, month - 1, day, 0, 0, 0) : new Date(year, month - 1, day, 23, 59, 59, 999)\n this.days = null\n this.grist?.fetch()\n }\n\n private narrow(change: { actor?: { id: string; name: string }; door?: string; outcome?: Outcome }) {\n Object.assign(this, change)\n if (this.view !== 'records') this.view = 'records'\n else this.grist?.fetch()\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist?.fetch()\n this.readHealth()\n }\n }\n\n private async readHealth() {\n try {\n const response = await client.query({ query: gql`{ auditHealth { failures since } }`, fetchPolicy: 'no-cache' })\n this.health = response.errors?.length || !response.data?.auditHealth ? 'unknown' : response.data.auditHealth\n } catch {\n this.health = 'unknown'\n }\n }\n\n private configOf(view: View) {\n const t = i18next.t.bind(i18next)\n const number = (name: string, header: string, click?: (record: any) => void) => ({\n type: 'integer',\n name,\n header,\n record: { align: 'right', editable: false },\n width: 90,\n ...(click ? { handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && click(record) } } : {})\n })\n\n if (view === 'people') {\n const person = (record: any) => ({ id: record.id, name: record.name || record.email })\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'name',\n header: t('field.name'),\n record: { editable: false },\n width: 140,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ actor: person(record), door: undefined, outcome: '' }) }\n },\n { type: 'string', name: 'email', header: t('field.email'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'roles', header: t('field.roles'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'status', header: t('field.status'), record: { editable: false, align: 'center', renderer: statusRenderer(() => 0) }, width: 80 },\n { type: 'datetime', name: 'lastCheckinAt', header: t('audit.field.last-checkin'), record: { editable: false }, width: 160 },\n number('checkins', t('audit.field.checkins')),\n number('failedSignins', t('audit.field.failed-signins'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'failed' })),\n number('granted', t('audit.field.granted'), record => this.narrow({ actor: person(record), door: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n if (view === 'doors') {\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'doorWords',\n header: t('audit.field.privilege'),\n record: { editable: false },\n width: 240,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ door: record.door, actor: undefined, outcome: '' }) }\n },\n number('people', t('audit.field.people')),\n number('granted', t('audit.field.granted'), record => this.narrow({ door: record.door, actor: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ door: record.door, actor: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n return {\n rows: { appendable: false, selectable: false },\n pagination: { pages: [50, 100, 200] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'datetime', name: 'createdAt', header: t('audit.field.time'), record: { editable: false }, width: 160 },\n { type: 'string', name: 'actorName', header: t('audit.field.actor'), record: { editable: false }, width: 120 },\n { type: 'string', name: 'operation', header: t('audit.field.request'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'what', header: t('audit.field.actions'), record: { editable: false }, width: 360 },\n { type: 'string', name: 'ip', header: t('audit.field.address'), record: { editable: false }, width: 120 },\n { type: 'integer', name: 'durationMs', header: t('audit.field.duration'), record: { editable: false, align: 'right' }, width: 80 }\n ]\n }\n }\n\n async fetchHandler({ page, limit }: FetchOption) {\n const t = i18next.t.bind(i18next)\n const period = { from: this.from.toISOString(), to: this.to.toISOString() }\n\n if (this.view === 'people') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditPeople(from: $from, to: $to) {\n user {\n id\n name\n email\n status\n }\n roles\n lastCheckinAt\n checkins\n failedSignins\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n const people = response.data?.auditPeople || []\n const records = people\n .map((one: any) => ({\n ...one,\n id: one.user.id,\n name: one.user.name,\n email: one.user.email,\n roles: one.roles.join(', '),\n status: one.user.status\n }))\n .sort((a: any, b: any) => String(b.lastCheckinAt || '').localeCompare(String(a.lastCheckinAt || '')))\n return { total: records.length, records }\n }\n\n if (this.view === 'doors') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditDoors(from: $from, to: $to) {\n door\n people\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n /* The doors used come first; the rest keep the server's order. */\n const used = (one: any) => one.granted + one.denied\n const records = (response.data?.auditDoors || [])\n .map((one: any) => ({ ...one, doorWords: doorWords(t, one.door) }))\n .sort((a: any, b: any) => used(b) - used(a))\n return { total: records.length, records }\n }\n\n const response = await client.query({\n query: gql`\n query ($filter: AuditRecordFilter!) {\n auditRecords(filter: $filter) {\n items {\n request {\n id\n createdAt\n actor {\n id\n name\n email\n }\n ip\n channel\n operationType\n operationName\n fields\n route\n durationMs\n }\n actions {\n kind\n door\n decision\n outcome\n code\n count\n objectId\n detail\n }\n }\n total\n }\n }\n `,\n variables: {\n filter: {\n ...period,\n actorId: this.actor?.id,\n door: this.door,\n outcome: this.outcome || undefined,\n page,\n limit\n }\n },\n fetchPolicy: 'no-cache'\n })\n\n const list = response.data?.auditRecords\n return {\n total: list?.total || 0,\n records: (list?.items || []).map(({ request, actions }: any) => ({\n id: request.id,\n createdAt: request.createdAt,\n actorName: request.actor?.name || request.actor?.email || '',\n what: recordWords(t, actions),\n operation: request.channel === 'graphql' ? [request.operationType, request.fields || request.operationName].filter(Boolean).join(' ') : request.route || '',\n ip: request.ip,\n durationMs: request.durationMs\n }))\n }\n }\n}\n"]}
|
|
@@ -953,7 +953,7 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
953
953
|
</button>`
|
|
954
954
|
: nothing}
|
|
955
955
|
</h4>
|
|
956
|
-
${gap.missingCount ? this.renderSentences(gap.missing) :
|
|
956
|
+
${gap.missingCount ? this.renderSentences(gap.missing) : nothing}
|
|
957
957
|
<h4>
|
|
958
958
|
${i18next.t('label.wider than the template')}
|
|
959
959
|
<span count>${gap.extraCount}</span>
|