@things-factory/scheduler 7.1.34

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 (81) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client/bootstrap.ts +1 -0
  3. package/client/index.ts +0 -0
  4. package/client/pages/scheduler/popup-crontab-input.ts +75 -0
  5. package/client/pages/scheduler/schedule-list-page.ts +326 -0
  6. package/client/pages/scheduler/schedule-popup.ts +484 -0
  7. package/client/route.ts +7 -0
  8. package/client/tsconfig.json +11 -0
  9. package/client/types.ts +34 -0
  10. package/dist-client/bootstrap.d.ts +1 -0
  11. package/dist-client/bootstrap.js +2 -0
  12. package/dist-client/bootstrap.js.map +1 -0
  13. package/dist-client/index.d.ts +0 -0
  14. package/dist-client/index.js +2 -0
  15. package/dist-client/index.js.map +1 -0
  16. package/dist-client/pages/scheduler/popup-crontab-input.d.ts +12 -0
  17. package/dist-client/pages/scheduler/popup-crontab-input.js +77 -0
  18. package/dist-client/pages/scheduler/popup-crontab-input.js.map +1 -0
  19. package/dist-client/pages/scheduler/schedule-list-page.d.ts +42 -0
  20. package/dist-client/pages/scheduler/schedule-list-page.js +326 -0
  21. package/dist-client/pages/scheduler/schedule-list-page.js.map +1 -0
  22. package/dist-client/pages/scheduler/schedule-popup.d.ts +25 -0
  23. package/dist-client/pages/scheduler/schedule-popup.js +457 -0
  24. package/dist-client/pages/scheduler/schedule-popup.js.map +1 -0
  25. package/dist-client/route.d.ts +1 -0
  26. package/dist-client/route.js +8 -0
  27. package/dist-client/route.js.map +1 -0
  28. package/dist-client/tsconfig.tsbuildinfo +1 -0
  29. package/dist-client/types.d.ts +33 -0
  30. package/dist-client/types.js +2 -0
  31. package/dist-client/types.js.map +1 -0
  32. package/dist-server/controllers/index.d.ts +0 -0
  33. package/dist-server/controllers/index.js +1 -0
  34. package/dist-server/controllers/index.js.map +1 -0
  35. package/dist-server/index.d.ts +2 -0
  36. package/dist-server/index.js +6 -0
  37. package/dist-server/index.js.map +1 -0
  38. package/dist-server/routes.d.ts +1 -0
  39. package/dist-server/routes.js +25 -0
  40. package/dist-server/routes.js.map +1 -0
  41. package/dist-server/service/index.d.ts +5 -0
  42. package/dist-server/service/index.js +21 -0
  43. package/dist-server/service/index.js.map +1 -0
  44. package/dist-server/service/schedule/index.d.ts +6 -0
  45. package/dist-server/service/schedule/index.js +10 -0
  46. package/dist-server/service/schedule/index.js.map +1 -0
  47. package/dist-server/service/schedule/schedule-mutation.d.ts +6 -0
  48. package/dist-server/service/schedule/schedule-mutation.js +55 -0
  49. package/dist-server/service/schedule/schedule-mutation.js.map +1 -0
  50. package/dist-server/service/schedule/schedule-query.d.ts +6 -0
  51. package/dist-server/service/schedule/schedule-query.js +70 -0
  52. package/dist-server/service/schedule/schedule-query.js.map +1 -0
  53. package/dist-server/service/schedule/schedule-type.d.ts +75 -0
  54. package/dist-server/service/schedule/schedule-type.js +281 -0
  55. package/dist-server/service/schedule/schedule-type.js.map +1 -0
  56. package/dist-server/tsconfig.tsbuildinfo +1 -0
  57. package/helps/scheduler/assets/scheduler-explains.png +0 -0
  58. package/helps/scheduler/assets/scheduler-service-msa.png +0 -0
  59. package/helps/scheduler/assets/scheduler-service-openapi.png +0 -0
  60. package/helps/scheduler/assets/scheduler-service-scalable.png +0 -0
  61. package/helps/scheduler/assets/updated-scheduler-diagram-periodic.png +0 -0
  62. package/helps/scheduler/assets/updated-scheduler-diagram-pubsub.png +0 -0
  63. package/helps/scheduler/scheduler.ko.md +185 -0
  64. package/helps/scheduler/scheduler.md +186 -0
  65. package/helps/scheduler/scheduler.zh.md +185 -0
  66. package/package.json +38 -0
  67. package/server/controllers/index.ts +0 -0
  68. package/server/index.ts +3 -0
  69. package/server/routes.ts +28 -0
  70. package/server/service/index.ts +25 -0
  71. package/server/service/schedule/index.ts +7 -0
  72. package/server/service/schedule/schedule-mutation.ts +34 -0
  73. package/server/service/schedule/schedule-query.ts +64 -0
  74. package/server/service/schedule/schedule-type.ts +194 -0
  75. package/server/tsconfig.json +10 -0
  76. package/things-factory.config.js +8 -0
  77. package/translations/en.json +9 -0
  78. package/translations/ja.json +9 -0
  79. package/translations/ko.json +9 -0
  80. package/translations/ms.json +9 -0
  81. package/translations/zh.json +9 -0
