@things-factory/oauth2-client 5.0.14 → 5.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist-client/bootstrap.d.ts +1 -0
  2. package/dist-client/bootstrap.js +2 -0
  3. package/dist-client/bootstrap.js.map +1 -0
  4. package/dist-client/index.d.ts +0 -0
  5. package/dist-client/index.js +2 -0
  6. package/dist-client/index.js.map +1 -0
  7. package/dist-client/pages/oauth2-client/oauth2-client-importer.d.ts +22 -0
  8. package/dist-client/pages/oauth2-client/oauth2-client-importer.js +100 -0
  9. package/dist-client/pages/oauth2-client/oauth2-client-importer.js.map +1 -0
  10. package/dist-client/pages/oauth2-client/oauth2-client-list-page.d.ts +55 -0
  11. package/dist-client/pages/oauth2-client/oauth2-client-list-page.js +315 -0
  12. package/dist-client/pages/oauth2-client/oauth2-client-list-page.js.map +1 -0
  13. package/dist-client/pages/oauth2-client-register.d.ts +21 -0
  14. package/dist-client/pages/oauth2-client-register.js +190 -0
  15. package/dist-client/pages/oauth2-client-register.js.map +1 -0
  16. package/dist-client/pages/oauth2-client.d.ts +35 -0
  17. package/dist-client/pages/oauth2-client.js +586 -0
  18. package/dist-client/pages/oauth2-client.js.map +1 -0
  19. package/dist-client/pages/oauth2-clients.d.ts +1 -0
  20. package/dist-client/pages/oauth2-clients.js +194 -0
  21. package/dist-client/pages/oauth2-clients.js.map +1 -0
  22. package/dist-client/route.d.ts +1 -0
  23. package/dist-client/route.js +14 -0
  24. package/dist-client/route.js.map +1 -0
  25. package/dist-client/tsconfig.tsbuildinfo +1 -0
  26. package/dist-server/entities/oauth2-client.js.map +1 -1
  27. package/dist-server/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ export default function bootstrap(): void;
