@things-factory/scheduler 9.1.19 → 10.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,13 +6,7 @@ import '@operato/data-grist/ox-record-creator.js';
6
6
  import './schedule-popup.js';
7
7
  import { PageView } from '@operato/shell';
8
8
  import { FetchOption } from '@operato/data-grist';
9
- declare const SchedulerListPage_base: (new (...args: any[]) => {
10
- _storeUnsubscribe: import("redux").Unsubscribe;
11
- connectedCallback(): void;
12
- disconnectedCallback(): void;
13
- stateChanged(_state: unknown): void;
14
- readonly isConnected: boolean;
15
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
9
+ declare const SchedulerListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
16
10
  export declare class SchedulerListPage extends SchedulerListPage_base {
17
11
  static styles: import("lit").CSSResult[];
18
12
  gristConfig: any;
@@ -6,7 +6,7 @@ import '@operato/data-grist/ox-filters-form.js';
6
6
  import '@operato/data-grist/ox-record-creator.js';
7
7
  import './schedule-popup.js';
8
8
  import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
9
- import { PageView, store } from '@operato/shell';
9
+ import { PageView } from '@operato/shell';
10
10
  import { css, html } from 'lit';
11
11
  import { customElement, property, query } from 'lit/decorators.js';
12
12
  import { DataGrist } from '@operato/data-grist';
@@ -15,9 +15,8 @@ import { i18next, localize } from '@operato/i18n';
15
15
  import { notify, openPopup } from '@operato/layout';
16
16
  import { OxPrompt } from '@operato/popup';
17
17
  import { isMobileDevice } from '@operato/utils';
18
- import { connect } from 'pwa-helpers/connect-mixin';
19
18
  import gql from 'graphql-tag';
20
- let SchedulerListPage = class SchedulerListPage extends connect(store)(localize(i18next)(PageView)) {
19
+ let SchedulerListPage = class SchedulerListPage extends localize(i18next)(PageView) {
21
20
  constructor() {
22
21
  super(...arguments);
23
22
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -27,41 +26,33 @@ let SchedulerListPage = class SchedulerListPage extends connect(store)(localize(
27
26
  CommonGristStyles,
28
27
  CommonHeaderStyles,
29
28
  css `
30
- :host {
31
- display: flex;
29
+ :host { display: flex;
32
30
 
33
31
  width: 100%;
34
32
 
35
33
  --grid-record-emphasized-background-color: #8b0000;
36
34
  --grid-record-emphasized-color: #ff6b6b;
37
- }
35
+ }
38
36
 
39
- ox-grist {
40
- overflow-y: auto;
37
+ ox-grist { overflow-y: auto;
41
38
  flex: 1;
42
- }
39
+ }
43
40
 
44
- ox-filters-form {
45
- flex: 1;
46
- }
41
+ ox-filters-form { flex: 1;
42
+ }
47
43
  `
48
44
  ]; }
49
45
  get context() {
50
- return {
51
- title: i18next.t('title.schedule list'),
52
- search: {
53
- handler: (search) => {
46
+ return { title: i18next.t('title.schedule list'),
47
+ search: { handler: (search) => {
54
48
  this.grist.searchText = search;
55
49
  },
56
- value: this.grist.searchText
57
- },
58
- filter: {
59
- handler: () => {
50
+ value: this.grist.searchText },
51
+ filter: { handler: () => {
60
52
  this.grist.toggleHeadroom();
61
53
  }
62
54
  },
63
- help: 'scheduler/scheduler'
64
- };
55
+ help: 'scheduler/scheduler' };
65
56
  }
66
57
  render() {
67
58
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
@@ -89,30 +80,25 @@ let SchedulerListPage = class SchedulerListPage extends connect(store)(localize(
89
80
  `;
90
81
  }
91
82
  async pageInitialized(lifecycle) {
92
- this.gristConfig = {
93
- list: {
94
- fields: ['name', 'description'],
83
+ this.gristConfig = { list: { fields: ['name', 'description'],
95
84
  details: ['active', 'updatedAt']
96
85
  },
97
86
  columns: [
98
87
  { type: 'gutter', gutterName: 'sequence' },
99
88
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
100
- {
101
- type: 'gutter',
89
+ { type: 'gutter',
102
90
  gutterName: 'button',
103
91
  fixed: true,
104
92
  icon: record => (!record ? 'reorder' : record.id ? 'reorder' : ''),
105
93
  iconOnly: false,
106
94
  title: record => (!record ? i18next.t('button.detail') : record.id ? i18next.t('button.detail') : ''),
107
95
  width: 72,
108
- handlers: {
109
- click: (columns, data, column, record, rowIndex) => {
96
+ handlers: { click: (columns, data, column, record, rowIndex) => {
110
97
  if (!record.id)
111
98
  return;
112
99
  openPopup(html `
113
100
  <schedule-popup schedule-id=${record.id} @requestRefresh=${() => this.grist.fetch()}></schedule-popup>
114
- `, {
115
- backdrop: true,
101
+ `, { backdrop: true,
116
102
  help: 'scheduler/scheduler',
117
103
  size: 'large',
118
104
  title: i18next.t('title.schedule detail')
@@ -120,107 +106,88 @@ let SchedulerListPage = class SchedulerListPage extends connect(store)(localize(
120
106
  }
121
107
  }
122
108
  },
123
- {
124
- type: 'gutter',
109
+ { type: 'gutter',
125
110
  gutterName: 'button',
126
111
  fixed: true,
127
112
  icon: record => (!record ? 'delete' : record.id ? 'delete' : ''),
128
113
  iconOnly: false,
129
114
  title: record => (!record ? i18next.t('button.delete') : record.id ? i18next.t('button.delete') : ''),
130
115
  width: 72,
131
- handlers: {
132
- click: (_columns, _data, _column, record, _rowIndex) => {
116
+ handlers: { click: (_columns, _data, _column, record, _rowIndex) => {
133
117
  if (record)
134
118
  this.unregisterSchedule(record.id);
135
119
  }
136
120
  }
137
121
  },
138
- {
139
- type: 'string',
122
+ { type: 'string',
140
123
  name: 'name',
141
124
  header: i18next.t('field.name'),
142
- record: {
143
- editable: false
125
+ record: { editable: false
144
126
  },
145
127
  filter: 'i_like' /* only i_like supported */,
146
128
  sortable: true,
147
129
  width: 150
148
130
  },
149
- {
150
- type: 'string',
131
+ { type: 'string',
151
132
  name: 'application',
152
133
  header: i18next.t('field.schedule-application'),
153
- record: {
154
- renderer: (value, column, record, rowIndex, field) => record.client?.application
134
+ record: { renderer: (value, column, record, rowIndex, field) => record.client?.application
155
135
  },
156
136
  filter: 'i_like' /* only i_like supported */,
157
137
  sortable: true,
158
138
  width: 150
159
139
  },
160
- {
161
- type: 'string',
140
+ { type: 'string',
162
141
  name: 'group',
163
142
  header: i18next.t('field.group'),
164
- record: {
165
- renderer: (value, column, record, rowIndex, field) => record.client?.group
143
+ record: { renderer: (value, column, record, rowIndex, field) => record.client?.group
166
144
  },
167
145
  filter: 'i_like' /* only i_like supported */,
168
146
  sortable: true,
169
147
  width: 150
170
148
  },
171
- {
172
- type: 'string',
149
+ { type: 'string',
173
150
  name: 'type',
174
151
  header: i18next.t('field.type'),
175
- record: {
176
- renderer: (value, column, record, rowIndex, field) => record.client?.type
152
+ record: { renderer: (value, column, record, rowIndex, field) => record.client?.type
177
153
  },
178
154
  filter: 'i_like' /* only i_like supported */,
179
155
  sortable: true,
180
156
  width: 150
181
157
  },
182
- {
183
- type: 'string',
158
+ { type: 'string',
184
159
  name: 'key',
185
160
  header: i18next.t('field.key'),
186
- record: {
187
- renderer: (value, column, record, rowIndex, field) => record.client?.key
161
+ record: { renderer: (value, column, record, rowIndex, field) => record.client?.key
188
162
  },
189
163
  filter: 'i_like' /* only i_like supported */,
190
164
  sortable: true,
191
165
  width: 150
192
166
  },
193
- {
194
- type: 'string',
167
+ { type: 'string',
195
168
  name: 'operation',
196
169
  header: i18next.t('field.schedule-operation'),
197
- record: {
198
- renderer: (value, column, record, rowIndex, field) => record.client?.operation
170
+ record: { renderer: (value, column, record, rowIndex, field) => record.client?.operation
199
171
  },
200
172
  filter: 'i_like' /* only i_like supported */,
201
173
  sortable: true,
202
174
  width: 150
203
175
  },
204
- {
205
- type: 'datetime',
176
+ { type: 'datetime',
206
177
  name: 'updatedAt',
207
178
  header: i18next.t('field.updated_at'),
208
- record: {
209
- editable: false
179
+ record: { editable: false
210
180
  },
211
181
  sortable: true,
212
182
  width: 180
213
183
  }
214
184
  ],
215
- rows: {
216
- appendable: false,
217
- selectable: {
218
- multiple: true
185
+ rows: { appendable: false,
186
+ selectable: { multiple: true
219
187
  }
220
188
  },
221
189
  sorters: [
222
- {
223
- name: 'name'
190
+ { name: 'name'
224
191
  }
225
192
  ]
226
193
  };
@@ -234,74 +201,60 @@ let SchedulerListPage = class SchedulerListPage extends connect(store)(localize(
234
201
  popup.onclosed = () => { };
235
202
  }
236
203
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
237
- const response = await client.query({
238
- query: gql `
239
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
240
- responses: schedules(filters: $filters, pagination: $pagination, sortings: $sortings) {
241
- items {
242
- id
204
+ const response = await client.query({ query: gql `
205
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: schedules(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
243
206
  name
244
- client {
245
- application
207
+ client { application
246
208
  group
247
209
  type
248
210
  key
249
211
  operation
250
- }
212
+ }
251
213
  type
252
214
  schedule
253
215
  timezone
254
- task {
255
- type
256
- connection {
257
- host
216
+ task { type
217
+ connection { host
258
218
  headers
259
219
  topic
260
- }
220
+ }
261
221
  data
262
222
  history_check
263
223
  failed_policy
264
224
  retry_wait
265
225
  retry_count
266
226
  max_retry_count
267
- }
268
- }
227
+ }
228
+ }
269
229
  total
270
- }
271
- }
230
+ }
231
+ }
272
232
  `,
273
- variables: {
274
- filters,
233
+ variables: { filters,
275
234
  pagination: { page, limit },
276
235
  sortings
277
236
  }
278
237
  });
279
- return {
280
- total: response.data.responses.total || 0,
238
+ return { total: response.data.responses.total || 0,
281
239
  records: response.data.responses.items || []
282
240
  };
283
241
  }
284
242
  async unregisterSchedule(handle) {
285
- if (await OxPrompt.open({
286
- title: i18next.t('text.are_you_sure'),
243
+ if (await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
287
244
  text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
288
245
  confirmButton: { text: i18next.t('button.confirm') },
289
246
  cancelButton: { text: i18next.t('button.cancel') }
290
247
  })) {
291
- const response = await client.mutate({
292
- mutation: gql `
293
- mutation ($handle: ID!) {
294
- unregisterSchedule(handle: $handle)
295
- }
248
+ const response = await client.mutate({ mutation: gql `
249
+ mutation ($handle: ID!) { unregisterSchedule(handle: $handle)
250
+ }
296
251
  `,
297
- variables: {
298
- handle
252
+ variables: { handle
299
253
  }
300
254
  });
301
255
  if (!response.errors) {
302
256
  this.grist.fetch();
303
- notify({
304
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
257
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
305
258
  });
306
259
  }
307
260
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schedule-list-page.js","sourceRoot":"","sources":["../../../client/pages/scheduler/schedule-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AACjD,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,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,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,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAGtB,IAAM,iBAAiB,GA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;;SAIZ;gBACD,SAAS,EAAE;oBACT,MAAM;iBACP;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;gBAClB,MAAM,CAAC;oBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;iBAChF,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;;AApR2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AA7BjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA+S7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\nimport './schedule-popup.js'\n\nimport { 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 { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('schedule-list-page')\nexport class SchedulerListPage extends connect(store)(localize(i18next)(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 @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.schedule list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'scheduler/scheduler'\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 without-search></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\n <ox-record-creator id=\"add\" .customPopupCallback=${this.popupCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n <schedule-popup slot=\"popup\"></schedule-popup>\n </ox-record-creator>\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: 'gutter',\n gutterName: 'button',\n fixed: true,\n icon: record => (!record ? 'reorder' : record.id ? 'reorder' : ''),\n iconOnly: false,\n title: record => (!record ? i18next.t('button.detail') : record.id ? i18next.t('button.detail') : ''),\n width: 72,\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) return\n openPopup(\n html`\n <schedule-popup schedule-id=${record.id} @requestRefresh=${() => this.grist.fetch()}></schedule-popup>\n `,\n {\n backdrop: true,\n help: 'scheduler/scheduler',\n size: 'large',\n title: i18next.t('title.schedule detail')\n }\n )\n }\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n fixed: true,\n icon: record => (!record ? 'delete' : record.id ? 'delete' : ''),\n iconOnly: false,\n title: record => (!record ? i18next.t('button.delete') : record.id ? i18next.t('button.delete') : ''),\n width: 72,\n handlers: {\n click: (_columns, _data, _column, record, _rowIndex) => {\n if (record) this.unregisterSchedule(record.id)\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: false\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'application',\n header: i18next.t('field.schedule-application'),\n record: {\n renderer: (value, column, record, rowIndex, field) => record.client?.application\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'group',\n header: i18next.t('field.group'),\n record: {\n renderer: (value, column, record, rowIndex, field) => record.client?.group\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n renderer: (value, column, record, rowIndex, field) => record.client?.type\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'key',\n header: i18next.t('field.key'),\n record: {\n renderer: (value, column, record, rowIndex, field) => record.client?.key\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'operation',\n header: i18next.t('field.schedule-operation'),\n record: {\n renderer: (value, column, record, rowIndex, field) => record.client?.operation\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\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 appendable: false,\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 this.grist.fetch()\n }\n }\n\n async popupCallback(popup) {\n popup.onclosed = () => {}\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: schedules(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n client {\n application\n group\n type\n key\n operation\n }\n type\n schedule\n timezone\n task {\n type\n connection {\n host\n headers\n topic\n }\n data\n history_check\n failed_policy\n retry_wait\n retry_count\n max_retry_count\n }\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 unregisterSchedule(handle: string) {\n if (\n await OxPrompt.open({\n 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 ) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($handle: ID!) {\n unregisterSchedule(handle: $handle)\n }\n `,\n variables: {\n handle\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"]}
1
+ {"version":3,"file":"schedule-list-page.js","sourceRoot":"","sources":["../../../client/pages/scheduler/schedule-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;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AAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAzBjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAoP7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\nimport './schedule-popup.js'\n\nimport { 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 { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\n@customElement('schedule-list-page')\nexport class SchedulerListPage extends 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 ox-filters-form { flex: 1;\n }\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.schedule list'),\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: 'scheduler/scheduler'\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 without-search></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\n <ox-record-creator id=\"add\" .customPopupCallback=${this.popupCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n <schedule-popup slot=\"popup\"></schedule-popup>\n </ox-record-creator>\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: 'gutter',\n gutterName: 'button',\n fixed: true,\n icon: record => (!record ? 'reorder' : record.id ? 'reorder' : ''),\n iconOnly: false,\n title: record => (!record ? i18next.t('button.detail') : record.id ? i18next.t('button.detail') : ''),\n width: 72,\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) return\n openPopup(\n html`\n <schedule-popup schedule-id=${record.id} @requestRefresh=${() => this.grist.fetch()}></schedule-popup>\n `,\n { backdrop: true,\n help: 'scheduler/scheduler',\n size: 'large',\n title: i18next.t('title.schedule detail')\n }\n )\n }\n }\n },\n { type: 'gutter',\n gutterName: 'button',\n fixed: true,\n icon: record => (!record ? 'delete' : record.id ? 'delete' : ''),\n iconOnly: false,\n title: record => (!record ? i18next.t('button.delete') : record.id ? i18next.t('button.delete') : ''),\n width: 72,\n handlers: { click: (_columns, _data, _column, record, _rowIndex) => { if (record) this.unregisterSchedule(record.id)\n }\n }\n },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: false\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'application',\n header: i18next.t('field.schedule-application'),\n record: { renderer: (value, column, record, rowIndex, field) => record.client?.application\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'group',\n header: i18next.t('field.group'),\n record: { renderer: (value, column, record, rowIndex, field) => record.client?.group\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'type',\n header: i18next.t('field.type'),\n record: { renderer: (value, column, record, rowIndex, field) => record.client?.type\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'key',\n header: i18next.t('field.key'),\n record: { renderer: (value, column, record, rowIndex, field) => record.client?.key\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'operation',\n header: i18next.t('field.schedule-operation'),\n record: { renderer: (value, column, record, rowIndex, field) => record.client?.operation\n },\n filter: 'i_like' /* only i_like supported */,\n sortable: true,\n width: 150\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: { appendable: false,\n 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) { this.grist.fetch()\n }\n }\n\n async popupCallback(popup) { popup.onclosed = () => {}\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: schedules(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n client { application\n group\n type\n key\n operation\n }\n type\n schedule\n timezone\n task { type\n connection { host\n headers\n topic\n }\n data\n history_check\n failed_policy\n retry_wait\n retry_count\n max_retry_count\n }\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 unregisterSchedule(handle: 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.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { const response = await client.mutate({ mutation: gql`\n mutation ($handle: ID!) { unregisterSchedule(handle: $handle)\n }\n `,\n variables: { handle\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"]}