@things-factory/auth-ui 9.2.5 → 10.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist-client/components/domain-switch.d.ts +2 -12
  2. package/dist-client/components/domain-switch.js +5 -18
  3. package/dist-client/components/domain-switch.js.map +1 -1
  4. package/dist-client/components/user-role-editor.js +13 -4
  5. package/dist-client/components/user-role-editor.js.map +1 -1
  6. package/dist-client/pages/app-binding/app-binding.js +66 -111
  7. package/dist-client/pages/app-binding/app-binding.js.map +1 -1
  8. package/dist-client/pages/app-binding/app-bindings.js +38 -59
  9. package/dist-client/pages/app-binding/app-bindings.js.map +1 -1
  10. package/dist-client/pages/appliance/appliance.js +72 -120
  11. package/dist-client/pages/appliance/appliance.js.map +1 -1
  12. package/dist-client/pages/appliance/home.js +39 -61
  13. package/dist-client/pages/appliance/home.js.map +1 -1
  14. package/dist-client/pages/appliance/register.js +33 -52
  15. package/dist-client/pages/appliance/register.js.map +1 -1
  16. package/dist-client/pages/application/application.js +67 -107
  17. package/dist-client/pages/application/application.js.map +1 -1
  18. package/dist-client/pages/application/applications.js +38 -59
  19. package/dist-client/pages/application/applications.js.map +1 -1
  20. package/dist-client/pages/application/register.js +41 -64
  21. package/dist-client/pages/application/register.js.map +1 -1
  22. package/dist-client/pages/attribute/attribute-set-management.d.ts +0 -6
  23. package/dist-client/pages/attribute/attribute-set-management.js +46 -87
  24. package/dist-client/pages/attribute/attribute-set-management.js.map +1 -1
  25. package/dist-client/pages/auth-provider/auth-provider-management.d.ts +0 -6
  26. package/dist-client/pages/auth-provider/auth-provider-management.js +67 -127
  27. package/dist-client/pages/auth-provider/auth-provider-management.js.map +1 -1
  28. package/dist-client/pages/domain/domain-management.d.ts +0 -6
  29. package/dist-client/pages/domain/domain-management.js +64 -119
  30. package/dist-client/pages/domain/domain-management.js.map +1 -1
  31. package/dist-client/pages/domain-link/domain-link-management.d.ts +1 -7
  32. package/dist-client/pages/domain-link/domain-link-management.js +67 -125
  33. package/dist-client/pages/domain-link/domain-link-management.js.map +1 -1
  34. package/dist-client/pages/env-var/env-var-list-page.d.ts +0 -6
  35. package/dist-client/pages/env-var/env-var-list-page.js +44 -82
  36. package/dist-client/pages/env-var/env-var-list-page.js.map +1 -1
  37. package/dist-client/pages/partner/partner-management.js +17 -28
  38. package/dist-client/pages/partner/partner-management.js.map +1 -1
  39. package/dist-client/pages/role/role-management.js +20 -33
  40. package/dist-client/pages/role/role-management.js.map +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +12 -12
  43. package/views/auth-page.html +1 -1
  44. package/views/oauth2-page.html +1 -1
@@ -8,16 +8,15 @@ import '../../components/create-domain-popup.js';
8
8
  import gql from 'graphql-tag';
9
9
  import { css, html } from 'lit';
10
10
  import { customElement, property, query } from 'lit/decorators.js';
11
- import { connect } from 'pwa-helpers/connect-mixin';
12
11
  import { DataGrist } from '@operato/data-grist/ox-grist.js';
13
12
  import { client } from '@operato/graphql';
14
13
  import { i18next, localize } from '@operato/i18n';
15
14
  import { openPopup } from '@operato/layout';
16
- import { PageView, store } from '@operato/shell';
15
+ import { PageView } from '@operato/shell';
17
16
  import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
18
17
  import { isMobileDevice } from '@operato/utils';
19
18
  import { p13n } from '@operato/p13n';