@@ -0,0 +1,2 @@
1
+ export default function bootstrap() { }
2
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,KAAI,CAAC","sourcesContent":["export default function bootstrap() {}\n"]}
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -0,0 +1,22 @@
1
+ import '@operato/data-grist';
2
+ import { LitElement } from 'lit';
3
+ export declare class Oauth2ClientImporter extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ oauth2Clients: any[];
6
+ columns: {
7
+ list: {
8
+ fields: string[];
9
+ };
10
+ pagination: {
11
+ infinite: boolean;
12
+ };
13
+ columns: {
14
+ type: string;
15
+ name: string;
16
+ header: string;
17
+ width: number;
18
+ }[];
19
+ };
20
+ render(): import("lit-html").TemplateResult<1>;
21
+ save(): Promise<void>;
22
+ }
@@ -0,0 +1,100 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import gql from 'graphql-tag';
4
+ import { css, html, LitElement } from 'lit';
5
+ import { property } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import { i18next } from '@operato/i18n';
8
+ import { isMobileDevice } from '@operato/utils';
9
+ export class Oauth2ClientImporter extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.oauth2Clients = [];
13
+ this.columns = {
14
+ list: { fields: ['name', 'description'] },
15
+ pagination: { infinite: true },
16
+ columns: [
17
+ {
18
+ type: 'string',
19
+ name: 'name',
20
+ header: i18next.t('field.name'),
21
+ width: 150
22
+ },
23
+ {
24
+ type: 'string',
25
+ name: 'description',
26
+ header: i18next.t('field.description'),
27
+ width: 200
28
+ },
29
+ {
30
+ type: 'checkbox',
31
+ name: 'active',
32
+ header: i18next.t('field.active'),
33
+ width: 60
34
+ }
35
+ ]
36
+ };
37
+ }
38
+ render() {
39
+ return html `
40
+ <ox-grist
41
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
42
+ .config=${this.columns}
43
+ .data=${{
44
+ records: this.oauth2Clients
45
+ }}
46
+ ></ox-grist>
47
+
48
+ <div class="button-container">
49
+ <mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
50
+ </div>
51
+ `;
52
+ }
53
+ async save() {
54
+ var _a;
55
+ const response = await client.mutate({
56
+ mutation: gql `
57
+ mutation importOauth2Clients($oauth2Clients: [Oauth2ClientPatch!]!) {
58
+ importOauth2Clients(oauth2Clients: $oauth2Clients)
59
+ }
60
+ `,
61
+ variables: { oauth2Clients: this.oauth2Clients }
62
+ });
63
+ if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)
64
+ return;
65
+ this.dispatchEvent(new CustomEvent('imported'));
66
+ }
67
+ }
68
+ Oauth2ClientImporter.styles = [
69
+ css `
70
+ :host {
71
+ display: flex;
72
+ flex-direction: column;
73
+
74
+ background-color: #fff;
75
+ }
76
+
77
+ ox-grist {
78
+ flex: 1;
79
+ }
80
+
81
+ .button-container {
82
+ display: flex;
83
+ margin-left: auto;
84
+ padding: var(--padding-default);
85
+ }
86
+
87
+ mwc-button {
88
+ margin-left: var(--margin-default);
89
+ }
90
+ `
91
+ ];
92
+ __decorate([
93
+ property({ type: Array }),
94
+ __metadata("design:type", Array)
95
+ ], Oauth2ClientImporter.prototype, "oauth2Clients", void 0);
96
+ __decorate([
97
+ property({ type: Object }),
98
+ __metadata("design:type", Object)
99
+ ], Oauth2ClientImporter.prototype, "columns", void 0);
100
+ //# sourceMappingURL=oauth2-client-importer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2-client-importer.js","sourceRoot":"","sources":["../../../client/pages/oauth2-client/oauth2-client-importer.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE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Aa,CAAC;;KAEjF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;;QACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE;SACjD,CAAC,CAAA;QAEF,IAAI,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM;YAAE,OAAM;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,CAAC;;AAnFM,2BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;2DAA0B;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAuB1B","sourcesContent":["import '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\n\nexport class Oauth2ClientImporter extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n padding: var(--padding-default);\n }\n\n mwc-button {\n margin-left: var(--margin-default);\n }\n `\n ]\n\n @property({ type: Array }) oauth2Clients: any[] = []\n @property({ type: Object }) columns = {\n list: { fields: ['name', 'description'] },\n pagination: { infinite: true },\n columns: [\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n width: 60\n }\n ]\n }\n\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${\n { \n records: this.oauth2Clients \n }\n }\n ></ox-grist>\n\n <div class=\"button-container\">\n <mwc-button raised @click=\"${this.save.bind(this)}\">${i18next.t('button.save')}</mwc-button>\n </div>\n `\n }\n\n async save() {\n const response = await client.mutate({\n mutation: gql`\n mutation importOauth2Clients($oauth2Clients: [Oauth2ClientPatch!]!) {\n importOauth2Clients(oauth2Clients: $oauth2Clients)\n }\n `,\n variables: { oauth2Clients: this.oauth2Clients }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n\n"]}
@@ -0,0 +1,55 @@
1
+ import '@operato/data-grist';
2
+ import { PageView } from '@operato/shell';
3
+ import { FetchOption } from '@operato/data-grist';
4
+ import { Oauth2ClientImporter } from './oauth2-client-importer';
5
+ declare const Oauth2ClientListPage_base: (new (...args: any[]) => {
6
+ _storeUnsubscribe: import("redux").Unsubscribe;
7
+ connectedCallback(): void;
8
+ disconnectedCallback(): void;
9
+ stateChanged(_state: unknown): void;
10
+ readonly isConnected: boolean;
11
+ }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
12
+ export declare class Oauth2ClientListPage extends Oauth2ClientListPage_base {
13
+ static styles: import("lit").CSSResult[];
14
+ static get scopedElements(): {
15
+ 'oauth2-client-importer': typeof Oauth2ClientImporter;
16
+ };
17
+ gristConfig: any;
18
+ mode: 'CARD' | 'GRID' | 'LIST';
19
+ private grist;
20
+ private sortersControl;
21
+ get context(): {
22
+ title: string;
23
+ help: string;
24
+ actions: {
25
+ icon: string;
26
+ emphasis: {
27
+ raised: boolean;
28
+ outlined: boolean;
29
+ dense: boolean;
30
+ danger: boolean;
31
+ };
32
+ title: string;
33
+ action: () => Promise<void>;
34
+ }[];
35
+ exportable: {
36
+ name: string;
37
+ data: () => Promise<{}[]>;
38
+ };
39
+ importable: {
40
+ handler: (records: any) => Promise<void>;
41
+ };
42
+ };
43
+ render(): import("lit-html").TemplateResult<1>;
44
+ pageInitialized(lifecycle: any): Promise<void>;
45
+ pageUpdated(changes: any, lifecycle: any): Promise<void>;
46
+ fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
47
+ total: any;
48
+ records: any;
49
+ }>;
50
+ _deleteOauth2Client(): Promise<void>;
51
+ _updateOauth2Client(): Promise<void>;
52
+ exportHandler(): Promise<{}[]>;
53
+ importHandler(records: any): Promise<void>;
54
+ }
55
+ export {};
@@ -0,0 +1,315 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
+ import { PageView, store } from '@operato/shell';
5
+ import { css, html } from 'lit';
6
+ import { customElement, property, query } from 'lit/decorators.js';
7
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
8
+ import { DataGrist } from '@operato/data-grist';
9
+ import { client } from '@operato/graphql';
10
+ import { i18next, localize } from '@operato/i18n';
11
+ import { notify, openPopup } from '@operato/layout';
12
+ import { OxPopup } from '@operato/popup';
13
+ import { isMobileDevice } from '@operato/utils';
14
+ import { connect } from 'pwa-helpers/connect-mixin';
15
+ import gql from 'graphql-tag';
16
+ import { Oauth2ClientImporter } from './oauth2-client-importer';
17
+ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.mode = isMobileDevice() ? 'CARD' : 'GRID';
21
+ }
22
+ static get scopedElements() {
23
+ return {
24
+ 'oauth2-client-importer': Oauth2ClientImporter
25
+ };
26
+ }
27
+ get context() {
28
+ return {
29
+ title: i18next.t('title.oauth2-client list'),
30
+ help: 'oauth2-client/oauth2-client',
31
+ actions: [
32
+ Object.assign({ title: i18next.t('button.save'), action: this._updateOauth2Client.bind(this) }, CommonButtonStyles.save),
33
+ Object.assign({ title: i18next.t('button.delete'), action: this._deleteOauth2Client.bind(this) }, CommonButtonStyles.delete)
34
+ ],
35
+ exportable: {
36
+ name: i18next.t('title.oauth2-client list'),
37
+ data: this.exportHandler.bind(this)
38
+ },
39
+ importable: {
40
+ handler: this.importHandler.bind(this)
41
+ }
42
+ };
43
+ }
44
+ render() {
45
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
46
+ return html `
47
+ <ox-grist
48
+ .mode=${mode}
49
+ .config=${this.gristConfig}
50
+ .fetchHandler=${this.fetchHandler.bind(this)}
51
+ >
52
+ <div slot="headroom">
53
+ <div id="filters">
54
+ <ox-filters-form autofocus></ox-filters-form>
55
+ </div>
56
+
57
+ <div id="sorters">
58
+ Sort
59
+ <mwc-icon
60
+ @click=${e => {
61
+ const target = e.currentTarget;
62
+ this.sortersControl.open({
63
+ right: 0,
64
+ top: target.offsetTop + target.offsetHeight
65
+ });
66
+ }}
67
+ >expand_more</mwc-icon
68
+ >
69
+ <ox-popup id="sorter-control">
70
+ <ox-sorters-control> </ox-sorters-control>
71
+ </ox-popup>
72
+ </div>
73
+
74
+ <div id="modes">
75
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
76
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
77
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
78
+ </div>
79
+ </div>
80
+ </ox-grist>
81
+ `;
82
+ }
83
+ async pageInitialized(lifecycle) {
84
+ this.gristConfig = {
85
+ list: {
86
+ fields: ['name', 'description'],
87
+ details: ['active', 'updatedAt']
88
+ },
89
+ columns: [
90
+ { type: 'gutter', gutterName: 'sequence' },
91
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
92
+ {
93
+ type: 'string',
94
+ name: 'name',
95
+ header: i18next.t('field.name'),
96
+ record: {
97
+ editable: true
98
+ },
99
+ filter: 'search',
100
+ sortable: true,
101
+ width: 150
102
+ },
103
+ {
104
+ type: 'string',
105
+ name: 'description',
106
+ header: i18next.t('field.description'),
107
+ record: {
108
+ editable: true
109
+ },
110
+ filter: 'search',
111
+ width: 200
112
+ },
113
+ {
114
+ type: 'checkbox',
115
+ name: 'active',
116
+ label: true,
117
+ header: i18next.t('field.active'),
118
+ record: {
119
+ editable: true
120
+ },
121
+ filter: true,
122
+ sortable: true,
123
+ width: 60
124
+ },
125
+ {
126
+ type: 'resource-object',
127
+ name: 'updater',
128
+ header: i18next.t('field.updater'),
129
+ record: {
130
+ editable: false
131
+ },
132
+ sortable: true,
133
+ width: 120
134
+ },
135
+ {
136
+ type: 'datetime',
137
+ name: 'updatedAt',
138
+ header: i18next.t('field.updated_at'),
139
+ record: {
140
+ editable: false
141
+ },
142
+ sortable: true,
143
+ width: 180
144
+ }
145
+ ],
146
+ rows: {
147
+ selectable: {
148
+ multiple: true
149
+ }
150
+ },
151
+ sorters: [
152
+ {
153
+ name: 'name'
154
+ }
155
+ ]
156
+ };
157
+ }
158
+ async pageUpdated(changes, lifecycle) {
159
+ if (this.active) {
160
+ // do something here when this page just became as active
161
+ }
162
+ }
163
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
164
+ const response = await client.query({
165
+ query: gql `
166
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
167
+ responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) {
168
+ items {
169
+ id
170
+ name
171
+ description
172
+ active
173
+ updater {
174
+ id
175
+ name
176
+ }
177
+ updatedAt
178
+ }
179
+ total
180
+ }
181
+ }
182
+ `,
183
+ variables: {
184
+ filters,
185
+ pagination: { page, limit },
186
+ sortings
187
+ }
188
+ });
189
+ return {
190
+ total: response.data.responses.total || 0,
191
+ records: response.data.responses.items || []
192
+ };
193
+ }
194
+ async _deleteOauth2Client() {
195
+ if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
196
+ const ids = this.grist.selected.map(record => record.id);
197
+ if (ids && ids.length > 0) {
198
+ const response = await client.mutate({
199
+ mutation: gql `
200
+ mutation ($ids: [String!]!) {
201
+ deleteOauth2Clients(ids: $ids)
202
+ }
203
+ `,
204
+ variables: {
205
+ ids
206
+ }
207
+ });
208
+ if (!response.errors) {
209
+ this.grist.fetch();
210
+ notify({
211
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
212
+ });
213
+ }
214
+ }
215
+ }
216
+ }
217
+ async _updateOauth2Client() {
218
+ let patches = this.grist.dirtyRecords;
219
+ if (patches && patches.length) {
220
+ patches = patches.map(patch => {
221
+ let patchField = patch.id ? { id: patch.id } : {};
222
+ const dirtyFields = patch.__dirtyfields__;
223
+ for (let key in dirtyFields) {
224
+ patchField[key] = dirtyFields[key].after;
225
+ }
226
+ patchField.cuFlag = patch.__dirty__;
227
+ return patchField;
228
+ });
229
+ const response = await client.mutate({
230
+ mutation: gql `
231
+ mutation ($patches: [Oauth2ClientPatch!]!) {
232
+ updateMultipleOauth2Client(patches: $patches) {
233
+ name
234
+ }
235
+ }
236
+ `,
237
+ variables: {
238
+ patches
239
+ }
240
+ });
241
+ if (!response.errors) {
242
+ this.grist.fetch();
243
+ }
244
+ }
245
+ }
246
+ async exportHandler() {
247
+ const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
248
+ const targetFieldSet = new Set([
249
+ 'id',
250
+ 'name',
251
+ 'description',
252
+ 'active'
253
+ ]);
254
+ return exportTargets.map(oauth2Client => {
255
+ let tempObj = {};
256
+ for (const field of targetFieldSet) {
257
+ tempObj[field] = oauth2Client[field];
258
+ }
259
+ return tempObj;
260
+ });
261
+ }
262
+ async importHandler(records) {
263
+ const popup = openPopup(html `
264
+ <oauth2-client-importer
265
+ .oauth2Clients=${records}
266
+ @imported=${() => {
267
+ history.back();
268
+ this.grist.fetch();
269
+ }}
270
+ ></oauth2-client-importer>
271
+ `, {
272
+ backdrop: true,
273
+ size: 'large',
274
+ title: i18next.t('title.import oauth2-client')
275
+ });
276
+ popup.onclosed = () => {
277
+ this.grist.fetch();
278
+ };
279
+ }
280
+ };
281
+ Oauth2ClientListPage.styles = [
282
+ ScrollbarStyles,
283
+ CommonGristStyles,
284
+ css `
285
+ :host {
286
+ display: flex;
287
+
288
+ width: 100%;
289
+
290
+ --grid-record-emphasized-background-color: red;
291
+ --grid-record-emphasized-color: yellow;
292
+ }
293
+ `
294
+ ];
295
+ __decorate([
296
+ property({ type: Object }),
297
+ __metadata("design:type", Object)
298
+ ], Oauth2ClientListPage.prototype, "gristConfig", void 0);
299
+ __decorate([
300
+ property({ type: String }),
301
+ __metadata("design:type", String)
302
+ ], Oauth2ClientListPage.prototype, "mode", void 0);
303
+ __decorate([
304
+ query('ox-grist'),
305
+ __metadata("design:type", DataGrist)
306
+ ], Oauth2ClientListPage.prototype, "grist", void 0);
307
+ __decorate([
308
+ query('#sorter-control'),
309
+ __metadata("design:type", OxPopup)
310
+ ], Oauth2ClientListPage.prototype, "sortersControl", void 0);
311
+ Oauth2ClientListPage = __decorate([
312
+ customElement('oauth2-client-list-page')
313
+ ], Oauth2ClientListPage);
314
+ export { Oauth2ClientListPage };
315
+ //# sourceMappingURL=oauth2-client-list-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2-client-list-page.js","sourceRoot":"","sources":["../../../client/pages/oauth2-client/oauth2-client-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,E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pB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;CACF,CAAA;AApTQ,2BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAoE;AAE5E;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;mDAAA;AAClB;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8BAA0B,OAAO;4DAAA;AA3B/C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAsThC;SAtTY,oBAAoB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport {\n ColumnConfig,\n DataGrist,\n FetchOption,\n SortersControl\n} from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { Oauth2ClientImporter } from './oauth2-client-importer'\n\n@customElement('oauth2-client-list-page')\nexport class Oauth2ClientListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'oauth2-client-importer': Oauth2ClientImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n @query('#sorter-control') private sortersControl!: OxPopup\n\n get context() {\n return {\n title: i18next.t('title.oauth2-client list'),\n help: 'oauth2-client/oauth2-client',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateOauth2Client.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteOauth2Client.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.oauth2-client list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n 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 >\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${e => {\n const target = e.currentTarget\n this.sortersControl.open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteOauth2Client() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteOauth2Clients(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateOauth2Client() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [Oauth2ClientPatch!]!) {\n updateMultipleOauth2Client(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'name',\n 'description',\n 'active'\n ])\n\n return exportTargets.map(oauth2Client => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = oauth2Client[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <oauth2-client-importer\n .oauth2Clients=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></oauth2-client-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import oauth2-client')\n }\n )\n \n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n\n"]}
@@ -0,0 +1,21 @@
1
+ import { PageView } from '@operato/shell';
2
+ declare const Oauth2ClientRegister_base: (new (...args: any[]) => {
3
+ _storeUnsubscribe: import("redux").Unsubscribe;
4
+ connectedCallback(): void;
5
+ disconnectedCallback(): void;
6
+ stateChanged(_state: unknown): void;
7
+ readonly isConnected: boolean;
8
+ }) & typeof PageView;
9
+ export declare class Oauth2ClientRegister extends Oauth2ClientRegister_base {
10
+ static styles: import("lit").CSSResult[];
11
+ application: any;
12
+ _icon?: string;
13
+ form: HTMLFormElement;
14
+ get context(): {
15
+ title: string;
16
+ };
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ createOauth2Client(e: any): Promise<void>;
19
+ pageUpdated(changes: any, lifecycle: any, before: any): Promise<void>;
20
+ }
21
+ export {};