@things-factory/auth-ui 10.1.4 → 10.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/components/change-password.d.ts +11 -0
- package/dist-client/components/change-password.js +103 -6
- package/dist-client/components/change-password.js.map +1 -1
- package/dist-client/components/role-privilege-picker.d.ts +37 -0
- package/dist-client/components/role-privilege-picker.js +58 -0
- package/dist-client/components/role-privilege-picker.js.map +1 -0
- package/dist-client/components/role-template-picker.d.ts +83 -0
- package/dist-client/components/role-template-picker.js +487 -0
- package/dist-client/components/role-template-picker.js.map +1 -0
- package/dist-client/components/user-detail.d.ts +151 -0
- package/dist-client/components/user-detail.js +631 -0
- package/dist-client/components/user-detail.js.map +1 -0
- package/dist-client/components/user-invite.d.ts +80 -0
- package/dist-client/components/user-invite.js +422 -0
- package/dist-client/components/user-invite.js.map +1 -0
- package/dist-client/entries/auth/activate.d.ts +0 -1
- package/dist-client/entries/auth/activate.js +0 -8
- package/dist-client/entries/auth/activate.js.map +1 -1
- package/dist-client/pages/role/role-list-page.d.ts +203 -0
- package/dist-client/pages/role/role-list-page.js +838 -0
- package/dist-client/pages/role/role-list-page.js.map +1 -0
- package/dist-client/pages/role/role-privilege-page.d.ts +181 -0
- package/dist-client/pages/role/role-privilege-page.js +980 -0
- package/dist-client/pages/role/role-privilege-page.js.map +1 -0
- package/dist-client/pages/user/user-list-page.d.ts +88 -0
- package/dist-client/pages/user/user-list-page.js +474 -0
- package/dist-client/pages/user/user-list-page.js.map +1 -0
- package/dist-client/route.js +5 -2
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/things-factory.config.js +3 -2
- package/translations/en.json +72 -3
- package/translations/ja.json +14 -3
- package/translations/ko.json +73 -4
- package/translations/ms.json +15 -4
- package/translations/zh.json +14 -3
- package/dist-client/components/contact-us.d.ts +0 -20
- package/dist-client/components/contact-us.js +0 -121
- package/dist-client/components/contact-us.js.map +0 -1
- package/dist-client/components/create-role.d.ts +0 -1
- package/dist-client/components/create-role.js +0 -117
- package/dist-client/components/create-role.js.map +0 -1
- package/dist-client/components/credential-manager.d.ts +0 -11
- package/dist-client/components/credential-manager.js +0 -64
- package/dist-client/components/credential-manager.js.map +0 -1
- package/dist-client/components/role-edit-form.d.ts +0 -1
- package/dist-client/components/role-edit-form.js +0 -95
- package/dist-client/components/role-edit-form.js.map +0 -1
- package/dist-client/components/role-privilege-editor.d.ts +0 -1
- package/dist-client/components/role-privilege-editor.js +0 -368
- package/dist-client/components/role-privilege-editor.js.map +0 -1
- package/dist-client/pages/role/role-management.d.ts +0 -4
- package/dist-client/pages/role/role-management.js +0 -137
- package/dist-client/pages/role/role-management.js.map +0 -1
- package/dist-client/pages/user/user-management.d.ts +0 -35
- package/dist-client/pages/user/user-management.js +0 -223
- package/dist-client/pages/user/user-management.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-role.js","sourceRoot":"","sources":["../../client/components/create-role.ts"],"names":[],"mappings":";AAAA,OAAO,8CAA8C,CAAA;AAErD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,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;AAGtD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;aAC7C,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,aAAa,CAAC;GACvB,UAAU,CA+Gf","sourcesContent":["import '@material/web/textfield/filled-text-field.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('create-role')\nclass CreateRole extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n --md-text-field-fill-color: var(--md-sys-color-on-primary);\n background-color: var(--md-sys-color-surface);\n margin: var(--spacing-large) 0;\n padding: var(--spacing-large);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n\n display: grid;\n grid-template-columns: 1fr 2fr auto;\n gap: 5px 15px;\n clear: both;\n max-width: var(--input-container-max-width);\n\n align-items: center;\n }\n\n md-outlined-button {\n margin: var(--input-margin);\n text-transform: capitalize;\n }\n\n @media screen and (max-width: 480px) {\n :host {\n grid-template-columns: 1fr 1fr;\n }\n\n md-outlined-button {\n grid-column: span 2;\n\n margin: var(--input-margin);\n }\n }\n `\n\n @query('[name=name]') nameInput!: HTMLInputElement\n @query('[name=description]') descriptionInput!: HTMLInputElement\n\n render() {\n return html`\n <md-filled-text-field\n type=\"text\"\n name=\"name\"\n label=${String(i18next.t('label.x name', { x: i18next.t('label.role') }))}\n ></md-filled-text-field>\n <md-filled-text-field\n type=\"text\"\n name=\"description\"\n label=${String(i18next.t('label.x description', { x: i18next.t('label.role') }))}\n ></md-filled-text-field>\n\n <md-outlined-button @click=${this.onCreateRole.bind(this)}\n >${String(i18next.t('button.create'))}</md-outlined-button\n >\n `\n }\n\n async onCreateRole() {\n let role: { name?: string; description?: string } = {}\n\n const name = this.nameInput.value.trim()\n const description = this.descriptionInput.value\n\n if (!name) {\n return this.showToast(i18next.t('error.value is empty', { value: i18next.t('field.name') }))\n }\n\n role.name = name\n role.description = description\n\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.do_you_want_to_create_x', { x: i18next.t('label.role') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation createRole($role: NewRole!) {\n createRole(role: $role) {\n name\n }\n }\n `,\n variables: { role },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await this.dispatchEvent(new CustomEvent('fetch-roles'))\n\n await OxPrompt.open({\n type: 'success',\n title: i18next.t('text.completed'),\n text: i18next.t('text.data_uploaded_successfully'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n this.nameInput.value = ''\n this.descriptionInput.value = ''\n }\n }\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
export declare class CredentialManager extends LitElement {
|
|
3
|
-
credentials: {
|
|
4
|
-
credentialId: string;
|
|
5
|
-
}[];
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
fetchCredentials(): Promise<void>;
|
|
9
|
-
deleteCredential(credentialId: string): Promise<void>;
|
|
10
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { LitElement, html, css } from 'lit';
|
|
3
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
-
let CredentialManager = class CredentialManager extends LitElement {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.credentials = [];
|
|
8
|
-
}
|
|
9
|
-
static { this.styles = css `
|
|
10
|
-
div {
|
|
11
|
-
margin: 20px;
|
|
12
|
-
}
|
|
13
|
-
button {
|
|
14
|
-
margin: 5px;
|
|
15
|
-
}
|
|
16
|
-
`; }
|
|
17
|
-
connectedCallback() {
|
|
18
|
-
super.connectedCallback();
|
|
19
|
-
this.fetchCredentials();
|
|
20
|
-
}
|
|
21
|
-
async fetchCredentials() {
|
|
22
|
-
const response = await fetch('/auth/credentials', {
|
|
23
|
-
method: 'GET',
|
|
24
|
-
credentials: 'include'
|
|
25
|
-
});
|
|
26
|
-
this.credentials = await response.json();
|
|
27
|
-
}
|
|
28
|
-
async deleteCredential(credentialId) {
|
|
29
|
-
const response = await fetch(`/credentials/${credentialId}`, {
|
|
30
|
-
method: 'DELETE',
|
|
31
|
-
credentials: 'include'
|
|
32
|
-
});
|
|
33
|
-
if (response.ok) {
|
|
34
|
-
this.fetchCredentials();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
console.error('Failed to delete credential');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
render() {
|
|
41
|
-
return html `
|
|
42
|
-
<div>
|
|
43
|
-
<h2>Manage Your WebAuthn Credentials</h2>
|
|
44
|
-
<ul>
|
|
45
|
-
${this.credentials.map(credential => html `
|
|
46
|
-
<li>
|
|
47
|
-
${credential.credentialId}
|
|
48
|
-
<button @click=${() => this.deleteCredential(credential.credentialId)}>Delete</button>
|
|
49
|
-
</li>
|
|
50
|
-
`)}
|
|
51
|
-
</ul>
|
|
52
|
-
</div>
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
__decorate([
|
|
57
|
-
property({ type: Array }),
|
|
58
|
-
__metadata("design:type", Array)
|
|
59
|
-
], CredentialManager.prototype, "credentials", void 0);
|
|
60
|
-
CredentialManager = __decorate([
|
|
61
|
-
customElement('credential-manager')
|
|
62
|
-
], CredentialManager);
|
|
63
|
-
export { CredentialManager };
|
|
64
|
-
//# sourceMappingURL=credential-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../../client/components/credential-manager.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,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B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;sDAElB;AAHG,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAwD7B","sourcesContent":["import gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\n\n@customElement('credential-manager')\nexport class CredentialManager extends LitElement {\n @property({ type: Array }) credentials: {\n credentialId: string\n }[] = []\n\n static styles = css`\n div {\n margin: 20px;\n }\n button {\n margin: 5px;\n }\n `\n\n connectedCallback() {\n super.connectedCallback()\n this.fetchCredentials()\n }\n\n async fetchCredentials() {\n const response = await fetch('/auth/credentials', {\n method: 'GET',\n credentials: 'include'\n })\n this.credentials = await response.json()\n }\n\n async deleteCredential(credentialId: string) {\n const response = await fetch(`/credentials/${credentialId}`, {\n method: 'DELETE',\n credentials: 'include'\n })\n if (response.ok) {\n this.fetchCredentials()\n } else {\n console.error('Failed to delete credential')\n }\n }\n\n render() {\n return html`\n <div>\n <h2>Manage Your WebAuthn Credentials</h2>\n <ul>\n ${this.credentials.map(\n credential => html`\n <li>\n ${credential.credentialId}\n <button @click=${() => this.deleteCredential(credential.credentialId)}>Delete</button>\n </li>\n `\n )}\n </ul>\n </div>\n `\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
-
import { i18next, localize } from '@operato/i18n';
|
|
5
|
-
let RoleEditForm = class RoleEditForm extends localize(i18next)(LitElement) {
|
|
6
|
-
static { this.styles = css `
|
|
7
|
-
[field-2column] {
|
|
8
|
-
border-radius: var(--border-radius);
|
|
9
|
-
display: grid;
|
|
10
|
-
grid-template-columns: 1fr 1fr;
|
|
11
|
-
gap: 5px 15px;
|
|
12
|
-
clear: both;
|
|
13
|
-
max-width: var(--input-container-max-width);
|
|
14
|
-
}
|
|
15
|
-
[field] {
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
padding-bottom: var(--spacing-medium);
|
|
19
|
-
}
|
|
20
|
-
input {
|
|
21
|
-
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
22
|
-
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
23
|
-
border: var(--border-dim-color);
|
|
24
|
-
border-radius: var(--border-radius);
|
|
25
|
-
margin: var(--input-margin);
|
|
26
|
-
padding: var(--input-padding);
|
|
27
|
-
min-width: 250px;
|
|
28
|
-
font: var(--input-font);
|
|
29
|
-
}
|
|
30
|
-
label {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
font: var(--label-font);
|
|
34
|
-
color: var(--md-sys-color-on-primary);
|
|
35
|
-
text-transform: var(--label-text-transform);
|
|
36
|
-
}
|
|
37
|
-
@media screen and (max-width: 480px) {
|
|
38
|
-
[field] {
|
|
39
|
-
grid-column: span 2;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`; }
|
|
43
|
-
render() {
|
|
44
|
-
const role = this.role || { name: '', description: '' };
|
|
45
|
-
return html `
|
|
46
|
-
<form field-2column @input="${this.dispatchRoleChanged.bind(this)}">
|
|
47
|
-
<div field>
|
|
48
|
-
<label
|
|
49
|
-
>role name
|
|
50
|
-
<input name="name" value="${role.name}" @click="${e => e.stopPropagation()}" />
|
|
51
|
-
</label>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div field>
|
|
55
|
-
<label
|
|
56
|
-
>role description
|
|
57
|
-
<input name="description" .value="${role.description}" @click="${e => e.stopPropagation()}" />
|
|
58
|
-
</label>
|
|
59
|
-
</div>
|
|
60
|
-
</form>
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
getRole() {
|
|
64
|
-
const name = this.nameInput.value;
|
|
65
|
-
const description = this.descriptionInput.value;
|
|
66
|
-
if (!name) {
|
|
67
|
-
return this.showToast(i18next.t('error.value is empty', { value: i18next.t('field.name') }));
|
|
68
|
-
}
|
|
69
|
-
return { name, description };
|
|
70
|
-
}
|
|
71
|
-
dispatchRoleChanged() {
|
|
72
|
-
this.dispatchEvent(new CustomEvent('roleChanged', {
|
|
73
|
-
detail: this.getRole()
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
showToast(message) {
|
|
77
|
-
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
__decorate([
|
|
81
|
-
property({ type: Object }),
|
|
82
|
-
__metadata("design:type", Object)
|
|
83
|
-
], RoleEditForm.prototype, "role", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
query('input[name=name]'),
|
|
86
|
-
__metadata("design:type", HTMLInputElement)
|
|
87
|
-
], RoleEditForm.prototype, "nameInput", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
query('input[name=description]'),
|
|
90
|
-
__metadata("design:type", HTMLInputElement)
|
|
91
|
-
], RoleEditForm.prototype, "descriptionInput", void 0);
|
|
92
|
-
RoleEditForm = __decorate([
|
|
93
|
-
customElement('role-edit-form')
|
|
94
|
-
], RoleEditForm);
|
|
95
|
-
//# sourceMappingURL=role-edit-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-edit-form.js","sourceRoot":"","sources":["../../client/components/role-edit-form.ts"],"names":[],"mappings":";AAAA,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,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,IAAM,YAAY,GAAlB,MAAM,YAAa,SA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AAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IACrG,CAAC;;AAhD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAAU;AAwBV;IAA1B,KAAK,CAAC,kBAAkB,CAAC;8BAAa,gBAAgB;+CAAA;AACrB;IAAjC,KAAK,CAAC,yBAAyB,CAAC;8BAAoB,gBAAgB;sDAAA;AA/DjE,YAAY;IADjB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,YAAY,CAuFjB","sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\n\n@customElement('role-edit-form')\nclass RoleEditForm extends localize(i18next)(LitElement) {\n static styles = css`\n [field-2column] {\n border-radius: var(--border-radius);\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 5px 15px;\n clear: both;\n max-width: var(--input-container-max-width);\n }\n [field] {\n display: flex;\n flex-direction: column;\n padding-bottom: var(--spacing-medium);\n }\n input {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n min-width: 250px;\n font: var(--input-font);\n }\n label {\n display: flex;\n flex-direction: column;\n font: var(--label-font);\n color: var(--md-sys-color-on-primary);\n text-transform: var(--label-text-transform);\n }\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n @property({ type: Object }) role: any\n\n render() {\n const role = this.role || { name: '', description: '' }\n\n return html`\n <form field-2column @input=\"${this.dispatchRoleChanged.bind(this)}\">\n <div field>\n <label\n >role name\n <input name=\"name\" value=\"${role.name}\" @click=\"${e => e.stopPropagation()}\" />\n </label>\n </div>\n\n <div field>\n <label\n >role description\n <input name=\"description\" .value=\"${role.description}\" @click=\"${e => e.stopPropagation()}\" />\n </label>\n </div>\n </form>\n `\n }\n\n @query('input[name=name]') nameInput!: HTMLInputElement\n @query('input[name=description]') descriptionInput!: HTMLInputElement\n\n getRole() {\n const name = this.nameInput.value\n const description = this.descriptionInput.value\n\n if (!name) {\n return this.showToast(i18next.t('error.value is empty', { value: i18next.t('field.name') }))\n }\n\n return { name, description }\n }\n\n dispatchRoleChanged() {\n this.dispatchEvent(\n new CustomEvent('roleChanged', {\n detail: this.getRole()\n })\n )\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import gql from 'graphql-tag';
|
|
3
|
-
import { css, html, LitElement } from 'lit';
|
|
4
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
|
-
import { client, gqlContext } from '@operato/graphql';
|
|
6
|
-
import { i18next, localize } from '@operato/i18n';
|
|
7
|
-
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
8
|
-
import { ButtonContainerStyles } from '@operato/styles';
|
|
9
|
-
let RolePrivilegeEditor = class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.allPrivileges = [];
|
|
13
|
-
this.privileges = [];
|
|
14
|
-
this.users = [];
|
|
15
|
-
}
|
|
16
|
-
static { this.styles = [
|
|
17
|
-
ButtonContainerStyles,
|
|
18
|
-
css `
|
|
19
|
-
:host {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
|
|
23
|
-
border: 1px solid var(--md-sys-color-primary);
|
|
24
|
-
font: normal 15px var(--theme-font);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
div {
|
|
28
|
-
margin: var(--spacing-medium);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
div[users] {
|
|
32
|
-
margin: 0;
|
|
33
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
div[titler] {
|
|
37
|
-
color: var(--md-sys-color-secondary);
|
|
38
|
-
font: bold 1.2em var(--theme-font);
|
|
39
|
-
text-transform: capitalize;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ul {
|
|
43
|
-
flex: 1;
|
|
44
|
-
color: var(--md-sys-color-secondary);
|
|
45
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
46
|
-
overflow: auto;
|
|
47
|
-
display: grid;
|
|
48
|
-
grid-template-columns: 1fr 1fr;
|
|
49
|
-
margin-block-start: 0;
|
|
50
|
-
margin-block-end: 0;
|
|
51
|
-
padding: var(--spacing-medium);
|
|
52
|
-
list-style: none;
|
|
53
|
-
border: 1px dashed rgba(0, 0, 0, 0.1);
|
|
54
|
-
border-width: 1px 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.category-group {
|
|
58
|
-
display: contents;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.category-title {
|
|
62
|
-
font-weight: bold;
|
|
63
|
-
font-size: 0.9em;
|
|
64
|
-
color: var(--md-sys-color-primary);
|
|
65
|
-
text-transform: uppercase;
|
|
66
|
-
opacity: 0.7;
|
|
67
|
-
align-self: stretch;
|
|
68
|
-
position: sticky;
|
|
69
|
-
top: 0;
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: flex-end;
|
|
73
|
-
text-align: right;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.category-privileges {
|
|
77
|
-
display: contents;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@media screen and (min-width: 640px) {
|
|
81
|
-
ul {
|
|
82
|
-
grid-template-columns: minmax(200px, auto) 1fr 1fr;
|
|
83
|
-
gap: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.category-title {
|
|
87
|
-
grid-column: 1;
|
|
88
|
-
padding-right: var(--spacing-medium);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
li {
|
|
92
|
-
grid-column: auto;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
input[type='checkbox'] {
|
|
97
|
-
display: inline;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
li {
|
|
101
|
-
padding: var(--spacing-small);
|
|
102
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* 코드가 더 이상 요구하지 않는 권한 — 부여해도 아무 일이 없으므로 눈에 구별되어야 한다.
|
|
106
|
-
감추지는 않는다. 이미 역할에 붙어 있을 수 있고, 그것을 보고 떼는 것이 관리자의 일이다. */
|
|
107
|
-
li[deprecated] label {
|
|
108
|
-
opacity: 0.55;
|
|
109
|
-
text-decoration: line-through;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
li[deprecated] small {
|
|
113
|
-
display: block;
|
|
114
|
-
margin-left: 1.6em;
|
|
115
|
-
color: var(--md-sys-color-error);
|
|
116
|
-
font-size: 0.8em;
|
|
117
|
-
text-decoration: none;
|
|
118
|
-
opacity: 0.9;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
#checkAll,
|
|
122
|
-
[for='checkAll'] {
|
|
123
|
-
margin-bottom: var(--spacing-medium);
|
|
124
|
-
padding-bottom: var(--spacing-small);
|
|
125
|
-
font-weight: bold;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
md-elevated-button {
|
|
129
|
-
margin: 5px;
|
|
130
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
md-outlined-button {
|
|
134
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@media screen and (max-width: 639px) {
|
|
138
|
-
ul {
|
|
139
|
-
grid-template-columns: 1fr;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.category-group {
|
|
143
|
-
display: block;
|
|
144
|
-
margin-top: var(--spacing-medium);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.category-group:first-child {
|
|
148
|
-
margin-top: 0;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.category-title {
|
|
152
|
-
position: static;
|
|
153
|
-
margin-bottom: var(--spacing-small);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.category-privileges {
|
|
157
|
-
display: grid;
|
|
158
|
-
grid-template-columns: 1fr;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
`
|
|
162
|
-
]; }
|
|
163
|
-
render() {
|
|
164
|
-
const allPrivileges = this.allPrivileges || [];
|
|
165
|
-
const privileges = this.privileges || [];
|
|
166
|
-
const users = this.users || [];
|
|
167
|
-
// Group privileges by category
|
|
168
|
-
const groupedPrivileges = allPrivileges.reduce((acc, privilege) => {
|
|
169
|
-
const category = privilege.category || 'Other';
|
|
170
|
-
if (!acc[category]) {
|
|
171
|
-
acc[category] = [];
|
|
172
|
-
}
|
|
173
|
-
acc[category].push(privilege);
|
|
174
|
-
return acc;
|
|
175
|
-
}, {});
|
|
176
|
-
// Sort categories alphabetically
|
|
177
|
-
const sortedCategories = Object.keys(groupedPrivileges).sort();
|
|
178
|
-
// Sort privileges within each category by name (descending)
|
|
179
|
-
sortedCategories.forEach(category => {
|
|
180
|
-
groupedPrivileges[category].sort((a, b) => b.name.localeCompare(a.name));
|
|
181
|
-
});
|
|
182
|
-
return html `
|
|
183
|
-
<div titler>${String(i18next.t('label.user'))}</div>
|
|
184
|
-
|
|
185
|
-
<div users>${users.map(user => html `<div>${user.name} (${user.email})</div>`)}</div>
|
|
186
|
-
|
|
187
|
-
<div titler>${String(i18next.t('field.privileges'))}</div>
|
|
188
|
-
|
|
189
|
-
<div>
|
|
190
|
-
<input id="checkAll" type="checkbox" @change=${e => this.oncheckAll(e)} />
|
|
191
|
-
<label for="checkAll">Check all</label>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<ul privileges>
|
|
195
|
-
${sortedCategories.map(category => html `
|
|
196
|
-
<div class="category-group">
|
|
197
|
-
<div class="category-title">${category}</div>
|
|
198
|
-
<div class="category-privileges">
|
|
199
|
-
${groupedPrivileges[category].map(
|
|
200
|
-
/* privilege : {id, name, category, description} */
|
|
201
|
-
privilege => html `
|
|
202
|
-
<li ?deprecated=${privilege.deprecated}>
|
|
203
|
-
<input
|
|
204
|
-
type="checkbox"
|
|
205
|
-
id="${privilege.id}"
|
|
206
|
-
.checked=${privileges.map(p => p.id).indexOf(privilege.id) > -1}
|
|
207
|
-
.data-privilege=${privilege}
|
|
208
|
-
/>
|
|
209
|
-
<label for="${privilege.id}">${privilege.description}</label>
|
|
210
|
-
${privilege.deprecated
|
|
211
|
-
? html `<small>${String(i18next.t('text.privilege no longer declared'))}</small>`
|
|
212
|
-
: ''}
|
|
213
|
-
</li>
|
|
214
|
-
`)}
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
`)}
|
|
218
|
-
</ul>
|
|
219
|
-
|
|
220
|
-
<div class="button-container">
|
|
221
|
-
<md-elevated-button @click=${e => this.onSave()}>${String(i18next.t('button.save'))}</md-elevated-button>
|
|
222
|
-
<md-elevated-button @click=${e => this.onDeleteRole()} danger
|
|
223
|
-
>${String(i18next.t('button.delete role'))}</md-elevated-button
|
|
224
|
-
>
|
|
225
|
-
</div>
|
|
226
|
-
`;
|
|
227
|
-
}
|
|
228
|
-
async firstUpdated() {
|
|
229
|
-
this.allPrivileges = await this.fetchPrivileges();
|
|
230
|
-
}
|
|
231
|
-
async updated(changes) {
|
|
232
|
-
if (changes.has('role')) {
|
|
233
|
-
await this.fetchPrivilegesOnRole(this.role.name);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
checkAll(checked) {
|
|
237
|
-
Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]')).forEach(checkbox => (checkbox.checked = checked));
|
|
238
|
-
}
|
|
239
|
-
oncheckAll(e) {
|
|
240
|
-
this.checkAll(e.target.checked);
|
|
241
|
-
}
|
|
242
|
-
async onSave() {
|
|
243
|
-
const updateRoleObj = this.updateRoleObj;
|
|
244
|
-
const privileges = Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]:checked')).map(e => ({ id: e['data-privilege'].id }) // ObjectRef 타입에 맞게 id만 전송
|
|
245
|
-
);
|
|
246
|
-
const patch = { ...updateRoleObj, privileges: privileges };
|
|
247
|
-
if (this.role) {
|
|
248
|
-
const response = await client.mutate({
|
|
249
|
-
mutation: gql `
|
|
250
|
-
mutation ($id: String!, $patch: RolePatch!) {
|
|
251
|
-
updateRole(id: $id, patch: $patch) {
|
|
252
|
-
id
|
|
253
|
-
name
|
|
254
|
-
description
|
|
255
|
-
privileges {
|
|
256
|
-
id
|
|
257
|
-
description
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
`,
|
|
262
|
-
variables: { id: this.role.id, patch },
|
|
263
|
-
context: gqlContext()
|
|
264
|
-
});
|
|
265
|
-
if (!response.errors) {
|
|
266
|
-
await this.dispatchEvent(new CustomEvent('fetch-roles'));
|
|
267
|
-
this.showToast(i18next.t('text.data_updated_successfully'));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
async onDeleteRole() {
|
|
272
|
-
if (await OxPrompt.open({
|
|
273
|
-
title: i18next.t('text.are_you_sure'),
|
|
274
|
-
text: i18next.t('text.are_you_sure_to_delete_x', { x: i18next.t('label.role') }),
|
|
275
|
-
confirmButton: { text: i18next.t('button.delete') },
|
|
276
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
277
|
-
})) {
|
|
278
|
-
const response = await client.mutate({
|
|
279
|
-
mutation: gql `
|
|
280
|
-
mutation ($id: String!) {
|
|
281
|
-
deleteRole(id: $id)
|
|
282
|
-
}
|
|
283
|
-
`,
|
|
284
|
-
variables: { id: this.role.id },
|
|
285
|
-
context: gqlContext()
|
|
286
|
-
});
|
|
287
|
-
if (!response.errors) {
|
|
288
|
-
await this.dispatchEvent(new CustomEvent('fetch-roles'));
|
|
289
|
-
await OxPrompt.open({
|
|
290
|
-
type: 'success',
|
|
291
|
-
title: i18next.t('text.completed'),
|
|
292
|
-
text: i18next.t('text.x_deleted_successfully', { x: i18next.t('label.role') }),
|
|
293
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
async fetchPrivileges() {
|
|
299
|
-
const response = await client.query({
|
|
300
|
-
query: gql `
|
|
301
|
-
query privileges {
|
|
302
|
-
privileges {
|
|
303
|
-
items {
|
|
304
|
-
id
|
|
305
|
-
name
|
|
306
|
-
category
|
|
307
|
-
description
|
|
308
|
-
deprecated
|
|
309
|
-
}
|
|
310
|
-
total
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
`
|
|
314
|
-
});
|
|
315
|
-
return response.data.privileges.items;
|
|
316
|
-
}
|
|
317
|
-
async fetchPrivilegesOnRole(name) {
|
|
318
|
-
const response = await client.query({
|
|
319
|
-
query: gql `
|
|
320
|
-
query ($name: String!) {
|
|
321
|
-
role(name: $name) {
|
|
322
|
-
id
|
|
323
|
-
name
|
|
324
|
-
privileges {
|
|
325
|
-
id
|
|
326
|
-
description
|
|
327
|
-
}
|
|
328
|
-
users {
|
|
329
|
-
name
|
|
330
|
-
email
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
`,
|
|
335
|
-
variables: { name },
|
|
336
|
-
context: gqlContext()
|
|
337
|
-
});
|
|
338
|
-
this.privileges = response.data.role?.privileges;
|
|
339
|
-
this.users = response.data.role?.users;
|
|
340
|
-
}
|
|
341
|
-
showToast(message) {
|
|
342
|
-
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }));
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
__decorate([
|
|
346
|
-
property({ type: Object }),
|
|
347
|
-
__metadata("design:type", Object)
|
|
348
|
-
], RolePrivilegeEditor.prototype, "role", void 0);
|
|
349
|
-
__decorate([
|
|
350
|
-
property({ type: Array }),
|
|
351
|
-
__metadata("design:type", Array)
|
|
352
|
-
], RolePrivilegeEditor.prototype, "allPrivileges", void 0);
|
|
353
|
-
__decorate([
|
|
354
|
-
property({ type: Object }),
|
|
355
|
-
__metadata("design:type", Object)
|
|
356
|
-
], RolePrivilegeEditor.prototype, "updateRoleObj", void 0);
|
|
357
|
-
__decorate([
|
|
358
|
-
state(),
|
|
359
|
-
__metadata("design:type", Array)
|
|
360
|
-
], RolePrivilegeEditor.prototype, "privileges", void 0);
|
|
361
|
-
__decorate([
|
|
362
|
-
state(),
|
|
363
|
-
__metadata("design:type", Array)
|
|
364
|
-
], RolePrivilegeEditor.prototype, "users", void 0);
|
|
365
|
-
RolePrivilegeEditor = __decorate([
|
|
366
|
-
customElement('role-privilege-editor')
|
|
367
|
-
], RolePrivilegeEditor);
|
|
368
|
-
//# sourceMappingURL=role-privilege-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-privilege-editor.js","sourceRoot":"","sources":["../../client/components/role-privilege-editor.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,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,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAGvD,I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,EAAE,EAAE,CAAC,CAAC,CAAA;IACrG,CAAC;;AA1N2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAU;AACV;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;0DAA0B;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DAAmB;AAErC;IAAR,KAAK,EAAE;;uDAAuD;AACtD;IAAR,KAAK,EAAE;;kDAAkF;AA1JtF,mBAAmB;IADxB,aAAa,CAAC,uBAAuB,CAAC;GACjC,mBAAmB,CAgXxB","sourcesContent":["import 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 { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { ButtonContainerStyles } from '@operato/styles'\n\n@customElement('role-privilege-editor')\nclass RolePrivilegeEditor extends localize(i18next)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n border: 1px solid var(--md-sys-color-primary);\n font: normal 15px var(--theme-font);\n }\n\n div {\n margin: var(--spacing-medium);\n }\n\n div[users] {\n margin: 0;\n background-color: var(--md-sys-color-surface-variant);\n }\n\n div[titler] {\n color: var(--md-sys-color-secondary);\n font: bold 1.2em var(--theme-font);\n text-transform: capitalize;\n }\n\n ul {\n flex: 1;\n color: var(--md-sys-color-secondary);\n background-color: var(--md-sys-color-surface-variant);\n overflow: auto;\n display: grid;\n grid-template-columns: 1fr 1fr;\n margin-block-start: 0;\n margin-block-end: 0;\n padding: var(--spacing-medium);\n list-style: none;\n border: 1px dashed rgba(0, 0, 0, 0.1);\n border-width: 1px 0;\n }\n\n .category-group {\n display: contents;\n }\n\n .category-title {\n font-weight: bold;\n font-size: 0.9em;\n color: var(--md-sys-color-primary);\n text-transform: uppercase;\n opacity: 0.7;\n align-self: stretch;\n position: sticky;\n top: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n text-align: right;\n }\n\n .category-privileges {\n display: contents;\n }\n\n @media screen and (min-width: 640px) {\n ul {\n grid-template-columns: minmax(200px, auto) 1fr 1fr;\n gap: 0;\n }\n\n .category-title {\n grid-column: 1;\n padding-right: var(--spacing-medium);\n }\n\n li {\n grid-column: auto;\n }\n }\n\n input[type='checkbox'] {\n display: inline;\n }\n\n li {\n padding: var(--spacing-small);\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n }\n\n /* 코드가 더 이상 요구하지 않는 권한 — 부여해도 아무 일이 없으므로 눈에 구별되어야 한다.\n 감추지는 않는다. 이미 역할에 붙어 있을 수 있고, 그것을 보고 떼는 것이 관리자의 일이다. */\n li[deprecated] label {\n opacity: 0.55;\n text-decoration: line-through;\n }\n\n li[deprecated] small {\n display: block;\n margin-left: 1.6em;\n color: var(--md-sys-color-error);\n font-size: 0.8em;\n text-decoration: none;\n opacity: 0.9;\n }\n\n #checkAll,\n [for='checkAll'] {\n margin-bottom: var(--spacing-medium);\n padding-bottom: var(--spacing-small);\n font-weight: bold;\n }\n\n md-elevated-button {\n margin: 5px;\n background-color: var(--md-sys-color-surface-variant);\n }\n\n md-outlined-button {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n @media screen and (max-width: 639px) {\n ul {\n grid-template-columns: 1fr;\n }\n\n .category-group {\n display: block;\n margin-top: var(--spacing-medium);\n }\n\n .category-group:first-child {\n margin-top: 0;\n }\n\n .category-title {\n position: static;\n margin-bottom: var(--spacing-small);\n }\n\n .category-privileges {\n display: grid;\n grid-template-columns: 1fr;\n }\n }\n `\n ]\n\n @property({ type: Object }) role: any\n @property({ type: Array }) allPrivileges: any[] = []\n @property({ type: Object }) updateRoleObj: any\n\n @state() privileges: { id: string; description: string }[] = []\n @state() users: { /* id: string; username: string; */ name: string; email: string }[] = []\n\n render() {\n const allPrivileges = this.allPrivileges || []\n const privileges = this.privileges || []\n const users = this.users || []\n\n // Group privileges by category\n const groupedPrivileges = allPrivileges.reduce(\n (acc, privilege) => {\n const category = privilege.category || 'Other'\n if (!acc[category]) {\n acc[category] = []\n }\n acc[category].push(privilege)\n return acc\n },\n {} as Record<string, any[]>\n )\n\n // Sort categories alphabetically\n const sortedCategories = Object.keys(groupedPrivileges).sort()\n\n // Sort privileges within each category by name (descending)\n sortedCategories.forEach(category => {\n groupedPrivileges[category].sort((a, b) => b.name.localeCompare(a.name))\n })\n\n return html`\n <div titler>${String(i18next.t('label.user'))}</div>\n\n <div users>${users.map(user => html`<div>${user.name} (${user.email})</div>`)}</div>\n\n <div titler>${String(i18next.t('field.privileges'))}</div>\n\n <div>\n <input id=\"checkAll\" type=\"checkbox\" @change=${e => this.oncheckAll(e)} />\n <label for=\"checkAll\">Check all</label>\n </div>\n\n <ul privileges>\n ${sortedCategories.map(\n category => html`\n <div class=\"category-group\">\n <div class=\"category-title\">${category}</div>\n <div class=\"category-privileges\">\n ${groupedPrivileges[category].map(\n /* privilege : {id, name, category, description} */\n privilege => html`\n <li ?deprecated=${privilege.deprecated}>\n <input\n type=\"checkbox\"\n id=\"${privilege.id}\"\n .checked=${privileges.map(p => p.id).indexOf(privilege.id) > -1}\n .data-privilege=${privilege}\n />\n <label for=\"${privilege.id}\">${privilege.description}</label>\n ${privilege.deprecated\n ? html`<small>${String(i18next.t('text.privilege no longer declared'))}</small>`\n : ''}\n </li>\n `\n )}\n </div>\n </div>\n `\n )}\n </ul>\n\n <div class=\"button-container\">\n <md-elevated-button @click=${e => this.onSave()}>${String(i18next.t('button.save'))}</md-elevated-button>\n <md-elevated-button @click=${e => this.onDeleteRole()} danger\n >${String(i18next.t('button.delete role'))}</md-elevated-button\n >\n </div>\n `\n }\n\n async firstUpdated() {\n this.allPrivileges = await this.fetchPrivileges()\n }\n\n async updated(changes) {\n if (changes.has('role')) {\n await this.fetchPrivilegesOnRole(this.role.name)\n }\n }\n\n checkAll(checked) {\n Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]')).forEach(\n checkbox => ((checkbox as HTMLInputElement).checked = checked)\n )\n }\n\n oncheckAll(e) {\n this.checkAll(e.target.checked)\n }\n\n async onSave() {\n const updateRoleObj = this.updateRoleObj\n const privileges = Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]:checked')).map(\n e => ({ id: e['data-privilege'].id }) // ObjectRef 타입에 맞게 id만 전송\n )\n\n const patch = { ...updateRoleObj, privileges: privileges }\n\n if (this.role) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: RolePatch!) {\n updateRole(id: $id, patch: $patch) {\n id\n name\n description\n privileges {\n id\n description\n }\n }\n }\n `,\n variables: { id: this.role.id, patch },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await this.dispatchEvent(new CustomEvent('fetch-roles'))\n this.showToast(i18next.t('text.data_updated_successfully'))\n }\n }\n }\n\n async onDeleteRole() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.are_you_sure_to_delete_x', { x: i18next.t('label.role') }),\n confirmButton: { text: i18next.t('button.delete') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteRole(id: $id)\n }\n `,\n variables: { id: this.role.id },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await this.dispatchEvent(new CustomEvent('fetch-roles'))\n\n await OxPrompt.open({\n type: 'success',\n title: i18next.t('text.completed'),\n text: i18next.t('text.x_deleted_successfully', { x: i18next.t('label.role') }),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n }\n }\n }\n\n async fetchPrivileges() {\n const response = await client.query({\n query: gql`\n query privileges {\n privileges {\n items {\n id\n name\n category\n description\n deprecated\n }\n total\n }\n }\n `\n })\n\n return response.data.privileges.items\n }\n\n async fetchPrivilegesOnRole(name) {\n const response = await client.query({\n query: gql`\n query ($name: String!) {\n role(name: $name) {\n id\n name\n privileges {\n id\n description\n }\n users {\n name\n email\n }\n }\n }\n `,\n variables: { name },\n context: gqlContext()\n })\n\n this.privileges = response.data.role?.privileges\n this.users = response.data.role?.users\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
|