@things-factory/oauth2-client 9.1.13 → 10.0.0-beta.1

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.
@@ -2,13 +2,7 @@ import '@operato/data-grist';
2
2
  import { PageView } from '@operato/shell';
3
3
  import { FetchOption } from '@operato/data-grist';
4
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>;
5
+ declare const Oauth2ClientListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
12
6
  export declare class Oauth2ClientListPage extends Oauth2ClientListPage_base {
13
7
  static styles: import("lit").CSSResult[];
14
8
  static get scopedElements(): {
@@ -1,7 +1,7 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@operato/data-grist';
3
3
  import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
- import { PageView, store } from '@operato/shell';
4
+ import { PageView } from '@operato/shell';
5
5
  import { css, html } from 'lit';
6
6
  import { customElement, property, query } from 'lit/decorators.js';
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements';
@@ -10,10 +10,9 @@ import { client } from '@operato/graphql';
10
10
  import { i18next, localize } from '@operato/i18n';
11
11
  import { notify, openPopup } from '@operato/layout';
12
12
  import { isMobileDevice } from '@operato/utils';
13
- import { connect } from 'pwa-helpers/connect-mixin';
14
13
  import gql from 'graphql-tag';
15
14
  import { Oauth2ClientImporter } from './oauth2-client-importer';
16
- let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
15
+ let Oauth2ClientListPage = class Oauth2ClientListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
17
16
  constructor() {
18
17
  super(...arguments);
19
18
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -23,52 +22,43 @@ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(loc
23
22
  CommonGristStyles,
24
23
  CommonHeaderStyles,
25
24
  css `
26
- :host {
27
- display: flex;
25
+ :host { display: flex;
28
26
 
29
27
  width: 100%;
30
28
 
31
29
  --grid-record-emphasized-background-color: #8b0000;
32
30
  --grid-record-emphasized-color: #ff6b6b;
33
- }
31
+ }
34
32
 
35
- ox-grist {
36
- overflow-y: auto;
33
+ ox-grist { overflow-y: auto;
37
34
  flex: 1;
38
- }
35
+ }
39
36
 
40
- ox-filters-form {
41
- flex: 1;
42
- }
37
+ ox-filters-form { flex: 1;
38
+ }
43
39
  `
44
40
  ]; }
45
41
  static get scopedElements() {
46
- return {
47
- 'oauth2-client-importer': Oauth2ClientImporter
42
+ return { 'oauth2-client-importer': Oauth2ClientImporter
48
43
  };
49
44
  }
50
45
  get context() {
51
- return {
52
- title: i18next.t('title.oauth2-client list'),
46
+ return { title: i18next.t('title.oauth2-client list'),
53
47
  help: 'oauth2-client/oauth2-client',
54
48
  actions: [
55
- {
56
- title: i18next.t('button.save'),
49
+ { title: i18next.t('button.save'),
57
50
  action: this._updateOauth2Client.bind(this),
58
51
  ...CommonButtonStyles.save
59
52
  },
60
- {
61
- title: i18next.t('button.delete'),
53
+ { title: i18next.t('button.delete'),
62
54
  action: this._deleteOauth2Client.bind(this),
63
55
  ...CommonButtonStyles.delete
64
56
  }
65
57
  ],
66
- exportable: {
67
- name: i18next.t('title.oauth2-client list'),
58
+ exportable: { name: i18next.t('title.oauth2-client list'),
68
59
  data: this.exportHandler.bind(this)
69
60
  },
70
- importable: {
71
- handler: this.importHandler.bind(this)
61
+ importable: { handler: this.importHandler.bind(this)
72
62
  }
73
63
  };
74
64
  }
@@ -91,113 +81,90 @@ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(loc
91
81
  `;
92
82
  }
93
83
  async pageInitialized(lifecycle) {
94
- this.gristConfig = {
95
- list: {
96
- fields: ['name', 'description'],
84
+ this.gristConfig = { list: { fields: ['name', 'description'],
97
85
  details: ['active', 'updatedAt']
98
86
  },
99
87
  columns: [
100
88
  { type: 'gutter', gutterName: 'sequence' },
101
89
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
102
- {
103
- type: 'string',
90
+ { type: 'string',
104
91
  name: 'name',
105
92
  header: i18next.t('field.name'),
106
- record: {
107
- editable: true
93
+ record: { editable: true
108
94
  },
109
95
  filter: 'search',
110
96
  sortable: true,
111
97
  width: 150
112
98
  },
113
- {
114
- type: 'string',
99
+ { type: 'string',
115
100
  name: 'description',
116
101
  header: i18next.t('field.description'),
117
- record: {
118
- editable: true
102
+ record: { editable: true
119
103
  },
120
104
  filter: 'search',
121
105
  width: 200
122
106
  },
123
- {
124
- type: 'checkbox',
107
+ { type: 'checkbox',
125
108
  name: 'active',
126
109
  label: true,
127
110
  header: i18next.t('field.active'),
128
- record: {
129
- editable: true
111
+ record: { editable: true
130
112
  },
131
113
  filter: true,
132
114
  sortable: true,
133
115
  width: 60
134
116
  },
135
- {
136
- type: 'resource-object',
117
+ { type: 'resource-object',
137
118
  name: 'updater',
138
119
  header: i18next.t('field.updater'),
139
- record: {
140
- editable: false
120
+ record: { editable: false
141
121
  },
142
122
  sortable: true,
143
123
  width: 120
144
124
  },
145
- {
146
- type: 'datetime',
125
+ { type: 'datetime',
147
126
  name: 'updatedAt',
148
127
  header: i18next.t('field.updated_at'),
149
- record: {
150
- editable: false
128
+ record: { editable: false
151
129
  },
152
130
  sortable: true,
153
131
  width: 180
154
132
  }
155
133
  ],
156
- rows: {
157
- selectable: {
158
- multiple: true
134
+ rows: { selectable: { multiple: true
159
135
  }
160
136
  },
161
137
  sorters: [
162
- {
163
- name: 'name'
138
+ { name: 'name'
164
139
  }
165
140
  ]
166
141
  };
167
142
  }
168
143
  async pageUpdated(changes, lifecycle) {
169
- if (this.active) {
170
- // do something here when this page just became as active
144
+ if (this.active) { // do something here when this page just became as active
171
145
  }
172
146
  }
173
147
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
174
- const response = await client.query({
175
- query: gql `
176
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
177
- responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) {
178
- items {
179
- id
148
+ const response = await client.query({ query: gql `
149
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
180
150
  name
181
151
  description
182
152
  active
183
- updater {
184
- id
153
+ updater { id
185
154
  name
186
- }
155
+ }
187
156
  updatedAt
188
- }
157
+ }
189
158
  total
190
- }
191
- }
159
+ }
160
+ }
192
161
  `,
193
- variables: {
194
- filters,
162
+ variables: { filters,
195
163
  pagination: { page, limit },
196
164
  sortings
197
165
  }
198
166
  });
199
- return {
200
- total: response.data.responses.total || 0,
167
+ return { total: response.data.responses.total || 0,
201
168
  records: response.data.responses.items || []
202
169
  };
203
170
  }
@@ -205,20 +172,16 @@ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(loc
205
172
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
206
173
  const ids = this.grist.selected.map(record => record.id);
207
174
  if (ids && ids.length > 0) {
208
- const response = await client.mutate({
209
- mutation: gql `
210
- mutation ($ids: [String!]!) {
211
- deleteOauth2Clients(ids: $ids)
212
- }
175
+ const response = await client.mutate({ mutation: gql `
176
+ mutation ($ids: [String!]!) { deleteOauth2Clients(ids: $ids)
177
+ }
213
178
  `,
214
- variables: {
215
- ids
179
+ variables: { ids
216
180
  }
217
181
  });
218
182
  if (!response.errors) {
219
183
  this.grist.fetch();
220
- notify({
221
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
184
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
222
185
  });
223
186
  }
224
187
  }
@@ -236,16 +199,12 @@ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(loc
236
199
  patchField.cuFlag = patch.__dirty__;
237
200
  return patchField;
238
201
  });
239
- const response = await client.mutate({
240
- mutation: gql `
241
- mutation ($patches: [Oauth2ClientPatch!]!) {
242
- updateMultipleOauth2Client(patches: $patches) {
243
- name
244
- }
245
- }
202
+ const response = await client.mutate({ mutation: gql `
203
+ mutation ($patches: [Oauth2ClientPatch!]!) { updateMultipleOauth2Client(patches: $patches) { name
204
+ }
205
+ }
246
206
  `,
247
- variables: {
248
- patches
207
+ variables: { patches
249
208
  }
250
209
  });
251
210
  if (!response.errors) {
@@ -273,8 +232,7 @@ let Oauth2ClientListPage = class Oauth2ClientListPage extends connect(store)(loc
273
232
  this.grist.fetch();
274
233
  }}
275
234
  ></oauth2-client-importer>
276
- `, {
277
- backdrop: true,
235
+ `, { backdrop: true,
278
236
  size: 'large',
279
237
  title: i18next.t('title.import oauth2-client')
280
238
  });
@@ -1 +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,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,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,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0B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3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;mDAAA;AAnCjC,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAoShC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, 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 { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\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 static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n 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 {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\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\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 .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\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(['id', 'name', 'description', 'active'])\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"]}
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,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAGx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AE,QAAQ,CAAC,CAAC,CAAA;QAEvE,OAAO,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAAS,IAAI,OAAO,GAAG,EAAE,CAAA;YAC/D,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;gBAAS,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;YACvF,CAAC;YAEI,OAAO,OAAO,CAAA;QACnB,CAAC,CAAC,CAAA;IACF,CAAC;IAEA,KAAK,CAAC,aAAa,CAAC,OAAO;QAAQ,MAAM,KAAK,GAAG,SAAS,CACtD,IAAI,CAAA;;2BAEiB,OAAO;sBACZ,GAAG,EAAE;YAAe,OAAO,CAAC,IAAI,EAAE,CAAA;YAC5C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAC7B,CAAC;;OAEK,EACD,EAAU,QAAQ,EAAE,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;SACpD,CACG,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpD,CAAC,CAAA;IACD,CAAC;;AA1M4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;mDAAA;AA7BjC,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAqOhC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { Oauth2ClientImporter } from './oauth2-client-importer'\n\n@customElement('oauth2-client-list-page')\nexport class Oauth2ClientListPage extends localize(i18next)(ScopedElementsMixin(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 ox-filters-form { flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { '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\n get context() { return { title: i18next.t('title.oauth2-client list'),\n help: 'oauth2-client/oauth2-client',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateOauth2Client.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteOauth2Client.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.oauth2-client list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\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: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteOauth2Client() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { 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!]!) { deleteOauth2Clients(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 async _updateOauth2Client() { 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 patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [Oauth2ClientPatch!]!) { updateMultipleOauth2Client(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(oauth2Client => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = oauth2Client[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <oauth2-client-importer\n .oauth2Clients=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></oauth2-client-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import oauth2-client')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
@@ -1,13 +1,6 @@
1
1
  import '@material/web/button/elevated-button.js';
2
2
  import { PageView } from '@operato/shell';
3
- declare const Oauth2ClientRegister_base: (new (...args: any[]) => {
4
- _storeUnsubscribe: import("redux").Unsubscribe;
5
- connectedCallback(): void;
6
- disconnectedCallback(): void;
7
- stateChanged(_state: unknown): void;
8
- readonly isConnected: boolean;
9
- }) & typeof PageView;
10
- export declare class Oauth2ClientRegister extends Oauth2ClientRegister_base {
3
+ export declare class Oauth2ClientRegister extends PageView {
11
4
  static styles: import("lit").CSSResult[];
12
5
  application: any;
13
6
  _icon?: string;
@@ -19,4 +12,3 @@ export declare class Oauth2ClientRegister extends Oauth2ClientRegister_base {
19
12
  createOauth2Client(e: any): Promise<void>;
20
13
  pageUpdated(changes: any, lifecycle: any, before: any): Promise<void>;
21
14
  }
22
- export {};
@@ -3,15 +3,13 @@ import '@material/web/button/elevated-button.js';
3
3
  import gql from 'graphql-tag';
4
4
  import { css, html } from 'lit';
5
5
  import { customElement, property, query } from 'lit/decorators.js';
6
- import { connect } from 'pwa-helpers/connect-mixin.js';
7
6
  import { client } from '@operato/graphql';
8
7
  import { notify } from '@operato/layout';
9
- import { navigate, PageView, store } from '@operato/shell';
10
- let Oauth2ClientRegister = class Oauth2ClientRegister extends connect(store)(PageView) {
8
+ import { navigate, PageView } from '@operato/shell';
9
+ let Oauth2ClientRegister = class Oauth2ClientRegister extends PageView {
11
10
  static { this.styles = [
12
11
  css `
13
- :host {
14
- display: flex;
12
+ :host { display: flex;
15
13
  flex-direction: column;
16
14
  color: var(--md-sys-color-on-background);
17
15
  background-color: var(--md-sys-color-background);
@@ -20,85 +18,71 @@ let Oauth2ClientRegister = class Oauth2ClientRegister extends connect(store)(Pag
20
18
  position: relative;
21
19
 
22
20
  overflow: auto;
23
- }
21
+ }
24
22
 
25
- h2 {
26
- margin: var(--title-margin);
23
+ h2 { margin: var(--title-margin);
27
24
  font: var(--title-font);
28
25
  color: var(--title-text-color);
29
- }
26
+ }
30
27
 
31
- [page-description] {
32
- margin: var(--page-description-margin);
28
+ [page-description] { margin: var(--page-description-margin);
33
29
  font: var(--page-description-font);
34
30
  color: var(--page-description-color);
35
- }
31
+ }
36
32
 
37
- [icon] {
38
- position: absolute;
33
+ [icon] { position: absolute;
39
34
  top: 10px;
40
35
  right: 10px;
41
36
 
42
37
  max-width: 80px;
43
- }
38
+ }
44
39
 
45
- [icon] img {
46
- max-width: 100%;
40
+ [icon] img { max-width: 100%;
47
41
  max-height: 100%;
48
- }
42
+ }
49
43
 
50
- label {
51
- font: var(--label-font);
44
+ label { font: var(--label-font);
52
45
  color: var(--label-color, var(--md-sys-color-on-surface));
53
46
  text-transform: var(--label-text-transform);
54
- }
47
+ }
55
48
 
56
49
  input,
57
- select {
58
- border: var(--border-dim-color);
50
+ select { border: var(--border-dim-color);
59
51
  border-radius: var(--border-radius);
60
52
  margin: var(--input-margin);
61
53
  padding: var(--input-padding);
62
54
  font: var(--input-font);
63
55
 
64
56
  flex: 1;
65
- }
57
+ }
66
58
 
67
59
  select:focus,
68
- input:focus {
69
- outline: none;
70
- }
60
+ input:focus { outline: none;
61
+ }
71
62
 
72
- [field-2column] {
73
- display: grid;
63
+ [field-2column] { display: grid;
74
64
  grid-template-columns: 1fr 1fr;
75
65
  grid-gap: 15px;
76
- }
66
+ }
77
67
 
78
- [field] {
79
- display: flex;
68
+ [field] { display: flex;
80
69
  flex-direction: column;
81
- }
70
+ }
82
71
 
83
- [grid-span] {
84
- grid-column: span 2;
85
- }
72
+ [grid-span] { grid-column: span 2;
73
+ }
86
74
 
87
- md-elevated-button {
88
- margin-top: 30px;
75
+ md-elevated-button { margin-top: 30px;
89
76
  width: 100%;
90
- }
77
+ }
91
78
 
92
- @media screen and (max-width: 480px) {
93
- [field] {
94
- grid-column: span 2;
95
- }
96
- }
79
+ @media screen and (max-width: 480px) { [field] { grid-column: span 2;
80
+ }
81
+ }
97
82
  `
98
83
  ]; }
99
84
  get context() {
100
- return {
101
- title: `oauth2 client registration`
85
+ return { title: `oauth2 client registration`
102
86
  };
103
87
  }
104
88
  render() {
@@ -155,21 +139,16 @@ let Oauth2ClientRegister = class Oauth2ClientRegister extends connect(store)(Pag
155
139
  oauth2Client[key] = value;
156
140
  return oauth2Client;
157
141
  }, {});
158
- const response = await client.mutate({
159
- mutation: gql `
160
- mutation ($oauth2Client: NewOauth2Client!) {
161
- createOauth2Client(oauth2Client: $oauth2Client) {
162
- id
163
- }
164
- }
142
+ const response = await client.mutate({ mutation: gql `
143
+ mutation ($oauth2Client: NewOauth2Client!) { createOauth2Client(oauth2Client: $oauth2Client) { id
144
+ }
145
+ }
165
146
  `,
166
- variables: {
167
- oauth2Client
147
+ variables: { oauth2Client
168
148
  }
169
149
  });
170
150
  if (response.errors) {
171
- notify({
172
- level: 'error',
151
+ notify({ level: 'error',
173
152
  message: 'create oauth2 client fail'
174
153
  });
175
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-client-register.js","sourceRoot":"","sources":["../../client/pages/oauth2-client-register.ts"],"names":[],"mappings":";AAAA,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,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGnD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;aACzD,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqFF;KACF,AAvFY,CAuFZ;IAOD,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,4BAA4B;SACpC,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;QAIP,IAAI,C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EAAE,SAAS,EAAE,MAAM;QAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AAjG2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAe;AAE3B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;kDAAA;AA7F1B,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA4LhC","sourcesContent":["import '@material/web/button/elevated-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('oauth2-client-register')\nexport class Oauth2ClientRegister extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n color: var(--md-sys-color-on-background);\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n\n max-width: 80px;\n }\n\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n label {\n 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 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 outline: none;\n }\n\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] {\n display: flex;\n flex-direction: column;\n }\n\n [grid-span] {\n grid-column: span 2;\n }\n\n md-elevated-button {\n margin-top: 30px;\n width: 100%;\n }\n\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n @property({ type: String }) _icon?: string\n\n @query('form') form!: HTMLFormElement\n\n get context() {\n return {\n title: `oauth2 client registration`\n }\n }\n\n render() {\n return html`\n <h2>Register new oauth2 client</h2>\n <p page-description>You can register new oauth2 client here</p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input type=\"text\" id=\"name\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input type=\"text\" id=\"description\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input type=\"text\" id=\"icon\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"client-id\">client id</label>\n <input type=\"text\" id=\"client-id\" name=\"clientId\" />\n The client identifier issued to the client during the application registration process.\n </div>\n\n <div field grid-span>\n <label for=\"client-secret\">client secret</label>\n <input type=\"text\" id=\"client-secret\" name=\"clientSecret\" />\n The client secret issued to the client during the application registration process.\n </div>\n </div>\n\n <md-elevated-button @click=${this.createOauth2Client.bind(this)}>register</md-elevated-button>\n </form>\n `\n }\n\n async createOauth2Client(e) {\n e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const oauth2Client = Array.from(formData.entries()).reduce((oauth2Client, [key, value]) => {\n oauth2Client[key] = value\n return oauth2Client\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($oauth2Client: NewOauth2Client!) {\n createOauth2Client(oauth2Client: $oauth2Client) {\n id\n }\n }\n `,\n variables: {\n oauth2Client\n }\n })\n\n if (response.errors) {\n notify({\n level: 'error',\n message: 'create oauth2 client fail'\n })\n } else {\n const id = response.data.createOauth2Client.id\n navigate(`oauth2-client/${id}`)\n }\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"oauth2-client-register.js","sourceRoot":"","sources":["../../client/pages/oauth2-client-register.ts"],"names":[],"mappings":";AAAA,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,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ;aAAY,WAAM,GAAG;QACnE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuEF;KACF,AAzEiE,CAyEjE;IAOD,IAAI,OAAO;QAAS,OAAO,EAAQ,KAAK,EAAE,4BAA4B;SACtE,CAAA;IACD,CAAC;IAEA,MAAM;QAAS,OAAO,IAAI,CAAA;;;;QAIpB,IAAI,CAAC,KAAK;YACV,CAAC,CAAC,IAAI,CAAA;;yBAEW,IAAI,CAAC,KAAK;;WAExB;YACH,CAAC,CAAC,IAAI,CAAA,EAAE;;;;;;;;;;;;;;;;+DAgB+C,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;;;;;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A3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAe;AAE3B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;kDAAA;AA9E1B,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA+JhC","sourcesContent":["import '@material/web/button/elevated-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('oauth2-client-register')\nexport class Oauth2ClientRegister extends PageView { static styles = [\n css`\n :host { display: flex;\n flex-direction: column;\n color: var(--md-sys-color-on-background);\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\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\n max-width: 80px;\n }\n\n [icon] img { max-width: 100%;\n max-height: 100%;\n }\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 { 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 { outline: none;\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 }\n\n [grid-span] { grid-column: span 2;\n }\n\n md-elevated-button { margin-top: 30px;\n width: 100%;\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 @property({ type: String }) _icon?: string\n\n @query('form') form!: HTMLFormElement\n\n get context() { return { title: `oauth2 client registration`\n }\n }\n\n render() { return html`\n <h2>Register new oauth2 client</h2>\n <p page-description>You can register new oauth2 client here</p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input type=\"text\" id=\"name\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input type=\"text\" id=\"description\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input type=\"text\" id=\"icon\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"client-id\">client id</label>\n <input type=\"text\" id=\"client-id\" name=\"clientId\" />\n The client identifier issued to the client during the application registration process.\n </div>\n\n <div field grid-span>\n <label for=\"client-secret\">client secret</label>\n <input type=\"text\" id=\"client-secret\" name=\"clientSecret\" />\n The client secret issued to the client during the application registration process.\n </div>\n </div>\n\n <md-elevated-button @click=${this.createOauth2Client.bind(this)}>register</md-elevated-button>\n </form>\n `\n }\n\n async createOauth2Client(e) { e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const oauth2Client = Array.from(formData.entries()).reduce((oauth2Client, [key, value]) => { oauth2Client[key] = value\n return oauth2Client\n }, {})\n\n const response = await client.mutate({ mutation: gql`\n mutation ($oauth2Client: NewOauth2Client!) { createOauth2Client(oauth2Client: $oauth2Client) { id\n }\n }\n `,\n variables: { oauth2Client\n }\n })\n\n if (response.errors) { notify({ level: 'error',\n message: 'create oauth2 client fail'\n })\n } else { const id = response.data.createOauth2Client.id\n navigate(`oauth2-client/${id}`)\n }\n }\n\n async pageUpdated(changes, lifecycle, before) { if (this.active) { this.form.reset()\n }\n }\n}\n"]}
@@ -1,14 +1,7 @@
1
1
  import '@material/web/icon/icon.js';
2
2
  import '@operato/help/ox-help-icon.js';
3
3
  import { PageView } from '@operato/shell';
4
- declare const Oauth2Client_base: (new (...args: any[]) => {
5
- _storeUnsubscribe: import("redux").Unsubscribe;
6
- connectedCallback(): void;
7
- disconnectedCallback(): void;
8
- stateChanged(_state: unknown): void;
9
- readonly isConnected: boolean;
10
- }) & typeof PageView;
11
- export declare class Oauth2Client extends Oauth2Client_base {
4
+ export declare class Oauth2Client extends PageView {
12
5
  static styles: import("lit").CSSResult[];
13
6
  oauth2Client: any;
14
7
  _grantType?: string;
@@ -33,4 +26,3 @@ export declare class Oauth2Client extends Oauth2Client_base {
33
26
  generateOauth2AccessToken(): Promise<void>;
34
27
  refreshOauth2AccessToken(): Promise<void>;
35
28
  }
36
- export {};