@things-factory/auth-ui 10.1.16 → 10.1.18
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/dist-client/components/app-binding-detail.d.ts +46 -0
- package/dist-client/components/app-binding-detail.js +384 -0
- package/dist-client/components/app-binding-detail.js.map +1 -0
- package/dist-client/components/appliance-editor.d.ts +37 -0
- package/dist-client/components/appliance-editor.js +489 -0
- package/dist-client/components/appliance-editor.js.map +1 -0
- package/dist-client/components/application-editor.d.ts +31 -0
- package/dist-client/components/application-editor.js +491 -0
- package/dist-client/components/application-editor.js.map +1 -0
- package/dist-client/components/profile-component.js +28 -11
- package/dist-client/components/profile-component.js.map +1 -1
- package/dist-client/components/secret-field.d.ts +35 -0
- package/dist-client/components/secret-field.js +149 -0
- package/dist-client/components/secret-field.js.map +1 -0
- package/dist-client/constants/application-type-parity.test.js +62 -0
- package/dist-client/constants/application-type-parity.test.js.map +1 -0
- package/dist-client/constants/application.d.ts +17 -7
- package/dist-client/constants/application.js +18 -8
- package/dist-client/constants/application.js.map +1 -1
- package/dist-client/pages/app-binding/app-binding-list-query.test.js +46 -0
- package/dist-client/pages/app-binding/app-binding-list-query.test.js.map +1 -0
- package/dist-client/pages/app-binding/app-bindings.d.ts +65 -2
- package/dist-client/pages/app-binding/app-bindings.js +217 -117
- package/dist-client/pages/app-binding/app-bindings.js.map +1 -1
- package/dist-client/pages/appliance/appliance-list-query.test.d.ts +1 -0
- package/dist-client/pages/appliance/appliance-list-query.test.js +58 -0
- package/dist-client/pages/appliance/appliance-list-query.test.js.map +1 -0
- package/dist-client/pages/appliance/home.d.ts +63 -2
- package/dist-client/pages/appliance/home.js +219 -123
- package/dist-client/pages/appliance/home.js.map +1 -1
- package/dist-client/pages/application/applications.d.ts +63 -2
- package/dist-client/pages/application/applications.js +212 -129
- package/dist-client/pages/application/applications.js.map +1 -1
- package/dist-client/pages/auth-provider/auth-provider-management.d.ts +4 -2
- package/dist-client/pages/auth-provider/auth-provider-management.js +35 -6
- package/dist-client/pages/auth-provider/auth-provider-management.js.map +1 -1
- package/dist-client/pages/domain-owner/domain-owner-management.d.ts +2 -0
- package/dist-client/pages/domain-owner/domain-owner-management.js +34 -7
- package/dist-client/pages/domain-owner/domain-owner-management.js.map +1 -1
- package/dist-client/pages/secrets-are-not-printed.test.d.ts +1 -0
- package/dist-client/pages/secrets-are-not-printed.test.js +88 -0
- package/dist-client/pages/secrets-are-not-printed.test.js.map +1 -0
- package/dist-client/route.js +0 -15
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/application-status.d.ts +32 -0
- package/dist-client/utils/application-status.js +45 -0
- package/dist-client/utils/application-status.js.map +1 -0
- package/dist-client/utils/application-status.test.d.ts +1 -0
- package/dist-client/utils/application-status.test.js +45 -0
- package/dist-client/utils/application-status.test.js.map +1 -0
- package/dist-client/utils/form-values.d.ts +71 -0
- package/dist-client/utils/form-values.js +102 -0
- package/dist-client/utils/form-values.js.map +1 -0
- package/dist-client/utils/form-values.test.d.ts +1 -0
- package/dist-client/utils/form-values.test.js +120 -0
- package/dist-client/utils/form-values.test.js.map +1 -0
- package/dist-client/utils/list-result.d.ts +62 -0
- package/dist-client/utils/list-result.js +92 -0
- package/dist-client/utils/list-result.js.map +1 -0
- package/dist-client/utils/list-result.test.d.ts +1 -0
- package/dist-client/utils/list-result.test.js +160 -0
- package/dist-client/utils/list-result.test.js.map +1 -0
- package/dist-client/utils/secret-display.d.ts +51 -0
- package/dist-client/utils/secret-display.js +61 -0
- package/dist-client/utils/secret-display.js.map +1 -0
- package/dist-client/utils/secret-display.test.d.ts +1 -0
- package/dist-client/utils/secret-display.test.js +59 -0
- package/dist-client/utils/secret-display.test.js.map +1 -0
- package/dist-client/utils/webauthn-verification.d.ts +56 -0
- package/dist-client/utils/webauthn-verification.js +79 -0
- package/dist-client/utils/webauthn-verification.js.map +1 -0
- package/dist-client/utils/webauthn-verification.test.d.ts +1 -0
- package/dist-client/utils/webauthn-verification.test.js +79 -0
- package/dist-client/utils/webauthn-verification.test.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/things-factory.config.js +0 -5
- package/translations/en.json +56 -0
- package/translations/ja.json +57 -0
- package/translations/ko.json +56 -0
- package/translations/ms.json +57 -0
- package/translations/zh.json +57 -0
- package/dist-client/pages/app-binding/app-binding.d.ts +0 -1
- package/dist-client/pages/app-binding/app-binding.js +0 -371
- package/dist-client/pages/app-binding/app-binding.js.map +0 -1
- package/dist-client/pages/appliance/appliance.d.ts +0 -1
- package/dist-client/pages/appliance/appliance.js +0 -392
- package/dist-client/pages/appliance/appliance.js.map +0 -1
- package/dist-client/pages/appliance/register.js +0 -166
- package/dist-client/pages/appliance/register.js.map +0 -1
- package/dist-client/pages/application/application.d.ts +0 -1
- package/dist-client/pages/application/application.js +0 -377
- package/dist-client/pages/application/application.js.map +0 -1
- package/dist-client/pages/application/register.js +0 -192
- package/dist-client/pages/application/register.js.map +0 -1
- /package/dist-client/{pages/appliance/register.d.ts → constants/application-type-parity.test.d.ts} +0 -0
- /package/dist-client/pages/{application/register.d.ts → app-binding/app-binding-list-query.test.d.ts} +0 -0
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import '@material/web/icon/icon.js';
|
|
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 { APPLICATION_TYPES } from '../../constants/application.js';
|
|
8
|
-
import { client } from '@operato/graphql';
|
|
9
|
-
import { navigate, PageView } from '@operato/shell';
|
|
10
|
-
let Application = class Application extends PageView {
|
|
11
|
-
static { this.styles = [
|
|
12
|
-
css `
|
|
13
|
-
:host { display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
overflow-y: auto;
|
|
16
|
-
position: relative;
|
|
17
|
-
|
|
18
|
-
background-color: var(--md-sys-color-background);
|
|
19
|
-
padding: var(--spacing-large);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
h2 { margin: var(--title-margin);
|
|
23
|
-
font: var(--title-font);
|
|
24
|
-
color: var(--title-text-color);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[page-description] { margin: var(--page-description-margin);
|
|
28
|
-
font: var(--page-description-font);
|
|
29
|
-
color: var(--page-description-color);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[icon] { position: absolute;
|
|
33
|
-
top: 10px;
|
|
34
|
-
right: 10px;
|
|
35
|
-
max-width: 80px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[icon] img { max-width: 100%;
|
|
39
|
-
max-height: 100%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[button-primary] { background-color: var(--button-primary-background-color);
|
|
43
|
-
border: var(--button-border);
|
|
44
|
-
border-radius: var(--button-border-radius);
|
|
45
|
-
margin: var(--button-margin);
|
|
46
|
-
padding: var(--button-primary-padding);
|
|
47
|
-
color: var(--button-primary-color);
|
|
48
|
-
font: var(--button-primary-font);
|
|
49
|
-
text-transform: var(--button-text-transform);
|
|
50
|
-
|
|
51
|
-
text-decoration: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[button-primary]:hover { background-color: var(--button-primary-active-background-color);
|
|
55
|
-
box-shadow: var(--button-active-box-shadow);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
[fieldset-container] { background-color: var(--md-sys-color-surface);
|
|
59
|
-
margin: var(--spacing-large) 0 var(--spacing-medium) 0;
|
|
60
|
-
padding: var(--spacing-medium);
|
|
61
|
-
border-radius: var(--border-radius);
|
|
62
|
-
box-shadow: var(--box-shadow);
|
|
63
|
-
|
|
64
|
-
label { font: var(--label-font);
|
|
65
|
-
color: var(--label-color, var(--md-sys-color-on-surface));
|
|
66
|
-
text-transform: var(--label-text-transform);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
input,
|
|
70
|
-
select {
|
|
71
|
-
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
72
|
-
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
73
|
-
border: var(--border-dim-color);
|
|
74
|
-
border-radius: var(--border-radius);
|
|
75
|
-
margin: var(--input-margin);
|
|
76
|
-
padding: var(--input-padding);
|
|
77
|
-
font: var(--input-font);
|
|
78
|
-
|
|
79
|
-
flex: 1;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
select:focus,
|
|
83
|
-
input:focus,
|
|
84
|
-
button { outline: none;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
form { max-width: var(--content-container-max-width);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
[fieldset-container] fieldset { margin: 0;
|
|
92
|
-
margin-top: -15px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
fieldset { border-radius: var(--border-radius);
|
|
96
|
-
border: var(--border-dim-color);
|
|
97
|
-
margin: var(--fieldset-margin);
|
|
98
|
-
padding: var(--fieldset-padding);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
legend { padding: var(--legend-padding);
|
|
102
|
-
font-weight: bold;
|
|
103
|
-
color: var(--legend-color);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
[field-2column] { display: grid;
|
|
107
|
-
grid-template-columns: 1fr 1fr;
|
|
108
|
-
grid-gap: 15px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[field] { display: flex;
|
|
112
|
-
flex-direction: column;
|
|
113
|
-
position: relative;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
[grid-span] { grid-column: span 2;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
button { display: flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
gap: var(--spacing-small);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
button,
|
|
125
|
-
input[type='submit'],
|
|
126
|
-
[button-in-field] { background-color: var(--button-background-color);
|
|
127
|
-
border: var(--button-border);
|
|
128
|
-
border-radius: var(--button-border-radius);
|
|
129
|
-
padding: var(--button-padding);
|
|
130
|
-
color: var(--button-color);
|
|
131
|
-
font: var(--button-font);
|
|
132
|
-
text-transform: var(--button-text-transform);
|
|
133
|
-
|
|
134
|
-
margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);
|
|
135
|
-
float: right;
|
|
136
|
-
text-decoration: none;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
button:hover,
|
|
140
|
-
input[type='submit']:hover { border: var(--button-activ-border);
|
|
141
|
-
box-shadow: var(--button-active-box-shadow);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
[button-in-field] { border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
|
|
145
|
-
position: absolute;
|
|
146
|
-
top: 12px;
|
|
147
|
-
right: 0;
|
|
148
|
-
max-height: 36px;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
[input-hint] { font: var(--input-hint-font);
|
|
152
|
-
color: var(--input-hint-color);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@media screen and (max-width: 480px) { [field] { grid-column: span 2;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`
|
|
159
|
-
]; }
|
|
160
|
-
get context() {
|
|
161
|
-
return { title: { icon: 'apps',
|
|
162
|
-
text: this.application.name
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
render() {
|
|
167
|
-
var app = this.application || {};
|
|
168
|
-
return html `
|
|
169
|
-
<div>
|
|
170
|
-
<h2><md-icon>apps</md-icon> ${app.name}</h2>
|
|
171
|
-
<p page-description>${app.description}</p>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<div icon>
|
|
175
|
-
<img src=${app.icon} />
|
|
176
|
-
</div>
|
|
177
|
-
|
|
178
|
-
<form>
|
|
179
|
-
<div fieldset-container>
|
|
180
|
-
<fieldset>
|
|
181
|
-
<legend>application</legend>
|
|
182
|
-
<div field-2column>
|
|
183
|
-
<div field grid-span>
|
|
184
|
-
<label for="name">app name</label>
|
|
185
|
-
<input id="name" type="text" name="name" .value=${app.name} />
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div field grid-span>
|
|
189
|
-
<label for="description">description</label>
|
|
190
|
-
<input id="description" type="text" name="description" .value=${app.description} />
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<div field grid-span>
|
|
194
|
-
<label for="email">contact email</label>
|
|
195
|
-
<input id="email" type="text" name="email" .value=${app.email} />
|
|
196
|
-
</div>
|
|
197
|
-
|
|
198
|
-
<div field grid-span>
|
|
199
|
-
<label for="type-selector">type</label>
|
|
200
|
-
<select id="type-selector" name="type">
|
|
201
|
-
${APPLICATION_TYPES.map(type => html `<option value="${app.type}" ?selected="${type === app.type ? true : false}">${type}</option>`)}
|
|
202
|
-
</select>
|
|
203
|
-
</div>
|
|
204
|
-
|
|
205
|
-
<div field grid-span>
|
|
206
|
-
<label for="url">application URL</label>
|
|
207
|
-
<input id="url" type="text" name="url" .value=${app.url} />
|
|
208
|
-
</div>
|
|
209
|
-
|
|
210
|
-
<div field grid-span>
|
|
211
|
-
<label for="icon">icon</label>
|
|
212
|
-
<input id="icon" type="text" name="icon" .value=${app.icon} />
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
<div field grid-span>
|
|
216
|
-
<label for="redirect-url">redirect URL</label>
|
|
217
|
-
<input id="redirect-url" type="text" name="redirectUrl" .value=${app.redirectUrl} />
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
<div field grid-span>
|
|
221
|
-
<label for="webhook">webhook</label>
|
|
222
|
-
<input id="webhook" type="text" name="webhook" .value=${app.webhook} />
|
|
223
|
-
</div>
|
|
224
|
-
|
|
225
|
-
<div field grid-span>
|
|
226
|
-
<label for="available-scopes">available-scopes</label>
|
|
227
|
-
<input id="available-scopes" type="text" .value=${app.availableScopes} readonly />
|
|
228
|
-
</div>
|
|
229
|
-
|
|
230
|
-
<div field grid-span>
|
|
231
|
-
<label for="auth-url">auth URL</label>
|
|
232
|
-
<input id="auth-url" type="text" .value=${app.authUrl} readonly />
|
|
233
|
-
<button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
234
|
-
The endpoint for authorization server. This is used to get the authorization code.
|
|
235
|
-
</div>
|
|
236
|
-
|
|
237
|
-
<div field grid-span>
|
|
238
|
-
<label for="access-token-url">access token URL</label>
|
|
239
|
-
<input id="access-token-url" type="text" .value=${app.accessTokenUrl} readonly />
|
|
240
|
-
<button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
241
|
-
The endpoint for authentication server. This is used to exchange the authorization code for an access
|
|
242
|
-
token.
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</fieldset>
|
|
246
|
-
</div>
|
|
247
|
-
|
|
248
|
-
<div fieldset-container>
|
|
249
|
-
<fieldset>
|
|
250
|
-
<legend>credentials</legend>
|
|
251
|
-
<div field-2column>
|
|
252
|
-
<div field grid-span>
|
|
253
|
-
<label for="app-key">appKey</label>
|
|
254
|
-
<input id="app-key" type="text" .value=${app.appKey} readonly />
|
|
255
|
-
<button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
<div field grid-span>
|
|
259
|
-
<label for="app-secret">appSecret</label>
|
|
260
|
-
<input id="app-secret" type="text" .value=${app.appSecret} readonly />
|
|
261
|
-
<button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
|
|
262
|
-
</div>
|
|
263
|
-
</div>
|
|
264
|
-
</fieldset>
|
|
265
|
-
</div>
|
|
266
|
-
|
|
267
|
-
<div class="button-container">
|
|
268
|
-
<button danger @click=${this.deleteApplication.bind(this)}>
|
|
269
|
-
<md-icon>delete_forever</md-icon>delete this app
|
|
270
|
-
</button>
|
|
271
|
-
<button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>
|
|
272
|
-
<button><md-icon>passkey</md-icon>generate new secret</button>
|
|
273
|
-
</div>
|
|
274
|
-
</form>
|
|
275
|
-
`;
|
|
276
|
-
}
|
|
277
|
-
firstUpdated() {
|
|
278
|
-
this.clipboard = new Clipboard(this.copybuttons, { target: (trigger => trigger.parentElement.querySelector('input'))
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
async pageUpdated(changes, lifecycle, before) {
|
|
282
|
-
if (this.active) {
|
|
283
|
-
await this.fetchApplication();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
async fetchApplication() {
|
|
287
|
-
const response = await client.query({ query: gql `
|
|
288
|
-
query ($id: String!) { application(id: $id) { id
|
|
289
|
-
name
|
|
290
|
-
description
|
|
291
|
-
email
|
|
292
|
-
url
|
|
293
|
-
icon
|
|
294
|
-
redirectUrl
|
|
295
|
-
authUrl
|
|
296
|
-
accessTokenUrl
|
|
297
|
-
webhook
|
|
298
|
-
availableScopes
|
|
299
|
-
appKey
|
|
300
|
-
appSecret
|
|
301
|
-
type
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
`,
|
|
305
|
-
variables: { id: this.lifecycle.resourceId
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
this.application = response.data.application;
|
|
309
|
-
}
|
|
310
|
-
async updateApplication(e) {
|
|
311
|
-
e.preventDefault();
|
|
312
|
-
const form = this.renderRoot.querySelector('form');
|
|
313
|
-
const formData = new FormData(form);
|
|
314
|
-
const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {
|
|
315
|
-
patch[key] = value;
|
|
316
|
-
return patch;
|
|
317
|
-
}, {});
|
|
318
|
-
const id = this.lifecycle.resourceId;
|
|
319
|
-
const response = await client.mutate({ mutation: gql `
|
|
320
|
-
mutation ($id: String!, $patch: ApplicationPatch!) { updateApplication(id: $id, patch: $patch) { id
|
|
321
|
-
name
|
|
322
|
-
description
|
|
323
|
-
email
|
|
324
|
-
url
|
|
325
|
-
icon
|
|
326
|
-
redirectUrl
|
|
327
|
-
webhook
|
|
328
|
-
appKey
|
|
329
|
-
appSecret
|
|
330
|
-
type
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
`,
|
|
334
|
-
variables: { id,
|
|
335
|
-
patch
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
if (response.errors) {
|
|
339
|
-
console.error('update fail');
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
this.application = { ...this.application, ...response.data.updateApplication };
|
|
343
|
-
console.log('update sucess');
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
async deleteApplication(e) {
|
|
347
|
-
e.preventDefault();
|
|
348
|
-
const id = this.lifecycle.resourceId;
|
|
349
|
-
const response = await client.mutate({ mutation: gql `
|
|
350
|
-
mutation ($id: String!) { deleteApplication(id: $id)
|
|
351
|
-
}
|
|
352
|
-
`,
|
|
353
|
-
variables: { id
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
const result = response.data.deleteApplication;
|
|
357
|
-
if (result) {
|
|
358
|
-
console.log('delete sucess');
|
|
359
|
-
navigate('applications');
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
console.error('delete fail');
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
__decorate([
|
|
367
|
-
property({ type: Object }),
|
|
368
|
-
__metadata("design:type", Object)
|
|
369
|
-
], Application.prototype, "application", void 0);
|
|
370
|
-
__decorate([
|
|
371
|
-
queryAll('[clipboard-copy]'),
|
|
372
|
-
__metadata("design:type", Object)
|
|
373
|
-
], Application.prototype, "copybuttons", void 0);
|
|
374
|
-
Application = __decorate([
|
|
375
|
-
customElement('application-page')
|
|
376
|
-
], Application);
|
|
377
|
-
//# sourceMappingURL=application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application.js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AAiB,EAAE,CAAA;YACxF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QACjC,CAAC;IACD,CAAC;IAEA,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAAQ,CAAC,CAAC,cAAc,EAAE,CAAA;QAEjD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAA;QAEpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAQ,QAAQ,EAAE,GAAG,CAAA;;;OAGvD;YACD,SAAS,EAAE,EAAU,EAAE;aAC3B;SACA,CAAC,CAAA;QAEC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;QAC9C,IAAI,MAAM,EAAE,CAAC;YAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;YAC9C,QAAQ,CAAC,cAAc,CAAC,CAAA;QAC7B,CAAC;aAAM,CAAC;YAAO,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC3C,CAAC;IACD,CAAC;;AApN4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiB;AACd;IAA7B,QAAQ,CAAC,kBAAkB,CAAC;;gDAAY;AAvJrC,WAAW;IADhB,aAAa,CAAC,kBAAkB,CAAC;GAC5B,WAAW,CA2WhB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport Clipboard from 'clipboard'\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\nimport { APPLICATION_TYPES } from '../../constants/application.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('application-page')\nclass Application extends PageView { static styles = [\n css`\n :host { display: flex;\n flex-direction: column;\n overflow-y: auto;\n position: relative;\n\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n }\n\n h2 { margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] { margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n [icon] { position: absolute;\n top: 10px;\n right: 10px;\n max-width: 80px;\n }\n\n [icon] img { max-width: 100%;\n max-height: 100%;\n }\n\n [button-primary] { background-color: var(--button-primary-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n margin: var(--button-margin);\n padding: var(--button-primary-padding);\n color: var(--button-primary-color);\n font: var(--button-primary-font);\n text-transform: var(--button-text-transform);\n\n text-decoration: none;\n }\n\n [button-primary]:hover { background-color: var(--button-primary-active-background-color);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [fieldset-container] { background-color: var(--md-sys-color-surface);\n margin: var(--spacing-large) 0 var(--spacing-medium) 0;\n padding: var(--spacing-medium);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n\n label { font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n\n input,\n select {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n\n select:focus,\n input:focus,\n button { outline: none;\n }\n\n form { max-width: var(--content-container-max-width);\n }\n }\n\n [fieldset-container] fieldset { margin: 0;\n margin-top: -15px;\n }\n\n fieldset { border-radius: var(--border-radius);\n border: var(--border-dim-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n\n legend { padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n\n [field-2column] { display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] { display: flex;\n flex-direction: column;\n position: relative;\n }\n\n [grid-span] { grid-column: span 2;\n }\n\n button { display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n button,\n input[type='submit'],\n [button-in-field] { background-color: var(--button-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n padding: var(--button-padding);\n color: var(--button-color);\n font: var(--button-font);\n text-transform: var(--button-text-transform);\n\n margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);\n float: right;\n text-decoration: none;\n }\n\n button:hover,\n input[type='submit']:hover { border: var(--button-activ-border);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [button-in-field] { border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;\n position: absolute;\n top: 12px;\n right: 0;\n max-height: 36px;\n }\n\n [input-hint] { font: var(--input-hint-font);\n color: var(--input-hint-color);\n }\n\n @media screen and (max-width: 480px) { [field] { grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n @queryAll('[clipboard-copy]') copybuttons\n private clipboard?: Clipboard\n\n get context() { return { title: { icon: 'apps',\n text: this.application.name\n }\n }\n }\n\n render() { var app = this.application || {}\n\n return html`\n <div>\n <h2><md-icon>apps</md-icon> ${app.name}</h2>\n <p page-description>${app.description}</p>\n </div>\n\n <div icon>\n <img src=${app.icon} />\n </div>\n\n <form>\n <div fieldset-container>\n <fieldset>\n <legend>application</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">app name</label>\n <input id=\"name\" type=\"text\" name=\"name\" .value=${app.name} />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" .value=${app.description} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" .value=${app.email} />\n </div>\n\n <div field grid-span>\n <label for=\"type-selector\">type</label>\n <select id=\"type-selector\" name=\"type\">\n ${APPLICATION_TYPES.map(\n type =>\n html`<option value=\"${app.type}\" ?selected=\"${type === app.type ? true : false}\">${type}</option>`\n )}\n </select>\n </div>\n\n <div field grid-span>\n <label for=\"url\">application URL</label>\n <input id=\"url\" type=\"text\" name=\"url\" .value=${app.url} />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" .value=${app.icon} />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirect URL</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" .value=${app.redirectUrl} />\n </div>\n\n <div field grid-span>\n <label for=\"webhook\">webhook</label>\n <input id=\"webhook\" type=\"text\" name=\"webhook\" .value=${app.webhook} />\n </div>\n\n <div field grid-span>\n <label for=\"available-scopes\">available-scopes</label>\n <input id=\"available-scopes\" type=\"text\" .value=${app.availableScopes} readonly />\n </div>\n\n <div field grid-span>\n <label for=\"auth-url\">auth URL</label>\n <input id=\"auth-url\" type=\"text\" .value=${app.authUrl} readonly />\n <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n The endpoint for authorization server. This is used to get the authorization code.\n </div>\n\n <div field grid-span>\n <label for=\"access-token-url\">access token URL</label>\n <input id=\"access-token-url\" type=\"text\" .value=${app.accessTokenUrl} readonly />\n <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n The endpoint for authentication server. This is used to exchange the authorization code for an access\n token.\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <legend>credentials</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"app-key\">appKey</label>\n <input id=\"app-key\" type=\"text\" .value=${app.appKey} readonly />\n <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n\n <div field grid-span>\n <label for=\"app-secret\">appSecret</label>\n <input id=\"app-secret\" type=\"text\" .value=${app.appSecret} readonly />\n <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"button-container\">\n <button danger @click=${this.deleteApplication.bind(this)}>\n <md-icon>delete_forever</md-icon>delete this app\n </button>\n <button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>\n <button><md-icon>passkey</md-icon>generate new secret</button>\n </div>\n </form>\n `\n }\n\n firstUpdated() { this.clipboard = new Clipboard(this.copybuttons, { target: (trigger => trigger.parentElement.querySelector('input')) as any\n })\n }\n\n async pageUpdated(changes, lifecycle, before) { if (this.active) { await this.fetchApplication()\n }\n }\n\n async fetchApplication() { const response = await client.query({ query: gql`\n query ($id: String!) { application(id: $id) { id\n name\n description\n email\n url\n icon\n redirectUrl\n authUrl\n accessTokenUrl\n webhook\n availableScopes\n appKey\n appSecret\n type\n }\n }\n `,\n variables: { id: this.lifecycle.resourceId\n }\n })\n\n this.application = response.data.application\n }\n\n async updateApplication(e) { e.preventDefault()\n\n const form = this.renderRoot.querySelector('form') as HTMLFormElement\n const formData = new FormData(form)\n\n const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => { patch[key] = value\n return patch\n }, {})\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $patch: ApplicationPatch!) { updateApplication(id: $id, patch: $patch) { id\n name\n description\n email\n url\n icon\n redirectUrl\n webhook\n appKey\n appSecret\n type\n }\n }\n `,\n variables: { id,\n patch\n }\n })\n\n if (response.errors) { console.error('update fail')\n } else { this.application = { ...this.application, ...response.data.updateApplication }\n console.log('update sucess')\n }\n }\n\n async deleteApplication(e) { e.preventDefault()\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!) { deleteApplication(id: $id)\n }\n `,\n variables: { id\n }\n })\n\n const result = response.data.deleteApplication\n if (result) { console.log('delete sucess')\n navigate('applications')\n } else { console.error('delete fail')\n }\n }\n}\n"]}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import gql from 'graphql-tag';
|
|
3
|
-
import { css, html } from 'lit';
|
|
4
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
|
-
import { client } from '@operato/graphql';
|
|
6
|
-
import { navigate, PageView } from '@operato/shell';
|
|
7
|
-
let ApplicationRegister = class ApplicationRegister extends PageView {
|
|
8
|
-
static { this.styles = [
|
|
9
|
-
css `
|
|
10
|
-
:host { background-color: var(--md-sys-color-background);
|
|
11
|
-
padding: var(--spacing-large);
|
|
12
|
-
|
|
13
|
-
position: relative;
|
|
14
|
-
|
|
15
|
-
overflow: auto;
|
|
16
|
-
}
|
|
17
|
-
h2 { margin: var(--title-margin);
|
|
18
|
-
font: var(--title-font);
|
|
19
|
-
color: var(--title-text-color);
|
|
20
|
-
}
|
|
21
|
-
[page-description] { margin: var(--page-description-margin);
|
|
22
|
-
font: var(--page-description-font);
|
|
23
|
-
color: var(--page-description-color);
|
|
24
|
-
}
|
|
25
|
-
[icon] { position: absolute;
|
|
26
|
-
top: 10px;
|
|
27
|
-
right: 10px;
|
|
28
|
-
|
|
29
|
-
max-width: 80px;
|
|
30
|
-
}
|
|
31
|
-
[icon] img { max-width: 100%;
|
|
32
|
-
max-height: 100%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
img[pagedeco] { width: 150px;
|
|
36
|
-
margin: 0 var(--spacing-large);
|
|
37
|
-
float: left;
|
|
38
|
-
position: relative;
|
|
39
|
-
top: -20px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[form-container] { background-color: var(--md-sys-color-surface);
|
|
43
|
-
padding: var(--spacing-large);
|
|
44
|
-
border-radius: var(--border-radius);
|
|
45
|
-
box-shadow: var(--box-shadow);
|
|
46
|
-
max-width: var(--input-container-max-width);
|
|
47
|
-
position: relative;
|
|
48
|
-
top: -50px;
|
|
49
|
-
clear: both;
|
|
50
|
-
}
|
|
51
|
-
label { font: var(--label-font);
|
|
52
|
-
color: var(--label-color, var(--md-sys-color-on-surface));
|
|
53
|
-
text-transform: var(--label-text-transform);
|
|
54
|
-
}
|
|
55
|
-
input {
|
|
56
|
-
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
57
|
-
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
58
|
-
border: var(--border-dim-color);
|
|
59
|
-
border-radius: var(--border-radius);
|
|
60
|
-
margin: var(--input-margin);
|
|
61
|
-
padding: var(--input-padding);
|
|
62
|
-
font: var(--input-font);
|
|
63
|
-
|
|
64
|
-
flex: 1;
|
|
65
|
-
}
|
|
66
|
-
select:focus,
|
|
67
|
-
input:focus { outline: none;
|
|
68
|
-
}
|
|
69
|
-
[field-2column] { display: grid;
|
|
70
|
-
grid-template-columns: 1fr 1fr;
|
|
71
|
-
grid-gap: 15px;
|
|
72
|
-
}
|
|
73
|
-
[field] { display: flex;
|
|
74
|
-
flex-direction: column;
|
|
75
|
-
}
|
|
76
|
-
[grid-span] { grid-column: span 2;
|
|
77
|
-
}
|
|
78
|
-
@media screen and (max-width: 480px) { img[pagedeco] { display: none;
|
|
79
|
-
}
|
|
80
|
-
[form-container] { position: initial;
|
|
81
|
-
}
|
|
82
|
-
[field] { grid-column: span 2;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
`
|
|
86
|
-
]; }
|
|
87
|
-
get context() {
|
|
88
|
-
return { title: `application registration`,
|
|
89
|
-
help: 'auth/application'
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
render() {
|
|
93
|
-
return html `
|
|
94
|
-
<img src="/assets/images/image-api.png" pagedeco />
|
|
95
|
-
<h2>Register new application</h2>
|
|
96
|
-
<p page-description>
|
|
97
|
-
You can register new application here.<br />
|
|
98
|
-
What type of app are you building? Choose the app type that best suits the audience you’re building for.
|
|
99
|
-
</p>
|
|
100
|
-
|
|
101
|
-
${this._icon
|
|
102
|
-
? html `
|
|
103
|
-
<div icon>
|
|
104
|
-
<img src=${this._icon} />
|
|
105
|
-
</div>
|
|
106
|
-
`
|
|
107
|
-
: html ``}
|
|
108
|
-
|
|
109
|
-
<div form-container>
|
|
110
|
-
<form>
|
|
111
|
-
<div field-2column>
|
|
112
|
-
<div field grid-span>
|
|
113
|
-
<label for="name">name</label>
|
|
114
|
-
<input id="name" type="text" name="name" />
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<div field grid-span>
|
|
118
|
-
<label for="description">description</label>
|
|
119
|
-
<input id="description" type="text" name="description" />
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div field grid-span>
|
|
123
|
-
<label for="app-url">application url</label>
|
|
124
|
-
<input id="app-url" type="text" name="url" />
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div field grid-span>
|
|
128
|
-
<label for="redirect-url">redirectUrl</label>
|
|
129
|
-
<input id="redirect-url" type="text" name="redirectUrl" />
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<div field grid-span>
|
|
133
|
-
<label for="icon">application icon</label>
|
|
134
|
-
<input id="icon" type="text" name="icon" @change=${e => (this._icon = e.target.value)} />
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<div field grid-span>
|
|
138
|
-
<label for="email">contact email</label>
|
|
139
|
-
<input id="email" type="text" name="email" />
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
<md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>
|
|
143
|
-
</div>
|
|
144
|
-
</form>
|
|
145
|
-
</div>
|
|
146
|
-
`;
|
|
147
|
-
}
|
|
148
|
-
async createApplication(e) {
|
|
149
|
-
e.preventDefault();
|
|
150
|
-
const formData = new FormData(this.form);
|
|
151
|
-
const application = Array.from(formData.entries()).reduce((application, [key, value]) => {
|
|
152
|
-
application[key] = value;
|
|
153
|
-
return application;
|
|
154
|
-
}, {});
|
|
155
|
-
const response = await client.mutate({ mutation: gql `
|
|
156
|
-
mutation ($application: NewApplication!) { createApplication(application: $application) { id
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
`,
|
|
160
|
-
variables: { application
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
if (response.errors) {
|
|
164
|
-
console.log('creation fail.');
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
const id = response.data.createApplication.id;
|
|
168
|
-
navigate(`application/${id}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
pageUpdated(changes, lifecycle, before) {
|
|
172
|
-
if (this.active) {
|
|
173
|
-
this.form.reset();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
__decorate([
|
|
178
|
-
property({ type: Object }),
|
|
179
|
-
__metadata("design:type", Object)
|
|
180
|
-
], ApplicationRegister.prototype, "application", void 0);
|
|
181
|
-
__decorate([
|
|
182
|
-
query('form'),
|
|
183
|
-
__metadata("design:type", HTMLFormElement)
|
|
184
|
-
], ApplicationRegister.prototype, "form", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
state(),
|
|
187
|
-
__metadata("design:type", String)
|
|
188
|
-
], ApplicationRegister.prototype, "_icon", void 0);
|
|
189
|
-
ApplicationRegister = __decorate([
|
|
190
|
-
customElement('application-register')
|
|
191
|
-
], ApplicationRegister);
|
|
192
|
-
//# sourceMappingURL=register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../client/pages/application/register.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGnD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,QAAQ;aAAY,WAAM,GAAG;QAC3D,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4EF;KACF,AA9EyD,CA8EzD;IAQD,IA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BAAiB,CAAC,EAAE,CAAA;YACvD,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAClC,CAAC;IACD,CAAC;IAEA,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACzF,CAAC;IACD,CAAC;;AA5F4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAE7B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;iDAAA;AAE5B;IAAR,KAAK,EAAE;;kDAAe;AApFnB,mBAAmB;IADxB,aAAa,CAAC,sBAAsB,CAAC;GAChC,mBAAmB,CA6KxB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('application-register')\nclass ApplicationRegister extends PageView { static styles = [\n css`\n :host { background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\n }\n h2 { margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n [page-description] { margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n [icon] { position: absolute;\n top: 10px;\n right: 10px;\n\n max-width: 80px;\n }\n [icon] img { max-width: 100%;\n max-height: 100%;\n }\n\n img[pagedeco] { width: 150px;\n margin: 0 var(--spacing-large);\n float: left;\n position: relative;\n top: -20px;\n }\n\n [form-container] { background-color: var(--md-sys-color-surface);\n padding: var(--spacing-large);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n max-width: var(--input-container-max-width);\n position: relative;\n top: -50px;\n clear: both;\n }\n label { font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n input {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n select:focus,\n input:focus { outline: none;\n }\n [field-2column] { display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n [field] { display: flex;\n flex-direction: column;\n }\n [grid-span] { grid-column: span 2;\n }\n @media screen and (max-width: 480px) { img[pagedeco] { display: none;\n }\n [form-container] { position: initial;\n }\n [field] { grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n\n @query('form') form!: HTMLFormElement\n\n @state() _icon?: string\n\n get context() { return { title: `application registration`,\n help: 'auth/application'\n }\n }\n\n render() { return html`\n <img src=\"/assets/images/image-api.png\" pagedeco />\n <h2>Register new application</h2>\n <p page-description>\n You can register new application here.<br />\n What type of app are you building? Choose the app type that best suits the audience you’re building for.\n </p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <div form-container>\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input id=\"name\" type=\"text\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"app-url\">application url</label>\n <input id=\"app-url\" type=\"text\" name=\"url\" />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirectUrl</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">application icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" />\n </div>\n\n <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>\n </div>\n </form>\n </div>\n `\n }\n\n async createApplication(e) { e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const application = Array.from(formData.entries()).reduce((application, [key, value]) => { application[key] = value\n return application\n }, {})\n\n const response = await client.mutate({ mutation: gql`\n mutation ($application: NewApplication!) { createApplication(application: $application) { id\n }\n }\n `,\n variables: { application\n }\n })\n\n if (response.errors) { console.log('creation fail.')\n } else { const id = response.data.createApplication.id\n navigate(`application/${id}`)\n }\n }\n\n pageUpdated(changes, lifecycle, before) { if (this.active) { this.form.reset()\n }\n }\n}\n"]}
|
/package/dist-client/{pages/appliance/register.d.ts → constants/application-type-parity.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|