20
- let DomainManagement = class DomainManagement extends connect(store)(p13n(localize(i18next)(PageView))) {
19
+ let DomainManagement = class DomainManagement extends p13n(localize(i18next)(PageView)) {
21
20
  constructor() {
22
21
  super(...arguments);
23
22
  this.active = false;
@@ -28,47 +27,38 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
28
27
  CommonHeaderStyles,
29
28
  ScrollbarStyles,
30
29
  css `
31
- :host {
32
- display: flex;
30
+ :host { display: flex;
33
31
  flex-direction: column;
34
32
 
35
33
  overflow: hidden;
36
- }
34
+ }
37
35
 
38
- ox-grist {
39
- overflow-y: auto;
36
+ ox-grist { overflow-y: auto;
40
37
  flex: 1;
41
- }
38
+ }
42
39
  `
43
40
  ]; }
44
41
  get context() {
45
- return {
46
- title: i18next.t('text.domain management'),
47
- search: {
48
- handler: (search) => {
42
+ return { title: i18next.t('text.domain management'),
43
+ search: { handler: (search) => {
49
44
  this.grist.searchText = search;
50
45
  },
51
- value: this.grist?.searchText || ''
52
- },
53
- filter: {
54
- handler: () => {
46
+ value: this.grist?.searchText || '' },
47
+ filter: { handler: () => {
55
48
  this.grist.toggleHeadroom();
56
49
  }
57
50
  },
58
51
  actions: [
59
- {
60
- title: i18next.t('button.add'),
52
+ { title: i18next.t('button.add'),
61
53
  action: this.onCreateDomain.bind(this),
62
54
  icon: 'add'
63
55
  },
64
- {
65
- title: i18next.t('button.save'),
56
+ { title: i18next.t('button.save'),
66
57
  action: this.onUpdateDomains.bind(this),
67
58
  icon: 'save'
68
59
  }
69
60
  ],
70
- toolbar: false
71
- };
61
+ toolbar: false };
72
62
  }
73
63
  render() {
74
64
  return html `
@@ -87,19 +77,15 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
87
77
  `;
88
78
  }
89
79
  async pageInitialized() {
90
- this.config = {
91
- rows: {
92
- appendable: false
80
+ this.config = { rows: { appendable: false
93
81
  },
94
82
  columns: [
95
83
  { type: 'gutter', gutterName: 'sequence' },
96
- {
97
- type: 'gutter',
84
+ { type: 'gutter',
98
85
  gutterName: 'button',
99
86
  icon: 'assignment',
100
87
  title: i18next.t('title.open attributes view'),
101
- handlers: {
102
- click: async (columns, data, column, record, rowIndex) => {
88
+ handlers: { click: async (columns, data, column, record, rowIndex) => {
103
89
  const attributeSet = await this.getAttributeSetForDomain();
104
90
  openPopup(html `
105
91
  <ox-attribute-view
@@ -107,21 +93,18 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
107
93
  .value=${record.attributes}
108
94
  style="background-color: white;"
109
95
  ></ox-attribute-view>
110
- `, {
111
- backdrop: true,
96
+ `, { backdrop: true,
112
97
  size: 'large',
113
98
  title: record.name + ' ' + i18next.t('title.attributes')
114
99
  });
115
100
  }
116
101
  }
117
102
  },
118
- {
119
- type: 'gutter',
103
+ { type: 'gutter',
120
104
  gutterName: 'button',
121
105
  icon: 'domain',
122
106
  title: i18next.t('title.move to this domain'),
123
- handlers: {
124
- click: (_columns, _data, _column, record, _rowIndex) => {
107
+ handlers: { click: (_columns, _data, _column, record, _rowIndex) => {
125
108
  if (record.id) {
126
109
  const subdomain = record.subdomain;
127
110
  const extType = record.extType || 'domain';
@@ -130,45 +113,36 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
130
113
  }
131
114
  }
132
115
  },
133
- {
134
- type: 'string',
116
+ { type: 'string',
135
117
  name: 'name',
136
118
  header: i18next.t('field.name'),
137
- record: {
138
- editable: false
119
+ record: { editable: false
139
120
  },
140
121
  filter: 'search',
141
122
  sortable: true,
142
123
  width: 200
143
124
  },
144
- {
145
- type: 'string',
125
+ { type: 'string',
146
126
  name: 'description',
147
127
  header: i18next.t('field.description'),
148
- record: {
149
- editable: true
128
+ record: { editable: true
150
129
  },
151
130
  filter: 'search',
152
131
  width: 200
153
132
  },
154
- {
155
- type: 'string',
133
+ { type: 'string',
156
134
  name: 'subdomain',
157
135
  header: i18next.t('field.subdomain'),
158
- record: {
159
- editable: false
136
+ record: { editable: false
160
137
  },
161
138
  filter: 'search',
162
139
  width: 200
163
140
  },
164
- {
165
- type: 'resource-object',
141
+ { type: 'resource-object',
166
142
  name: 'parent',
167
143
  header: i18next.t('field.parent-domain'),
168
- record: {
169
- editable: true,
170
- options: {
171
- title: i18next.t('text.select domain'),
144
+ record: { editable: true,
145
+ options: { title: i18next.t('text.select domain'),
172
146
  queryName: 'domains',
173
147
  nameField: 'name',
174
148
  descriptionField: 'description',
@@ -182,14 +156,11 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
182
156
  },
183
157
  width: 140
184
158
  },
185
- {
186
- type: 'resource-object',
159
+ { type: 'resource-object',
187
160
  name: 'ownerUser',
188
161
  header: i18next.t('field.owner-user'),
189
- record: {
190
- editable: true,
191
- options: {
192
- title: i18next.t('title.lookup user'),
162
+ record: { editable: true,
163
+ options: { title: i18next.t('title.lookup user'),
193
164
  queryName: 'users',
194
165
  nameField: 'name',
195
166
  descriptionField: 'email',
@@ -204,12 +175,10 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
204
175
  },
205
176
  width: 140
206
177
  },
207
- {
208
- type: 'select',
178
+ { type: 'select',
209
179
  name: 'extType',
210
180
  header: i18next.t('field.type'),
211
- record: {
212
- editable: true,
181
+ record: { editable: true,
213
182
  options: async () => {
214
183
  return ['', ...(await this.getDomainTypes())];
215
184
  }
@@ -226,32 +195,26 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
226
195
  },
227
196
  width: 140
228
197
  },
229
- {
230
- type: 'timezone',
198
+ { type: 'timezone',
231
199
  name: 'timezone',
232
200
  header: i18next.t('field.timezone'),
233
- record: {
234
- editable: true
201
+ record: { editable: true
235
202
  },
236
203
  width: 120
237
204
  },
238
- {
239
- type: 'attributes',
205
+ { type: 'attributes',
240
206
  name: 'attributes',
241
207
  header: i18next.t('field.attributes'),
242
- record: {
243
- editable: true,
208
+ record: { editable: true,
244
209
  options: async () => {
245
- return {
246
- objectified: true,
210
+ return { objectified: true,
247
211
  attributeSet: await this.getAttributeSetForDomain()
248
212
  };
249
213
  }
250
214
  },
251
215
  width: 120
252
216
  },
253
- {
254
- type: 'datetime',
217
+ { type: 'datetime',
255
218
  name: 'updatedAt',
256
219
  header: i18next.t('field.updated_at'),
257
220
  width: 180
@@ -266,42 +229,34 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
266
229
  }
267
230
  }
268
231
  async fetchHandler({ page, limit, sortings = [], filters = [] }) {
269
- const response = await client.query({
270
- query: gql `
271
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
272
- domains(filters: $filters, pagination: $pagination, sortings: $sortings) {
273
- items {
274
- id
232
+ const response = await client.query({ query: gql `
233
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { domains(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
275
234
  name
276
235
  description
277
236
  subdomain
278
- parent {
279
- id
237
+ parent { id
280
238
  name
281
- }
282
- ownerUser {
283
- id
239
+ }
240
+ ownerUser { id
284
241
  name
285
242
  email
286
- }
243
+ }
287
244
  extType
288
245
  theme
289
246
  timezone
290
247
  attributes
291
248
  updatedAt
292
- }
249
+ }
293
250
  total
294
- }
295
- }
251
+ }
252
+ }
296
253
  `,
297
- variables: {
298
- filters,
254
+ variables: { filters,
299
255
  pagination: { page, limit },
300
256
  sortings
301
257
  }
302
258
  });
303
- return {
304
- total: response.data.domains.total || 0,
259
+ return { total: response.data.domains.total || 0,
305
260
  records: response.data.domains.items || []
306
261
  };
307
262
  }
@@ -320,15 +275,12 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
320
275
  patchField[key] = dirtyFields[key].after;
321
276
  }
322
277
  }
323
- return {
324
- ...patchField
278
+ return { ...patchField
325
279
  };
326
280
  });
327
- const response = await client.mutate({
328
- mutation: gql `
329
- mutation updateDomains($patches: [DomainPatch!]!) {
330
- updateDomains(patches: $patches)
331
- }
281
+ const response = await client.mutate({ mutation: gql `
282
+ mutation updateDomains($patches: [DomainPatch!]!) { updateDomains(patches: $patches)
283
+ }
332
284
  `,
333
285
  variables: { patches }
334
286
  });
@@ -345,40 +297,33 @@ let DomainManagement = class DomainManagement extends connect(store)(p13n(locali
345
297
  this.grist.fetch();
346
298
  }}
347
299
  ></create-domain-popup>
348
- `, {
349
- size: 'small',
300
+ `, { size: 'small',
350
301
  title: `${i18next.t('title.create_domain')}`
351
302
  });
352
303
  }
353
304
  async getAttributeSetForDomain() {
354
- const response = await client.query({
355
- query: gql `
356
- query {
357
- attributeSet: attributeSetByEntity(entity: "Domain") {
358
- entity
305
+ const response = await client.query({ query: gql `
306
+ query { attributeSet: attributeSetByEntity(entity: "Domain") { entity
359
307
  description
360
- items {
361
- name
308
+ items { name
362
309
  description
363
310
  tag
364
311
  type
365
312
  active
366
313
  hidden
367
314
  options
368
- }
369
- }
370
- }
315
+ }
316
+ }
317
+ }
371
318
  `
372
319
  });
373
320
  return response.data?.attributeSet || {};
374
321
  }
375
322
  async getDomainTypes() {
376
323
  if (!this.domainTypes) {
377
- const response = await client.query({
378
- query: gql `
379
- query {
380
- domainTypes
381
- }
324
+ const response = await client.query({ query: gql `
325
+ query { domainTypes
326
+ }
382
327
  `
383
328
  });
384
329
  this.domainTypes = response.data?.domainTypes || ['domain'];
@@ -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,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO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IACH,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBT;SACF,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,IAAI,EAAE,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;SAIT;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC,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"]}
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,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC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AAE,EAAE,CAAC,CAAC,CAAA;IACpG,CAAC;;AA9S6B;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;AAvBjC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAgU5B","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 { 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 } 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 p13n(localize(i18next)(PageView)) { static styles = [\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist { 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() { return { title: i18next.t('text.domain management'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n actions: [\n { title: i18next.t('button.add'),\n action: this.onCreateDomain.bind(this),\n icon: 'add'\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() { 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() { this.config = { rows: { appendable: false\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter',\n gutterName: 'button',\n icon: 'assignment',\n title: i18next.t('title.open attributes view'),\n handlers: { click: async (columns, data, column, record, rowIndex) => { 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 { backdrop: true,\n size: 'large',\n title: record.name + ' ' + i18next.t('title.attributes')\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: { click: (_columns, _data, _column, record, _rowIndex) => { if (record.id) { const subdomain = record.subdomain\n const extType = record.extType || 'domain'\n location.pathname = `/${extType}/${subdomain}/users`\n }\n }\n }\n },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: false\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'string',\n name: 'subdomain',\n header: i18next.t('field.subdomain'),\n record: { editable: false\n },\n filter: 'search',\n width: 200\n },\n { type: 'resource-object',\n name: 'parent',\n header: i18next.t('field.parent-domain'),\n record: { editable: true,\n options: { 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 { type: 'resource-object',\n name: 'ownerUser',\n header: i18next.t('field.owner-user'),\n record: { editable: true,\n options: { 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 { type: 'select',\n name: 'extType',\n header: i18next.t('field.type'),\n record: { editable: true,\n options: async () => { 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 { type: 'timezone',\n name: 'timezone',\n header: i18next.t('field.timezone'),\n record: { editable: true\n },\n width: 120\n },\n { type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n record: { editable: true,\n options: async () => { return { objectified: true,\n attributeSet: await this.getAttributeSetForDomain()\n }\n }\n },\n width: 120\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) { if (this.active) { await this.updateComplete\n\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { domains(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n subdomain\n parent { id\n name\n }\n ownerUser { id\n name\n email\n }\n extType\n theme\n timezone\n attributes\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.domains.total || 0,\n records: response.data.domains.items || []\n }\n }\n\n async onUpdateDomains() { let patches = this.grist.dirtyRecords\n\n if (patches && patches.length) { patches = patches.map(domain => { let patchField = domain.id ? { id: domain.id } : {}\n const dirtyFields = domain.__dirtyfields__\n for (let key in dirtyFields) { if (key == 'ownerUser') { const ownerUser = dirtyFields[key].after\n patchField['owner'] = ownerUser.id || ''\n } else { patchField[key] = dirtyFields[key].after\n }\n }\n\n return { ...patchField\n }\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation updateDomains($patches: [DomainPatch!]!) { updateDomains(patches: $patches)\n }\n `,\n variables: { patches }\n })\n\n if (!response.errors) { this.grist.fetch()\n return this.showToast(i18next.t('text.updated_successfully'))\n }\n }\n }\n\n async onCreateDomain() { openPopup(\n html`\n <create-domain-popup\n @fetch-data=${async () => { this.grist.fetch()\n }}\n ></create-domain-popup>\n `,\n { size: 'small',\n title: `${i18next.t('title.create_domain')}`\n }\n )\n }\n\n async getAttributeSetForDomain() { const response = await client.query({ query: gql`\n query { attributeSet: attributeSetByEntity(entity: \"Domain\") { entity\n description\n items { 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() { if (!this.domainTypes) { const response = await client.query({ query: gql`\n query { domainTypes\n }\n `\n })\n\n this.domainTypes = response.data?.domainTypes || ['domain']\n }\n\n return this.domainTypes || []\n }\n\n showToast(message) { document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))\n }\n}\n"]}
@@ -5,13 +5,7 @@ import '@operato/data-grist/ox-filters-form.js';
5
5
  import '@operato/data-grist/ox-record-creator.js';
6
6
  import { PageView } from '@operato/shell';
7
7
  import { FetchOption } from '@operato/data-grist';
8
- declare const DomainLinkLManagement_base: (new (...args: any[]) => {
9
- _storeUnsubscribe: import("redux").Unsubscribe;
10
- connectedCallback(): void;
11
- disconnectedCallback(): void;
12
- stateChanged(_state: unknown): void;
13
- readonly isConnected: boolean;
14
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
8
+ declare const DomainLinkLManagement_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
15
9
  export declare class DomainLinkLManagement extends DomainLinkLManagement_base {
16
10
  static styles: import("lit").CSSResult[];
17
11
  gristConfig: any;