@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,423 @@
|
|
|
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, state } from 'lit/decorators.js'
|
|
7
|
+
import { asyncReplace } from 'lit/directives/async-replace.js'
|
|
8
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
9
|
+
|
|
10
|
+
import { client } from '@operato/graphql'
|
|
11
|
+
import { navigate, PageView, store } from '@operato/shell'
|
|
12
|
+
import { parseJwt, sleep } from '@operato/utils'
|
|
13
|
+
|
|
14
|
+
@customElement('app-binding-page')
|
|
15
|
+
class AppBinding extends connect(store)(PageView) {
|
|
16
|
+
static styles = [
|
|
17
|
+
css`
|
|
18
|
+
:host {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
background-color: var(--md-sys-color-background);
|
|
26
|
+
padding: var(--spacing-large);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
h2 {
|
|
30
|
+
margin: var(--title-margin);
|
|
31
|
+
font: var(--title-font);
|
|
32
|
+
color: var(--title-text-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[page-description] {
|
|
36
|
+
margin: var(--page-description-margin);
|
|
37
|
+
font: var(--page-description-font);
|
|
38
|
+
color: var(--page-description-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[icon] {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 10px;
|
|
44
|
+
right: 10px;
|
|
45
|
+
|
|
46
|
+
max-width: 80px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[icon] img {
|
|
50
|
+
max-width: 100%;
|
|
51
|
+
max-height: 100%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[fieldset-container] {
|
|
55
|
+
background-color: var(--md-sys-color-surface);
|
|
56
|
+
margin: var(--spacing-large) 0 var(--spacing-medium) 0;
|
|
57
|
+
padding: var(--spacing-medium);
|
|
58
|
+
border-radius: var(--border-radius);
|
|
59
|
+
box-shadow: var(--box-shadow);
|
|
60
|
+
|
|
61
|
+
label {
|
|
62
|
+
font: var(--label-font);
|
|
63
|
+
color: var(--label-color, var(--md-sys-color-on-surface));
|
|
64
|
+
text-transform: var(--label-text-transform);
|
|
65
|
+
}
|
|
66
|
+
input {
|
|
67
|
+
border: var(--border-dim-color);
|
|
68
|
+
border-radius: var(--border-radius);
|
|
69
|
+
margin: var(--input-margin);
|
|
70
|
+
padding: var(--input-padding);
|
|
71
|
+
font: var(--input-font);
|
|
72
|
+
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
select:focus,
|
|
76
|
+
input:focus,
|
|
77
|
+
button {
|
|
78
|
+
outline: none;
|
|
79
|
+
}
|
|
80
|
+
form {
|
|
81
|
+
max-width: var(--content-container-max-width);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[fieldset-container] fieldset {
|
|
86
|
+
margin: 0;
|
|
87
|
+
margin-top: -15px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fieldset {
|
|
91
|
+
border-radius: var(--border-radius);
|
|
92
|
+
border: var(--border-dim-color);
|
|
93
|
+
margin: var(--fieldset-margin);
|
|
94
|
+
padding: var(--fieldset-padding);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
legend {
|
|
98
|
+
padding: var(--legend-padding);
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
color: var(--legend-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[field-2column] {
|
|
104
|
+
display: grid;
|
|
105
|
+
grid-template-columns: 1fr 1fr;
|
|
106
|
+
grid-gap: 15px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[field] {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
position: relative;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[grid-span] {
|
|
116
|
+
grid-column: span 2;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
button,
|
|
120
|
+
[button-in-field] {
|
|
121
|
+
background-color: var(--button-background-color);
|
|
122
|
+
border: var(--button-border);
|
|
123
|
+
border-radius: var(--button-border-radius);
|
|
124
|
+
padding: var(--button-padding);
|
|
125
|
+
color: var(--button-color);
|
|
126
|
+
font: var(--button-font);
|
|
127
|
+
text-transform: var(--button-text-transform);
|
|
128
|
+
|
|
129
|
+
margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);
|
|
130
|
+
float: right;
|
|
131
|
+
text-decoration: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
button:hover {
|
|
135
|
+
border: var(--button-activ-border);
|
|
136
|
+
box-shadow: var(--button-active-box-shadow);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[button-in-field] {
|
|
140
|
+
border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
|
|
141
|
+
position: absolute;
|
|
142
|
+
top: 12px;
|
|
143
|
+
right: 0;
|
|
144
|
+
max-height: 36px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[input-hint] {
|
|
148
|
+
font: var(--input-hint-font);
|
|
149
|
+
color: var(--input-hint-color);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media screen and (max-width: 480px) {
|
|
153
|
+
[field] {
|
|
154
|
+
grid-column: span 2;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
@property({ type: Object }) appbinding: any
|
|
161
|
+
@property({ type: String }) accessToken?: string
|
|
162
|
+
|
|
163
|
+
@state() _refreshTokenInfo: any
|
|
164
|
+
@state() _accessTokenInfo: any
|
|
165
|
+
|
|
166
|
+
private clipboard?: Clipboard
|
|
167
|
+
|
|
168
|
+
get context() {
|
|
169
|
+
return {
|
|
170
|
+
title: {
|
|
171
|
+
icon: 'link',
|
|
172
|
+
text: this.appbinding.name
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
render() {
|
|
178
|
+
var binding = this.appbinding || {}
|
|
179
|
+
var app = this.appbinding?.application || {}
|
|
180
|
+
var refreshTokenExp = this._refreshTokenInfo?.exp
|
|
181
|
+
var accessTokenExp = this._accessTokenInfo?.exp
|
|
182
|
+
|
|
183
|
+
return html`
|
|
184
|
+
<div>
|
|
185
|
+
<h2><md-icon>link</md-icon> ${app.name}</h2>
|
|
186
|
+
<p page-description>${app.description}</p>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
${app.icon
|
|
190
|
+
? html`
|
|
191
|
+
<div icon>
|
|
192
|
+
<img src=${app.icon} />
|
|
193
|
+
</div>
|
|
194
|
+
`
|
|
195
|
+
: html``}
|
|
196
|
+
|
|
197
|
+
<form>
|
|
198
|
+
<div fieldset-container>
|
|
199
|
+
<fieldset>
|
|
200
|
+
<legend>application</legend>
|
|
201
|
+
<div field-2column>
|
|
202
|
+
<div field grid-span>
|
|
203
|
+
<label for="app-name">app name</label>
|
|
204
|
+
<input id="app-name" type="text" .value=${app.name} readonly />
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div field grid-span>
|
|
208
|
+
<label for="app-description">description</label>
|
|
209
|
+
<input id="app-description" type="text" .value=${app.description} readonly />
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div field>
|
|
213
|
+
<label for="contact-email">contact email</label>
|
|
214
|
+
<input id="contact-email" type="text" .value=${app.email} readonly />
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</fieldset>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div fieldset-container>
|
|
221
|
+
<fieldset>
|
|
222
|
+
<legend>binding</legend>
|
|
223
|
+
<div field-2column>
|
|
224
|
+
<div field grid-span>
|
|
225
|
+
<label for="id">id</label>
|
|
226
|
+
<input id="id" type="text" .value=${binding.id} readonly />
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<div field grid-span>
|
|
230
|
+
<label for="name">name</label>
|
|
231
|
+
<input id="name" type="text" .value=${binding.email} readonly />
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div field>
|
|
235
|
+
<label for="status">status</label>
|
|
236
|
+
<input id="status" type="text" .value=${binding.status} readonly />
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<div field>
|
|
240
|
+
<label for="scope">scope</label>
|
|
241
|
+
<input id="scope" type="text" .value=${binding.scope} readonly />
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
</fieldset>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div fieldset-container>
|
|
248
|
+
<fieldset>
|
|
249
|
+
<legend>binding credential</legend>
|
|
250
|
+
<div field-2column>
|
|
251
|
+
<div field grid-span>
|
|
252
|
+
<label for="access-token">access token</label>
|
|
253
|
+
<input id="access-token" type="text" .value=${this.accessToken || ''} readonly />
|
|
254
|
+
<button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
255
|
+
${accessTokenExp
|
|
256
|
+
? html`<div input-hint>
|
|
257
|
+
expired in ${new Date(accessTokenExp).toLocaleString()} :
|
|
258
|
+
${asyncReplace(this.expTimer(accessTokenExp))}
|
|
259
|
+
</div>`
|
|
260
|
+
: html``}
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div field grid-span>
|
|
264
|
+
<label for="refresh-token">refresh token</label>
|
|
265
|
+
<input id="refresh-token" type="text" .value=${binding.refreshToken || ''} readonly />
|
|
266
|
+
<button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
267
|
+
${refreshTokenExp
|
|
268
|
+
? html`<div input-hint>
|
|
269
|
+
expired in ${new Date(refreshTokenExp).toLocaleString()} :
|
|
270
|
+
${asyncReplace(this.expTimer(refreshTokenExp))}
|
|
271
|
+
</div>`
|
|
272
|
+
: html``}
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</fieldset>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<button @click=${this.deleteAppBinding.bind(this)}>delete this application binding</button>
|
|
279
|
+
<button @click=${this.renewApplicationAccessToken.bind(this)}>renew access token</button>
|
|
280
|
+
</form>
|
|
281
|
+
`
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
async *expTimer(exp) {
|
|
285
|
+
const DAY = 24 * 60 * 60
|
|
286
|
+
const HOUR = 60 * 60
|
|
287
|
+
const MIN = 60
|
|
288
|
+
|
|
289
|
+
while (this.active) {
|
|
290
|
+
var remain = Math.floor(Number(exp) - Date.now() / 1000)
|
|
291
|
+
const days = Math.floor(remain / DAY)
|
|
292
|
+
remain -= days * DAY
|
|
293
|
+
const hours = Math.floor(remain / HOUR)
|
|
294
|
+
remain -= hours * HOUR
|
|
295
|
+
const mins = Math.floor(remain / MIN)
|
|
296
|
+
const secs = remain - mins * MIN
|
|
297
|
+
|
|
298
|
+
yield `${days} days ${hours} hours ${mins} mins ${secs} seconds remain`
|
|
299
|
+
|
|
300
|
+
await sleep(1000)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
firstUpdated() {
|
|
305
|
+
const copybuttons = this.renderRoot.querySelectorAll('[clipboard-copy]')
|
|
306
|
+
|
|
307
|
+
this.clipboard = new Clipboard(copybuttons, {
|
|
308
|
+
target: (trigger => trigger.parentElement.querySelector('input')) as any
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
updated(changes) {
|
|
313
|
+
/*
|
|
314
|
+
* If this page properties are changed, this callback will be invoked.
|
|
315
|
+
* This callback will be called back only when this page is activated.
|
|
316
|
+
*/
|
|
317
|
+
if (changes.has('appbinding')) {
|
|
318
|
+
const { refreshToken } = this.appbinding || {}
|
|
319
|
+
this._refreshTokenInfo = refreshToken ? parseJwt(refreshToken) : {}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (changes.has('accessToken')) {
|
|
323
|
+
this._accessTokenInfo = this.accessToken ? parseJwt(this.accessToken) : {}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
async pageUpdated(changes, lifecycle, before) {
|
|
328
|
+
if (this.active) {
|
|
329
|
+
/*
|
|
330
|
+
* this page is activated
|
|
331
|
+
*/
|
|
332
|
+
await this.fetchAppBinding()
|
|
333
|
+
} else {
|
|
334
|
+
/* this page is deactivated */
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async fetchAppBinding() {
|
|
339
|
+
const response = await client.query({
|
|
340
|
+
query: gql`
|
|
341
|
+
query ($id: String!) {
|
|
342
|
+
appBinding(id: $id) {
|
|
343
|
+
id
|
|
344
|
+
name
|
|
345
|
+
description
|
|
346
|
+
email
|
|
347
|
+
scope
|
|
348
|
+
status
|
|
349
|
+
application {
|
|
350
|
+
id
|
|
351
|
+
name
|
|
352
|
+
description
|
|
353
|
+
email
|
|
354
|
+
icon
|
|
355
|
+
}
|
|
356
|
+
refreshToken
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
`,
|
|
360
|
+
variables: {
|
|
361
|
+
id: this.lifecycle.resourceId
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
this.appbinding = response.data.appBinding
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async deleteAppBinding(e) {
|
|
369
|
+
e.preventDefault()
|
|
370
|
+
|
|
371
|
+
const id = this.lifecycle.resourceId
|
|
372
|
+
|
|
373
|
+
const response = await client.mutate({
|
|
374
|
+
mutation: gql`
|
|
375
|
+
mutation ($id: String!) {
|
|
376
|
+
deleteAppBinding(id: $id)
|
|
377
|
+
}
|
|
378
|
+
`,
|
|
379
|
+
variables: {
|
|
380
|
+
id
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
const result = response.data.deleteAppBinding
|
|
385
|
+
if (result) {
|
|
386
|
+
console.log('delete sucess')
|
|
387
|
+
navigate(`app-bindings`)
|
|
388
|
+
} else {
|
|
389
|
+
console.error('delete fail')
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
async renewApplicationAccessToken(e) {
|
|
394
|
+
e.preventDefault()
|
|
395
|
+
|
|
396
|
+
const id = this.lifecycle.resourceId
|
|
397
|
+
|
|
398
|
+
const response = await client.mutate({
|
|
399
|
+
mutation: gql`
|
|
400
|
+
mutation ($id: String!) {
|
|
401
|
+
renewApplicationAccessToken(id: $id) {
|
|
402
|
+
accessToken
|
|
403
|
+
refreshToken
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`,
|
|
407
|
+
variables: {
|
|
408
|
+
id
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
|
|
412
|
+
if (response.errors) {
|
|
413
|
+
console.error('renew application access token fail')
|
|
414
|
+
} else {
|
|
415
|
+
const { accessToken, refreshToken } = response.data.renewApplicationAccessToken
|
|
416
|
+
this.accessToken = accessToken
|
|
417
|
+
this.appbinding = {
|
|
418
|
+
...this.appbinding,
|
|
419
|
+
refreshToken
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import '@material/web/button/elevated-button.js'
|
|
2
|
+
import '@material/web/button/outlined-button.js'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
7
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
8
|
+
|
|
9
|
+
import { client } from '@operato/graphql'
|
|
10
|
+
import { navigate, PageView, store } from '@operato/shell'
|
|
11
|
+
|
|
12
|
+
@customElement('app-bindings-page')
|
|
13
|
+
class AppBindings extends connect(store)(PageView) {
|
|
14
|
+
static styles = [
|
|
15
|
+
css`
|
|
16
|
+
:host {
|
|
17
|
+
background-color: var(--md-sys-color-background);
|
|
18
|
+
padding: var(--spacing-large);
|
|
19
|
+
|
|
20
|
+
overflow: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
md-elevated-button {
|
|
24
|
+
text-transform: capitalize;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
md-outlined-button {
|
|
28
|
+
float: right;
|
|
29
|
+
margin-top: var(--spacing-medium);
|
|
30
|
+
text-transform: capitalize;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h2 {
|
|
34
|
+
margin: var(--title-margin);
|
|
35
|
+
font: var(--title-font);
|
|
36
|
+
color: var(--title-text-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[page-description] {
|
|
40
|
+
margin: var(--page-description-margin);
|
|
41
|
+
font: var(--page-description-font);
|
|
42
|
+
color: var(--page-description-color);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
table {
|
|
46
|
+
width: 100%;
|
|
47
|
+
margin: var(--spacing-large) 0;
|
|
48
|
+
border-collapse: collapse;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tr {
|
|
52
|
+
background-color: var(--tr-background-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tr:nth-child(odd) {
|
|
56
|
+
background-color: var(--tr-background-odd-color);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tr:hover {
|
|
60
|
+
background-color: var(--tr-background-hover-color);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
th {
|
|
64
|
+
border-top: var(--th-border-top);
|
|
65
|
+
border-bottom: var(--td-border-bottom);
|
|
66
|
+
padding: var(--th-padding);
|
|
67
|
+
|
|
68
|
+
font: var(--th-font);
|
|
69
|
+
color: var(--th-color);
|
|
70
|
+
text-transform: var(--th-text-transform);
|
|
71
|
+
text-align: left;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
td {
|
|
75
|
+
padding: var(--td-padding);
|
|
76
|
+
border-bottom: var(--td-border-bottom);
|
|
77
|
+
font: var(--td-font);
|
|
78
|
+
color: var(--td-color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
td a {
|
|
82
|
+
color: var(--md-sys-color-primary);
|
|
83
|
+
font: bold 16px var(--theme-font);
|
|
84
|
+
|
|
85
|
+
display: block;
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.text-align-center {
|
|
90
|
+
text-align: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.text-align-right {
|
|
94
|
+
text-align: right;
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
@property({ type: Array }) appBindings: any[] = []
|
|
100
|
+
|
|
101
|
+
get context() {
|
|
102
|
+
return {
|
|
103
|
+
title: `application bindings`,
|
|
104
|
+
help: 'auth/application'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
var appBindings = this.appBindings || []
|
|
110
|
+
|
|
111
|
+
return html`
|
|
112
|
+
<div>
|
|
113
|
+
<h2>Bound Applications</h2>
|
|
114
|
+
<p page-description>Bound Applications goes here</p>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<table>
|
|
118
|
+
<tr>
|
|
119
|
+
<th>app name</th>
|
|
120
|
+
<th>Scope</th>
|
|
121
|
+
<th>status</th>
|
|
122
|
+
</tr>
|
|
123
|
+
${appBindings.map(
|
|
124
|
+
appBinding => html`
|
|
125
|
+
<tr>
|
|
126
|
+
<td>
|
|
127
|
+
<a href=${`app-binding/${appBinding.id}`}>${appBinding.name}</a>
|
|
128
|
+
${appBinding.description}
|
|
129
|
+
</td>
|
|
130
|
+
<td>${appBinding.scope}</td>
|
|
131
|
+
<td>${appBinding.status}</td>
|
|
132
|
+
</tr>
|
|
133
|
+
`
|
|
134
|
+
)}
|
|
135
|
+
</table>
|
|
136
|
+
<md-elevated-button @click=${e => navigate('applications')}>registered applications ..</md-elevated-button>
|
|
137
|
+
`
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async pageUpdated(changes, lifecycle, before) {
|
|
141
|
+
if (this.active) {
|
|
142
|
+
this.appBindings = (await this.fetchAppBindings()).items
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async fetchAppBindings() {
|
|
147
|
+
const response = await client.query({
|
|
148
|
+
query: gql`
|
|
149
|
+
query {
|
|
150
|
+
appBindings {
|
|
151
|
+
items {
|
|
152
|
+
id
|
|
153
|
+
name
|
|
154
|
+
application {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
}
|
|
158
|
+
scope
|
|
159
|
+
status
|
|
160
|
+
}
|
|
161
|
+
total
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
if (!response.errors) {
|
|
168
|
+
return response.data.appBindings
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|