@things-factory/auth-ui 8.0.5 → 9.0.0-beta.12

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 (146) hide show
  1. package/dist-client/components/abstract-auth-page.d.ts +1 -1
  2. package/dist-client/components/abstract-auth-page.js +12 -10
  3. package/dist-client/components/abstract-auth-page.js.map +1 -1
  4. package/dist-client/components/abstract-password-reset.d.ts +2 -3
  5. package/dist-client/components/abstract-password-reset.js +10 -17
  6. package/dist-client/components/abstract-password-reset.js.map +1 -1
  7. package/dist-client/components/abstract-sign.js +12 -11
  8. package/dist-client/components/abstract-sign.js.map +1 -1
  9. package/dist-client/components/change-password.js +1 -1
  10. package/dist-client/components/change-password.js.map +1 -1
  11. package/dist-client/components/contact-us.d.ts +1 -1
  12. package/dist-client/components/contact-us.js +10 -7
  13. package/dist-client/components/contact-us.js.map +1 -1
  14. package/dist-client/components/create-user.js +28 -5
  15. package/dist-client/components/create-user.js.map +1 -1
  16. package/dist-client/components/invite-user.d.ts +1 -1
  17. package/dist-client/components/invite-user.js +19 -12
  18. package/dist-client/components/invite-user.js.map +1 -1
  19. package/dist-client/components/ownership-transfer-popup.js +3 -3
  20. package/dist-client/components/ownership-transfer-popup.js.map +1 -1
  21. package/dist-client/components/partner-role-editor.js +1 -1
  22. package/dist-client/components/partner-role-editor.js.map +1 -1
  23. package/dist-client/components/profile-component.d.ts +8 -4
  24. package/dist-client/components/profile-component.js +67 -7
  25. package/dist-client/components/profile-component.js.map +1 -1
  26. package/dist-client/components/role-privilege-editor.js +2 -1
  27. package/dist-client/components/role-privilege-editor.js.map +1 -1
  28. package/dist-client/components/user-role-editor.d.ts +2 -2
  29. package/dist-client/components/user-role-editor.js +20 -20
  30. package/dist-client/components/user-role-editor.js.map +1 -1
  31. package/dist-client/constants/index.d.ts +1 -1
  32. package/dist-client/constants/index.js +1 -1
  33. package/dist-client/constants/index.js.map +1 -1
  34. package/dist-client/entries/auth/activate.d.ts +1 -1
  35. package/dist-client/entries/auth/activate.js +1 -1
  36. package/dist-client/entries/auth/activate.js.map +1 -1
  37. package/dist-client/entries/auth/checkin.js +2 -2
  38. package/dist-client/entries/auth/checkin.js.map +1 -1
  39. package/dist-client/entries/auth/forgot-password.d.ts +2 -2
  40. package/dist-client/entries/auth/forgot-password.js +13 -4
  41. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  42. package/dist-client/entries/auth/reset-password.d.ts +1 -1
  43. package/dist-client/entries/auth/reset-password.js +1 -1
  44. package/dist-client/entries/auth/reset-password.js.map +1 -1
  45. package/dist-client/entries/auth/result.d.ts +1 -1
  46. package/dist-client/entries/auth/result.js +1 -1
  47. package/dist-client/entries/auth/result.js.map +1 -1
  48. package/dist-client/entries/auth/signin.d.ts +1 -1
  49. package/dist-client/entries/auth/signin.js +1 -1
  50. package/dist-client/entries/auth/signin.js.map +1 -1
  51. package/dist-client/entries/auth/signup.d.ts +3 -1
  52. package/dist-client/entries/auth/signup.js +45 -9
  53. package/dist-client/entries/auth/signup.js.map +1 -1
  54. package/dist-client/entries/auth/unlock-user.d.ts +1 -1
  55. package/dist-client/entries/auth/unlock-user.js +1 -1
  56. package/dist-client/entries/auth/unlock-user.js.map +1 -1
  57. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +1 -1
  58. package/dist-client/entries/oauth2/oauth2-decision-page.js +1 -1
  59. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  60. package/dist-client/entries/public/home.js +2 -2
  61. package/dist-client/entries/public/home.js.map +1 -1
  62. package/dist-client/index.js +1 -1
  63. package/dist-client/index.js.map +1 -1
  64. package/dist-client/pages/application/application.js +1 -1
  65. package/dist-client/pages/application/application.js.map +1 -1
  66. package/dist-client/pages/domain/domain-management.d.ts +1 -1
  67. package/dist-client/pages/domain/domain-management.js +1 -1
  68. package/dist-client/pages/domain/domain-management.js.map +1 -1
  69. package/dist-client/pages/partner/partner-management.d.ts +3 -3
  70. package/dist-client/pages/partner/partner-management.js +3 -3
  71. package/dist-client/pages/partner/partner-management.js.map +1 -1
  72. package/dist-client/pages/profile.d.ts +1 -1
  73. package/dist-client/pages/profile.js +1 -1
  74. package/dist-client/pages/profile.js.map +1 -1
  75. package/dist-client/pages/role/role-management.d.ts +3 -3
  76. package/dist-client/pages/role/role-management.js +3 -3
  77. package/dist-client/pages/role/role-management.js.map +1 -1
  78. package/dist-client/pages/user/user-management.d.ts +9 -5
  79. package/dist-client/pages/user/user-management.js +10 -11
  80. package/dist-client/pages/user/user-management.js.map +1 -1
  81. package/dist-client/tsconfig.tsbuildinfo +1 -1
  82. package/dist-server/tsconfig.tsbuildinfo +1 -1
  83. package/package.json +12 -12
  84. package/translations/en.json +6 -2
  85. package/translations/ja.json +6 -2
  86. package/translations/ko.json +6 -2
  87. package/translations/ms.json +6 -2
  88. package/translations/zh.json +6 -2
  89. package/client/auth-style-sign.ts +0 -194
  90. package/client/bootstrap.ts +0 -51
  91. package/client/components/abstract-auth-page.ts +0 -301
  92. package/client/components/abstract-password-reset.ts +0 -168
  93. package/client/components/abstract-sign.ts +0 -127
  94. package/client/components/change-password.ts +0 -153
  95. package/client/components/contact-us.ts +0 -113
  96. package/client/components/create-domain-popup.ts +0 -141
  97. package/client/components/create-role.ts +0 -123
  98. package/client/components/create-user.ts +0 -95
  99. package/client/components/credential-manager.ts +0 -64
  100. package/client/components/delete-user-popup.ts +0 -117
  101. package/client/components/domain-switch.ts +0 -127
  102. package/client/components/invite-customer.ts +0 -104
  103. package/client/components/invite-user.ts +0 -96
  104. package/client/components/my-login-history.ts +0 -101
  105. package/client/components/ownership-transfer-popup.ts +0 -110
  106. package/client/components/partner-info-card.ts +0 -89
  107. package/client/components/partner-role-editor.ts +0 -153
  108. package/client/components/profile-component.ts +0 -332
  109. package/client/components/role-edit-form.ts +0 -92
  110. package/client/components/role-privilege-editor.ts +0 -267
  111. package/client/components/role-selector.ts +0 -102
  112. package/client/components/user-role-editor.ts +0 -499
  113. package/client/constants/application.ts +0 -9
  114. package/client/constants/index.ts +0 -1
  115. package/client/entries/auth/activate.ts +0 -272
  116. package/client/entries/auth/checkin.ts +0 -190
  117. package/client/entries/auth/forgot-password.ts +0 -103
  118. package/client/entries/auth/reset-password.ts +0 -22
  119. package/client/entries/auth/result.ts +0 -193
  120. package/client/entries/auth/signin.ts +0 -18
  121. package/client/entries/auth/signup.ts +0 -109
  122. package/client/entries/auth/unlock-user.ts +0 -22
  123. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  124. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  125. package/client/entries/public/home.ts +0 -246
  126. package/client/index.ts +0 -124
  127. package/client/pages/app-binding/app-binding.ts +0 -423
  128. package/client/pages/app-binding/app-bindings.ts +0 -171
  129. package/client/pages/appliance/appliance.ts +0 -452
  130. package/client/pages/appliance/home.ts +0 -177
  131. package/client/pages/appliance/register.ts +0 -183
  132. package/client/pages/application/application.ts +0 -428
  133. package/client/pages/application/applications.ts +0 -182
  134. package/client/pages/application/register.ts +0 -211
  135. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  136. package/client/pages/attribute/attribute-set-management.ts +0 -282
  137. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  138. package/client/pages/domain/domain-management.ts +0 -410
  139. package/client/pages/partner/partner-management.ts +0 -112
  140. package/client/pages/profile.ts +0 -32
  141. package/client/pages/role/role-management.ts +0 -134
  142. package/client/pages/user/user-management.ts +0 -224
  143. package/client/route.ts +0 -67
  144. package/client/themes/auth-theme.css +0 -65
  145. package/client/utils/password-rule.ts +0 -37
  146. package/server/index.ts +0 -0
