@things-factory/auth-ui 6.2.6 → 6.2.8
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/create-domain-popup.ts +2 -2
- package/client/components/create-role.ts +38 -34
- package/client/components/create-user.ts +27 -52
- package/client/components/invite-customer.ts +29 -29
- package/client/components/invite-user.ts +15 -14
- package/client/components/ownership-transfer-popup.ts +29 -30
- package/client/components/partner-role-editor.ts +28 -28
- package/client/components/role-privilege-editor.ts +30 -29
- package/client/components/role-selector.ts +2 -2
- package/client/components/user-role-editor.ts +64 -66
- package/client/entries/oauth2/oauth2-decision-page.ts +2 -2
- package/client/pages/role/role-management.ts +0 -1
- package/client/pages/user/user-management.ts +26 -26
- package/dist-client/components/create-domain-popup.js +2 -2
- package/dist-client/components/create-domain-popup.js.map +1 -1
- package/dist-client/components/create-role.js +30 -27
- package/dist-client/components/create-role.js.map +1 -1
- package/dist-client/components/create-user.js +26 -51
- package/dist-client/components/create-user.js.map +1 -1
- package/dist-client/components/invite-customer.js +24 -25
- package/dist-client/components/invite-customer.js.map +1 -1
- package/dist-client/components/invite-user.js +8 -9
- package/dist-client/components/invite-user.js.map +1 -1
- package/dist-client/components/ownership-transfer-popup.js +23 -23
- package/dist-client/components/ownership-transfer-popup.js.map +1 -1
- package/dist-client/components/partner-role-editor.js +21 -22
- package/dist-client/components/partner-role-editor.js.map +1 -1
- package/dist-client/components/role-privilege-editor.js +23 -23
- package/dist-client/components/role-privilege-editor.js.map +1 -1
- package/dist-client/components/role-selector.js +2 -2
- package/dist-client/components/role-selector.js.map +1 -1
- package/dist-client/components/user-role-editor.js +54 -58
- package/dist-client/components/user-role-editor.js.map +1 -1
- package/dist-client/entries/oauth2/oauth2-decision-page.js +2 -2
- package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
- package/dist-client/pages/role/role-management.js +0 -1
- package/dist-client/pages/role/role-management.js.map +1 -1
- package/dist-client/pages/user/user-management.js +19 -20
- package/dist-client/pages/user/user-management.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('create-domain-popup')
|
|
12
12
|
class CreateDomainPopup extends localize(i18next)(LitElement) {
|
|
@@ -118,7 +118,7 @@ class CreateDomainPopup extends localize(i18next)(LitElement) {
|
|
|
118
118
|
})
|
|
119
119
|
|
|
120
120
|
if (!response.errors) {
|
|
121
|
-
await
|
|
121
|
+
await OxPrompt.open({
|
|
122
122
|
type: 'success',
|
|
123
123
|
title: i18next.t('text.completed'),
|
|
124
124
|
text: i18next.t('text.x_created_successfully', { x: i18next.t('label.domain') }),
|
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('create-role')
|
|
12
12
|
class CreateRole extends localize(i18next)(LitElement) {
|
|
@@ -53,15 +53,19 @@ class CreateRole extends localize(i18next)(LitElement) {
|
|
|
53
53
|
<mwc-textfield
|
|
54
54
|
type="text"
|
|
55
55
|
name="name"
|
|
56
|
-
label=${i18next.t('label.x name', { x: i18next.t('label.role') })}
|
|
56
|
+
label=${String(i18next.t('label.x name', { x: i18next.t('label.role') }))}
|
|
57
57
|
></mwc-textfield>
|
|
58
58
|
<mwc-textfield
|
|
59
59
|
type="text"
|
|
60
60
|
name="description"
|
|
61
|
-
label=${i18next.t('label.x description', { x: i18next.t('label.role') })}
|
|
61
|
+
label=${String(i18next.t('label.x description', { x: i18next.t('label.role') }))}
|
|
62
62
|
></mwc-textfield>
|
|
63
63
|
|
|
64
|
-
<mwc-button
|
|
64
|
+
<mwc-button
|
|
65
|
+
@click=${this.onCreateRole.bind(this)}
|
|
66
|
+
outlined
|
|
67
|
+
label=${String(i18next.t('button.create'))}
|
|
68
|
+
></mwc-button>
|
|
65
69
|
`
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -78,39 +82,39 @@ class CreateRole extends localize(i18next)(LitElement) {
|
|
|
78
82
|
role.name = name
|
|
79
83
|
role.description = description
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
if (
|
|
86
|
+
await OxPrompt.open({
|
|
87
|
+
title: i18next.t('text.are_you_sure'),
|
|
88
|
+
text: i18next.t('text.do_you_want_to_create_x', { x: i18next.t('label.role') }),
|
|
89
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
90
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
91
|
+
})
|
|
92
|
+
) {
|
|
93
|
+
const response = await client.mutate({
|
|
94
|
+
mutation: gql`
|
|
95
|
+
mutation createRole($role: NewRole!) {
|
|
96
|
+
createRole(role: $role) {
|
|
97
|
+
name
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
context: gqlContext()
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
if (!response.errors) {
|
|
103
|
-
await this.dispatchEvent(new CustomEvent('fetch-roles'))
|
|
104
|
-
|
|
105
|
-
await CustomAlert({
|
|
106
|
-
type: 'success',
|
|
107
|
-
title: i18next.t('text.completed'),
|
|
108
|
-
text: i18next.t('text.data_uploaded_successfully'),
|
|
109
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
100
|
+
`,
|
|
101
|
+
variables: { role },
|
|
102
|
+
context: gqlContext()
|
|
110
103
|
})
|
|
111
104
|
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
if (!response.errors) {
|
|
106
|
+
await this.dispatchEvent(new CustomEvent('fetch-roles'))
|
|
107
|
+
|
|
108
|
+
await OxPrompt.open({
|
|
109
|
+
type: 'success',
|
|
110
|
+
title: i18next.t('text.completed'),
|
|
111
|
+
text: i18next.t('text.data_uploaded_successfully'),
|
|
112
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
this.nameInput.value = ''
|
|
116
|
+
this.descriptionInput.value = ''
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -6,83 +6,58 @@ import { i18next } from '@operato/i18n'
|
|
|
6
6
|
@customElement('create-user')
|
|
7
7
|
class CreateUser extends LitElement {
|
|
8
8
|
static styles = css`
|
|
9
|
-
|
|
9
|
+
:host {
|
|
10
|
+
--mdc-text-field-fill-color: var(--theme-white-color);
|
|
10
11
|
background-color: var(--theme-white-color);
|
|
11
12
|
margin: var(--margin-wide) 0;
|
|
12
13
|
padding: var(--padding-wide);
|
|
13
14
|
border-radius: var(--border-radius);
|
|
14
15
|
box-shadow: var(--box-shadow);
|
|
16
|
+
|
|
15
17
|
display: grid;
|
|
16
|
-
grid-template-columns: 1fr
|
|
18
|
+
grid-template-columns: 1fr 2fr auto;
|
|
17
19
|
gap: 5px 15px;
|
|
18
20
|
clear: both;
|
|
19
21
|
max-width: var(--input-container-max-width);
|
|
20
|
-
}
|
|
21
|
-
[field] {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
padding-bottom: var(--padding-default);
|
|
25
|
-
}
|
|
26
|
-
[grid-span] {
|
|
27
|
-
grid-column: span 2;
|
|
28
|
-
}
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
border: var(--border-dark-color);
|
|
32
|
-
border-radius: var(--border-radius);
|
|
33
|
-
margin: var(--input-margin);
|
|
34
|
-
padding: var(--input-padding);
|
|
35
|
-
min-width: 250px;
|
|
36
|
-
font: var(--input-font);
|
|
23
|
+
align-items: center;
|
|
37
24
|
}
|
|
38
|
-
label {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
25
|
|
|
42
|
-
font: var(--label-font);
|
|
43
|
-
color: var(--label-color);
|
|
44
|
-
text-transform: var(--label-text-transform);
|
|
45
|
-
}
|
|
46
26
|
mwc-button {
|
|
47
27
|
margin: var(--input-margin);
|
|
48
28
|
}
|
|
29
|
+
|
|
49
30
|
@media screen and (max-width: 480px) {
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
:host {
|
|
32
|
+
grid-template-columns: 1fr 1fr;
|
|
52
33
|
}
|
|
53
|
-
|
|
34
|
+
|
|
35
|
+
mwc-button {
|
|
54
36
|
grid-column: span 2;
|
|
37
|
+
|
|
38
|
+
margin: var(--input-margin);
|
|
55
39
|
}
|
|
56
40
|
}
|
|
57
41
|
`
|
|
58
42
|
|
|
59
|
-
@query('
|
|
60
|
-
@query('
|
|
43
|
+
@query('[name=name]') nameInput!: HTMLInputElement
|
|
44
|
+
@query('[name=email]') emailInput!: HTMLInputElement
|
|
61
45
|
|
|
62
46
|
render() {
|
|
63
47
|
return html`
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<div>
|
|
79
|
-
<mwc-button
|
|
80
|
-
@click=${this.onCreateUser.bind(this)}
|
|
81
|
-
outlined
|
|
82
|
-
label="${i18next.t('button.create')}"
|
|
83
|
-
></mwc-button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
48
|
+
<mwc-textfield
|
|
49
|
+
type="text"
|
|
50
|
+
name="name"
|
|
51
|
+
label=${String(i18next.t('label.x name', { x: i18next.t('label.user') }))}
|
|
52
|
+
></mwc-textfield>
|
|
53
|
+
|
|
54
|
+
<mwc-textfield type="email" name="email" label=${String(i18next.t('field.email'))}></mwc-textfield>
|
|
55
|
+
|
|
56
|
+
<mwc-button
|
|
57
|
+
@click=${this.onCreateUser.bind(this)}
|
|
58
|
+
outlined
|
|
59
|
+
label=${String(i18next.t('button.create'))}
|
|
60
|
+
></mwc-button>
|
|
86
61
|
`
|
|
87
62
|
}
|
|
88
63
|
|
|
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('invite-customer')
|
|
12
12
|
class InviteCustomer extends localize(i18next)(LitElement) {
|
|
@@ -43,7 +43,7 @@ class InviteCustomer extends localize(i18next)(LitElement) {
|
|
|
43
43
|
@click=${this.invite.bind(this)}
|
|
44
44
|
outlined
|
|
45
45
|
icon="group_add"
|
|
46
|
-
label
|
|
46
|
+
label=${String(i18next.t('label.invite customer'))}
|
|
47
47
|
></mwc-button>
|
|
48
48
|
</div>
|
|
49
49
|
`
|
|
@@ -60,39 +60,39 @@ class InviteCustomer extends localize(i18next)(LitElement) {
|
|
|
60
60
|
)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (
|
|
64
|
+
await OxPrompt.open({
|
|
65
|
+
title: i18next.t('text.are_you_sure'),
|
|
66
|
+
text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.partner`) }),
|
|
67
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
68
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
69
|
+
})
|
|
70
|
+
) {
|
|
71
|
+
const customerDomainName = this.customerNameInput.value
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
const response = await client.mutate({
|
|
74
|
+
mutation: gql`
|
|
75
|
+
mutation inviteCustomer($customerDomainName: String!) {
|
|
76
|
+
inviteCustomer(customerDomainName: $customerDomainName)
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
variables: { customerDomainName },
|
|
80
|
+
context: gqlContext()
|
|
81
|
+
})
|
|
71
82
|
|
|
72
|
-
|
|
83
|
+
if (!response.errors) {
|
|
84
|
+
const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
if (answer) {
|
|
87
|
+
await OxPrompt.open({
|
|
88
|
+
type: 'success',
|
|
89
|
+
title: i18next.t('text.completed'),
|
|
90
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
91
|
+
})
|
|
78
92
|
}
|
|
79
|
-
`,
|
|
80
|
-
variables: { customerDomainName },
|
|
81
|
-
context: gqlContext()
|
|
82
|
-
})
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
86
|
-
|
|
87
|
-
if (answer) {
|
|
88
|
-
await CustomAlert({
|
|
89
|
-
type: 'success',
|
|
90
|
-
title: i18next.t('text.completed'),
|
|
91
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
92
|
-
})
|
|
94
|
+
this.customerNameInput.value = ''
|
|
93
95
|
}
|
|
94
|
-
|
|
95
|
-
this.customerNameInput.value = ''
|
|
96
96
|
}
|
|
97
97
|
} catch (e: any) {
|
|
98
98
|
document.dispatchEvent(
|
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('invite-user')
|
|
12
12
|
class InviteUser extends localize(i18next)(LitElement) {
|
|
@@ -40,7 +40,7 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
40
40
|
@click=${this.invite.bind(this)}
|
|
41
41
|
outlined
|
|
42
42
|
icon="group_add"
|
|
43
|
-
label
|
|
43
|
+
label=${String(i18next.t('label.invite user'))}
|
|
44
44
|
></mwc-button>
|
|
45
45
|
`
|
|
46
46
|
}
|
|
@@ -51,18 +51,18 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
51
51
|
throw new Error(i18next.t('error.not valid pattern of type', { type: 'e-mail' }))
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await this.inviteUser(this.emailInput.value)
|
|
54
|
+
if (
|
|
55
|
+
await OxPrompt.open({
|
|
56
|
+
title: i18next.t('text.are_you_sure'),
|
|
57
|
+
text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.user`) }),
|
|
58
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
59
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
60
|
+
})
|
|
61
|
+
) {
|
|
62
|
+
await this.inviteUser(this.emailInput.value)
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
65
|
+
}
|
|
66
66
|
} catch (e: any) {
|
|
67
67
|
document.dispatchEvent(
|
|
68
68
|
new CustomEvent('notify', {
|
|
@@ -87,10 +87,11 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
87
87
|
})
|
|
88
88
|
|
|
89
89
|
if (!response.errors) {
|
|
90
|
-
await
|
|
90
|
+
await OxPrompt.open({
|
|
91
91
|
title: i18next.t('text.completed'),
|
|
92
92
|
confirmButton: { text: i18next.t('button.confirm') }
|
|
93
93
|
})
|
|
94
|
+
|
|
94
95
|
this.emailInput.value = ''
|
|
95
96
|
}
|
|
96
97
|
}
|
|
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('ownership-transfer-popup')
|
|
12
12
|
class OwnershipTransferPopup extends localize(i18next)(LitElement) {
|
|
@@ -65,39 +65,38 @@ class OwnershipTransferPopup extends localize(i18next)(LitElement) {
|
|
|
65
65
|
return
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
if (
|
|
69
|
+
await OxPrompt.open({
|
|
70
|
+
title: i18next.t('text.are_you_sure'),
|
|
71
|
+
text: i18next.t('text.are_you_sure_to_transfer_owner'),
|
|
72
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
73
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
74
|
+
})
|
|
75
|
+
) {
|
|
76
|
+
const response = await client.mutate({
|
|
77
|
+
mutation: gql`
|
|
78
|
+
mutation transferOwner($email: String!) {
|
|
79
|
+
transferOwner(email: $email)
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
variables: { email: this.user.email },
|
|
83
|
+
context: gqlContext()
|
|
84
|
+
})
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
context: gqlContext()
|
|
88
|
-
})
|
|
86
|
+
if (!response.errors?.length) {
|
|
87
|
+
await OxPrompt.open({
|
|
88
|
+
type: 'success',
|
|
89
|
+
title: i18next.t('text.completed'),
|
|
90
|
+
text: i18next.t('text.owner_transfer_completed'),
|
|
91
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
92
|
+
})
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
await CustomAlert({
|
|
92
|
-
type: 'success',
|
|
93
|
-
title: i18next.t('text.completed'),
|
|
94
|
-
text: i18next.t('text.owner_transfer_completed'),
|
|
95
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
96
|
-
})
|
|
94
|
+
history.back()
|
|
97
95
|
|
|
96
|
+
this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
98
99
|
history.back()
|
|
99
|
-
|
|
100
|
-
this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
|
|
@@ -7,7 +7,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
7
7
|
|
|
8
8
|
import { client, gqlContext } from '@operato/graphql'
|
|
9
9
|
import { i18next, localize } from '@operato/i18n'
|
|
10
|
-
import {
|
|
10
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
11
11
|
|
|
12
12
|
import { RoleSelector } from './role-selector'
|
|
13
13
|
|
|
@@ -123,34 +123,34 @@ class PartnerRoleEditor extends localize(i18next)(LitElement) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
async onTerminateContract() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
126
|
+
if (
|
|
127
|
+
await OxPrompt.open({
|
|
128
|
+
title: i18next.t('text.are_you_sure'),
|
|
129
|
+
text: i18next.t('text.are_you_sure_to_terminate_contract'),
|
|
130
|
+
confirmButton: { text: i18next.t('button.terminate contract') },
|
|
131
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
132
|
+
})
|
|
133
|
+
) {
|
|
134
|
+
const response = await client.mutate({
|
|
135
|
+
mutation: gql`
|
|
136
|
+
mutation terminateContract($partnerName: String!) {
|
|
137
|
+
terminateContract(partnerName: $partnerName)
|
|
138
|
+
}
|
|
139
|
+
`,
|
|
140
|
+
variables: { partnerName: this.customer.name },
|
|
141
|
+
context: gqlContext()
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
if (!response.errors?.length) {
|
|
145
|
+
const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
|
|
146
|
+
|
|
147
|
+
if (answer) {
|
|
148
|
+
await OxPrompt.open({
|
|
149
|
+
type: 'success',
|
|
150
|
+
title: i18next.t('text.completed'),
|
|
151
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
152
|
+
})
|
|
139
153
|
}
|
|
140
|
-
`,
|
|
141
|
-
variables: { partnerName: this.customer.name },
|
|
142
|
-
context: gqlContext()
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
if (!response.errors?.length) {
|
|
146
|
-
const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
|
|
147
|
-
|
|
148
|
-
if (answer) {
|
|
149
|
-
await CustomAlert({
|
|
150
|
-
type: 'success',
|
|
151
|
-
title: i18next.t('text.completed'),
|
|
152
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
153
|
-
})
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -4,7 +4,7 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
4
4
|
|
|
5
5
|
import { client, gqlContext } from '@operato/graphql'
|
|
6
6
|
import { i18next, localize } from '@operato/i18n'
|
|
7
|
-
import {
|
|
7
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
8
8
|
|
|
9
9
|
@customElement('role-privilege-editor')
|
|
10
10
|
class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
@@ -51,14 +51,15 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
51
51
|
|
|
52
52
|
[buttons] {
|
|
53
53
|
margin: 0;
|
|
54
|
-
padding:
|
|
54
|
+
padding: 5px;
|
|
55
55
|
background-color: rgba(var(--primary-color-rgb), 0.2);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
mwc-button {
|
|
59
|
+
margin: 5px;
|
|
59
60
|
background-color: var(--theme-white-color);
|
|
60
|
-
overflow: hidden;
|
|
61
61
|
}
|
|
62
|
+
|
|
62
63
|
[danger] {
|
|
63
64
|
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
|
64
65
|
}
|
|
@@ -172,34 +173,34 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
async onDeleteRole() {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
})
|
|
176
|
+
if (
|
|
177
|
+
await OxPrompt.open({
|
|
178
|
+
title: i18next.t('text.are_you_sure'),
|
|
179
|
+
text: i18next.t('text.are_you_sure_to_delete_x', { x: i18next.t('label.role') }),
|
|
180
|
+
confirmButton: { text: i18next.t('button.delete') },
|
|
181
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
182
|
+
})
|
|
183
|
+
) {
|
|
184
|
+
const response = await client.mutate({
|
|
185
|
+
mutation: gql`
|
|
186
|
+
mutation ($id: String!) {
|
|
187
|
+
deleteRole(id: $id)
|
|
188
|
+
}
|
|
189
|
+
`,
|
|
190
|
+
variables: { id: this.role.id },
|
|
191
|
+
context: gqlContext()
|
|
192
|
+
})
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
if (!response.errors) {
|
|
195
|
+
await this.dispatchEvent(new CustomEvent('fetch-roles'))
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
await OxPrompt.open({
|
|
198
|
+
type: 'success',
|
|
199
|
+
title: i18next.t('text.completed'),
|
|
200
|
+
text: i18next.t('text.x_deleted_successfully', { x: i18next.t('label.role') }),
|
|
201
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
202
|
+
})
|
|
203
|
+
}
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
1
|
+
import { css, html, LitElement, nothing } from 'lit'
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js'
|
|
3
3
|
|
|
4
4
|
@customElement('role-selector')
|
|
@@ -59,7 +59,7 @@ export class RoleSelector extends LitElement {
|
|
|
59
59
|
${this.roles.length
|
|
60
60
|
? html`
|
|
61
61
|
<div>
|
|
62
|
-
|
|
62
|
+
${this.roleCategory ? html`<h3 subtitle>${this.roleCategory}</h3>` : nothing}
|
|
63
63
|
<input id="checkAll" type="checkbox" @change=${this.checkAll.bind(this)} />
|
|
64
64
|
<label for="checkAll">Check all</label>
|
|
65
65
|
</div>
|