@things-factory/setting-ui 6.2.49 → 6.2.51
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/client/components/{partner-selector.js → partner-selector.ts} +26 -62
- package/client/{fetch-setting-value.js → fetch-setting-value.ts} +6 -5
- package/client/{index.js → index.ts} +2 -1
- package/client/pages/{partner-setting-list.js → partner-setting-list.ts} +67 -103
- package/client/pages/{setting-list.js → setting-list.ts} +50 -85
- package/client/pages/{setting.js → setting.ts} +17 -23
- package/client/setting-lets/{domain-switch-let.js → domain-switch-let.ts} +15 -20
- package/client/setting-lets/secure-iplist-setting-let.ts +202 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/partner-selector.d.ts +3 -0
- package/dist-client/components/partner-selector.js +136 -0
- package/dist-client/components/partner-selector.js.map +1 -0
- package/dist-client/fetch-setting-value.d.ts +1 -0
- package/dist-client/fetch-setting-value.js +29 -0
- package/dist-client/fetch-setting-value.js.map +1 -0
- package/dist-client/index.d.ts +5 -0
- package/dist-client/index.js +6 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/partner-setting-list.d.ts +57 -0
- package/dist-client/pages/partner-setting-list.js +356 -0
- package/dist-client/pages/partner-setting-list.js.map +1 -0
- package/dist-client/pages/setting-list.d.ts +60 -0
- package/dist-client/pages/setting-list.js +279 -0
- package/dist-client/pages/setting-list.js.map +1 -0
- package/dist-client/pages/setting.d.ts +18 -0
- package/dist-client/pages/setting.js +52 -0
- package/dist-client/pages/setting.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/setting-lets/domain-switch-let.d.ts +18 -0
- package/dist-client/setting-lets/domain-switch-let.js +59 -0
- package/dist-client/setting-lets/domain-switch-let.js.map +1 -0
- package/dist-client/setting-lets/secure-iplist-setting-let.d.ts +24 -0
- package/dist-client/setting-lets/secure-iplist-setting-let.js +198 -0
- package/dist-client/setting-lets/secure-iplist-setting-let.js.map +1 -0
- package/dist-client/themes/setting-theme.css +32 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/things-factory.config.js +1 -1
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -9,67 +9,42 @@ import { CommonGristStyles } from '@operato/styles'
|
|
|
9
9
|
|
|
10
10
|
import gql from 'graphql-tag'
|
|
11
11
|
import { css, html, LitElement } from 'lit'
|
|
12
|
+
import { customElement, query, state } from 'lit/decorators.js'
|
|
12
13
|
|
|
14
|
+
@customElement('partner-selector')
|
|
13
15
|
class PartnerSelector extends LitElement {
|
|
14
|
-
static
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]
|
|
33
|
-
}
|
|
16
|
+
static styles = [
|
|
17
|
+
CommonGristStyles,
|
|
18
|
+
css`
|
|
19
|
+
:host {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
background-color: white;
|
|
24
|
+
}
|
|
25
|
+
.button-container {
|
|
26
|
+
padding: var(--button-container-padding);
|
|
27
|
+
margin: var(--button-container-margin);
|
|
28
|
+
text-align: var(--button-container-align);
|
|
29
|
+
background-color: var(--button-container-background);
|
|
30
|
+
height: var(--button-container-height);
|
|
31
|
+
}
|
|
32
|
+
`
|
|
33
|
+
]
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
35
|
+
@state() private config: any
|
|
36
|
+
@state() private data: any
|
|
37
|
+
@state() private mode: string = isMobileDevice() ? 'LIST' : 'GRID'
|
|
38
|
+
|
|
39
|
+
@query('ox-grist') private dataGrist: any
|
|
42
40
|
|
|
43
41
|
render() {
|
|
44
|
-
let mode = this.mode
|
|
45
42
|
return html`
|
|
46
|
-
<ox-grist .mode=${mode} auto-fetch .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
43
|
+
<ox-grist .mode=${this.mode} auto-fetch .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
47
44
|
<div slot="headroom">
|
|
48
45
|
<div id="filters">
|
|
49
46
|
<ox-filters-form></ox-filters-form>
|
|
50
47
|
</div>
|
|
51
|
-
|
|
52
|
-
<div id="sorters">
|
|
53
|
-
Sort
|
|
54
|
-
<mwc-icon
|
|
55
|
-
@click=${e => {
|
|
56
|
-
const target = e.currentTarget
|
|
57
|
-
this.renderRoot.querySelector('#sorter-control').open({
|
|
58
|
-
right: 0,
|
|
59
|
-
top: target.offsetTop + target.offsetHeight
|
|
60
|
-
})
|
|
61
|
-
}}
|
|
62
|
-
>expand_more</mwc-icon
|
|
63
|
-
>
|
|
64
|
-
<ox-popup id="sorter-control">
|
|
65
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
66
|
-
</ox-popup>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<div id="modes">
|
|
70
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
71
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
72
|
-
</div>
|
|
73
48
|
</div>
|
|
74
49
|
</ox-grist>
|
|
75
50
|
|
|
@@ -79,15 +54,6 @@ class PartnerSelector extends LitElement {
|
|
|
79
54
|
`
|
|
80
55
|
}
|
|
81
56
|
|
|
82
|
-
constructor() {
|
|
83
|
-
super()
|
|
84
|
-
this.mode = isMobileDevice() ? 'LIST' : 'GRID'
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get dataGrist() {
|
|
88
|
-
return this.renderRoot?.querySelector('ox-grist')
|
|
89
|
-
}
|
|
90
|
-
|
|
91
57
|
firstUpdated() {
|
|
92
58
|
this.config = {
|
|
93
59
|
list: { fields: ['name', 'description'] },
|
|
@@ -164,5 +130,3 @@ class PartnerSelector extends LitElement {
|
|
|
164
130
|
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
|
|
165
131
|
}
|
|
166
132
|
}
|
|
167
|
-
|
|
168
|
-
customElements.define('partner-selector', PartnerSelector)
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { client, buildArgs } from '@operato/graphql'
|
|
2
1
|
import gql from 'graphql-tag'
|
|
2
|
+
import { client } from '@operato/graphql'
|
|
3
3
|
|
|
4
|
-
export async function fetchSettingRule(
|
|
4
|
+
export async function fetchSettingRule(name: string) {
|
|
5
5
|
const response = await client.query({
|
|
6
6
|
query: gql`
|
|
7
|
-
query {
|
|
8
|
-
setting(
|
|
7
|
+
query ($name: String!) {
|
|
8
|
+
setting(name: $name) {
|
|
9
9
|
value
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
`,
|
|
13
|
+
variables: { name }
|
|
13
14
|
})
|
|
14
15
|
|
|
15
16
|
if (!response.errors) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './fetch-setting-value'
|
|
2
2
|
export { SettingPage } from './pages/setting'
|
|
3
3
|
export { SettingList } from './pages/setting-list'
|
|
4
|
-
export * from './setting-lets/domain-switch-let'
|
|
5
4
|
|
|
5
|
+
export * from './setting-lets/domain-switch-let'
|
|
6
|
+
export * from './setting-lets/secure-iplist-setting-let'
|
|
@@ -3,6 +3,7 @@ import '../components/partner-selector'
|
|
|
3
3
|
|
|
4
4
|
import gql from 'graphql-tag'
|
|
5
5
|
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
7
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
8
|
|
|
8
9
|
import { openPopup } from '@operato/layout'
|
|
@@ -10,56 +11,51 @@ import { i18next, localize } from '@operato/i18n'
|
|
|
10
11
|
import { PageView, store } from '@operato/shell'
|
|
11
12
|
import { client, gqlContext } from '@operato/graphql'
|
|
12
13
|
import { ScrollbarStyles, CommonButtonStyles, CommonGristStyles } from '@operato/styles'
|
|
14
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
15
|
+
import { getEditor, getRenderer } from '@operato/data-grist'
|
|
13
16
|
import { isMobileDevice } from '@operato/utils'
|
|
14
17
|
|
|
15
|
-
import { CustomAlert } from '@things-factory/shell'
|
|
16
18
|
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
@customElement('partner-setting-list')
|
|
20
21
|
export class PartnerSettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
21
|
-
static
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
label
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]
|
|
50
|
-
}
|
|
22
|
+
static styles = [
|
|
23
|
+
CommonGristStyles,
|
|
24
|
+
ScrollbarStyles,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
fieldset {
|
|
32
|
+
max-width: var(--input-container-max-width);
|
|
33
|
+
border: none;
|
|
34
|
+
}
|
|
35
|
+
label {
|
|
36
|
+
font: var(--label-font);
|
|
37
|
+
color: var(--label-color);
|
|
38
|
+
text-transform: var(--label-text-transform);
|
|
39
|
+
}
|
|
40
|
+
input {
|
|
41
|
+
border: var(--border-dark-color);
|
|
42
|
+
border-radius: var(--border-radius);
|
|
43
|
+
margin: var(--input-margin);
|
|
44
|
+
padding: var(--input-padding);
|
|
45
|
+
background-color: var(--theme-white-color);
|
|
46
|
+
font: var(--input-font);
|
|
47
|
+
}
|
|
48
|
+
`
|
|
49
|
+
]
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
mode: String
|
|
57
|
-
}
|
|
58
|
-
}
|
|
51
|
+
@state() private config: any
|
|
52
|
+
@state() private partnerDomain: any
|
|
53
|
+
@state() private mode: string = isMobileDevice() ? 'LIST' : 'GRID'
|
|
54
|
+
@state() private refreshHandlers: any[] = []
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
let mode = this.mode
|
|
56
|
+
@query('ox-grist') private dataGrist: any
|
|
62
57
|
|
|
58
|
+
render() {
|
|
63
59
|
return html`
|
|
64
60
|
<form class="multi-column-form">
|
|
65
61
|
<fieldset>
|
|
@@ -75,7 +71,7 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
75
71
|
</form>
|
|
76
72
|
|
|
77
73
|
<ox-grist
|
|
78
|
-
.mode=${mode}
|
|
74
|
+
.mode=${this.mode}
|
|
79
75
|
.config=${this.config}
|
|
80
76
|
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
81
77
|
@record-change="${this.onRecordChangeHandler.bind(this)}"
|
|
@@ -84,39 +80,11 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
84
80
|
<div id="filters">
|
|
85
81
|
<ox-filters-form></ox-filters-form>
|
|
86
82
|
</div>
|
|
87
|
-
|
|
88
|
-
<div id="sorters">
|
|
89
|
-
Sort
|
|
90
|
-
<mwc-icon
|
|
91
|
-
@click=${e => {
|
|
92
|
-
const target = e.currentTarget
|
|
93
|
-
this.renderRoot.querySelector('#sorter-control').open({
|
|
94
|
-
right: 0,
|
|
95
|
-
top: target.offsetTop + target.offsetHeight
|
|
96
|
-
})
|
|
97
|
-
}}
|
|
98
|
-
>expand_more</mwc-icon
|
|
99
|
-
>
|
|
100
|
-
<ox-popup id="sorter-control">
|
|
101
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
102
|
-
</ox-popup>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div id="modes">
|
|
106
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
107
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
108
|
-
</div>
|
|
109
83
|
</div>
|
|
110
84
|
</ox-grist>
|
|
111
85
|
`
|
|
112
86
|
}
|
|
113
87
|
|
|
114
|
-
constructor() {
|
|
115
|
-
super()
|
|
116
|
-
this.refreshHandlers = []
|
|
117
|
-
this.mode = isMobileDevice() ? 'LIST' : 'GRID'
|
|
118
|
-
}
|
|
119
|
-
|
|
120
88
|
get context() {
|
|
121
89
|
return {
|
|
122
90
|
title: i18next.t('title.partner_setting'),
|
|
@@ -234,10 +202,6 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
234
202
|
}
|
|
235
203
|
}
|
|
236
204
|
|
|
237
|
-
get dataGrist() {
|
|
238
|
-
return this.renderRoot.querySelector('ox-grist')
|
|
239
|
-
}
|
|
240
|
-
|
|
241
205
|
async fetchHandler({ filters, page, limit, sorters = [] }) {
|
|
242
206
|
if (!this.partnerDomain) return { total: 0, records: [] }
|
|
243
207
|
|
|
@@ -302,7 +266,7 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
302
266
|
}
|
|
303
267
|
|
|
304
268
|
patches = patches.map(partnerSetting => {
|
|
305
|
-
let patchField = {
|
|
269
|
+
let patchField: any = {
|
|
306
270
|
cuFlag: partnerSetting.__dirty__,
|
|
307
271
|
setting: { id: partnerSetting.setting.id },
|
|
308
272
|
partnerDomain: { id: this.partnerDomain.id }
|
|
@@ -337,34 +301,36 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
337
301
|
}
|
|
338
302
|
|
|
339
303
|
const ids = this.dataGrist.selected.map(record => record.id)
|
|
340
|
-
const answer = await CustomAlert({
|
|
341
|
-
type: 'warning',
|
|
342
|
-
title: i18next.t('button.delete'),
|
|
343
|
-
text: i18next.t('text.are_you_sure'),
|
|
344
|
-
confirmButton: { text: i18next.t('button.delete') },
|
|
345
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
346
|
-
})
|
|
347
304
|
|
|
348
|
-
if (
|
|
305
|
+
if (
|
|
306
|
+
await OxPrompt.open({
|
|
307
|
+
type: 'warning',
|
|
308
|
+
title: i18next.t('button.delete'),
|
|
309
|
+
text: i18next.t('text.are_you_sure'),
|
|
310
|
+
confirmButton: { text: i18next.t('button.delete') },
|
|
311
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
312
|
+
})
|
|
313
|
+
) {
|
|
314
|
+
const response = await client.mutate({
|
|
315
|
+
mutation: gql`
|
|
316
|
+
mutation deletePartnerSettings($ids: [String!]!) {
|
|
317
|
+
deletePartnerSettings(ids: $ids)
|
|
318
|
+
}
|
|
319
|
+
`,
|
|
320
|
+
variables: { ids },
|
|
321
|
+
context: gqlContext()
|
|
322
|
+
})
|
|
349
323
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
context: gqlContext()
|
|
358
|
-
})
|
|
324
|
+
if (!response.errors) {
|
|
325
|
+
await OxPrompt.open({
|
|
326
|
+
type: 'success',
|
|
327
|
+
title: i18next.t('text.completed'),
|
|
328
|
+
text: i18next.t('text.data_deleted_successfully'),
|
|
329
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
330
|
+
})
|
|
359
331
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
type: 'success',
|
|
363
|
-
title: i18next.t('text.completed'),
|
|
364
|
-
text: i18next.t('text.data_deleted_successfully'),
|
|
365
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
366
|
-
})
|
|
367
|
-
this.dataGrist.fetch()
|
|
332
|
+
this.dataGrist.fetch()
|
|
333
|
+
}
|
|
368
334
|
}
|
|
369
335
|
}
|
|
370
336
|
|
|
@@ -401,5 +367,3 @@ export class PartnerSettingList extends connect(store)(localize(i18next)(PageVie
|
|
|
401
367
|
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
|
|
402
368
|
}
|
|
403
369
|
}
|
|
404
|
-
|
|
405
|
-
window.customElements.define('partner-setting-list', PartnerSettingList)
|
|
@@ -5,81 +5,50 @@ import '@operato/data-grist/ox-record-creator.js'
|
|
|
5
5
|
|
|
6
6
|
import { getEditor, getRenderer } from '@operato/data-grist'
|
|
7
7
|
import { i18next, localize } from '@operato/i18n'
|
|
8
|
-
import { CustomAlert } from '@things-factory/shell'
|
|
9
8
|
import { PageView, store } from '@operato/shell'
|
|
10
9
|
import { client, gqlContext } from '@operato/graphql'
|
|
11
10
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
11
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
12
12
|
import { isMobileDevice } from '@operato/utils'
|
|
13
13
|
|
|
14
14
|
import gql from 'graphql-tag'
|
|
15
15
|
import { css, html } from 'lit'
|
|
16
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
16
17
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
17
18
|
|
|
19
|
+
@customElement('setting-list')
|
|
18
20
|
export class SettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]
|
|
31
|
-
}
|
|
21
|
+
static styles = [
|
|
22
|
+
CommonGristStyles,
|
|
23
|
+
ScrollbarStyles,
|
|
24
|
+
css`
|
|
25
|
+
:host {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
]
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
mode: String
|
|
38
|
-
}
|
|
39
|
-
}
|
|
33
|
+
@state() private config: any
|
|
34
|
+
@state() private data: any
|
|
35
|
+
@state() private mode: string = isMobileDevice() ? 'LIST' : 'GRID'
|
|
36
|
+
@state() private refreshHandlers: any[] = []
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
let mode = this.mode
|
|
38
|
+
@query('ox-grist') private dataGrist: any
|
|
43
39
|
|
|
40
|
+
render() {
|
|
44
41
|
return html`
|
|
45
|
-
<ox-grist .mode=${mode} auto-fetch .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
42
|
+
<ox-grist .mode=${this.mode} auto-fetch .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
46
43
|
<div slot="headroom">
|
|
47
44
|
<div id="filters">
|
|
48
45
|
<ox-filters-form></ox-filters-form>
|
|
49
46
|
</div>
|
|
50
|
-
|
|
51
|
-
<div id="sorters">
|
|
52
|
-
Sort
|
|
53
|
-
<mwc-icon
|
|
54
|
-
@click=${e => {
|
|
55
|
-
const target = e.currentTarget
|
|
56
|
-
this.renderRoot.querySelector('#sorter-control').open({
|
|
57
|
-
right: 0,
|
|
58
|
-
top: target.offsetTop + target.offsetHeight
|
|
59
|
-
})
|
|
60
|
-
}}
|
|
61
|
-
>expand_more</mwc-icon
|
|
62
|
-
>
|
|
63
|
-
<ox-popup id="sorter-control">
|
|
64
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
65
|
-
</ox-popup>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div id="modes">
|
|
69
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
70
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
71
|
-
</div>
|
|
72
47
|
</div>
|
|
73
48
|
</ox-grist>
|
|
74
49
|
`
|
|
75
50
|
}
|
|
76
51
|
|
|
77
|
-
constructor() {
|
|
78
|
-
super()
|
|
79
|
-
this.refreshHandlers = []
|
|
80
|
-
this.mode = isMobileDevice() ? 'LIST' : 'GRID'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
52
|
get context() {
|
|
84
53
|
return {
|
|
85
54
|
title: i18next.t('title.setting'),
|
|
@@ -183,10 +152,6 @@ export class SettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
|
183
152
|
}
|
|
184
153
|
}
|
|
185
154
|
|
|
186
|
-
get dataGrist() {
|
|
187
|
-
return this.renderRoot.querySelector('ox-grist')
|
|
188
|
-
}
|
|
189
|
-
|
|
190
155
|
async fetchHandler({ filters, page, limit, sorters = [] }) {
|
|
191
156
|
const pagination = { page, limit }
|
|
192
157
|
const sortings = sorters
|
|
@@ -230,7 +195,7 @@ export class SettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
|
230
195
|
}
|
|
231
196
|
|
|
232
197
|
patches = patches.map(setting => {
|
|
233
|
-
let patchField = setting.id ? { id: setting.id } : {}
|
|
198
|
+
let patchField: any = setting.id ? { id: setting.id } : {}
|
|
234
199
|
const dirtyFields = setting.__dirtyfields__
|
|
235
200
|
for (let key in dirtyFields) {
|
|
236
201
|
patchField[key] = dirtyFields[key].after
|
|
@@ -272,35 +237,37 @@ export class SettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
|
272
237
|
}
|
|
273
238
|
|
|
274
239
|
const names = this.dataGrist.selected.map(record => record.name)
|
|
275
|
-
const anwer = await CustomAlert({
|
|
276
|
-
type: 'warning',
|
|
277
|
-
title: i18next.t('button.delete'),
|
|
278
|
-
text: i18next.t('text.are_you_sure'),
|
|
279
|
-
confirmButton: { text: i18next.t('button.delete') },
|
|
280
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
281
|
-
})
|
|
282
240
|
|
|
283
|
-
if (
|
|
241
|
+
if (
|
|
242
|
+
await OxPrompt.open({
|
|
243
|
+
type: 'warning',
|
|
244
|
+
title: i18next.t('button.delete'),
|
|
245
|
+
text: i18next.t('text.are_you_sure'),
|
|
246
|
+
confirmButton: { text: i18next.t('button.delete') },
|
|
247
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
248
|
+
})
|
|
249
|
+
) {
|
|
250
|
+
const response = await client.mutate({
|
|
251
|
+
mutation: gql`
|
|
252
|
+
mutation deleteSettings($names: [String!]!) {
|
|
253
|
+
deleteSettings(names: $names)
|
|
254
|
+
}
|
|
255
|
+
`,
|
|
256
|
+
variables: { names },
|
|
257
|
+
context: gqlContext()
|
|
258
|
+
})
|
|
284
259
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
context: gqlContext()
|
|
293
|
-
})
|
|
260
|
+
if (!response.errors) {
|
|
261
|
+
await OxPrompt.open({
|
|
262
|
+
type: 'success',
|
|
263
|
+
title: i18next.t('text.completed'),
|
|
264
|
+
text: i18next.t('text.data_deleted_successfully'),
|
|
265
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
266
|
+
})
|
|
294
267
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
title: i18next.t('text.completed'),
|
|
299
|
-
text: i18next.t('text.data_deleted_successfully'),
|
|
300
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
301
|
-
})
|
|
302
|
-
this.dataGrist.fetch()
|
|
303
|
-
this.applyRefreshHandlers()
|
|
268
|
+
this.dataGrist.fetch()
|
|
269
|
+
this.applyRefreshHandlers()
|
|
270
|
+
}
|
|
304
271
|
}
|
|
305
272
|
}
|
|
306
273
|
|
|
@@ -320,5 +287,3 @@ export class SettingList extends connect(store)(localize(i18next)(PageView)) {
|
|
|
320
287
|
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
|
|
321
288
|
}
|
|
322
289
|
}
|
|
323
|
-
|
|
324
|
-
window.customElements.define('setting-list', SettingList)
|
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { html, css } from 'lit'
|
|
2
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
2
3
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
3
4
|
|
|
4
5
|
import { store, PageView } from '@operato/shell'
|
|
5
6
|
import { i18next, localize } from '@operato/i18n'
|
|
6
7
|
|
|
8
|
+
@customElement('setting-page')
|
|
7
9
|
export class SettingPage extends connect(store)(localize(i18next)(PageView)) {
|
|
8
|
-
static
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]
|
|
23
|
-
}
|
|
10
|
+
static styles = [
|
|
11
|
+
css`
|
|
12
|
+
:host {
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
background-color: var(--setting-background);
|
|
15
|
+
}
|
|
16
|
+
div {
|
|
17
|
+
margin: var(--setting-icon-margin);
|
|
18
|
+
height: var(--setting-icon-height);
|
|
19
|
+
background: url(/assets/images/icon-setting.png) center top no-repeat;
|
|
20
|
+
background-size: contain;
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
]
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
_settings: Array
|
|
28
|
-
}
|
|
29
|
-
}
|
|
25
|
+
@state() private _settings: any[] = []
|
|
30
26
|
|
|
31
27
|
render() {
|
|
32
28
|
var _sortedSettings = this._settings.sort((a, b) => {
|
|
@@ -49,5 +45,3 @@ export class SettingPage extends connect(store)(localize(i18next)(PageView)) {
|
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
|
-
|
|
53
|
-
window.customElements.define('setting-page', SettingPage)
|
|
@@ -4,27 +4,24 @@ import '@operato/i18n/ox-i18n.js'
|
|
|
4
4
|
import { store } from '@operato/shell'
|
|
5
5
|
|
|
6
6
|
import { html, css, LitElement } from 'lit'
|
|
7
|
+
import { customElement, property, query, queryAll, state } from 'lit/decorators.js'
|
|
7
8
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
8
9
|
|
|
10
|
+
@customElement('domain-switch-let')
|
|
9
11
|
export class DomainSwitchLet extends connect(store)(LitElement) {
|
|
10
|
-
static
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
domains: Array,
|
|
25
|
-
domain: Object
|
|
26
|
-
}
|
|
27
|
-
}
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
select {
|
|
15
|
+
border: var(--input-field-border);
|
|
16
|
+
padding: var(--input-padding);
|
|
17
|
+
border-radius: var(--border-radius);
|
|
18
|
+
font: var(--input-font);
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
@state() domains: any[] = []
|
|
24
|
+
@state() domain: any
|
|
28
25
|
|
|
29
26
|
render() {
|
|
30
27
|
return html`
|
|
@@ -50,5 +47,3 @@ export class DomainSwitchLet extends connect(store)(LitElement) {
|
|
|
50
47
|
this.domain = state.app.domain
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
customElements.define('domain-switch-let', DomainSwitchLet)
|