@@ -0,0 +1,457 @@
1
+ import { __decorate, __metadata, __rest } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@material/web/textfield/filled-text-field.js';
4
+ import '@material/web/select/outlined-select.js';
5
+ import '@material/web/checkbox/checkbox.js';
6
+ import '@material/web/button/filled-button.js';
7
+ import '@operato/input/ox-input-data.js';
8
+ import '@operato/input/ox-input-key-values.js';
9
+ import { html, css, LitElement } from 'lit';
10
+ import { customElement, property, query, state } from 'lit/decorators.js';
11
+ import gql from 'graphql-tag';
12
+ import { client } from '@operato/graphql';
13
+ import { i18next } from '@operato/i18n';
14
+ import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
15
+ import { notify, openPopup } from '@operato/layout';
16
+ import moment from '@operato/moment-timezone-es';
17
+ function getSystemTimeZone() {
18
+ try {
19
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
20
+ if (!timeZone) {
21
+ throw new Error('Unable to resolve timeZone');
22
+ }
23
+ return timeZone;
24
+ }
25
+ catch (e) {
26
+ console.warn('Failed to get system timeZone, falling back to UTC.', e);
27
+ return 'UTC';
28
+ }
29
+ }
30
+ const DEFAULT_TZ = getSystemTimeZone();
31
+ const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)];
32
+ let NewSchedulePopup = class NewSchedulePopup extends LitElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.schedule = {};
36
+ }
37
+ render() {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
39
+ const updatable = !!this.scheduleId;
40
+ return html `
41
+ <div content>
42
+ <form @change=${this.onInputChanged}>
43
+ <md-filled-text-field
44
+ label="Name"
45
+ type="text"
46
+ id="name"
47
+ name="name"
48
+ .value=${this.schedule.name || ''}
49
+ required
50
+ ></md-filled-text-field>
51
+ <br /><br />
52
+
53
+ <fieldset>
54
+ <legend>Client Details</legend>
55
+ <md-filled-text-field
56
+ label="Application"
57
+ type="text"
58
+ id="application"
59
+ name="client.application"
60
+ .value=${((_a = this.schedule.client) === null || _a === void 0 ? void 0 : _a.application) || ''}
61
+ ?readonly=${updatable}
62
+ required
63
+ ></md-filled-text-field>
64
+ <br /><br />
65
+
66
+ <md-filled-text-field
67
+ label="Group"
68
+ type="text"
69
+ id="group"
70
+ name="client.group"
71
+ .value=${((_b = this.schedule.client) === null || _b === void 0 ? void 0 : _b.group) || ''}
72
+ ?readonly=${updatable}
73
+ required
74
+ ></md-filled-text-field>
75
+ <br /><br />
76
+
77
+ <md-filled-text-field
78
+ label="Type"
79
+ type="text"
80
+ id="type"
81
+ name="client.type"
82
+ .value=${((_c = this.schedule.client) === null || _c === void 0 ? void 0 : _c.type) || ''}
83
+ ?readonly=${updatable}
84
+ required
85
+ ></md-filled-text-field>
86
+ <br /><br />
87
+
88
+ <md-filled-text-field
89
+ label="Key"
90
+ type="text"
91
+ id="key"
92
+ name="client.key"
93
+ .value=${((_d = this.schedule.client) === null || _d === void 0 ? void 0 : _d.key) || ''}
94
+ ?readonly=${updatable}
95
+ required
96
+ ></md-filled-text-field>
97
+ <br /><br />
98
+
99
+ <md-filled-text-field
100
+ label="Operation"
101
+ type="text"
102
+ id="operation"
103
+ name="client.operation"
104
+ .value=${((_e = this.schedule.client) === null || _e === void 0 ? void 0 : _e.operation) || ''}
105
+ ?readonly=${updatable}
106
+ required
107
+ ></md-filled-text-field>
108
+ </fieldset>
109
+ <br />
110
+
111
+ <fieldset>
112
+ <legend>Schedule</legend>
113
+
114
+ <md-outlined-select label="Schedule Type" name="type" required>
115
+ <md-select-option value="now" ?selected=${this.schedule.type === 'now'}>Now</md-select-option>
116
+ <md-select-option value="delay" ?selected=${this.schedule.type === 'delay'}>Delay</md-select-option>
117
+ <md-select-option value="date" ?selected=${this.schedule.type === 'date'}>Date</md-select-option>
118
+ <md-select-option value="cron" ?selected=${this.schedule.type === 'cron'}>Cron</md-select-option>
119
+ <md-select-option value="delay-recur" ?selected=${this.schedule.type === 'delay-recur'}
120
+ >Delay-Recur</md-select-option
121
+ >
122
+ </md-outlined-select>
123
+ <br /><br />
124
+
125
+ <md-filled-text-field
126
+ label="Schedule (optional)"
127
+ type="text"
128
+ id="schedule"
129
+ name="schedule"
130
+ .value=${this.schedule.schedule || ''}
131
+ @click=${(e) => {
132
+ const x = e.target;
133
+ openPopup(html `
134
+ <ox-popup-crontab-input
135
+ .value=${x.value}
136
+ .confirmCallback=${value => {
137
+ x.value = value;
138
+ x.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
139
+ }}
140
+ ></ox-popup-crontab-input>
141
+ `, {
142
+ backdrop: true,
143
+ title: i18next.t('title.setting schedule')
144
+ });
145
+ }}
146
+ ></md-filled-text-field>
147
+ <br /><br />
148
+
149
+ <md-outlined-select
150
+ label="Timezone (optional)"
151
+ id="timezone"
152
+ name="timezone"
153
+ .value=${this.schedule.timezone || ''}
154
+ required
155
+ >
156
+ ${TIMEZONE_OPTIONS.map(tz => html ` <md-select-option value=${tz} ?selected=${this.schedule.timezone === tz}
157
+ >${tz}</md-select-option
158
+ >`)}
159
+ </md-outlined-select>
160
+ </fieldset>
161
+ <br /><br />
162
+
163
+ <fieldset>
164
+ <legend>Task Details</legend>
165
+ <md-outlined-select label="Task Type" name="task.type" required>
166
+ <md-select-option value="rest" ?selected=${((_f = this.schedule.task) === null || _f === void 0 ? void 0 : _f.type) === 'rest'}>REST</md-select-option>
167
+ <md-select-option value="kafka" ?selected=${((_g = this.schedule.task) === null || _g === void 0 ? void 0 : _g.type) === 'kafka'}>Kafka</md-select-option>
168
+ <md-select-option value="redis" ?selected=${((_h = this.schedule.task) === null || _h === void 0 ? void 0 : _h.type) === 'redis'}>Redis</md-select-option>
169
+ </md-outlined-select>
170
+ <br /><br />
171
+
172
+ <md-filled-text-field
173
+ label="Connection Host"
174
+ id="connectionHost"
175
+ name="task.connection.host"
176
+ .value=${((_k = (_j = this.schedule.task) === null || _j === void 0 ? void 0 : _j.connection) === null || _k === void 0 ? void 0 : _k.host) || ''}
177
+ required
178
+ ></md-filled-text-field>
179
+ <br /><br />
180
+
181
+ <md-filled-text-field
182
+ label="Connection Topic (optional)"
183
+ id="connectionTopic"
184
+ name="task.connection.topic"
185
+ .value=${((_m = (_l = this.schedule.task) === null || _l === void 0 ? void 0 : _l.connection) === null || _m === void 0 ? void 0 : _m.topic) || ''}
186
+ ></md-filled-text-field>
187
+ <br /><br />
188
+
189
+ <fieldset>
190
+ <legend>Connection Headers (optional)</legend>
191
+ <ox-input-key-values
192
+ name="task.connection.headers"
193
+ .value=${((_p = (_o = this.schedule.task) === null || _o === void 0 ? void 0 : _o.connection) === null || _p === void 0 ? void 0 : _p.headers) || {}}
194
+ ></ox-input-key-values>
195
+ </fieldset>
196
+ <br /><br />
197
+
198
+ <fieldset>
199
+ <legend>Data (JSON)</legend>
200
+
201
+ <ox-input-data name="task.data" .value=${(_q = this.schedule.task) === null || _q === void 0 ? void 0 : _q.data}> </ox-input-data>
202
+ </fieldset>
203
+ <br /><br />
204
+
205
+ <label>
206
+ <md-checkbox
207
+ type="checkbox"
208
+ id="historyCheck"
209
+ name="task.history_check"
210
+ .checked=${((_r = this.schedule.task) === null || _r === void 0 ? void 0 : _r.history_check) || false}
211
+ ></md-checkbox
212
+ >History Check
213
+ </label>
214
+ <br /><br />
215
+
216
+ <md-outlined-select label="Failed Policy" name="task.failed_policy" required>
217
+ <md-select-option value="ignore" ?selected=${((_s = this.schedule.task) === null || _s === void 0 ? void 0 : _s.failed_policy) === 'ignore'}
218
+ >Ignore</md-select-option
219
+ >
220
+ <md-select-option value="retry" ?selected=${((_t = this.schedule.task) === null || _t === void 0 ? void 0 : _t.failed_policy) === 'retry'}
221
+ >Retry</md-select-option
222
+ >
223
+ <md-select-option value="retry_dlq" ?selected=${((_u = this.schedule.task) === null || _u === void 0 ? void 0 : _u.failed_policy) === 'retry_dlq'}
224
+ >Retry DLQ</md-select-option
225
+ >
226
+ </md-outlined-select>
227
+ <br /><br />
228
+
229
+ <md-filled-text-field
230
+ label="Retry Wait (ms)"
231
+ type="number"
232
+ id="retryWait"
233
+ name="task.retry_wait"
234
+ .valueAsNumber=${((_v = this.schedule.task) === null || _v === void 0 ? void 0 : _v.retry_wait) || 0}
235
+ ></md-filled-text-field>
236
+ <br /><br />
237
+
238
+ <md-filled-text-field
239
+ label="Retry Count"
240
+ type="number"
241
+ id="retryCount"
242
+ name="task.retry_count"
243
+ .valueAsNumber=${((_w = this.schedule.task) === null || _w === void 0 ? void 0 : _w.retry_count) || 0}
244
+ ></md-filled-text-field>
245
+ <br /><br />
246
+
247
+ <md-filled-text-field
248
+ label="Max Retry Count"
249
+ type="number"
250
+ id="maxRetryCount"
251
+ name="task.max_retry_count"
252
+ .valueAsNumber=${((_x = this.schedule.task) === null || _x === void 0 ? void 0 : _x.max_retry_count) || 0}
253
+ ></md-filled-text-field>
254
+ </fieldset>
255
+ </form>
256
+ </div>
257
+
258
+ <div class="footer">
259
+ <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>
260
+ <div filler></div>
261
+ <button @click=${this.cancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>
262
+ ${updatable
263
+ ? html ` <button @click=${this.updateSchedule.bind(this)} done>
264
+ <md-icon>update</md-icon>${i18next.t('button.update')}
265
+ </button>`
266
+ : html ` <button @click=${this.registerSchedule.bind(this)} done>
267
+ <md-icon>pending_actions</md-icon>${i18next.t('button.register')}
268
+ </button>`}
269
+ </div>
270
+ `;
271
+ }
272
+ async updated(changes) {
273
+ if (changes.has('scheduleId')) {
274
+ this.schedule = this.scheduleId ? await this.fetchSchedule(this.scheduleId) : {};
275
+ }
276
+ }
277
+ onInputChanged(event) {
278
+ const target = event.target;
279
+ const nameParts = target.name.split('.');
280
+ let current = this.schedule;
281
+ for (let i = 0; i < nameParts.length - 1; i++) {
282
+ const part = nameParts[i];
283
+ if (!current[part]) {
284
+ current[part] = {};
285
+ }
286
+ current = current[part];
287
+ }
288
+ const key = nameParts[nameParts.length - 1];
289
+ current[key] =
290
+ 'checked' in target
291
+ ? target.checked
292
+ : target.type === 'number'
293
+ ? Number(target.value)
294
+ : key == 'task.data'
295
+ ? JSON.parse(target.value)
296
+ : target.value;
297
+ this.requestUpdate();
298
+ }
299
+ reset() {
300
+ this.form.reset();
301
+ }
302
+ cancel() {
303
+ history.back();
304
+ }
305
+ prepareSchedule() {
306
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
307
+ this.schedule = Object.assign(Object.assign({}, this.schedule), { client: {
308
+ application: ((_a = this.schedule.client) === null || _a === void 0 ? void 0 : _a.application) || '',
309
+ group: ((_b = this.schedule.client) === null || _b === void 0 ? void 0 : _b.group) || '',
310
+ type: ((_c = this.schedule.client) === null || _c === void 0 ? void 0 : _c.type) || '',
311
+ key: ((_d = this.schedule.client) === null || _d === void 0 ? void 0 : _d.key) || '',
312
+ operation: ((_e = this.schedule.client) === null || _e === void 0 ? void 0 : _e.operation) || ''
313
+ }, task: Object.assign(Object.assign({}, this.schedule.task), { data: ((_f = this.schedule.task) === null || _f === void 0 ? void 0 : _f.data) || {}, history_check: (_h = (_g = this.schedule.task) === null || _g === void 0 ? void 0 : _g.history_check) !== null && _h !== void 0 ? _h : false, failed_policy: ((_j = this.schedule.task) === null || _j === void 0 ? void 0 : _j.failed_policy) || 'ignore', retry_wait: ((_k = this.schedule.task) === null || _k === void 0 ? void 0 : _k.retry_wait) || 0, retry_count: ((_l = this.schedule.task) === null || _l === void 0 ? void 0 : _l.retry_count) || 0, max_retry_count: ((_m = this.schedule.task) === null || _m === void 0 ? void 0 : _m.max_retry_count) || 0, connection: Object.assign(Object.assign({}, (_o = this.schedule.task) === null || _o === void 0 ? void 0 : _o.connection), { headers: ((_q = (_p = this.schedule.task) === null || _p === void 0 ? void 0 : _p.connection) === null || _q === void 0 ? void 0 : _q.headers) || {} }) }) });
314
+ }
315
+ async registerSchedule() {
316
+ var _a;
317
+ this.prepareSchedule();
318
+ const _b = this.schedule, { id } = _b, newSchedule = __rest(_b, ["id"]);
319
+ const response = await client.mutate({
320
+ mutation: gql `
321
+ mutation ($schedule: NewSchedule!) {
322
+ handle: registerSchedule(schedule: $schedule)
323
+ }
324
+ `,
325
+ variables: {
326
+ schedule: newSchedule
327
+ }
328
+ });
329
+ if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.handle) {
330
+ this.scheduleId = response.data.handle;
331
+ notify({
332
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.register') })
333
+ });
334
+ }
335
+ }
336
+ async updateSchedule() {
337
+ var _a;
338
+ this.prepareSchedule();
339
+ const response = await client.mutate({
340
+ mutation: gql `
341
+ mutation UpdateSchedule($schedule: SchedulePatch!) {
342
+ handle: updateSchedule(schedule: $schedule)
343
+ }
344
+ `,
345
+ variables: {
346
+ schedule: this.schedule
347
+ }
348
+ });
349
+ if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.handle) {
350
+ this.scheduleId = response.data.handle;
351
+ notify({
352
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.update') })
353
+ });
354
+ }
355
+ }
356
+ async fetchSchedule(id) {
357
+ var _a;
358
+ const response = await client.query({
359
+ query: gql `
360
+ query ($id: ID!) {
361
+ schedule(id: $id) {
362
+ id
363
+ name
364
+ client {
365
+ application
366
+ group
367
+ type
368
+ key
369
+ operation
370
+ }
371
+ type
372
+ schedule
373
+ timezone
374
+ task {
375
+ type
376
+ connection {
377
+ host
378
+ headers
379
+ topic
380
+ }
381
+ data
382
+ history_check
383
+ failed_policy
384
+ retry_wait
385
+ retry_count
386
+ max_retry_count
387
+ }
388
+ }
389
+ }
390
+ `,
391
+ variables: {
392
+ id
393
+ }
394
+ });
395
+ if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.schedule) {
396
+ console.log(`a schedule fetched : ${response.data.schedule}`);
397
+ return response.data.schedule;
398
+ }
399
+ }
400
+ };
401
+ NewSchedulePopup.styles = [
402
+ ScrollbarStyles,
403
+ CommonHeaderStyles,
404
+ css `
405
+ :host {
406
+ display: flex;
407
+ flex-direction: column;
408
+ color: var(--popup-content-color);
409
+ background-color: var(--popup-content-background-color);
410
+ }
411
+
412
+ [content] {
413
+ flex: 1;
414
+ padding: var(--spacing-medium);
415
+ overflow: auto;
416
+ }
417
+
418
+ label {
419
+ display: flex;
420
+ flex-direction: row;
421
+ gap: 10px;
422
+ align-items: center;
423
+ }
424
+
425
+ md-filled-button,
426
+ md-outlined-button {
427
+ margin-top: 16px;
428
+ }
429
+
430
+ .footer {
431
+ display: flex;
432
+ align-items: center;
433
+ justify-content: space-between;
434
+ }
435
+ `
436
+ ];
437
+ __decorate([
438
+ property({ type: Object }),
439
+ __metadata("design:type", Function)
440
+ ], NewSchedulePopup.prototype, "closeCallback", void 0);
441
+ __decorate([
442
+ property({ type: String, attribute: 'schedule-id' }),
443
+ __metadata("design:type", String)
444
+ ], NewSchedulePopup.prototype, "scheduleId", void 0);
445
+ __decorate([
446
+ state(),
447
+ __metadata("design:type", Object)
448
+ ], NewSchedulePopup.prototype, "schedule", void 0);
449
+ __decorate([
450
+ query('form'),
451
+ __metadata("design:type", HTMLFormElement)
452
+ ], NewSchedulePopup.prototype, "form", void 0);
453
+ NewSchedulePopup = __decorate([
454
+ customElement('schedule-popup')
455
+ ], NewSchedulePopup);
456
+ export { NewSchedulePopup };
457
+ //# sourceMappingURL=schedule-popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-popup.js","sourceRoot":"","sources":["../../../client/pages/scheduler/schedule-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8CAA8C,CAAA;AACr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AO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;aAChF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,EAAU;;QACpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BT;YACD,SAAS,EAAE;gBACT,EAAE;aACH;SACF,CAAC,CAAA;QAEF,IAAI,MAAA,QAAQ,CAAC,IAAI,0CAAE,QAAQ,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,wBAAwB,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;YAE7D,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAA;QAC/B,CAAC;IACH,CAAC;;AA5bM,uBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;CACF,AAnCY,CAmCZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAqD;AAC1B;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;oDAAoB;AAEhE;IAAR,KAAK,EAAE;;kDAAwB;AAEjB;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;8CAAA;AA3C1B,gBAAgB;IAD5B,aAAa,CAAC,gBAAgB,CAAC;GACnB,gBAAgB,CA8b5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/textfield/filled-text-field.js'\nimport '@material/web/select/outlined-select.js'\nimport '@material/web/checkbox/checkbox.js'\nimport '@material/web/button/filled-button.js'\nimport '@operato/input/ox-input-data.js'\nimport '@operato/input/ox-input-key-values.js'\n\nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { notify, openPopup } from '@operato/layout'\nimport moment from '@operato/moment-timezone-es'\n\nimport { Schedule } from 'types'\n\nfunction getSystemTimeZone(): string {\n try {\n const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone\n if (!timeZone) {\n throw new Error('Unable to resolve timeZone')\n }\n return timeZone\n } catch (e) {\n console.warn('Failed to get system timeZone, falling back to UTC.', e)\n return 'UTC'\n }\n}\n\nconst DEFAULT_TZ = getSystemTimeZone()\nconst TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]\n\n@customElement('schedule-popup')\nexport class NewSchedulePopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n color: var(--popup-content-color);\n background-color: var(--popup-content-background-color);\n }\n\n [content] {\n flex: 1;\n padding: var(--spacing-medium);\n overflow: auto;\n }\n\n label {\n display: flex;\n flex-direction: row;\n gap: 10px;\n align-items: center;\n }\n\n md-filled-button,\n md-outlined-button {\n margin-top: 16px;\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n `\n ]\n\n @property({ type: Object }) closeCallback?: (schedule?: Schedule | null) => void\n @property({ type: String, attribute: 'schedule-id' }) scheduleId?: string\n\n @state() schedule: Schedule = {}\n\n @query('form') form!: HTMLFormElement\n\n render() {\n const updatable = !!this.scheduleId\n\n return html`\n <div content>\n <form @change=${this.onInputChanged}>\n <md-filled-text-field\n label=\"Name\"\n type=\"text\"\n id=\"name\"\n name=\"name\"\n .value=${this.schedule.name || ''}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <fieldset>\n <legend>Client Details</legend>\n <md-filled-text-field\n label=\"Application\"\n type=\"text\"\n id=\"application\"\n name=\"client.application\"\n .value=${this.schedule.client?.application || ''}\n ?readonly=${updatable}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Group\"\n type=\"text\"\n id=\"group\"\n name=\"client.group\"\n .value=${this.schedule.client?.group || ''}\n ?readonly=${updatable}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Type\"\n type=\"text\"\n id=\"type\"\n name=\"client.type\"\n .value=${this.schedule.client?.type || ''}\n ?readonly=${updatable}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Key\"\n type=\"text\"\n id=\"key\"\n name=\"client.key\"\n .value=${this.schedule.client?.key || ''}\n ?readonly=${updatable}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Operation\"\n type=\"text\"\n id=\"operation\"\n name=\"client.operation\"\n .value=${this.schedule.client?.operation || ''}\n ?readonly=${updatable}\n required\n ></md-filled-text-field>\n </fieldset>\n <br />\n\n <fieldset>\n <legend>Schedule</legend>\n\n <md-outlined-select label=\"Schedule Type\" name=\"type\" required>\n <md-select-option value=\"now\" ?selected=${this.schedule.type === 'now'}>Now</md-select-option>\n <md-select-option value=\"delay\" ?selected=${this.schedule.type === 'delay'}>Delay</md-select-option>\n <md-select-option value=\"date\" ?selected=${this.schedule.type === 'date'}>Date</md-select-option>\n <md-select-option value=\"cron\" ?selected=${this.schedule.type === 'cron'}>Cron</md-select-option>\n <md-select-option value=\"delay-recur\" ?selected=${this.schedule.type === 'delay-recur'}\n >Delay-Recur</md-select-option\n >\n </md-outlined-select>\n <br /><br />\n\n <md-filled-text-field\n label=\"Schedule (optional)\"\n type=\"text\"\n id=\"schedule\"\n name=\"schedule\"\n .value=${this.schedule.schedule || ''}\n @click=${(e: MouseEvent) => {\n const x = e.target as HTMLInputElement\n openPopup(\n html`\n <ox-popup-crontab-input\n .value=${x.value}\n .confirmCallback=${value => {\n x.value = value\n x.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }))\n }}\n ></ox-popup-crontab-input>\n `,\n {\n backdrop: true,\n title: i18next.t('title.setting schedule')\n }\n )\n }}\n ></md-filled-text-field>\n <br /><br />\n\n <md-outlined-select\n label=\"Timezone (optional)\"\n id=\"timezone\"\n name=\"timezone\"\n .value=${this.schedule.timezone || ''}\n required\n >\n ${TIMEZONE_OPTIONS.map(\n tz =>\n html` <md-select-option value=${tz} ?selected=${this.schedule.timezone === tz}\n >${tz}</md-select-option\n >`\n )}\n </md-outlined-select>\n </fieldset>\n <br /><br />\n\n <fieldset>\n <legend>Task Details</legend>\n <md-outlined-select label=\"Task Type\" name=\"task.type\" required>\n <md-select-option value=\"rest\" ?selected=${this.schedule.task?.type === 'rest'}>REST</md-select-option>\n <md-select-option value=\"kafka\" ?selected=${this.schedule.task?.type === 'kafka'}>Kafka</md-select-option>\n <md-select-option value=\"redis\" ?selected=${this.schedule.task?.type === 'redis'}>Redis</md-select-option>\n </md-outlined-select>\n <br /><br />\n\n <md-filled-text-field\n label=\"Connection Host\"\n id=\"connectionHost\"\n name=\"task.connection.host\"\n .value=${this.schedule.task?.connection?.host || ''}\n required\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Connection Topic (optional)\"\n id=\"connectionTopic\"\n name=\"task.connection.topic\"\n .value=${this.schedule.task?.connection?.topic || ''}\n ></md-filled-text-field>\n <br /><br />\n\n <fieldset>\n <legend>Connection Headers (optional)</legend>\n <ox-input-key-values\n name=\"task.connection.headers\"\n .value=${this.schedule.task?.connection?.headers || {}}\n ></ox-input-key-values>\n </fieldset>\n <br /><br />\n\n <fieldset>\n <legend>Data (JSON)</legend>\n\n <ox-input-data name=\"task.data\" .value=${this.schedule.task?.data}> </ox-input-data>\n </fieldset>\n <br /><br />\n\n <label>\n <md-checkbox\n type=\"checkbox\"\n id=\"historyCheck\"\n name=\"task.history_check\"\n .checked=${this.schedule.task?.history_check || false}\n ></md-checkbox\n >History Check\n </label>\n <br /><br />\n\n <md-outlined-select label=\"Failed Policy\" name=\"task.failed_policy\" required>\n <md-select-option value=\"ignore\" ?selected=${this.schedule.task?.failed_policy === 'ignore'}\n >Ignore</md-select-option\n >\n <md-select-option value=\"retry\" ?selected=${this.schedule.task?.failed_policy === 'retry'}\n >Retry</md-select-option\n >\n <md-select-option value=\"retry_dlq\" ?selected=${this.schedule.task?.failed_policy === 'retry_dlq'}\n >Retry DLQ</md-select-option\n >\n </md-outlined-select>\n <br /><br />\n\n <md-filled-text-field\n label=\"Retry Wait (ms)\"\n type=\"number\"\n id=\"retryWait\"\n name=\"task.retry_wait\"\n .valueAsNumber=${this.schedule.task?.retry_wait || 0}\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Retry Count\"\n type=\"number\"\n id=\"retryCount\"\n name=\"task.retry_count\"\n .valueAsNumber=${this.schedule.task?.retry_count || 0}\n ></md-filled-text-field>\n <br /><br />\n\n <md-filled-text-field\n label=\"Max Retry Count\"\n type=\"number\"\n id=\"maxRetryCount\"\n name=\"task.max_retry_count\"\n .valueAsNumber=${this.schedule.task?.max_retry_count || 0}\n ></md-filled-text-field>\n </fieldset>\n </form>\n </div>\n\n <div class=\"footer\">\n <button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>\n <div filler></div>\n <button @click=${this.cancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>\n ${updatable\n ? html` <button @click=${this.updateSchedule.bind(this)} done>\n <md-icon>update</md-icon>${i18next.t('button.update')}\n </button>`\n : html` <button @click=${this.registerSchedule.bind(this)} done>\n <md-icon>pending_actions</md-icon>${i18next.t('button.register')}\n </button>`}\n </div>\n `\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('scheduleId')) {\n this.schedule = this.scheduleId ? await this.fetchSchedule(this.scheduleId) : {}\n }\n }\n\n private onInputChanged(event: Event) {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement\n const nameParts = target.name.split('.')\n let current = this.schedule\n\n for (let i = 0; i < nameParts.length - 1; i++) {\n const part = nameParts[i]\n if (!current[part]) {\n current[part] = {}\n }\n current = current[part]\n }\n\n const key = nameParts[nameParts.length - 1]\n current[key] =\n 'checked' in target\n ? (target as HTMLInputElement).checked\n : target.type === 'number'\n ? Number(target.value)\n : key == 'task.data'\n ? JSON.parse(target.value)\n : target.value\n\n this.requestUpdate()\n }\n\n private reset() {\n this.form.reset()\n }\n\n private cancel() {\n history.back()\n }\n\n private prepareSchedule() {\n this.schedule = {\n ...this.schedule,\n client: {\n application: this.schedule.client?.application || '',\n group: this.schedule.client?.group || '',\n type: this.schedule.client?.type || '',\n key: this.schedule.client?.key || '',\n operation: this.schedule.client?.operation || ''\n },\n task: {\n ...this.schedule.task,\n data: this.schedule.task?.data || {},\n history_check: this.schedule.task?.history_check ?? false,\n failed_policy: this.schedule.task?.failed_policy || 'ignore',\n retry_wait: this.schedule.task?.retry_wait || 0,\n retry_count: this.schedule.task?.retry_count || 0,\n max_retry_count: this.schedule.task?.max_retry_count || 0,\n connection: {\n ...this.schedule.task?.connection,\n headers: this.schedule.task?.connection?.headers || {}\n }\n }\n }\n }\n\n private async registerSchedule() {\n this.prepareSchedule()\n\n const { id, ...newSchedule } = this.schedule\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($schedule: NewSchedule!) {\n handle: registerSchedule(schedule: $schedule)\n }\n `,\n variables: {\n schedule: newSchedule\n }\n })\n\n if (response.data?.handle) {\n this.scheduleId = response.data.handle\n\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.register') })\n })\n }\n }\n\n private async updateSchedule() {\n this.prepareSchedule()\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateSchedule($schedule: SchedulePatch!) {\n handle: updateSchedule(schedule: $schedule)\n }\n `,\n variables: {\n schedule: this.schedule\n }\n })\n\n if (response.data?.handle) {\n this.scheduleId = response.data.handle\n\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.update') })\n })\n }\n }\n\n private async fetchSchedule(id: string) {\n const response = await client.query({\n query: gql`\n query ($id: ID!) {\n schedule(id: $id) {\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 }\n `,\n variables: {\n id\n }\n })\n\n if (response.data?.schedule) {\n console.log(`a schedule fetched : ${response.data.schedule}`)\n\n return response.data.schedule\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export default function route(page: string): "schedule-list" | undefined;
@@ -0,0 +1,8 @@
1
+ export default function route(page) {
2
+ switch (page) {
3
+ case 'schedule-list':
4
+ import('./pages/scheduler/schedule-list-page');
5
+ return page;
6
+ }
7
+ }
8
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,eAAe;YAClB,MAAM,CAAC,sCAAsC,CAAC,CAAA;YAC9C,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'schedule-list':\n import('./pages/scheduler/schedule-list-page')\n return page\n }\n}\n"]}