@things-factory/auth-ui 9.1.19 → 9.2.5

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.
@@ -1,5 +1,6 @@
1
1
  import '@material/web/icon/icon.js';
2
2
  import '@operato/i18n/ox-i18n.js';
3
+ import { i18next } from '@operato/i18n';
3
4
  import '@operato/attribute/grist-editor'; /* for register data-grist editor type 'attributes' */
4
5
  import { html } from 'lit-html';
5
6
  import { navigate, store } from '@operato/shell';
@@ -31,10 +32,33 @@ export default async function bootstrap() {
31
32
  name: html ` <ox-i18n msgid="field.sign out"></ox-i18n> `,
32
33
  position: TOOL_POSITION.FRONT_END,
33
34
  action: () => {
35
+ try {
36
+ if (typeof localStorage !== 'undefined') {
37
+ localStorage.removeItem('i18nextLng');
38
+ localStorage.removeItem('i18next');
39
+ }
40
+ ;
41
+ ['i18next', 'i18nextLng'].forEach(name => {
42
+ try {
43
+ document.cookie = `${name}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`;
44
+ }
45
+ catch (e) {
46
+ // ignore
47
+ }
48
+ });
49
+ }
50
+ catch (e) {
51
+ // ignore
52
+ }
34
53
  auth.signout();
35
54
  }
36
55
  }
37
56
  });
57
+ auth.on('profile', ({ credential }) => {
58
+ if (credential && credential.locale) {
59
+ i18next.changeLanguage(credential.locale);
60
+ }
61
+ });
38
62
  /*
39
63
  Get user profile information from server.
40
64
  As soon as response received, auth.on('profile', ...) handlers start to work.
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,iCAAiC,CAAA,CAAC,sDAAsD;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAA;AAC/F,OAAO,EACL,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EACzC,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,SAAS;IACrC,mBAAmB,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAA;IACxD,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;IAExD,8BAA8B;IAC9B,KAAK,CAAC,QAAQ,CAAC;QACb,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,CAAA,qCAAqC;YAC/C,IAAI,EAAE,IAAI,CAAA,iDAAiD;YAC3D,QAAQ,EAAE,aAAa,CAAC,SAAS;YACjC,MAAM,EAAE,GAAG,EAAE;gBACX,QAAQ,CAAC,SAAS,CAAC,CAAA;YACrB,CAAC;SACF;KACF,CAAC,CAAA;IAEF,0BAA0B;IAC1B,KAAK,CAAC,QAAQ,CAAC;QACb,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,CAAA,kCAAkC;YAC5C,IAAI,EAAE,IAAI,CAAA,8CAA8C;YACxD,QAAQ,EAAE,aAAa,CAAC,SAAS;YACjC,MAAM,EAAE,GAAG,EAAE;gBACX,IAAI,CAAC,OAAO,EAAE,CAAA;YAChB,CAAC;SACF;KACF,CAAC,CAAA;IAEF;;;;MAIE;IACF,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;AACtB,CAAC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/attribute/grist-editor' /* for register data-grist editor type 'attributes' */\n\nimport { html } from 'lit-html'\n\nimport { navigate, store } from '@operato/shell'\nimport { TOOL_POSITION } from '@operato/layout'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\n\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\nimport { ADD_MORENDA } from '@things-factory/more-base/client'\n\nexport default async function bootstrap() {\n registerGristEditor('privilege', OxGristEditorPrivilege)\n registerGristRenderer('privilege', OxGristRendererJson5)\n\n /* add user profile morenda */\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>account_circle</md-icon> `,\n name: html` <ox-i18n msgid=\"text.auth profile\"></ox-i18n> `,\n position: TOOL_POSITION.FRONT_END,\n action: () => {\n navigate('profile')\n }\n }\n })\n\n /* add sign-out morenda */\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>exit_to_app</md-icon> `,\n name: html` <ox-i18n msgid=\"field.sign out\"></ox-i18n> `,\n position: TOOL_POSITION.FRONT_END,\n action: () => {\n auth.signout()\n }\n }\n })\n\n /* \n Get user profile information from server. \n As soon as response received, auth.on('profile', ...) handlers start to work.\n It's very important point to build UI for the user.\n */\n await auth.profile()\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,iCAAiC,CAAA,CAAC,sDAAsD;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE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GAAG,GAAG,IAAI,mDAAmD,CAAA;wBAC9E,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,SAAS;wBACX,CAAC;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC,OAAO,EAAE,CAAA;YAChB,CAAC;SACF;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;QACpC,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC,CAAC,CAAA;IAEF;;;;MAIE;IACF,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;AACtB,CAAC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\nimport { i18next } from '@operato/i18n'\nimport '@operato/attribute/grist-editor' /* for register data-grist editor type 'attributes' */\n\nimport { html } from 'lit-html'\n\nimport { navigate, store } from '@operato/shell'\nimport { TOOL_POSITION } from '@operato/layout'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\n\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\nimport { ADD_MORENDA } from '@things-factory/more-base/client'\n\nexport default async function bootstrap() {\n registerGristEditor('privilege', OxGristEditorPrivilege)\n registerGristRenderer('privilege', OxGristRendererJson5)\n\n /* add user profile morenda */\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>account_circle</md-icon> `,\n name: html` <ox-i18n msgid=\"text.auth profile\"></ox-i18n> `,\n position: TOOL_POSITION.FRONT_END,\n action: () => {\n navigate('profile')\n }\n }\n })\n\n /* add sign-out morenda */\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>exit_to_app</md-icon> `,\n name: html` <ox-i18n msgid=\"field.sign out\"></ox-i18n> `,\n position: TOOL_POSITION.FRONT_END,\n action: () => {\n try {\n if (typeof localStorage !== 'undefined') {\n localStorage.removeItem('i18nextLng')\n localStorage.removeItem('i18next')\n }\n\n ;['i18next', 'i18nextLng'].forEach(name => {\n try {\n document.cookie = `${name}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`\n } catch (e) {\n // ignore\n }\n })\n } catch (e) {\n // ignore\n }\n\n auth.signout()\n }\n }\n })\n\n auth.on('profile', ({ credential }) => {\n if (credential && credential.locale) {\n i18next.changeLanguage(credential.locale)\n }\n })\n\n /* \n Get user profile information from server. \n As soon as response received, auth.on('profile', ...) handlers start to work.\n It's very important point to build UI for the user.\n */\n await auth.profile()\n}\n"]}
@@ -216,6 +216,16 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
216
216
  },
