@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,160 +1,243 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import '@material/web/
|
|
3
|
-
import '@
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@operato/data-grist/ox-grist.js';
|
|
4
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
4
5
|
import gql from 'graphql-tag';
|
|
5
6
|
import { css, html } from 'lit';
|
|
6
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
7
|
-
import { client } from '@operato/graphql';
|
|
8
|
-
import {
|
|
9
|
-
|
|
7
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
8
|
+
import { client, gqlContext } from '@operato/graphql';
|
|
9
|
+
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { openPopup } from '@operato/layout';
|
|
11
|
+
import { PageView } from '@operato/shell';
|
|
12
|
+
import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
13
|
+
import { isMobileDevice } from '@operato/utils';
|
|
14
|
+
import { p13n } from '@operato/p13n';
|
|
15
|
+
import '../../components/application-editor.js';
|
|
16
|
+
import { applicationStatusLabel } from '../../utils/application-status.js';
|
|
17
|
+
import { listOutcome, pageFromResponse } from '../../utils/list-result.js';
|
|
18
|
+
/**
|
|
19
|
+
* Registered applications.
|
|
20
|
+
*
|
|
21
|
+
* ── What this screen looked like before ──────────────────────────────────────
|
|
22
|
+
* A hand-written `<table>` with no paging, no sort and no search, and three columns that
|
|
23
|
+
* were not data at all: "API health" printed OK, "Installs" printed 1, "status" printed
|
|
24
|
+
* draft — written into the markup, identical on every row. The previous commit removed the
|
|
25
|
+
* two the server cannot answer and made status real. This one gives the list the same shape
|
|
26
|
+
* as every other list in the product.
|
|
27
|
+
*
|
|
28
|
+
* The server was already ready for it: `applications` takes ListParam and declares
|
|
29
|
+
* `searchables: ['name', 'description']`, so paging, sorting and the header's search box all
|
|
30
|
+
* work by passing the grist's own options through.
|
|
31
|
+
*
|
|
32
|
+
* ── Why the row does not carry health or install counts ──────────────────────
|
|
33
|
+
* Because Application does not declare them. If they arrive one day, they are columns; until
|
|
34
|
+
* then the screen says what it knows. See `utils/application-status.ts` for the matching rule
|
|
35
|
+
* on values the screen has no word for.
|
|
36
|
+
*/
|
|
37
|
+
let Applications = class Applications extends p13n(localize(i18next)(PageView)) {
|
|
10
38
|
constructor() {
|
|
11
39
|
super(...arguments);
|
|
12
|
-
this.
|
|
40
|
+
this.active = false;
|
|
41
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
42
|
+
/** The last fetch did not answer. Distinct from answering with nothing. */
|
|
43
|
+
this.failed = false;
|
|
13
44
|
}
|
|
14
45
|
static { this.styles = [
|
|
46
|
+
CommonGristStyles,
|
|
47
|
+
CommonHeaderStyles,
|
|
48
|
+
ScrollbarStyles,
|
|
15
49
|
css `
|
|
16
|
-
:host {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
overflow:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
color: var(--title-text-color);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[page-description] { margin: var(--page-description-margin);
|
|
36
|
-
font: var(--page-description-font);
|
|
37
|
-
color: var(--page-description-color);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
table { margin: var(--spacing-large) 0;
|
|
41
|
-
width: 100%;
|
|
42
|
-
border-collapse: collapse;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
tr { background-color: var(--tr-background-color);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
tr:nth-child(odd) { background-color: var(--tr-background-odd-color);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
tr:hover { background-color: var(--tr-background-hover-color);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
th { border-top: var(--th-border-top);
|
|
55
|
-
border-bottom: var(--td-border-bottom);
|
|
56
|
-
padding: var(--th-padding);
|
|
57
|
-
|
|
58
|
-
font: var(--th-font);
|
|
59
|
-
color: var(--th-color);
|
|
60
|
-
text-transform: var(--th-text-transform);
|
|
61
|
-
text-align: left;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
td { padding: var(--td-padding);
|
|
65
|
-
border-bottom: var(--td-border-bottom);
|
|
66
|
-
font: var(--td-font);
|
|
67
|
-
color: var(--td-color);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
td a { font: var(--td-font);
|
|
71
|
-
text-decoration: none;
|
|
72
|
-
color: var(--md-sys-color-on-surface);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
td a strong { font: bold 16px var(--theme-font);
|
|
76
|
-
|
|
77
|
-
display: block;
|
|
78
|
-
text-decoration: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.text-align-center { text-align: center;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.text-align-right { text-align: right;
|
|
85
|
-
}
|
|
50
|
+
:host {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ox-grist {
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
flex: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[failed] {
|
|
62
|
+
padding: var(--spacing-medium);
|
|
63
|
+
color: var(--md-sys-color-error);
|
|
64
|
+
font: var(--label-font, inherit);
|
|
65
|
+
}
|
|
86
66
|
`
|
|
87
67
|
]; }
|
|
88
68
|
get context() {
|
|
89
|
-
return {
|
|
90
|
-
|
|
69
|
+
return {
|
|
70
|
+
title: i18next.t('text.applications'),
|
|
71
|
+
help: 'auth/application',
|
|
72
|
+
search: {
|
|
73
|
+
handler: (search) => {
|
|
74
|
+
this.grist.searchText = search;
|
|
75
|
+
},
|
|
76
|
+
value: this.grist?.searchText || ''
|
|
77
|
+
},
|
|
78
|
+
actions: [
|
|
79
|
+
{
|
|
80
|
+
title: i18next.t('button.register'),
|
|
81
|
+
action: () => this.openEditor(),
|
|
82
|
+
icon: 'add'
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
toolbar: false
|
|
91
86
|
};
|
|
92
87
|
}
|
|
93
88
|
render() {
|
|
94
|
-
var apps = this.applications || [];
|
|
95
89
|
return html `
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
>
|
|
105
|
-
</
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<tr>
|
|
109
|
-
<th>app name</th>
|
|
110
|
-
<th>API health</th>
|
|
111
|
-
<th>Installs</th>
|
|
112
|
-
<th>status</th>
|
|
113
|
-
</tr>
|
|
114
|
-
${apps.map(app => html `
|
|
115
|
-
<tr>
|
|
116
|
-
<td>
|
|
117
|
-
<a href=${`application/${app.id}`}>
|
|
118
|
-
<strong>${app.name}</strong>
|
|
119
|
-
${app.description}
|
|
120
|
-
</a>
|
|
121
|
-
</td>
|
|
122
|
-
<td>OK</td>
|
|
123
|
-
<td class="text-align-center">1</td>
|
|
124
|
-
<td>draft</td>
|
|
125
|
-
</tr>
|
|
126
|
-
`)}
|
|
127
|
-
</table>
|
|
128
|
-
|
|
129
|
-
<md-outlined-button @click=${e => navigate('app-bindings')}>bound applications ..</md-outlined-button>
|
|
90
|
+
<ox-grist
|
|
91
|
+
.mode=${this.mode}
|
|
92
|
+
.config=${this.config}
|
|
93
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
94
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')}
|
|
95
|
+
>
|
|
96
|
+
<div slot="headroom" class="header">
|
|
97
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
|
|
98
|
+
</div>
|
|
99
|
+
</ox-grist>
|
|
100
|
+
|
|
101
|
+
${this.failed ? html `<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}
|
|
130
102
|
`;
|
|
131
103
|
}
|
|
132
|
-
async
|
|
104
|
+
async pageInitialized() {
|
|
105
|
+
this.config = {
|
|
106
|
+
rows: { appendable: false, selectable: { multiple: false } },
|
|
107
|
+
columns: [
|
|
108
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
109
|
+
{
|
|
110
|
+
type: 'gutter',
|
|
111
|
+
gutterName: 'button',
|
|
112
|
+
icon: 'chevron_right',
|
|
113
|
+
title: i18next.t('button.detail'),
|
|
114
|
+
handlers: {
|
|
115
|
+
click: (_columns, _data, _column, record) => {
|
|
116
|
+
if (record?.id) {
|
|
117
|
+
this.openEditor(record.id);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'string',
|
|
124
|
+
name: 'name',
|
|
125
|
+
header: i18next.t('field.name'),
|
|
126
|
+
record: { editable: false },
|
|
127
|
+
sortable: true,
|
|
128
|
+
width: 200
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'string',
|
|
132
|
+
name: 'description',
|
|
133
|
+
header: i18next.t('field.description'),
|
|
134
|
+
record: { editable: false },
|
|
135
|
+
width: 260
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: 'string',
|
|
139
|
+
name: 'type',
|
|
140
|
+
header: i18next.t('field.type'),
|
|
141
|
+
record: { align: 'center', editable: false },
|
|
142
|
+
sortable: true,
|
|
143
|
+
width: 120
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'string',
|
|
147
|
+
name: 'statusLabel',
|
|
148
|
+
header: i18next.t('field.status'),
|
|
149
|
+
record: { align: 'center', editable: false },
|
|
150
|
+
width: 120
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'datetime',
|
|
154
|
+
name: 'updatedAt',
|
|
155
|
+
header: i18next.t('field.updated at'),
|
|
156
|
+
sortable: true,
|
|
157
|
+
width: 180
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/*
|
|
163
|
+
* Registering and editing both happen over the list, the way every other resource in this
|
|
164
|
+
* package works. `application-register` and `application/{id}` were routes; nothing outside
|
|
165
|
+
* auth-ui linked to either.
|
|
166
|
+
*/
|
|
167
|
+
openEditor(applicationId) {
|
|
168
|
+
const popup = openPopup(html `<application-editor
|
|
169
|
+
.applicationId=${applicationId}
|
|
170
|
+
@application-changed=${() => this.grist.fetch()}
|
|
171
|
+
@close=${() => popup.close()}
|
|
172
|
+
></application-editor>`, {
|
|
173
|
+
backdrop: true,
|
|
174
|
+
size: 'medium',
|
|
175
|
+
title: applicationId ? i18next.t('text.application') : i18next.t('text.register new application')
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async pageUpdated(_changes, _lifecycle) {
|
|
133
179
|
if (this.active) {
|
|
134
|
-
|
|
180
|
+
await this.updateComplete;
|
|
181
|
+
this.grist.fetch();
|
|
135
182
|
}
|
|
136
183
|
}
|
|
137
|
-
async
|
|
138
|
-
const response = await client.query({
|
|
139
|
-
|
|
184
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
185
|
+
const response = await client.query({
|
|
186
|
+
query: gql `
|
|
187
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
188
|
+
applications(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
189
|
+
items {
|
|
190
|
+
id
|
|
140
191
|
name
|
|
141
192
|
description
|
|
142
|
-
|
|
193
|
+
type
|
|
194
|
+
status
|
|
195
|
+
updatedAt
|
|
196
|
+
}
|
|
143
197
|
total
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
`
|
|
147
|
-
});
|
|
148
|
-
if (!response.errors) {
|
|
149
|
-
return response.data.applications;
|
|
198
|
+
}
|
|
150
199
|
}
|
|
200
|
+
`,
|
|
201
|
+
variables: { filters, pagination: { page, limit }, sortings },
|
|
202
|
+
context: gqlContext()
|
|
203
|
+
});
|
|
204
|
+
const { items, total, failed } = listOutcome(pageFromResponse(response, 'applications'));
|
|
205
|
+
this.failed = failed;
|
|
206
|
+
/*
|
|
207
|
+
* The status is turned into words here rather than in a cell renderer so the rule lives
|
|
208
|
+
* in one tested place — a value this screen has no word for is printed as it arrived.
|
|
209
|
+
*/
|
|
210
|
+
return {
|
|
211
|
+
total,
|
|
212
|
+
records: items.map((item) => ({
|
|
213
|
+
...item,
|
|
214
|
+
statusLabel: applicationStatusLabel(item.status, (key) => i18next.t(key))
|
|
215
|
+
}))
|
|
216
|
+
};
|
|
151
217
|
}
|
|
152
218
|
};
|
|
153
219
|
__decorate([
|
|
154
|
-
property({ type:
|
|
155
|
-
__metadata("design:type",
|
|
156
|
-
], Applications.prototype, "
|
|
220
|
+
property({ type: Boolean }),
|
|
221
|
+
__metadata("design:type", Boolean)
|
|
222
|
+
], Applications.prototype, "active", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: Object }),
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], Applications.prototype, "config", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: String }),
|
|
229
|
+
__metadata("design:type", String)
|
|
230
|
+
], Applications.prototype, "mode", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: Boolean }),
|
|
233
|
+
__metadata("design:type", Boolean)
|
|
234
|
+
], Applications.prototype, "failed", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
query('ox-grist'),
|
|
237
|
+
__metadata("design:type", Function)
|
|
238
|
+
], Applications.prototype, "grist", void 0);
|
|
157
239
|
Applications = __decorate([
|
|
158
240
|
customElement('applications-page')
|
|
159
241
|
], Applications);
|
|
242
|
+
export { Applications };
|
|
160
243
|
//# sourceMappingURL=applications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applications.js","sourceRoot":"","sources":["../../../client/pages/application/applications.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAChD,OAAO,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGnD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,QAAQ;IAAnC;;QA2E6B,i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B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAyB;AA3E/C,YAAY;IADjB,aAAa,CAAC,mBAAmB,CAAC;GAC7B,YAAY,CA8IjB","sourcesContent":["import '@material/web/button/elevated-button.js'\nimport '@material/web/button/outlined-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('applications-page')\nclass Applications extends PageView { static styles = [\n css`\n :host { background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n overflow: auto;\n }\n\n md-elevated-button { text-transform: capitalize;\n }\n\n md-outlined-button { float: right;\n margin-top: var(--spacing-medium);\n text-transform: capitalize;\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 table { margin: var(--spacing-large) 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n tr { background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) { background-color: var(--tr-background-odd-color);\n }\n\n tr:hover { background-color: var(--tr-background-hover-color);\n }\n\n th { border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n padding: var(--th-padding);\n\n font: var(--th-font);\n color: var(--th-color);\n text-transform: var(--th-text-transform);\n text-align: left;\n }\n\n td { padding: var(--td-padding);\n border-bottom: var(--td-border-bottom);\n font: var(--td-font);\n color: var(--td-color);\n }\n\n td a { font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong { font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center { text-align: center;\n }\n\n .text-align-right { text-align: right;\n }\n `\n ]\n\n @property({ type: Array }) applications: any[] = []\n\n get context() { return { title: `applications`,\n help: 'auth/application'\n }\n }\n\n render() { var apps = this.applications || []\n\n return html`\n <div>\n <h2>Registered Applications</h2>\n <p page-description>\n What type of app are you building?<br />Choose the app type that best suits the audience you’re building for.\n </p>\n\n <md-elevated-button @click=${e => navigate('application-register')}\n >register new application</md-elevated-button\n >\n </div>\n\n <table>\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${apps.map(\n app => html`\n <tr>\n <td>\n <a href=${`application/${app.id}`}>\n <strong>${app.name}</strong>\n ${app.description}\n </a>\n </td>\n <td>OK</td>\n <td class=\"text-align-center\">1</td>\n <td>draft</td>\n </tr>\n `\n )}\n </table>\n\n <md-outlined-button @click=${e => navigate('app-bindings')}>bound applications ..</md-outlined-button>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) { if (this.active) { this.applications = (await this.fetchApplications()).items\n }\n }\n\n async fetchApplications() { const response = await client.query({ query: gql`\n query { applications { items { id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (!response.errors) { return response.data.applications\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"applications.js","sourceRoot":"","sources":["../../../client/pages/application/applications.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,6CAA6C,CAAA;AAEpD,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,MAAM,mBAAmB,CAAA;AAGlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAA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IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAAoE;AAGlE;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;4CAAwB;AAEzB;IAA1B,KAAK,CAAC,UAAU,CAAC;;2CAA0B;AAhCjC,YAAY;IADxB,aAAa,CAAC,mBAAmB,CAAC;GACtB,YAAY,CAmMxB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\nimport '../../components/application-editor.js'\nimport { applicationStatusLabel } from '../../utils/application-status.js'\nimport { listOutcome, pageFromResponse } from '../../utils/list-result.js'\n\n/**\n * Registered applications.\n *\n * ── What this screen looked like before ──────────────────────────────────────\n * A hand-written `<table>` with no paging, no sort and no search, and three columns that\n * were not data at all: \"API health\" printed OK, \"Installs\" printed 1, \"status\" printed\n * draft — written into the markup, identical on every row. The previous commit removed the\n * two the server cannot answer and made status real. This one gives the list the same shape\n * as every other list in the product.\n *\n * The server was already ready for it: `applications` takes ListParam and declares\n * `searchables: ['name', 'description']`, so paging, sorting and the header's search box all\n * work by passing the grist's own options through.\n *\n * ── Why the row does not carry health or install counts ──────────────────────\n * Because Application does not declare them. If they arrive one day, they are columns; until\n * then the screen says what it knows. See `utils/application-status.ts` for the matching rule\n * on values the screen has no word for.\n */\n@customElement('applications-page')\nexport class Applications extends p13n(localize(i18next)(PageView)) {\n static styles = [\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n [failed] {\n padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n font: var(--label-font, inherit);\n }\n `\n ]\n\n @property({ type: Boolean }) active: boolean = false\n @property({ type: Object }) config: any\n @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'\n\n /** The last fetch did not answer. Distinct from answering with nothing. */\n @property({ type: Boolean }) failed: boolean = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.applications'),\n help: 'auth/application',\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n actions: [\n {\n title: i18next.t('button.register'),\n action: () => this.openEditor(),\n icon: 'add'\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${this.mode}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <div slot=\"headroom\" class=\"header\">\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized() {\n this.config = {\n rows: { appendable: false, selectable: { multiple: false } },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'chevron_right',\n title: i18next.t('button.detail'),\n handlers: {\n click: (_columns: any, _data: any, _column: any, record: any) => {\n if (record?.id) {\n this.openEditor(record.id)\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: false },\n sortable: true,\n width: 200\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: false },\n width: 260\n },\n {\n type: 'string',\n name: 'type',\n header: i18next.t('field.type'),\n record: { align: 'center', editable: false },\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'statusLabel',\n header: i18next.t('field.status'),\n record: { align: 'center', editable: false },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated at'),\n sortable: true,\n width: 180\n }\n ]\n }\n }\n\n /*\n * Registering and editing both happen over the list, the way every other resource in this\n * package works. `application-register` and `application/{id}` were routes; nothing outside\n * auth-ui linked to either.\n */\n private openEditor(applicationId?: string) {\n const popup = openPopup(\n html`<application-editor\n .applicationId=${applicationId}\n @application-changed=${() => this.grist.fetch()}\n @close=${() => popup.close()}\n ></application-editor>`,\n {\n backdrop: true,\n size: 'medium',\n title: applicationId ? i18next.t('text.application') : i18next.t('text.register new application')\n }\n )\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n applications(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n type\n status\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings },\n context: gqlContext()\n })\n\n const { items, total, failed } = listOutcome(pageFromResponse(response, 'applications'))\n\n this.failed = failed\n\n /*\n * The status is turned into words here rather than in a cell renderer so the rule lives\n * in one tested place — a value this screen has no word for is printed as it arrived.\n */\n return {\n total,\n records: items.map((item: any) => ({\n ...item,\n statusLabel: applicationStatusLabel(item.status, (key: string) => i18next.t(key))\n }))\n }\n }\n}\n"]}
|
|
@@ -13,6 +13,8 @@ export declare class AuthProviderManagementPage extends AuthProviderManagementPa
|
|
|
13
13
|
static styles: import("lit").CSSResult[];
|
|
14
14
|
gristConfig: any;
|
|
15
15
|
mode: 'CARD' | 'GRID' | 'LIST';
|
|
16
|
+
/** The last fetch did not answer. Distinct from answering with nothing. */
|
|
17
|
+
failed: boolean;
|
|
16
18
|
authProviderTypes: {
|
|
17
19
|
type: string;
|
|
18
20
|
description?: string;
|
|
@@ -47,8 +49,8 @@ export declare class AuthProviderManagementPage extends AuthProviderManagementPa
|
|
|
47
49
|
render(): import("lit-html").TemplateResult<1>;
|
|
48
50
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
49
51
|
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
50
|
-
total:
|
|
51
|
-
records: any;
|
|
52
|
+
total: number;
|
|
53
|
+
records: any[];
|
|
52
54
|
}>;
|
|
53
55
|
private deleteAuthProvider;
|
|
54
56
|
private updateAuthProvider;
|
|
@@ -14,10 +14,13 @@ import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato
|
|
|
14
14
|
import { isMobileDevice } from '@operato/utils';
|
|
15
15
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
16
16
|
import { p13n } from '@operato/p13n';
|
|
17
|
+
import { listOutcome, pageFromResponse } from '../../utils/list-result.js';
|
|
17
18
|
let AuthProviderManagementPage = class AuthProviderManagementPage extends p13n(localize(i18next)(PageView)) {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
21
|
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
22
|
+
/** The last fetch did not answer. Distinct from answering with nothing. */
|
|
23
|
+
this.failed = false;
|
|
21
24
|
this.authProviderTypes = [];
|
|
22
25
|
}
|
|
23
26
|
static { this.styles = [
|
|
@@ -36,6 +39,11 @@ let AuthProviderManagementPage = class AuthProviderManagementPage extends p13n(l
|
|
|
36
39
|
ox-grist { overflow-y: auto;
|
|
37
40
|
flex: 1;
|
|
38
41
|
}
|
|
42
|
+
|
|
43
|
+
[failed] { padding: var(--spacing-medium);
|
|
44
|
+
color: var(--md-sys-color-error);
|
|
45
|
+
font: var(--label-font, inherit);
|
|
46
|
+
}
|
|
39
47
|
`
|
|
40
48
|
]; }
|
|
41
49
|
get context() {
|
|
@@ -83,6 +91,8 @@ let AuthProviderManagementPage = class AuthProviderManagementPage extends p13n(l
|
|
|
83
91
|
|
|
84
92
|
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
85
93
|
</ox-grist>
|
|
94
|
+
|
|
95
|
+
${this.failed ? html `<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}
|
|
86
96
|
`;
|
|
87
97
|
}
|
|
88
98
|
async pageInitialized(lifecycle) {
|
|
@@ -134,14 +144,14 @@ let AuthProviderManagementPage = class AuthProviderManagementPage extends p13n(l
|
|
|
134
144
|
},
|
|
135
145
|
width: 200
|
|
136
146
|
},
|
|
137
|
-
{ type: '
|
|
147
|
+
{ type: 'secret',
|
|
138
148
|
name: 'clientSecret',
|
|
139
149
|
header: i18next.t('field.client-secret'),
|
|
140
150
|
record: { editable: true
|
|
141
151
|
},
|
|
142
152
|
width: 200
|
|
143
153
|
},
|
|
144
|
-
{ type: '
|
|
154
|
+
{ type: 'secret',
|
|
145
155
|
name: 'privateKey',
|
|
146
156
|
header: i18next.t('field.private-key'),
|
|
147
157
|
record: { editable: true
|
|
@@ -211,10 +221,25 @@ let AuthProviderManagementPage = class AuthProviderManagementPage extends p13n(l
|
|
|
211
221
|
sortings
|
|
212
222
|
}
|
|
213
223
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
/*
|
|
225
|
+
This read `response.data.authProviderTypes.items` with no check at all. On a refused
|
|
226
|
+
query `data` is null, so the line threw inside the grist's fetch handler — an empty
|
|
227
|
+
grid and nothing said.
|
|
228
|
+
|
|
229
|
+
`clientSecret` and `privateKey` each carry their own
|
|
230
|
+
`@privilege(category: "security", privilege: "query", domainOwnerGranted: true)`, so a
|
|
231
|
+
viewer without that privilege gets the whole list **plus** one error per withheld
|
|
232
|
+
value. Those errors point inside the page, and `pageFromResponse` reads the path and
|
|
233
|
+
keeps the list — blacking it out would take the screen away from everyone who may see
|
|
234
|
+
the providers but not their secrets.
|
|
235
|
+
*/
|
|
236
|
+
const types = pageFromResponse(response, 'authProviderTypes');
|
|
237
|
+
if (types) {
|
|
238
|
+
this.authProviderTypes = types.items;
|
|
239
|
+
}
|
|
240
|
+
const { items, total, failed } = listOutcome(pageFromResponse(response, 'responses'));
|
|
241
|
+
this.failed = failed;
|
|
242
|
+
return { total, records: items };
|
|
218
243
|
}
|
|
219
244
|
async deleteAuthProvider() {
|
|
220
245
|
if (await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
|
|
@@ -298,6 +323,10 @@ __decorate([
|
|
|
298
323
|
state(),
|
|
299
324
|
__metadata("design:type", String)
|
|
300
325
|
], AuthProviderManagementPage.prototype, "mode", void 0);
|
|
326
|
+
__decorate([
|
|
327
|
+
state(),
|
|
328
|
+
__metadata("design:type", Boolean)
|
|
329
|
+
], AuthProviderManagementPage.prototype, "failed", void 0);
|
|
301
330
|
__decorate([
|
|
302
331
|
state(),
|
|
303
332
|
__metadata("design:type", Array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-provider-management.js","sourceRoot":"","sources":["../../../client/pages/auth-provider/auth-provider-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AAEpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAwC,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,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I,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBAAW,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;oBAClD,MAAM,CAAC,EAAc,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAAE,CAAC;qBACjH,CAAC,CAAA;gBACF,CAAC;YACD,CAAC;QACD,CAAC;IACD,CAAC;;AApQS;IAAR,KAAK,EAAE;;+DAAiB;AAChB;IAAR,KAAK,EAAE;;wDAAoE;AACnE;IAAR,KAAK,EAAE;;qEAAuG;AAEpF;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;yDAAA;AAvBjC,0BAA0B;IADtC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,0BAA0B,CAwRtC","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice, sleep } from '@operato/utils'\nimport { OxPopup } from '@operato/popup'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { p13n } from '@operato/p13n'\n\n@customElement('auth-provider-management')\nexport class AuthProviderManagementPage extends p13n(localize(i18next)(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n @state() authProviderTypes: { type: string; description?: string; help?: string; parameterSpec?: any[] }[] = []\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.auth-provider'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n // help: 'auth/auth-provider',\n actions: [\n { title: i18next.t('button.save'),\n action: this.updateAuthProvider.bind(this),\n icon: 'save'\n },\n { title: i18next.t('button.delete'),\n action: this.deleteAuthProvider.bind(this),\n icon: 'delete',\n emphasis: { danger: true\n }\n }\n ],\n toolbar: false\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">${i18next.t('title.auth-provider')}</div>\n\n <ox-filters-form autofocus without-search class=\"filters\"></ox-filters-form>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}> </ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { fields: ['entity', 'description']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'gutter',\n gutterName: 'button',\n title: i18next.t('title.auth-provider'),\n icon: 'sync',\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) return\n this.synchronizeUsers(record.id)\n }\n }\n },\n { type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: { editable: true,\n options: () => ['', ...this.authProviderTypes.map(({ type }) => type)]\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'boolean',\n name: 'active',\n header: i18next.t('field.active'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'tenantId',\n header: i18next.t('field.tenant-id'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'string',\n name: 'clientId',\n header: i18next.t('field.client-id'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'string',\n name: 'clientSecret',\n header: i18next.t('field.client-secret'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'string',\n name: 'privateKey',\n header: i18next.t('field.private-key'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'parameters',\n name: 'params',\n header: i18next.t('field.params'),\n record: { editable: true,\n options: async (value, column, record, row, field) => { const { description,\n help,\n parameterSpec: spec\n } = record.type ? this.authProviderTypes[record.type] : ({} as any)\n const context = this.grist\n\n return { description, help, spec, context }\n },\n renderer: 'json5'\n },\n width: 200\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'type'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { authProviderTypes { items { type\n description\n help\n parameterSpec { type\n label\n name\n placeholder\n property\n styles\n }\n }\n total\n }\n\n responses: authProviders(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n type\n active\n tenantId\n clientId\n clientSecret\n privateKey\n params\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n this.authProviderTypes = response.data.authProviderTypes.items\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n private async deleteAuthProvider() { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteAuthProviders(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n private async updateAuthProvider() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n if (patchField['reportTemplate'] instanceof FileList) { patchField['reportTemplate'] = patchField['reportTemplate'][0]\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [AuthProviderPatch!]!) { updateMultipleAuthProvider(patches: $patches) { id\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n private async synchronizeUsers(id: string) { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.synchronize') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { if (id && id.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($id: String!) { synchronizeAuthProviderUsers(id: $id)\n }\n `,\n variables: { id\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.synchronize') })\n })\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"auth-provider-management.js","sourceRoot":"","sources":["../../../client/pages/auth-provider/auth-provider-management.ts"],"names":[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oE;AAEnE;IAAR,KAAK,EAAE;;0DAAwB;AAEvB;IAAR,KAAK,EAAE;;qEAAuG;AAEpF;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;yDAAA;AA/BjC,0BAA0B;IADtC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,0BAA0B,CAoTtC","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice, sleep } from '@operato/utils'\nimport { OxPopup } from '@operato/popup'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { p13n } from '@operato/p13n'\n\nimport { listOutcome, pageFromResponse } from '../../utils/list-result.js'\n\n@customElement('auth-provider-management')\nexport class AuthProviderManagementPage extends p13n(localize(i18next)(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n\n [failed] { padding: var(--spacing-medium);\n color: var(--md-sys-color-error);\n font: var(--label-font, inherit);\n }\n `\n ]\n\n @state() gristConfig: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n /** The last fetch did not answer. Distinct from answering with nothing. */\n @state() failed: boolean = false\n\n @state() authProviderTypes: { type: string; description?: string; help?: string; parameterSpec?: any[] }[] = []\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.auth-provider'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n // help: 'auth/auth-provider',\n actions: [\n { title: i18next.t('button.save'),\n action: this.updateAuthProvider.bind(this),\n icon: 'save'\n },\n { title: i18next.t('button.delete'),\n action: this.deleteAuthProvider.bind(this),\n icon: 'delete',\n emphasis: { danger: true\n }\n }\n ],\n toolbar: false\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">${i18next.t('title.auth-provider')}</div>\n\n <ox-filters-form autofocus without-search class=\"filters\"></ox-filters-form>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}> </ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n\n ${this.failed ? html`<div failed>${i18next.t('text.the list could not be loaded')}</div>` : ''}\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { fields: ['entity', 'description']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'gutter',\n gutterName: 'button',\n title: i18next.t('title.auth-provider'),\n icon: 'sync',\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) return\n this.synchronizeUsers(record.id)\n }\n }\n },\n { type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: { editable: true,\n options: () => ['', ...this.authProviderTypes.map(({ type }) => type)]\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'boolean',\n name: 'active',\n header: i18next.t('field.active'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'tenantId',\n header: i18next.t('field.tenant-id'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'string',\n name: 'clientId',\n header: i18next.t('field.client-id'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'secret',\n name: 'clientSecret',\n header: i18next.t('field.client-secret'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'secret',\n name: 'privateKey',\n header: i18next.t('field.private-key'),\n record: { editable: true\n },\n width: 200\n },\n { type: 'parameters',\n name: 'params',\n header: i18next.t('field.params'),\n record: { editable: true,\n options: async (value, column, record, row, field) => { const { description,\n help,\n parameterSpec: spec\n } = record.type ? this.authProviderTypes[record.type] : ({} as any)\n const context = this.grist\n\n return { description, help, spec, context }\n },\n renderer: 'json5'\n },\n width: 200\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'type'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { authProviderTypes { items { type\n description\n help\n parameterSpec { type\n label\n name\n placeholder\n property\n styles\n }\n }\n total\n }\n\n responses: authProviders(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n type\n active\n tenantId\n clientId\n clientSecret\n privateKey\n params\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n /*\n This read `response.data.authProviderTypes.items` with no check at all. On a refused\n query `data` is null, so the line threw inside the grist's fetch handler — an empty\n grid and nothing said.\n\n `clientSecret` and `privateKey` each carry their own\n `@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)`, so a\n viewer without that privilege gets the whole list **plus** one error per withheld\n value. Those errors point inside the page, and `pageFromResponse` reads the path and\n keeps the list — blacking it out would take the screen away from everyone who may see\n the providers but not their secrets.\n */\n const types = pageFromResponse(response, 'authProviderTypes')\n\n if (types) {\n this.authProviderTypes = types.items\n }\n\n const { items, total, failed } = listOutcome(pageFromResponse(response, 'responses'))\n\n this.failed = failed\n\n return { total, records: items }\n }\n\n private async deleteAuthProvider() { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteAuthProviders(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n private async updateAuthProvider() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n if (patchField['reportTemplate'] instanceof FileList) { patchField['reportTemplate'] = patchField['reportTemplate'][0]\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [AuthProviderPatch!]!) { updateMultipleAuthProvider(patches: $patches) { id\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n private async synchronizeUsers(id: string) { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.synchronize') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { if (id && id.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($id: String!) { synchronizeAuthProviderUsers(id: $id)\n }\n `,\n variables: { id\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.synchronize') })\n })\n }\n }\n }\n }\n}\n"]}
|
|
@@ -23,6 +23,8 @@ export declare class DomainOwnerManagement extends DomainOwnerManagement_base {
|
|
|
23
23
|
config: any;
|
|
24
24
|
mode: 'CARD' | 'LIST' | 'GRID';
|
|
25
25
|
private isDomainOwner;
|
|
26
|
+
/** The last fetch did not answer. Distinct from answering with nothing. */
|
|
27
|
+
private failed;
|
|
26
28
|
private grist;
|
|
27
29
|
get context(): {
|
|
28
30
|
title: string;
|