@things-factory/auth-ui 8.0.0-beta.9 → 8.0.2
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/auth-style-sign.ts +194 -0
- package/client/bootstrap.ts +51 -0
- package/client/components/abstract-auth-page.ts +301 -0
- package/client/components/abstract-password-reset.ts +168 -0
- package/client/components/abstract-sign.ts +127 -0
- package/client/components/change-password.ts +153 -0
- package/client/components/contact-us.ts +113 -0
- package/client/components/create-domain-popup.ts +141 -0
- package/client/components/create-role.ts +123 -0
- package/client/components/create-user.ts +95 -0
- package/client/components/credential-manager.ts +64 -0
- package/client/components/delete-user-popup.ts +117 -0
- package/client/components/domain-switch.ts +127 -0
- package/client/components/invite-customer.ts +104 -0
- package/client/components/invite-user.ts +96 -0
- package/client/components/my-login-history.ts +101 -0
- package/client/components/ownership-transfer-popup.ts +110 -0
- package/client/components/partner-info-card.ts +89 -0
- package/client/components/partner-role-editor.ts +153 -0
- package/client/components/profile-component.ts +332 -0
- package/client/components/role-edit-form.ts +92 -0
- package/client/components/role-privilege-editor.ts +267 -0
- package/client/components/role-selector.ts +102 -0
- package/client/components/user-role-editor.ts +499 -0
- package/client/constants/application.ts +9 -0
- package/client/constants/index.ts +1 -0
- package/client/entries/auth/activate.ts +272 -0
- package/client/entries/auth/checkin.ts +190 -0
- package/client/entries/auth/forgot-password.ts +103 -0
- package/client/entries/auth/reset-password.ts +22 -0
- package/client/entries/auth/result.ts +193 -0
- package/client/entries/auth/signin.ts +18 -0
- package/client/entries/auth/signup.ts +109 -0
- package/client/entries/auth/unlock-user.ts +22 -0
- package/client/entries/oauth2/oauth2-decision-error-page.ts +50 -0
- package/client/entries/oauth2/oauth2-decision-page.ts +196 -0
- package/client/entries/public/home.ts +246 -0
- package/client/index.ts +124 -0
- package/client/pages/app-binding/app-binding.ts +423 -0
- package/client/pages/app-binding/app-bindings.ts +171 -0
- package/client/pages/appliance/appliance.ts +452 -0
- package/client/pages/appliance/home.ts +177 -0
- package/client/pages/appliance/register.ts +183 -0
- package/client/pages/application/application.ts +428 -0
- package/client/pages/application/applications.ts +182 -0
- package/client/pages/application/register.ts +211 -0
- package/client/pages/attribute/attribute-set-item-list.ts +237 -0
- package/client/pages/attribute/attribute-set-management.ts +282 -0
- package/client/pages/auth-provider/auth-provider-management.ts +381 -0
- package/client/pages/domain/domain-management.ts +410 -0
- package/client/pages/partner/partner-management.ts +112 -0
- package/client/pages/profile.ts +32 -0
- package/client/pages/role/role-management.ts +134 -0
- package/client/pages/user/user-management.ts +224 -0
- package/client/route.ts +67 -0
- package/client/themes/auth-theme.css +65 -0
- package/client/utils/password-rule.ts +37 -0
- package/dist-client/components/abstract-auth-page.js +10 -10
- package/dist-client/components/abstract-auth-page.js.map +1 -1
- package/dist-client/components/abstract-password-reset.d.ts +2 -1
- package/dist-client/components/abstract-password-reset.js +14 -7
- package/dist-client/components/abstract-password-reset.js.map +1 -1
- package/dist-client/components/abstract-sign.js +11 -12
- package/dist-client/components/abstract-sign.js.map +1 -1
- package/dist-client/components/contact-us.d.ts +1 -1
- package/dist-client/components/contact-us.js +7 -10
- package/dist-client/components/contact-us.js.map +1 -1
- package/dist-client/components/create-user.js +5 -28
- package/dist-client/components/create-user.js.map +1 -1
- package/dist-client/components/invite-user.js +11 -19
- package/dist-client/components/invite-user.js.map +1 -1
- package/dist-client/components/ownership-transfer-popup.js +3 -3
- package/dist-client/components/ownership-transfer-popup.js.map +1 -1
- package/dist-client/components/profile-component.d.ts +1 -5
- package/dist-client/components/profile-component.js +4 -64
- package/dist-client/components/profile-component.js.map +1 -1
- package/dist-client/components/role-privilege-editor.js +1 -2
- package/dist-client/components/role-privilege-editor.js.map +1 -1
- package/dist-client/components/user-role-editor.js +18 -18
- package/dist-client/components/user-role-editor.js.map +1 -1
- package/dist-client/entries/auth/checkin.js +1 -1
- package/dist-client/entries/auth/checkin.js.map +1 -1
- package/dist-client/entries/auth/forgot-password.js +2 -11
- package/dist-client/entries/auth/forgot-password.js.map +1 -1
- package/dist-client/entries/auth/signup.js +7 -13
- package/dist-client/entries/auth/signup.js.map +1 -1
- package/dist-client/index.js +1 -1
- package/dist-client/index.js.map +1 -1
- package/dist-client/pages/user/user-management.d.ts +1 -5
- package/dist-client/pages/user/user-management.js +7 -6
- package/dist-client/pages/user/user-management.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/server/index.ts +0 -0
- package/translations/en.json +2 -6
- package/translations/ja.json +2 -6
- package/translations/ko.json +2 -6
- package/translations/ms.json +2 -6
- package/translations/zh.json +2 -6
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
3
|
+
import '@operato/data-grist'
|
|
4
|
+
import '@operato/context/ox-context-page-toolbar.js'
|
|
5
|
+
import './attribute-set-item-list.js'
|
|
6
|
+
|
|
7
|
+
import gql from 'graphql-tag'
|
|
8
|
+
import { css, html } from 'lit'
|
|
9
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
10
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
11
|
+
|
|
12
|
+
import { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
14
|
+
import { i18next, localize } from '@operato/i18n'
|
|
15
|
+
import { notify, openPopup } from '@operato/layout'
|
|
16
|
+
import { PageView, store } from '@operato/shell'
|
|
17
|
+
import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
18
|
+
import { isMobileDevice, sleep } from '@operato/utils'
|
|
19
|
+
import { OxPopup } from '@operato/popup'
|
|
20
|
+
import { p13n } from '@operato/p13n'
|
|
21
|
+
|
|
22
|
+
@customElement('attribute-set-management')
|
|
23
|
+
export class AttributeSetManagementPage extends connect(store)(p13n(localize(i18next)(PageView))) {
|
|
24
|
+
static styles = [
|
|
25
|
+
ScrollbarStyles,
|
|
26
|
+
CommonGristStyles,
|
|
27
|
+
CommonHeaderStyles,
|
|
28
|
+
css`
|
|
29
|
+
:host {
|
|
30
|
+
display: flex;
|
|
31
|
+
|
|
32
|
+
width: 100%;
|
|
33
|
+
|
|
34
|
+
--grid-record-emphasized-background-color: #8b0000;
|
|
35
|
+
--grid-record-emphasized-color: #ff6b6b;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ox-grist {
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
@state() gristConfig: any
|
|
46
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
47
|
+
|
|
48
|
+
@query('ox-grist') private grist!: DataGrist
|
|
49
|
+
|
|
50
|
+
get context() {
|
|
51
|
+
return {
|
|
52
|
+
title: i18next.t('title.attributes'),
|
|
53
|
+
search: {
|
|
54
|
+
handler: (search: string) => {
|
|
55
|
+
this.grist.searchText = search
|
|
56
|
+
},
|
|
57
|
+
value: this.grist?.searchText || ''
|
|
58
|
+
},
|
|
59
|
+
filter: {
|
|
60
|
+
handler: () => {
|
|
61
|
+
this.grist.toggleHeadroom()
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
// help: 'system/attribute',
|
|
65
|
+
actions: [
|
|
66
|
+
{
|
|
67
|
+
title: i18next.t('button.save'),
|
|
68
|
+
action: this.updateAttributeSet.bind(this),
|
|
69
|
+
icon: 'save'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: i18next.t('button.delete'),
|
|
73
|
+
action: this.deleteAttributeSet.bind(this),
|
|
74
|
+
icon: 'delete',
|
|
75
|
+
emphasis: {
|
|
76
|
+
danger: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
toolbar: false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render() {
|
|
85
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
86
|
+
|
|
87
|
+
return html`
|
|
88
|
+
<ox-grist
|
|
89
|
+
.mode=${mode}
|
|
90
|
+
.config=${this.gristConfig}
|
|
91
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
92
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
|
|
93
|
+
?url-params-sensitive=${this.active}
|
|
94
|
+
>
|
|
95
|
+
<div slot="headroom" class="header">
|
|
96
|
+
<div class="title">${i18next.t('title.attributes')}</div>
|
|
97
|
+
|
|
98
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
102
|
+
</ox-grist>
|
|
103
|
+
`
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async pageInitialized(lifecycle) {
|
|
107
|
+
this.gristConfig = {
|
|
108
|
+
list: {
|
|
109
|
+
fields: ['entity', 'description']
|
|
110
|
+
},
|
|
111
|
+
columns: [
|
|
112
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
113
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
114
|
+
{
|
|
115
|
+
type: 'gutter',
|
|
116
|
+
gutterName: 'button',
|
|
117
|
+
title: i18next.t('title.attribute model'),
|
|
118
|
+
icon: 'reorder',
|
|
119
|
+
handlers: {
|
|
120
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
121
|
+
if (!record.id) return
|
|
122
|
+
const popup = openPopup(
|
|
123
|
+
html` <attribute-set-item-list .attribute=${record}></attribute-set-item-list> `,
|
|
124
|
+
{
|
|
125
|
+
backdrop: true,
|
|
126
|
+
help: 'attribute/ui/attribute-set-item-list',
|
|
127
|
+
size: 'large',
|
|
128
|
+
title: i18next.t('title.attribute-item list')
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
popup.onclosed = () => {
|
|
132
|
+
this.grist.fetch()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: 'string',
|
|
139
|
+
name: 'entity',
|
|
140
|
+
header: i18next.t('field.entity'),
|
|
141
|
+
record: {
|
|
142
|
+
editable: true
|
|
143
|
+
},
|
|
144
|
+
filter: 'search',
|
|
145
|
+
sortable: true,
|
|
146
|
+
width: 150
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
type: 'string',
|
|
150
|
+
name: 'description',
|
|
151
|
+
header: i18next.t('field.description'),
|
|
152
|
+
record: {
|
|
153
|
+
editable: true
|
|
154
|
+
},
|
|
155
|
+
filter: 'search',
|
|
156
|
+
width: 200
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'datetime',
|
|
160
|
+
name: 'updatedAt',
|
|
161
|
+
header: i18next.t('field.updated_at'),
|
|
162
|
+
record: {
|
|
163
|
+
editable: false
|
|
164
|
+
},
|
|
165
|
+
sortable: true,
|
|
166
|
+
width: 180
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
rows: {
|
|
170
|
+
selectable: {
|
|
171
|
+
multiple: true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
sorters: [
|
|
175
|
+
{
|
|
176
|
+
name: 'name'
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
|
183
|
+
const response = await client.query({
|
|
184
|
+
query: gql`
|
|
185
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
186
|
+
responses: attributeSets(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
187
|
+
items {
|
|
188
|
+
id
|
|
189
|
+
entity
|
|
190
|
+
description
|
|
191
|
+
updatedAt
|
|
192
|
+
items {
|
|
193
|
+
name
|
|
194
|
+
description
|
|
195
|
+
tag
|
|
196
|
+
active
|
|
197
|
+
hidden
|
|
198
|
+
type
|
|
199
|
+
options
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
total
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`,
|
|
206
|
+
variables: {
|
|
207
|
+
filters,
|
|
208
|
+
pagination: { page, limit },
|
|
209
|
+
sortings
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
total: response.data.responses.total || 0,
|
|
215
|
+
records: response.data.responses.items || []
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private async deleteAttributeSet() {
|
|
220
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
221
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
222
|
+
if (ids && ids.length > 0) {
|
|
223
|
+
const response = await client.mutate({
|
|
224
|
+
mutation: gql`
|
|
225
|
+
mutation ($ids: [String!]!) {
|
|
226
|
+
deleteAttributeSets(ids: $ids)
|
|
227
|
+
}
|
|
228
|
+
`,
|
|
229
|
+
variables: {
|
|
230
|
+
ids
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
if (!response.errors) {
|
|
235
|
+
this.grist.fetch()
|
|
236
|
+
notify({
|
|
237
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private async updateAttributeSet() {
|
|
245
|
+
let patches = this.grist.dirtyRecords
|
|
246
|
+
if (patches && patches.length) {
|
|
247
|
+
patches = patches.map(patch => {
|
|
248
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
249
|
+
const dirtyFields = patch.__dirtyfields__
|
|
250
|
+
for (let key in dirtyFields) {
|
|
251
|
+
patchField[key] = dirtyFields[key].after
|
|
252
|
+
}
|
|
253
|
+
if (patchField['reportTemplate'] instanceof FileList) {
|
|
254
|
+
patchField['reportTemplate'] = patchField['reportTemplate'][0]
|
|
255
|
+
}
|
|
256
|
+
patchField.cuFlag = patch.__dirty__
|
|
257
|
+
|
|
258
|
+
return patchField
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
const response = await client.mutate({
|
|
262
|
+
mutation: gql`
|
|
263
|
+
mutation ($patches: [AttributeSetPatch!]!) {
|
|
264
|
+
updateMultipleAttributeSet(patches: $patches) {
|
|
265
|
+
entity
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
`,
|
|
269
|
+
variables: {
|
|
270
|
+
patches
|
|
271
|
+
},
|
|
272
|
+
context: {
|
|
273
|
+
hasUpload: true
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
if (!response.errors) {
|
|
278
|
+
this.grist.fetch()
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
3
|
+
import '@operato/data-grist'
|
|
4
|
+
import '@operato/context/ox-context-page-toolbar.js'
|
|
5
|
+
|
|
6
|
+
import gql from 'graphql-tag'
|
|
7
|
+
import { css, html } from 'lit'
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
9
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
10
|
+
|
|
11
|
+
import { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
|
|
12
|
+
import { client } from '@operato/graphql'
|
|
13
|
+
import { i18next, localize } from '@operato/i18n'
|
|
14
|
+
import { notify, openPopup } from '@operato/layout'
|
|
15
|
+
import { PageView, store } from '@operato/shell'
|
|
16
|
+
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
|
|
17
|
+
import { isMobileDevice, sleep } from '@operato/utils'
|
|
18
|
+
import { OxPopup } from '@operato/popup'
|
|
19
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
20
|
+
import { p13n } from '@operato/p13n'
|
|
21
|
+
|
|
22
|
+
@customElement('auth-provider-management')
|
|
23
|
+
export class AuthProviderManagementPage extends connect(store)(p13n(localize(i18next)(PageView))) {
|
|
24
|
+
static styles = [
|
|
25
|
+
ScrollbarStyles,
|
|
26
|
+
CommonGristStyles,
|
|
27
|
+
CommonHeaderStyles,
|
|
28
|
+
css`
|
|
29
|
+
:host {
|
|
30
|
+
display: flex;
|
|
31
|
+
|
|
32
|
+
width: 100%;
|
|
33
|
+
|
|
34
|
+
--grid-record-emphasized-background-color: #8b0000;
|
|
35
|
+
--grid-record-emphasized-color: #ff6b6b;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ox-grist {
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
@state() gristConfig: any
|
|
46
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
47
|
+
@state() authProviderTypes: { type: string; description?: string; help?: string; parameterSpec?: any[] }[] = []
|
|
48
|
+
|
|
49
|
+
@query('ox-grist') private grist!: DataGrist
|
|
50
|
+
|
|
51
|
+
get context() {
|
|
52
|
+
return {
|
|
53
|
+
title: i18next.t('title.auth-provider'),
|
|
54
|
+
search: {
|
|
55
|
+
handler: (search: string) => {
|
|
56
|
+
this.grist.searchText = search
|
|
57
|
+
},
|
|
58
|
+
value: this.grist?.searchText || ''
|
|
59
|
+
},
|
|
60
|
+
filter: {
|
|
61
|
+
handler: () => {
|
|
62
|
+
this.grist.toggleHeadroom()
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
// help: 'auth/auth-provider',
|
|
66
|
+
actions: [
|
|
67
|
+
{
|
|
68
|
+
title: i18next.t('button.save'),
|
|
69
|
+
action: this.updateAuthProvider.bind(this),
|
|
70
|
+
icon: 'save'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: i18next.t('button.delete'),
|
|
74
|
+
action: this.deleteAuthProvider.bind(this),
|
|
75
|
+
icon: 'delete',
|
|
76
|
+
emphasis: {
|
|
77
|
+
danger: true
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
toolbar: false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
87
|
+
|
|
88
|
+
return html`
|
|
89
|
+
<ox-grist
|
|
90
|
+
.mode=${mode}
|
|
91
|
+
.config=${this.gristConfig}
|
|
92
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
93
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
|
|
94
|
+
?url-params-sensitive=${this.active}
|
|
95
|
+
>
|
|
96
|
+
<div slot="headroom" class="header">
|
|
97
|
+
<div class="title">${i18next.t('title.auth-provider')}</div>
|
|
98
|
+
|
|
99
|
+
<ox-filters-form autofocus without-search class="filters"></ox-filters-form>
|
|
100
|
+
|
|
101
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
105
|
+
</ox-grist>
|
|
106
|
+
`
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async pageInitialized(lifecycle) {
|
|
110
|
+
this.gristConfig = {
|
|
111
|
+
list: {
|
|
112
|
+
fields: ['entity', 'description']
|
|
113
|
+
},
|
|
114
|
+
columns: [
|
|
115
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
116
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
117
|
+
{
|
|
118
|
+
type: 'gutter',
|
|
119
|
+
gutterName: 'button',
|
|
120
|
+
title: i18next.t('title.auth-provider'),
|
|
121
|
+
icon: 'sync',
|
|
122
|
+
handlers: {
|
|
123
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
124
|
+
if (!record.id) return
|
|
125
|
+
this.synchronizeUsers(record.id)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: 'select',
|
|
131
|
+
name: 'type',
|
|
132
|
+
header: i18next.t('field.type'),
|
|
133
|
+
record: {
|
|
134
|
+
editable: true,
|
|
135
|
+
options: () => ['', ...this.authProviderTypes.map(({ type }) => type)]
|
|
136
|
+
},
|
|
137
|
+
filter: 'search',
|
|
138
|
+
sortable: true,
|
|
139
|
+
width: 150
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: 'boolean',
|
|
143
|
+
name: 'active',
|
|
144
|
+
header: i18next.t('field.active'),
|
|
145
|
+
record: {
|
|
146
|
+
editable: true
|
|
147
|
+
},
|
|
148
|
+
sortable: true,
|
|
149
|
+
width: 150
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: 'string',
|
|
153
|
+
name: 'tenantId',
|
|
154
|
+
header: i18next.t('field.tenant-id'),
|
|
155
|
+
record: {
|
|
156
|
+
editable: true
|
|
157
|
+
},
|
|
158
|
+
width: 200
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: 'string',
|
|
162
|
+
name: 'clientId',
|
|
163
|
+
header: i18next.t('field.client-id'),
|
|
164
|
+
record: {
|
|
165
|
+
editable: true
|
|
166
|
+
},
|
|
167
|
+
width: 200
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'string',
|
|
171
|
+
name: 'clientSecret',
|
|
172
|
+
header: i18next.t('field.client-secret'),
|
|
173
|
+
record: {
|
|
174
|
+
editable: true
|
|
175
|
+
},
|
|
176
|
+
width: 200
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'string',
|
|
180
|
+
name: 'privateKey',
|
|
181
|
+
header: i18next.t('field.private-key'),
|
|
182
|
+
record: {
|
|
183
|
+
editable: true
|
|
184
|
+
},
|
|
185
|
+
width: 200
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'parameters',
|
|
189
|
+
name: 'params',
|
|
190
|
+
header: i18next.t('field.params'),
|
|
191
|
+
record: {
|
|
192
|
+
editable: true,
|
|
193
|
+
options: async (value, column, record, row, field) => {
|
|
194
|
+
const {
|
|
195
|
+
description,
|
|
196
|
+
help,
|
|
197
|
+
parameterSpec: spec
|
|
198
|
+
} = record.type ? this.authProviderTypes[record.type] : ({} as any)
|
|
199
|
+
const context = this.grist
|
|
200
|
+
|
|
201
|
+
return { description, help, spec, context }
|
|
202
|
+
},
|
|
203
|
+
renderer: 'json5'
|
|
204
|
+
},
|
|
205
|
+
width: 200
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: 'datetime',
|
|
209
|
+
name: 'updatedAt',
|
|
210
|
+
header: i18next.t('field.updated_at'),
|
|
211
|
+
record: {
|
|
212
|
+
editable: false
|
|
213
|
+
},
|
|
214
|
+
sortable: true,
|
|
215
|
+
width: 180
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
rows: {
|
|
219
|
+
selectable: {
|
|
220
|
+
multiple: true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
sorters: [
|
|
224
|
+
{
|
|
225
|
+
name: 'type'
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
|
232
|
+
const response = await client.query({
|
|
233
|
+
query: gql`
|
|
234
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
235
|
+
authProviderTypes {
|
|
236
|
+
items {
|
|
237
|
+
type
|
|
238
|
+
description
|
|
239
|
+
help
|
|
240
|
+
parameterSpec {
|
|
241
|
+
type
|
|
242
|
+
label
|
|
243
|
+
name
|
|
244
|
+
placeholder
|
|
245
|
+
property
|
|
246
|
+
styles
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
total
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
responses: authProviders(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
253
|
+
items {
|
|
254
|
+
id
|
|
255
|
+
type
|
|
256
|
+
active
|
|
257
|
+
tenantId
|
|
258
|
+
clientId
|
|
259
|
+
clientSecret
|
|
260
|
+
privateKey
|
|
261
|
+
params
|
|
262
|
+
updatedAt
|
|
263
|
+
}
|
|
264
|
+
total
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`,
|
|
268
|
+
variables: {
|
|
269
|
+
filters,
|
|
270
|
+
pagination: { page, limit },
|
|
271
|
+
sortings
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
this.authProviderTypes = response.data.authProviderTypes.items
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
total: response.data.responses.total || 0,
|
|
279
|
+
records: response.data.responses.items || []
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
private async deleteAuthProvider() {
|
|
284
|
+
if (
|
|
285
|
+
await OxPrompt.open({
|
|
286
|
+
title: i18next.t('text.are_you_sure'),
|
|
287
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
288
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
289
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
290
|
+
})
|
|
291
|
+
) {
|
|
292
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
293
|
+
if (ids && ids.length > 0) {
|
|
294
|
+
const response = await client.mutate({
|
|
295
|
+
mutation: gql`
|
|
296
|
+
mutation ($ids: [String!]!) {
|
|
297
|
+
deleteAuthProviders(ids: $ids)
|
|
298
|
+
}
|
|
299
|
+
`,
|
|
300
|
+
variables: {
|
|
301
|
+
ids
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
if (!response.errors) {
|
|
306
|
+
this.grist.fetch()
|
|
307
|
+
notify({
|
|
308
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
private async updateAuthProvider() {
|
|
316
|
+
let patches = this.grist.dirtyRecords
|
|
317
|
+
if (patches && patches.length) {
|
|
318
|
+
patches = patches.map(patch => {
|
|
319
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
320
|
+
const dirtyFields = patch.__dirtyfields__
|
|
321
|
+
for (let key in dirtyFields) {
|
|
322
|
+
patchField[key] = dirtyFields[key].after
|
|
323
|
+
}
|
|
324
|
+
if (patchField['reportTemplate'] instanceof FileList) {
|
|
325
|
+
patchField['reportTemplate'] = patchField['reportTemplate'][0]
|
|
326
|
+
}
|
|
327
|
+
patchField.cuFlag = patch.__dirty__
|
|
328
|
+
|
|
329
|
+
return patchField
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
const response = await client.mutate({
|
|
333
|
+
mutation: gql`
|
|
334
|
+
mutation ($patches: [AuthProviderPatch!]!) {
|
|
335
|
+
updateMultipleAuthProvider(patches: $patches) {
|
|
336
|
+
id
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
`,
|
|
340
|
+
variables: {
|
|
341
|
+
patches
|
|
342
|
+
}
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
if (!response.errors) {
|
|
346
|
+
this.grist.fetch()
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
private async synchronizeUsers(id: string) {
|
|
352
|
+
if (
|
|
353
|
+
await OxPrompt.open({
|
|
354
|
+
title: i18next.t('text.are_you_sure'),
|
|
355
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.synchronize') }),
|
|
356
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
357
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
358
|
+
})
|
|
359
|
+
) {
|
|
360
|
+
if (id && id.length > 0) {
|
|
361
|
+
const response = await client.mutate({
|
|
362
|
+
mutation: gql`
|
|
363
|
+
mutation ($id: String!) {
|
|
364
|
+
synchronizeAuthProviderUsers(id: $id)
|
|
365
|
+
}
|
|
366
|
+
`,
|
|
367
|
+
variables: {
|
|
368
|
+
id
|
|
369
|
+
}
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
if (!response.errors) {
|
|
373
|
+
this.grist.fetch()
|
|
374
|
+
notify({
|
|
375
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.synchronize') })
|
|
376
|
+
})
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|