217
217
  width: 100
218
218
  },
219
+ {
220
+ type: 'select',
221
+ name: 'theme',
222
+ header: i18next.t('field.theme'),
223
+ record: {
224
+ editable: true,
225
+ options: ['', 'ocean-blue', 'forest-green', 'sunset-orange', 'royal-purple', 'cherry-red']
226
+ },
227
+ width: 140
228
+ },
219
229
  {
220
230
  type: 'timezone',
221
231
  name: 'timezone',
@@ -275,6 +285,7 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
275
285
  email
276
286
  }
277
287
  extType
288
+ theme
278
289
  timezone
279
290
  attributes
280
291
  updatedAt
@@ -1 +1 @@
1
- {"version":3,"file":"domain-management.js","sourceRoot":"","sources":["../../../client/pages/domain/domain-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,6CAA6C,CAAA;AACpD,OAAO,yCAAyC,CAAA;AAChD,OAAO,y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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAIpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AA1BjC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAoY5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@operato/attribute/ox-attribute-view.js'\nimport '../../components/create-domain-popup.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist } from '@operato/data-grist/ox-grist.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\nimport { FetchOption } from '@operato/data-grist'\n\n@customElement('domain-management')\nexport class DomainManagement extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'\n\n private domainTypes?: string[]\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.domain management'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [\n {\n title: i18next.t('button.add'),\n action: this.onCreateDomain.bind(this),\n icon: 'add'\n },\n {\n title: i18next.t('button.save'),\n action: this.onUpdateDomains.bind(this),\n icon: 'save'\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${this.mode}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <div slot=\"headroom\" class=\"header\">\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.config = {\n rows: {\n appendable: false\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'assignment',\n title: i18next.t('title.open attributes view'),\n handlers: {\n click: async (columns, data, column, record, rowIndex) => {\n const attributeSet = await this.getAttributeSetForDomain()\n\n openPopup(\n html`\n <ox-attribute-view\n .attributeSet=${attributeSet}\n .value=${record.attributes}\n style=\"background-color: white;\"\n ></ox-attribute-view>\n `,\n {\n backdrop: true,\n size: 'large',\n title: record.name + ' ' + i18next.t('title.attributes')\n }\n )\n }\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'domain',\n title: i18next.t('title.move to this domain'),\n handlers: {\n click: (_columns, _data, _column, record, _rowIndex) => {\n if (record.id) {\n const subdomain = record.subdomain\n const extType = record.extType || 'domain'\n location.pathname = `/${extType}/${subdomain}/users`\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: false\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'subdomain',\n header: i18next.t('field.subdomain'),\n record: {\n editable: false\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'resource-object',\n name: 'parent',\n header: i18next.t('field.parent-domain'),\n record: {\n editable: true,\n options: {\n title: i18next.t('text.select domain'),\n queryName: 'domains',\n nameField: 'name',\n descriptionField: 'description',\n select: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'description', header: i18next.t('field.description'), filter: 'search' }\n ],\n list: { fields: ['name', 'description'] }\n }\n },\n width: 140\n },\n {\n type: 'resource-object',\n name: 'ownerUser',\n header: i18next.t('field.owner-user'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.lookup user'),\n queryName: 'users',\n nameField: 'name',\n descriptionField: 'email',\n select: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'email', header: i18next.t('field.email'), filter: 'search' }\n ],\n filters: [{ name: 'userType', operator: 'eq', value: 'user' }],\n list: { fields: ['name', 'email'] }\n }\n },\n width: 140\n },\n {\n type: 'select',\n name: 'extType',\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: async () => {\n return ['', ...(await this.getDomainTypes())]\n }\n },\n width: 100\n },\n {\n type: 'timezone',\n name: 'timezone',\n header: i18next.t('field.timezone'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n record: {\n editable: true,\n options: async () => {\n return {\n objectified: true,\n attributeSet: await this.getAttributeSetForDomain()\n }\n }\n },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180\n }\n ]\n }\n }\n\n async pageUpdated(changes, lifecycle) {\n if (this.active) {\n await this.updateComplete\n\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n domains(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n subdomain\n parent {\n id\n name\n }\n ownerUser {\n id\n name\n email\n }\n extType\n timezone\n attributes\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.domains.total || 0,\n records: response.data.domains.items || []\n }\n }\n\n async onUpdateDomains() {\n let patches = this.grist.dirtyRecords\n\n if (patches && patches.length) {\n patches = patches.map(domain => {\n let patchField = domain.id ? { id: domain.id } : {}\n const dirtyFields = domain.__dirtyfields__\n for (let key in dirtyFields) {\n if (key == 'ownerUser') {\n const ownerUser = dirtyFields[key].after\n patchField['owner'] = ownerUser.id || ''\n } else {\n patchField[key] = dirtyFields[key].after\n }\n }\n\n return {\n ...patchField\n }\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation updateDomains($patches: [DomainPatch!]!) {\n updateDomains(patches: $patches)\n }\n `,\n variables: { patches }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n return this.showToast(i18next.t('text.updated_successfully'))\n }\n }\n }\n\n async onCreateDomain() {\n openPopup(\n html`\n <create-domain-popup\n @fetch-data=${async () => {\n this.grist.fetch()\n }}\n ></create-domain-popup>\n `,\n {\n size: 'small',\n title: `${i18next.t('title.create_domain')}`\n }\n )\n }\n\n async getAttributeSetForDomain() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"Domain\") {\n entity\n description\n items {\n name\n description\n tag\n type\n active\n hidden\n options\n }\n }\n }\n `\n })\n\n return response.data?.attributeSet || {}\n }\n\n async getDomainTypes() {\n if (!this.domainTypes) {\n const response = await client.query({\n query: gql`\n query {\n domainTypes\n }\n `\n })\n\n this.domainTypes = response.data?.domainTypes || ['domain']\n }\n\n return this.domainTypes || []\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))\n }\n}\n"]}
1
+ {"version":3,"file":"domain-management.js","sourceRoot":"","sources":["../../../client/pages/domain/domain-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4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AAC,QAAQ,CAAC,CAAA;QAC7D,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,IAAI,EAAE,CAAA;IAC/B,CAAC;IAED,SAAS,CAAC,OAAO;QACf,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;IAC5E,CAAC;;AA1X4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAAwB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAIpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AA1BjC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA+Y5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@operato/attribute/ox-attribute-view.js'\nimport '../../components/create-domain-popup.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist } from '@operato/data-grist/ox-grist.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\nimport { FetchOption } from '@operato/data-grist'\n\n@customElement('domain-management')\nexport class DomainManagement extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'\n\n private domainTypes?: string[]\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.domain management'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [\n {\n title: i18next.t('button.add'),\n action: this.onCreateDomain.bind(this),\n icon: 'add'\n },\n {\n title: i18next.t('button.save'),\n action: this.onUpdateDomains.bind(this),\n icon: 'save'\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${this.mode}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <div slot=\"headroom\" class=\"header\">\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.config = {\n rows: {\n appendable: false\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'assignment',\n title: i18next.t('title.open attributes view'),\n handlers: {\n click: async (columns, data, column, record, rowIndex) => {\n const attributeSet = await this.getAttributeSetForDomain()\n\n openPopup(\n html`\n <ox-attribute-view\n .attributeSet=${attributeSet}\n .value=${record.attributes}\n style=\"background-color: white;\"\n ></ox-attribute-view>\n `,\n {\n backdrop: true,\n size: 'large',\n title: record.name + ' ' + i18next.t('title.attributes')\n }\n )\n }\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'domain',\n title: i18next.t('title.move to this domain'),\n handlers: {\n click: (_columns, _data, _column, record, _rowIndex) => {\n if (record.id) {\n const subdomain = record.subdomain\n const extType = record.extType || 'domain'\n location.pathname = `/${extType}/${subdomain}/users`\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: false\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'subdomain',\n header: i18next.t('field.subdomain'),\n record: {\n editable: false\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'resource-object',\n name: 'parent',\n header: i18next.t('field.parent-domain'),\n record: {\n editable: true,\n options: {\n title: i18next.t('text.select domain'),\n queryName: 'domains',\n nameField: 'name',\n descriptionField: 'description',\n select: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'description', header: i18next.t('field.description'), filter: 'search' }\n ],\n list: { fields: ['name', 'description'] }\n }\n },\n width: 140\n },\n {\n type: 'resource-object',\n name: 'ownerUser',\n header: i18next.t('field.owner-user'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.lookup user'),\n queryName: 'users',\n nameField: 'name',\n descriptionField: 'email',\n select: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'email', header: i18next.t('field.email'), filter: 'search' }\n ],\n filters: [{ name: 'userType', operator: 'eq', value: 'user' }],\n list: { fields: ['name', 'email'] }\n }\n },\n width: 140\n },\n {\n type: 'select',\n name: 'extType',\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: async () => {\n return ['', ...(await this.getDomainTypes())]\n }\n },\n width: 100\n },\n {\n type: 'select',\n name: 'theme',\n header: i18next.t('field.theme'),\n record: {\n editable: true,\n options: ['', 'ocean-blue', 'forest-green', 'sunset-orange', 'royal-purple', 'cherry-red']\n },\n width: 140\n },\n {\n type: 'timezone',\n name: 'timezone',\n header: i18next.t('field.timezone'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n record: {\n editable: true,\n options: async () => {\n return {\n objectified: true,\n attributeSet: await this.getAttributeSetForDomain()\n }\n }\n },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180\n }\n ]\n }\n }\n\n async pageUpdated(changes, lifecycle) {\n if (this.active) {\n await this.updateComplete\n\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n domains(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n subdomain\n parent {\n id\n name\n }\n ownerUser {\n id\n name\n email\n }\n extType\n theme\n timezone\n attributes\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.domains.total || 0,\n records: response.data.domains.items || []\n }\n }\n\n async onUpdateDomains() {\n let patches = this.grist.dirtyRecords\n\n if (patches && patches.length) {\n patches = patches.map(domain => {\n let patchField = domain.id ? { id: domain.id } : {}\n const dirtyFields = domain.__dirtyfields__\n for (let key in dirtyFields) {\n if (key == 'ownerUser') {\n const ownerUser = dirtyFields[key].after\n patchField['owner'] = ownerUser.id || ''\n } else {\n patchField[key] = dirtyFields[key].after\n }\n }\n\n return {\n ...patchField\n }\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation updateDomains($patches: [DomainPatch!]!) {\n updateDomains(patches: $patches)\n }\n `,\n variables: { patches }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n return this.showToast(i18next.t('text.updated_successfully'))\n }\n }\n }\n\n async onCreateDomain() {\n openPopup(\n html`\n <create-domain-popup\n @fetch-data=${async () => {\n this.grist.fetch()\n }}\n ></create-domain-popup>\n `,\n {\n size: 'small',\n title: `${i18next.t('title.create_domain')}`\n }\n )\n }\n\n async getAttributeSetForDomain() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"Domain\") {\n entity\n description\n items {\n name\n description\n tag\n type\n active\n hidden\n options\n }\n }\n }\n `\n })\n\n return response.data?.attributeSet || {}\n }\n\n async getDomainTypes() {\n if (!this.domainTypes) {\n const response = await client.query({\n query: gql`\n query {\n domainTypes\n }\n `\n })\n\n this.domainTypes = response.data?.domainTypes || ['domain']\n }\n\n return this.domainTypes || []\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))\n }\n}\n"]}