@@ -1,183 +0,0 @@
1
- import gql from 'graphql-tag'
2
- import { css, html } from 'lit'
3
- import { customElement, property, query } from 'lit/decorators.js'
4
- import { connect } from 'pwa-helpers/connect-mixin.js'
5
-
6
- import { client } from '@operato/graphql'
7
- import { navigate, PageView, store } from '@operato/shell'
8
-
9
- @customElement('appliance-register')
10
- class ApplianceRegister extends connect(store)(PageView) {
11
- static get styles() {
12
- return [
13
- css`
14
- :host {
15
- background-color: var(--md-sys-color-background);
16
- padding: var(--spacing-large);
17
-
18
- display: flex;
19
- flex-direction: column;
20
-
21
- align-items: center;
22
-
23
- overflow: auto;
24
- }
25
- h2 {
26
- margin: var(--title-margin);
27
- font: var(--title-font);
28
- color: var(--title-text-color);
29
- }
30
- [page-description] {
31
- margin: var(--page-description-margin);
32
- font: var(--page-description-font);
33
- color: var(--page-description-color);
34
- }
35
-
36
- [form-container] {
37
- background-color: var(--md-sys-color-surface);
38
- padding: var(--spacing-large);
39
- border-radius: var(--border-radius);
40
- box-shadow: var(--box-shadow);
41
- min-width: 60%;
42
- max-width: var(--input-container-max-width);
43
- position: relative;
44
- clear: both;
45
- }
46
- label {
47
- font: var(--label-font);
48
- color: var(--label-color, var(--md-sys-color-on-surface));
49
- text-transform: var(--label-text-transform);
50
- }
51
- input {
52
- border: var(--border-dim-color);
53
- border-radius: var(--border-radius);
54
- margin: var(--input-margin);
55
- padding: var(--input-padding);
56
- font: var(--input-font);
57
-
58
- flex: 1;
59
- }
60
- select:focus,
61
- input:focus {
62
- outline: none;
63
- }
64
- [field-2column] {
65
- display: grid;
66
- grid-template-columns: 1fr 1fr;
67
- grid-gap: 15px;
68
- max-width: var(--content-container-max-width);
69
- }
70
- [field] {
71
- display: flex;
72
- flex-direction: column;
73
- }
74
- [grid-span] {
75
- grid-column: span 2;
76
- }
77
- @media screen and (max-width: 480px) {
78
- [form-container] {
79
- position: initial;
80
- width: 100%;
81
- }
82
- [field] {
83
- grid-column: span 2;
84
- }
85
- }
86
- `
87
- ]
88
- }
89
-
90
- @property({ type: Object }) appliance: any
91
-
92
- @query('form') form!: HTMLFormElement
93
-
94
- get context() {
95
- return {
96
- title: `appliance registration`,
97
- help: 'auth/appliance'
98
- }
99
- }
100
-
101
- render() {
102
- return html`
103
- <h2>Register new appliance</h2>
104
- <p page-description>You can register new appliance here</p>
105
-
106
- <div form-container>
107
- <form>
108
- <div field-2column>
109
- <div field grid-span>
110
- <label for="name">name</label>
111
- <input id="name" type="text" name="name" />
112
- </div>
113
-
114
- <div field grid-span>
115
- <label for="description">description</label>
116
- <input id="description" type="text" name="description" />
117
- </div>
118
-
119
- <div field>
120
- <label for="brand">brand</label>
121
- <input id="brand" type="text" name="brand" />
122
- </div>
123
-
124
- <div field>
125
- <label for="serial-no">serial #</label>
126
- <input id="serial-no" type="text" name="serialNo" />
127
- </div>
128
-
129
- <div field>
130
- <label for="model">model</label>
131
- <input id="model" type="text" name="model" />
132
- </div>
133
-
134
- <div field>
135
- <label for="netmask">netmask</label>
136
- <input id="netmask" type="text" name="netmask" />
137
- </div>
138
-
139
- <md-elevated-button grid-span @click=${this.createAppliance.bind(this)}>register</md-elevated-button>
140
- </div>
141
- </form>
142
- </div>
143
- `
144
- }
145
-
146
- async createAppliance(e) {
147
- e.preventDefault()
148
-
149
- const form = this.renderRoot.querySelector('form') as HTMLFormElement
150
- const formData = new FormData(form)
151
-
152
- const appliance = Array.from(formData.entries()).reduce((appliance, [key, value]) => {
153
- appliance[key] = value
154
- return appliance
155
- }, {})
156
-
157
- const response = await client.mutate({
158
- mutation: gql`
159
- mutation ($appliance: NewAppliance!) {
160
- createAppliance(appliance: $appliance) {
161
- id
162
- }
163
- }
164
- `,
165
- variables: {
166
- appliance
167
- }
168
- })
169
-
170
- if (response.errors) {
171
- console.log('creation fail.')
172
- } else {
173
- const id = response.data.createAppliance.id
174
- navigate(`appliance/${id}`)
175
- }
176
- }
177
-
178
- pageUpdated(changes, lifecycle, before) {
179
- if (this.active) {
180
- this.form.reset()
181
- }
182
- }
183
- }
@@ -1,428 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import Clipboard from 'clipboard'
4
- import gql from 'graphql-tag'
5
- import { css, html } from 'lit'
6
- import { customElement, property, queryAll } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
- import { APPLICATION_TYPES } from '../../constants/application'
10
-
11
- import { client } from '@operato/graphql'
12
- import { navigate, PageView, store } from '@operato/shell'
13
-
14
- @customElement('application-page')
15
- class Application extends connect(store)(PageView) {
16
- static styles = [
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
- overflow-y: auto;
22
- position: relative;
23
-
24
- background-color: var(--md-sys-color-background);
25
- padding: var(--spacing-large);
26
- }
27
-
28
- h2 {
29
- margin: var(--title-margin);
30
- font: var(--title-font);
31
- color: var(--title-text-color);
32
- }
33
-
34
- [page-description] {
35
- margin: var(--page-description-margin);
36
- font: var(--page-description-font);
37
- color: var(--page-description-color);
38
- }
39
-
40
- [icon] {
41
- position: absolute;
42
- top: 10px;
43
- right: 10px;
44
- max-width: 80px;
45
- }
46
-
47
- [icon] img {
48
- max-width: 100%;
49
- max-height: 100%;
50
- }
51
-
52
- [button-primary] {
53
- background-color: var(--button-primary-background-color);
54
- border: var(--button-border);
55
- border-radius: var(--button-border-radius);
56
- margin: var(--button-margin);
57
- padding: var(--button-primary-padding);
58
- color: var(--button-primary-color);
59
- font: var(--button-primary-font);
60
- text-transform: var(--button-text-transform);
61
-
62
- text-decoration: none;
63
- }
64
-
65
- [button-primary]:hover {
66
- background-color: var(--button-primary-active-background-color);
67
- box-shadow: var(--button-active-box-shadow);
68
- }
69
-
70
- [fieldset-container] {
71
- background-color: var(--md-sys-color-surface);
72
- margin: var(--spacing-large) 0 var(--spacing-medium) 0;
73
- padding: var(--spacing-medium);
74
- border-radius: var(--border-radius);
75
- box-shadow: var(--box-shadow);
76
-
77
- label {
78
- font: var(--label-font);
79
- color: var(--label-color, var(--md-sys-color-on-surface));
80
- text-transform: var(--label-text-transform);
81
- }
82
-
83
- input,
84
- select {
85
- border: var(--border-dim-color);
86
- border-radius: var(--border-radius);
87
- margin: var(--input-margin);
88
- padding: var(--input-padding);
89
- font: var(--input-font);
90
-
91
- flex: 1;
92
- }
93
-
94
- select:focus,
95
- input:focus,
96
- button {
97
- outline: none;
98
- }
99
-
100
- form {
101
- max-width: var(--content-container-max-width);
102
- }
103
- }
104
-
105
- [fieldset-container] fieldset {
106
- margin: 0;
107
- margin-top: -15px;
108
- }
109
-
110
- fieldset {
111
- border-radius: var(--border-radius);
112
- border: var(--border-dim-color);
113
- margin: var(--fieldset-margin);
114
- padding: var(--fieldset-padding);
115
- }
116
-
117
- legend {
118
- padding: var(--legend-padding);
119
- font-weight: bold;
120
- color: var(--legend-color);
121
- }
122
-
123
- [field-2column] {
124
- display: grid;
125
- grid-template-columns: 1fr 1fr;
126
- grid-gap: 15px;
127
- }
128
-
129
- [field] {
130
- display: flex;
131
- flex-direction: column;
132
- position: relative;
133
- }
134
-
135
- [grid-span] {
136
- grid-column: span 2;
137
- }
138
-
139
- button {
140
- display: flex;
141
- align-items: center;
142
- gap: var(--spacing-small);
143
- }
144
-
145
- button,
146
- input[type='submit'],
147
- [button-in-field] {
148
- background-color: var(--button-background-color);
149
- border: var(--button-border);
150
- border-radius: var(--button-border-radius);
151
- padding: var(--button-padding);
152
- color: var(--button-color);
153
- font: var(--button-font);
154
- text-transform: var(--button-text-transform);
155
-
156
- margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);
157
- float: right;
158
- text-decoration: none;
159
- }
160
-
161
- button:hover,
162
- input[type='submit']:hover {
163
- border: var(--button-activ-border);
164
- box-shadow: var(--button-active-box-shadow);
165
- }
166
-
167
- [button-in-field] {
168
- border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
169
- position: absolute;
170
- top: 12px;
171
- right: 0;
172
- max-height: 36px;
173
- }
174
-
175
- [input-hint] {
176
- font: var(--input-hint-font);
177
- color: var(--input-hint-color);
178
- }
179
-
180
- @media screen and (max-width: 480px) {
181
- [field] {
182
- grid-column: span 2;
183
- }
184
- }
185
- `
186
- ]
187
-
188
- @property({ type: Object }) application: any
189
- @queryAll('[clipboard-copy]') copybuttons
190
- private clipboard?: Clipboard
191
-
192
- get context() {
193
- return {
194
- title: {
195
- icon: 'apps',
196
- text: this.application.name
197
- }
198
- }
199
- }
200
-
201
- render() {
202
- var app = this.application || {}
203
-
204
- return html`
205
- <div>
206
- <h2><md-icon>apps</md-icon>&nbsp;${app.name}</h2>
207
- <p page-description>${app.description}</p>
208
- </div>
209
-
210
- <div icon>
211
- <img src=${app.icon} />
212
- </div>
213
-
214
- <form>
215
- <div fieldset-container>
216
- <fieldset>
217
- <legend>application</legend>
218
- <div field-2column>
219
- <div field grid-span>
220
- <label for="name">app name</label>
221
- <input id="name" type="text" name="name" .value=${app.name} />
222
- </div>
223
-
224
- <div field grid-span>
225
- <label for="description">description</label>
226
- <input id="description" type="text" name="description" .value=${app.description} />
227
- </div>
228
-
229
- <div field grid-span>
230
- <label for="email">contact email</label>
231
- <input id="email" type="text" name="email" .value=${app.email} />
232
- </div>
233
-
234
- <div field grid-span>
235
- <label for="type-selector">type</label>
236
- <select id="type-selector" name="type">
237
- ${APPLICATION_TYPES.map(
238
- type =>
239
- html`<option value="${app.type}" ?selected="${type === app.type ? true : false}">${type}</option>`
240
- )}
241
- </select>
242
- </div>
243
-
244
- <div field grid-span>
245
- <label for="url">application URL</label>
246
- <input id="url" type="text" name="url" .value=${app.url} />
247
- </div>
248
-
249
- <div field grid-span>
250
- <label for="icon">icon</label>
251
- <input id="icon" type="text" name="icon" .value=${app.icon} />
252
- </div>
253
-
254
- <div field grid-span>
255
- <label for="redirect-url">redirect URL</label>
256
- <input id="redirect-url" type="text" name="redirectUrl" .value=${app.redirectUrl} />
257
- </div>
258
-
259
- <div field grid-span>
260
- <label for="webhook">webhook</label>
261
- <input id="webhook" type="text" name="webhook" .value=${app.webhook} />
262
- </div>
263
-
264
- <div field grid-span>
265
- <label for="available-scopes">available-scopes</label>
266
- <input id="available-scopes" type="text" .value=${app.availableScopes} readonly />
267
- </div>
268
-
269
- <div field grid-span>
270
- <label for="auth-url">auth URL</label>
271
- <input id="auth-url" type="text" .value=${app.authUrl} readonly />
272
- <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
273
- The endpoint for authorization server. This is used to get the authorization code.
274
- </div>
275
-
276
- <div field grid-span>
277
- <label for="access-token-url">access token URL</label>
278
- <input id="access-token-url" type="text" .value=${app.accessTokenUrl} readonly />
279
- <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
280
- The endpoint for authentication server. This is used to exchange the authorization code for an access
281
- token.
282
- </div>
283
- </div>
284
- </fieldset>
285
- </div>
286
-
287
- <div fieldset-container>
288
- <fieldset>
289
- <legend>credentials</legend>
290
- <div field-2column>
291
- <div field grid-span>
292
- <label for="app-key">appKey</label>
293
- <input id="app-key" type="text" .value=${app.appKey} readonly />
294
- <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
295
- </div>
296
-
297
- <div field grid-span>
298
- <label for="app-secret">appSecret</label>
299
- <input id="app-secret" type="text" .value=${app.appSecret} readonly />
300
- <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
301
- </div>
302
- </div>
303
- </fieldset>
304
- </div>
305
-
306
- <div class="button-container">
307
- <button danger @click=${this.deleteApplication.bind(this)}>
308
- <md-icon>delete_forever</md-icon>delete this app
309
- </button>
310
- <button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>
311
- <button><md-icon>passkey</md-icon>generate new secret</button>
312
- </div>
313
- </form>
314
- `
315
- }
316
-
317
- firstUpdated() {
318
- this.clipboard = new Clipboard(this.copybuttons, {
319
- target: (trigger => trigger.parentElement.querySelector('input')) as any
320
- })
321
- }
322
-
323
- async pageUpdated(changes, lifecycle, before) {
324
- if (this.active) {
325
- await this.fetchApplication()
326
- }
327
- }
328
-
329
- async fetchApplication() {
330
- const response = await client.query({
331
- query: gql`
332
- query ($id: String!) {
333
- application(id: $id) {
334
- id
335
- name
336
- description
337
- email
338
- url
339
- icon
340
- redirectUrl
341
- authUrl
342
- accessTokenUrl
343
- webhook
344
- availableScopes
345
- appKey
346
- appSecret
347
- type
348
- }
349
- }
350
- `,
351
- variables: {
352
- id: this.lifecycle.resourceId
353
- }
354
- })
355
-
356
- this.application = response.data.application
357
- }
358
-
359
- async updateApplication(e) {
360
- e.preventDefault()
361
-
362
- const form = this.renderRoot.querySelector('form') as HTMLFormElement
363
- const formData = new FormData(form)
364
-
365
- const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {
366
- patch[key] = value
367
- return patch
368
- }, {})
369
-
370
- const id = this.lifecycle.resourceId
371
-
372
- const response = await client.mutate({
373
- mutation: gql`
374
- mutation ($id: String!, $patch: ApplicationPatch!) {
375
- updateApplication(id: $id, patch: $patch) {
376
- id
377
- name
378
- description
379
- email
380
- url
381
- icon
382
- redirectUrl
383
- webhook
384
- appKey
385
- appSecret
386
- type
387
- }
388
- }
389
- `,
390
- variables: {
391
- id,
392
- patch
393
- }
394
- })
395
-
396
- if (response.errors) {
397
- console.error('update fail')
398
- } else {
399
- this.application = { ...this.application, ...response.data.updateApplication }
400
- console.log('update sucess')
401
- }
402
- }
403
-
404
- async deleteApplication(e) {
405
- e.preventDefault()
406
-
407
- const id = this.lifecycle.resourceId
408
-
409
- const response = await client.mutate({
410
- mutation: gql`
411
- mutation ($id: String!) {
412
- deleteApplication(id: $id)
413
- }
414
- `,
415
- variables: {
416
- id
417
- }
418
- })
419
-
420
- const result = response.data.deleteApplication
421
- if (result) {
422
- console.log('delete sucess')
423
- navigate('applications')
424
- } else {
425
- console.error('delete fail')
426
- }
427
- }
428
- }