@gravitee/ui-components 3.27.2 → 3.27.3-pagination-4da8f9f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/en.json +3 -1
- package/assets/i18n/fr.json +3 -1
- package/package.json +10 -6
- package/src/atoms/gv-button/gv-button.d.ts +22 -5
- package/src/atoms/gv-button/gv-button.js +5 -8
- package/src/atoms/gv-button/gv-button.js.map +1 -1
- package/src/atoms/gv-button/gv-button.stories.js +11 -14
- package/src/atoms/gv-button/gv-button.stories.js.map +1 -1
- package/src/atoms/gv-checkbox/gv-checkbox.d.ts +3 -3
- package/src/atoms/gv-checkbox/gv-checkbox.stories.js +2 -2
- package/src/atoms/gv-checkbox/gv-checkbox.stories.js.map +1 -1
- package/src/atoms/gv-date-picker/gv-date-picker.js +32 -19
- package/src/atoms/gv-date-picker/gv-date-picker.js.map +1 -1
- package/src/atoms/gv-date-picker/gv-date-picker.stories.js +2 -2
- package/src/atoms/gv-date-picker/gv-date-picker.stories.js.map +1 -1
- package/src/atoms/gv-date-picker-calendar/gv-date-picker-calendar.d.ts +4 -4
- package/src/atoms/gv-icon/gv-icon.stories.js +1 -4
- package/src/atoms/gv-icon/gv-icon.stories.js.map +1 -1
- package/src/atoms/gv-input/gv-input.d.ts +5 -5
- package/src/atoms/gv-input/gv-input.js +1 -20
- package/src/atoms/gv-input/gv-input.js.map +1 -1
- package/src/atoms/gv-input/gv-input.stories.js +13 -13
- package/src/atoms/gv-input/gv-input.stories.js.map +1 -1
- package/src/atoms/gv-link/gv-link.js +19 -8
- package/src/atoms/gv-link/gv-link.js.map +1 -1
- package/src/atoms/gv-link/gv-link.stories.js +2 -2
- package/src/atoms/gv-link/gv-link.stories.js.map +1 -1
- package/src/atoms/gv-message/gv-message.d.ts +1 -1
- package/src/atoms/gv-message/gv-message.stories.js +7 -7
- package/src/atoms/gv-message/gv-message.stories.js.map +1 -1
- package/src/atoms/gv-metric/gv-metric.stories.js +1 -1
- package/src/atoms/gv-metric/gv-metric.stories.js.map +1 -1
- package/src/atoms/gv-relative-time/gv-relative-time.js +54 -41
- package/src/atoms/gv-relative-time/gv-relative-time.js.map +1 -1
- package/src/atoms/gv-relative-time/gv-relative-time.stories.js +1 -4
- package/src/atoms/gv-relative-time/gv-relative-time.stories.js.map +1 -1
- package/src/atoms/gv-select/gv-select.d.ts +2 -2
- package/src/atoms/gv-select/gv-select.js +1 -16
- package/src/atoms/gv-select/gv-select.js.map +1 -1
- package/src/atoms/gv-select/gv-select.stories.js +10 -10
- package/src/atoms/gv-select/gv-select.stories.js.map +1 -1
- package/src/atoms/gv-select-native/gv-select-native.d.ts +7 -6
- package/src/atoms/gv-select-native/gv-select-native.js +28 -28
- package/src/atoms/gv-select-native/gv-select-native.js.map +1 -1
- package/src/atoms/gv-select-native/gv-select-native.stories.js +10 -10
- package/src/atoms/gv-select-native/gv-select-native.stories.js.map +1 -1
- package/src/atoms/gv-state/gv-state.stories.js +1 -1
- package/src/atoms/gv-state/gv-state.stories.js.map +1 -1
- package/src/atoms/gv-switch/gv-switch.stories.js +3 -3
- package/src/atoms/gv-switch/gv-switch.stories.js.map +1 -1
- package/src/atoms/gv-switch/gv-switch.test.js +21 -12
- package/src/atoms/gv-switch/gv-switch.test.js.map +1 -1
- package/src/atoms/gv-tag/gv-tag.stories.js +2 -2
- package/src/atoms/gv-tag/gv-tag.stories.js.map +1 -1
- package/src/atoms/gv-text/gv-text.d.ts +2 -2
- package/src/atoms/gv-text/gv-text.stories.js +6 -6
- package/src/atoms/gv-text/gv-text.stories.js.map +1 -1
- package/src/charts/gv-chart-bar/gv-chart-bar.d.ts +1 -1
- package/src/charts/gv-chart-bar/gv-chart-bar.js +68 -57
- package/src/charts/gv-chart-bar/gv-chart-bar.js.map +1 -1
- package/src/charts/gv-chart-gauge/gv-chart-gauge.d.ts +1 -1
- package/src/charts/gv-chart-gauge/gv-chart-gauge.js +42 -39
- package/src/charts/gv-chart-gauge/gv-chart-gauge.js.map +1 -1
- package/src/charts/gv-chart-histogram/gv-chart-histogram.d.ts +1 -1
- package/src/charts/gv-chart-histogram/gv-chart-histogram.js +56 -45
- package/src/charts/gv-chart-histogram/gv-chart-histogram.js.map +1 -1
- package/src/charts/gv-chart-line/gv-chart-line.d.ts +1 -1
- package/src/charts/gv-chart-line/gv-chart-line.js +115 -111
- package/src/charts/gv-chart-line/gv-chart-line.js.map +1 -1
- package/src/charts/gv-chart-map/gv-chart-map.d.ts +1 -1
- package/src/charts/gv-chart-map/gv-chart-map.js +78 -67
- package/src/charts/gv-chart-map/gv-chart-map.js.map +1 -1
- package/src/charts/gv-chart-map/gv-chart-map.stories.js +2 -2
- package/src/charts/gv-chart-map/gv-chart-map.stories.js.map +1 -1
- package/src/charts/gv-chart-pie/gv-chart-pie.d.ts +1 -1
- package/src/charts/gv-chart-pie/gv-chart-pie.js +58 -47
- package/src/charts/gv-chart-pie/gv-chart-pie.js.map +1 -1
- package/src/charts/gv-chart-pie/gv-chart-pie.stories.js +15 -6
- package/src/charts/gv-chart-pie/gv-chart-pie.stories.js.map +1 -1
- package/src/lib/cron-expression.js +1 -1
- package/src/lib/cron-expression.js.map +1 -1
- package/src/lib/events.js +1 -6
- package/src/lib/events.js.map +1 -1
- package/src/lib/i18n.d.ts +1 -1
- package/src/lib/i18n.js +2 -2
- package/src/lib/i18n.js.map +1 -1
- package/src/mixins/chart-element.d.ts +1 -1
- package/src/mixins/chart-element.js +26 -18
- package/src/mixins/chart-element.js.map +1 -1
- package/src/mixins/input-element.d.ts +1 -1
- package/src/mixins/item-resource.d.ts +3 -3
- package/src/mixins/item-resource.js +2 -7
- package/src/mixins/item-resource.js.map +1 -1
- package/src/mixins/keyboard-element.d.ts +3 -1
- package/src/mixins/keyboard-element.js +10 -6
- package/src/mixins/keyboard-element.js.map +1 -1
- package/src/mixins/update-after-browser.js +17 -3
- package/src/mixins/update-after-browser.js.map +1 -1
- package/src/mixins/with-resize-observer.js +29 -15
- package/src/mixins/with-resize-observer.js.map +1 -1
- package/src/molecules/gv-card/gv-card.d.ts +4 -4
- package/src/molecules/gv-card-full/gv-card-full.d.ts +4 -4
- package/src/molecules/gv-card-list/gv-card-list.d.ts +2 -2
- package/src/molecules/gv-category/gv-category.d.ts +1 -1
- package/src/molecules/gv-code/gv-code.js +66 -53
- package/src/molecules/gv-code/gv-code.js.map +1 -1
- package/src/molecules/gv-code/gv-code.stories.js +4 -4
- package/src/molecules/gv-code/gv-code.stories.js.map +1 -1
- package/src/molecules/gv-code/gv-code.test.js +29 -20
- package/src/molecules/gv-code/gv-code.test.js.map +1 -1
- package/src/molecules/gv-cron-editor/gv-cron-editor.d.ts +3 -3
- package/src/molecules/gv-cron-editor/gv-cron-editor.js +19 -15
- package/src/molecules/gv-cron-editor/gv-cron-editor.js.map +1 -1
- package/src/molecules/gv-expandable/gv-expandable.stories.js +1 -4
- package/src/molecules/gv-expandable/gv-expandable.stories.js.map +1 -1
- package/src/molecules/gv-expression-language/gv-expression-language.js +1 -4
- package/src/molecules/gv-expression-language/gv-expression-language.js.map +1 -1
- package/src/molecules/gv-expression-language/gv-expression-language.stories.js +4 -4
- package/src/molecules/gv-expression-language/gv-expression-language.stories.js.map +1 -1
- package/src/molecules/gv-expression-language/gv-expression-language.test.js +24 -15
- package/src/molecules/gv-expression-language/gv-expression-language.test.js.map +1 -1
- package/src/molecules/gv-list/gv-list.d.ts +5 -5
- package/src/molecules/gv-list/gv-list.js +1 -7
- package/src/molecules/gv-list/gv-list.js.map +1 -1
- package/src/molecules/gv-metrics/gv-metrics.d.ts +2 -2
- package/src/molecules/gv-metrics/gv-metrics.stories.js +4 -7
- package/src/molecules/gv-metrics/gv-metrics.stories.js.map +1 -1
- package/src/molecules/gv-modal/gv-modal.stories.d.ts +1 -1
- package/src/molecules/gv-modal/gv-modal.stories.js +1 -4
- package/src/molecules/gv-modal/gv-modal.stories.js.map +1 -1
- package/src/molecules/gv-nav/gv-nav.d.ts +1 -1
- package/src/molecules/gv-option/gv-option.d.ts +1 -1
- package/src/molecules/gv-option/gv-option.js +17 -3
- package/src/molecules/gv-option/gv-option.js.map +1 -1
- package/src/molecules/gv-option/gv-option.stories.js +3 -3
- package/src/molecules/gv-option/gv-option.stories.js.map +1 -1
- package/src/molecules/gv-plans/gv-plans.d.ts +1 -1
- package/src/molecules/gv-popover/gv-popover.d.ts +1 -1
- package/src/molecules/gv-promote/gv-promote.d.ts +4 -4
- package/src/molecules/gv-promote/gv-promote.js +1 -4
- package/src/molecules/gv-promote/gv-promote.js.map +1 -1
- package/src/molecules/gv-rating/gv-rating.d.ts +1 -1
- package/src/molecules/gv-rating/gv-rating.stories.js +2 -2
- package/src/molecules/gv-rating/gv-rating.stories.js.map +1 -1
- package/src/molecules/gv-rating-list/gv-rating-list.d.ts +2 -2
- package/src/molecules/gv-row/gv-row.d.ts +1 -1
- package/src/molecules/gv-row/gv-row.js +2 -4
- package/src/molecules/gv-row/gv-row.js.map +1 -1
- package/src/molecules/gv-row/gv-row.stories.js +1 -1
- package/src/molecules/gv-row/gv-row.stories.js.map +1 -1
- package/src/molecules/gv-row-expandable/gv-row-expandable.stories.js +1 -4
- package/src/molecules/gv-row-expandable/gv-row-expandable.stories.js.map +1 -1
- package/src/molecules/gv-stats/gv-stats.d.ts +2 -2
- package/src/molecules/gv-stepper/gv-stepper.d.ts +2 -2
- package/src/molecules/gv-stepper/gv-stepper.js +27 -13
- package/src/molecules/gv-stepper/gv-stepper.js.map +1 -1
- package/src/molecules/gv-stepper/gv-stepper.stories.js +2 -8
- package/src/molecules/gv-stepper/gv-stepper.stories.js.map +1 -1
- package/src/molecules/gv-table/gv-table.d.ts +8 -8
- package/src/molecules/gv-table/gv-table.js +11 -17
- package/src/molecules/gv-table/gv-table.js.map +1 -1
- package/src/molecules/gv-table/gv-table.stories.js +2 -2
- package/src/molecules/gv-table/gv-table.stories.js.map +1 -1
- package/src/molecules/gv-tree/gv-tree.d.ts +1 -1
- package/src/organisms/gv-documentation/gv-documentation.d.ts +1 -1
- package/src/organisms/gv-header/gv-header.d.ts +3 -3
- package/src/organisms/gv-header/gv-header.stories.js +2 -2
- package/src/organisms/gv-header/gv-header.stories.js.map +1 -1
- package/src/organisms/gv-http-client/gv-http-client.d.ts +6 -22
- package/src/organisms/gv-http-client/gv-http-client.js +1 -2
- package/src/organisms/gv-http-client/gv-http-client.js.map +1 -1
- package/src/organisms/gv-http-client/gv-http-client.stories.d.ts +1 -1
- package/src/organisms/gv-http-client/gv-http-client.stories.js +4 -10
- package/src/organisms/gv-http-client/gv-http-client.stories.js.map +1 -1
- package/src/organisms/gv-menu/gv-menu.d.ts +1 -1
- package/src/organisms/gv-pagination/gv-pagination.d.ts +37 -47
- package/src/organisms/gv-pagination/gv-pagination.js +220 -71
- package/src/organisms/gv-pagination/gv-pagination.js.map +1 -1
- package/src/organisms/gv-pagination/gv-pagination.stories.d.ts +85 -8
- package/src/organisms/gv-pagination/gv-pagination.stories.js +36 -2
- package/src/organisms/gv-pagination/gv-pagination.stories.js.map +1 -1
- package/src/organisms/gv-pagination/index.d.ts +1 -0
- package/src/organisms/gv-pagination/index.js +1 -0
- package/src/organisms/gv-pagination/index.js.map +1 -1
- package/src/organisms/gv-pagination/model/index.d.ts +2 -0
- package/src/organisms/gv-pagination/model/index.js +18 -0
- package/src/organisms/gv-pagination/model/index.js.map +1 -0
- package/src/organisms/gv-pagination/model/paginate-detail.d.ts +4 -0
- package/src/organisms/gv-pagination/model/paginate-detail.js +2 -0
- package/src/organisms/gv-pagination/model/paginate-detail.js.map +1 -0
- package/src/organisms/gv-pagination/model/pagination.d.ts +9 -0
- package/src/organisms/gv-pagination/model/pagination.js +2 -0
- package/src/organisms/gv-pagination/model/pagination.js.map +1 -0
- package/src/organisms/gv-properties/gv-properties.d.ts +11 -11
- package/src/organisms/gv-properties/gv-properties.js +7 -13
- package/src/organisms/gv-properties/gv-properties.js.map +1 -1
- package/src/organisms/gv-resources/gv-resources.d.ts +6 -5
- package/src/organisms/gv-resources/gv-resources.js +20 -6
- package/src/organisms/gv-resources/gv-resources.js.map +1 -1
- package/src/organisms/gv-resources/gv-resources.test.js +4 -4
- package/src/organisms/gv-resources/gv-resources.test.js.map +1 -1
- package/src/organisms/gv-schema-form/gv-schema-form.d.ts +1 -1
- package/src/organisms/gv-schema-form/gv-schema-form.js +43 -25
- package/src/organisms/gv-schema-form/gv-schema-form.js.map +1 -1
- package/src/organisms/gv-schema-form/gv-schema-form.stories.js +100 -90
- package/src/organisms/gv-schema-form/gv-schema-form.stories.js.map +1 -1
- package/src/organisms/gv-schema-form/gv-schema-form.test.js +27 -18
- package/src/organisms/gv-schema-form/gv-schema-form.test.js.map +1 -1
- package/src/organisms/gv-schema-form-array/gv-schema-form-array.d.ts +2 -2
- package/src/organisms/gv-schema-form-array/gv-schema-form-array.js +18 -4
- package/src/organisms/gv-schema-form-array/gv-schema-form-array.js.map +1 -1
- package/src/organisms/gv-schema-form-control/gv-schema-form-control.d.ts +2 -2
- package/src/organisms/gv-schema-form-control/gv-schema-form-control.js +25 -9
- package/src/organisms/gv-schema-form-control/gv-schema-form-control.js.map +1 -1
- package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.d.ts +2 -2
- package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.js +18 -4
- package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.js.map +1 -1
- package/src/organisms/gv-tabs/gv-tabs.js +1 -1
- package/src/organisms/gv-tabs/gv-tabs.js.map +1 -1
- package/src/organisms/gv-user-menu/gv-user-menu.d.ts +1 -1
- package/src/policy-studio/gv-flow/gv-flow.d.ts +2 -2
- package/src/policy-studio/gv-flow/gv-flow.js +28 -9
- package/src/policy-studio/gv-flow/gv-flow.js.map +1 -1
- package/src/policy-studio/gv-flow-step/gv-flow-step.d.ts +2 -2
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.d.ts +11 -10
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.js +405 -349
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.js.map +1 -1
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.stories.js +3 -3
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.stories.js.map +1 -1
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.test.js +32 -33
- package/src/policy-studio/gv-policy-studio/gv-policy-studio.test.js.map +1 -1
- package/src/policy-studio/gv-policy-studio-menu/gv-policy-studio-menu.d.ts +3 -3
- package/wc/gv-pagination.d.ts +1 -1
- package/wc/gv-pagination.js +1 -1
- package/wc/gv-pagination.js.map +1 -1
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
1
21
|
/*
|
|
2
22
|
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3
23
|
*
|
|
@@ -350,31 +370,33 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
350
370
|
this._policyFilter = [];
|
|
351
371
|
this._flowFilter = [];
|
|
352
372
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
willUpdate(changedProperties) {
|
|
374
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
375
|
+
if (changedProperties.has('configurationSchema') && this.configurationSchema) {
|
|
376
|
+
this._tabs.splice(1, 0, { id: 'settings', title: 'Configuration', icon: 'general:settings#2' });
|
|
377
|
+
}
|
|
378
|
+
if (changedProperties.has('hasPolicyFilter') && this.hasPolicyFilter === true) {
|
|
379
|
+
this._policyFilterOptions = [
|
|
380
|
+
{ id: 'onRequest', title: 'Request', icon: 'navigation:arrow-from-left' },
|
|
381
|
+
{ id: 'onResponse', title: 'Response', icon: 'navigation:arrow-from-right' },
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
if (changedProperties.has('canDebug') && this.canDebug === true) {
|
|
385
|
+
this._tabs = [...this._tabs, { id: 'debug', title: 'Try it', icon: 'content:send' }];
|
|
386
|
+
}
|
|
387
|
+
const tabsImport = [];
|
|
388
|
+
if (changedProperties.has('hasProperties') && this.hasProperties === true) {
|
|
389
|
+
tabsImport.push(import('../../organisms/gv-properties').then(() => ({ id: 'properties', title: 'Properties', icon: 'general:settings#1' })));
|
|
390
|
+
}
|
|
391
|
+
if (changedProperties.has('hasResources') && this.hasProperties === true) {
|
|
392
|
+
tabsImport.push(import('../../organisms/gv-resources').then(() => ({ id: 'resources', title: 'Resources', icon: 'general:settings#5' })));
|
|
393
|
+
}
|
|
394
|
+
if (tabsImport.length > 0) {
|
|
395
|
+
const [...tabs] = yield Promise.all(tabsImport);
|
|
396
|
+
this._tabs = [...this._tabs, ...tabs];
|
|
397
|
+
this.requestUpdate();
|
|
398
|
+
}
|
|
399
|
+
});
|
|
378
400
|
}
|
|
379
401
|
get _flowFilterOptions() {
|
|
380
402
|
if (this.definedPlans.length > 0) {
|
|
@@ -384,6 +406,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
384
406
|
];
|
|
385
407
|
}
|
|
386
408
|
}
|
|
409
|
+
get keyboardTarget() {
|
|
410
|
+
return window;
|
|
411
|
+
}
|
|
387
412
|
onKeyboard() {
|
|
388
413
|
if (this._currentAskConfirmation == null) {
|
|
389
414
|
if (this.isPressed(KEYS.Shift, KEYS.Ctrl, KEYS.Space)) {
|
|
@@ -418,9 +443,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
418
443
|
const plans = definition.plans == null
|
|
419
444
|
? []
|
|
420
445
|
: definition.plans.map((plan) => {
|
|
421
|
-
return {
|
|
446
|
+
return Object.assign(Object.assign({}, plan), { flows: this._generatePlanFlowsId(plan) });
|
|
422
447
|
});
|
|
423
|
-
this._initialDefinition = {
|
|
448
|
+
this._initialDefinition = Object.assign(Object.assign({}, definition), { flows, resources, plans });
|
|
424
449
|
this._definition = deepClone(this._initialDefinition);
|
|
425
450
|
this.isDirty = false;
|
|
426
451
|
this._selectFirstFlow();
|
|
@@ -472,90 +497,92 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
472
497
|
_onDragEndPolicy() {
|
|
473
498
|
this.shadowRoot.querySelectorAll('gv-flow').forEach((e) => e.onDragEnd());
|
|
474
499
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
else {
|
|
494
|
-
_id = this._generateFlowStepId(targetFlow._id, detail.flowKey, detail.position);
|
|
495
|
-
_new = true;
|
|
496
|
-
}
|
|
497
|
-
const flowStep = { _id, _new, name, policy: policy.id, description, condition, enabled: true, configuration };
|
|
498
|
-
const sourceFlow = detail.sourceFlowId != null ? this._findFlowById(detail.sourceFlowId) : targetFlow;
|
|
499
|
-
if (detail.sourcePosition != null) {
|
|
500
|
-
if (detail.sourceFlowKey && detail.sourceFlowKey !== detail.flowKey) {
|
|
501
|
-
sourceFlow[detail.sourceFlowKey].splice(detail.sourcePosition, 1);
|
|
502
|
-
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
503
|
-
if (this._currentFlowStep != null && this._currentFlowStep.step._id === _id) {
|
|
504
|
-
this._currentFlowStep.group = detail.flowKey;
|
|
505
|
-
// Special case for update schema after change request to response or inverse
|
|
506
|
-
const schema = this.buildSchema(this._currentFlowStep.policy);
|
|
507
|
-
await this._setCurrentFlowStep(this._currentFlowStep, schema, true);
|
|
508
|
-
this._getFlowElement(targetFlow._id).requestUpdate();
|
|
509
|
-
}
|
|
500
|
+
_onDropPolicy({ detail }) {
|
|
501
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
502
|
+
try {
|
|
503
|
+
yield this._askToValidateForms();
|
|
504
|
+
const policy = detail.policy;
|
|
505
|
+
const targetFlow = this._findFlowById(detail.flowId);
|
|
506
|
+
let name = policy.name;
|
|
507
|
+
let description = '';
|
|
508
|
+
let condition = '';
|
|
509
|
+
let configuration = {};
|
|
510
|
+
let _id;
|
|
511
|
+
let _new = false;
|
|
512
|
+
if (detail.flowStep) {
|
|
513
|
+
_id = detail.flowStep._id;
|
|
514
|
+
name = detail.flowStep.name;
|
|
515
|
+
description = detail.flowStep.description || '';
|
|
516
|
+
condition = detail.flowStep.condition || '';
|
|
517
|
+
configuration = detail.flowStep.configuration;
|
|
510
518
|
}
|
|
511
519
|
else {
|
|
512
|
-
|
|
520
|
+
_id = this._generateFlowStepId(targetFlow._id, detail.flowKey, detail.position);
|
|
521
|
+
_new = true;
|
|
522
|
+
}
|
|
523
|
+
const flowStep = { _id, _new, name, policy: policy.id, description, condition, enabled: true, configuration };
|
|
524
|
+
const sourceFlow = detail.sourceFlowId != null ? this._findFlowById(detail.sourceFlowId) : targetFlow;
|
|
525
|
+
if (detail.sourcePosition != null) {
|
|
526
|
+
if (detail.sourceFlowKey && detail.sourceFlowKey !== detail.flowKey) {
|
|
527
|
+
sourceFlow[detail.sourceFlowKey].splice(detail.sourcePosition, 1);
|
|
513
528
|
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
514
|
-
|
|
529
|
+
if (this._currentFlowStep != null && this._currentFlowStep.step._id === _id) {
|
|
530
|
+
this._currentFlowStep.group = detail.flowKey;
|
|
531
|
+
// Special case for update schema after change request to response or inverse
|
|
532
|
+
const schema = this.buildSchema(this._currentFlowStep.policy);
|
|
533
|
+
yield this._setCurrentFlowStep(this._currentFlowStep, schema, true);
|
|
534
|
+
this._getFlowElement(targetFlow._id).requestUpdate();
|
|
535
|
+
}
|
|
515
536
|
}
|
|
516
537
|
else {
|
|
517
|
-
|
|
518
|
-
|
|
538
|
+
if (detail.position > detail.sourcePosition) {
|
|
539
|
+
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
540
|
+
sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
|
|
544
|
+
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
545
|
+
}
|
|
519
546
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
this._getFlowElement(targetFlow._id).requestUpdate();
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
528
|
-
const currentFlowForm = this._getFlowStepForm();
|
|
529
|
-
if (currentFlowForm == null || currentFlowForm.dirty !== true) {
|
|
530
|
-
let step = targetFlow[detail.flowKey][detail.position];
|
|
531
|
-
if (step == null) {
|
|
532
|
-
// When confirm lose change after drop policy
|
|
533
|
-
step = targetFlow[detail.flowKey][detail.position - 1];
|
|
547
|
+
// Force Refresh source flow element when move to other flow
|
|
548
|
+
if (targetFlow._id !== sourceFlow._id) {
|
|
549
|
+
this._getFlowElement(targetFlow._id).requestUpdate();
|
|
534
550
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
|
|
554
|
+
const currentFlowForm = this._getFlowStepForm();
|
|
555
|
+
if (currentFlowForm == null || currentFlowForm.dirty !== true) {
|
|
556
|
+
let step = targetFlow[detail.flowKey][detail.position];
|
|
557
|
+
if (step == null) {
|
|
558
|
+
// When confirm lose change after drop policy
|
|
559
|
+
step = targetFlow[detail.flowKey][detail.position - 1];
|
|
560
|
+
}
|
|
561
|
+
if (detail.cancelEdit !== true) {
|
|
562
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
563
|
+
yield this._editFlowStep({ step, policy, flow: targetFlow, group: detail.flowKey });
|
|
564
|
+
this.updateComplete.then(() => {
|
|
565
|
+
const flowElement = this._getFlowElement(targetFlow._id);
|
|
566
|
+
flowElement.selectedStepId = step._id;
|
|
567
|
+
flowElement.requestUpdate();
|
|
568
|
+
});
|
|
569
|
+
}));
|
|
570
|
+
}
|
|
544
571
|
}
|
|
545
572
|
}
|
|
573
|
+
targetFlow._dirty = true;
|
|
574
|
+
sourceFlow._dirty = true;
|
|
575
|
+
this.isDirty = true;
|
|
576
|
+
this.shadowRoot.querySelectorAll('gv-flow').forEach((gvFlow) => gvFlow.removeCandidate());
|
|
577
|
+
setTimeout(() => {
|
|
578
|
+
this._dragPolicy = null;
|
|
579
|
+
this._dropPolicy = null;
|
|
580
|
+
}, 0);
|
|
546
581
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
setTimeout(() => {
|
|
552
|
-
this._dragPolicy = null;
|
|
553
|
-
this._dropPolicy = null;
|
|
554
|
-
}, 0);
|
|
555
|
-
}
|
|
556
|
-
catch (e) {
|
|
557
|
-
this._currentAskConfirmation = null;
|
|
558
|
-
}
|
|
582
|
+
catch (e) {
|
|
583
|
+
this._currentAskConfirmation = null;
|
|
584
|
+
}
|
|
585
|
+
});
|
|
559
586
|
}
|
|
560
587
|
_onDeletePolicy({ detail }) {
|
|
561
588
|
const targetFlow = this._findFlowById(detail.flowId);
|
|
@@ -587,35 +614,39 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
587
614
|
};
|
|
588
615
|
if (schema) {
|
|
589
616
|
const jsonSchema = typeof schema === 'string' ? JSON.parse(schema) : schema;
|
|
590
|
-
const properties = { commonDescription,
|
|
591
|
-
return {
|
|
617
|
+
const properties = Object.assign(Object.assign({ commonDescription }, (this.hasConditionalSteps ? { commonCondition } : {})), jsonSchema.properties);
|
|
618
|
+
return Object.assign(Object.assign({}, jsonSchema), { properties });
|
|
592
619
|
}
|
|
593
|
-
return { properties: { commonDescription,
|
|
620
|
+
return { properties: Object.assign({ commonDescription }, (this.hasConditionalSteps ? { commonCondition } : {})) };
|
|
594
621
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
622
|
+
_editFlowStep({ step, flow, policy, group }) {
|
|
623
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
624
|
+
if (step) {
|
|
625
|
+
this._currentPolicyId = policy.id;
|
|
626
|
+
const currentFlowStep = { flow, step, policy, group };
|
|
627
|
+
const schema = this.buildSchema(policy);
|
|
628
|
+
try {
|
|
629
|
+
yield this._setCurrentFlowStep(currentFlowStep, schema);
|
|
630
|
+
this._updateSelectedFlows([flow._id]);
|
|
631
|
+
this._splitMainViews();
|
|
632
|
+
if (localStorage.getItem('gv-policy-studio:keep-documentation-close') == null) {
|
|
633
|
+
this._onOpenDocumentation();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
catch (e) {
|
|
637
|
+
this._currentAskConfirmation = null;
|
|
606
638
|
}
|
|
607
639
|
}
|
|
608
|
-
|
|
609
|
-
this.
|
|
640
|
+
else {
|
|
641
|
+
yield this._closeFlowStepForm();
|
|
642
|
+
this._maximizeTopView();
|
|
610
643
|
}
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
await this._closeFlowStepForm();
|
|
614
|
-
this._maximizeTopView();
|
|
615
|
-
}
|
|
644
|
+
});
|
|
616
645
|
}
|
|
617
|
-
|
|
618
|
-
return this
|
|
646
|
+
_onEditFlowStep({ detail: { step, flow, policy, group } }) {
|
|
647
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
648
|
+
return this._editFlowStep({ step, flow, policy, group });
|
|
649
|
+
});
|
|
619
650
|
}
|
|
620
651
|
_getResizableViews() {
|
|
621
652
|
return this.shadowRoot.querySelector('gv-resizable-views');
|
|
@@ -638,78 +669,82 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
638
669
|
targetFlow._dirty = true;
|
|
639
670
|
this.isDirty = true;
|
|
640
671
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
672
|
+
_onCloseFlowStepForm() {
|
|
673
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
674
|
+
try {
|
|
675
|
+
yield this._closeFlowStepForm();
|
|
676
|
+
}
|
|
677
|
+
catch (err) {
|
|
678
|
+
this._currentAskConfirmation = null;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
648
681
|
}
|
|
649
|
-
|
|
650
|
-
|
|
682
|
+
_closeFlowStepForm(force = false) {
|
|
683
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
684
|
+
yield this._setCurrentFlowStep(null, null, force);
|
|
685
|
+
});
|
|
651
686
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
this._currentAskConfirmation
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
// Refresh if lose changes lost current step selection
|
|
660
|
-
return this._checkCurrentFlowStep().then(() => {
|
|
687
|
+
_askToValidateForms() {
|
|
688
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
689
|
+
if (this._currentAskConfirmation == null) {
|
|
690
|
+
this._currentAskConfirmation = true;
|
|
691
|
+
return Promise.all(this._submitOrConfirmForms()).then((forms) => {
|
|
692
|
+
if (forms.filter((r) => r != null).length > 0) {
|
|
693
|
+
this._definition = this._buildDefinitionToSave();
|
|
661
694
|
this.getChildren().forEach((e) => e.requestUpdate());
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
695
|
+
// Refresh if lose changes lost current step selection
|
|
696
|
+
return this._checkCurrentFlowStep().then(() => {
|
|
697
|
+
this.getChildren().forEach((e) => e.requestUpdate());
|
|
698
|
+
return this.updateComplete.then(() => {
|
|
699
|
+
this._currentAskConfirmation = null;
|
|
700
|
+
return forms;
|
|
701
|
+
});
|
|
665
702
|
});
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
if (this._currentFlowStep._values) {
|
|
703
|
-
this._currentFlowStep._values.scope = schema.properties.scope.enum[0];
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
this._currentAskConfirmation = null;
|
|
706
|
+
return forms;
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
throw new Error('ask already waiting');
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
_setCurrentFlowStep(currentFlowStep, flowStepSchema, force = false) {
|
|
714
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
715
|
+
if (!force) {
|
|
716
|
+
yield this._askToValidateForms();
|
|
717
|
+
}
|
|
718
|
+
const schema = deepClone(flowStepSchema);
|
|
719
|
+
if (currentFlowStep != null) {
|
|
720
|
+
const configuration = typeof currentFlowStep.step.configuration === 'string'
|
|
721
|
+
? JSON.parse(currentFlowStep.step.configuration)
|
|
722
|
+
: currentFlowStep.step.configuration;
|
|
723
|
+
const step = Object.assign(Object.assign({}, currentFlowStep.step), { configuration });
|
|
724
|
+
const _initialValues = Object.assign(Object.assign({}, step.configuration), { commonDescription: step.description, commonCondition: step.condition });
|
|
725
|
+
this._currentFlowStep = Object.assign(Object.assign({}, currentFlowStep), { step, _initialValues });
|
|
726
|
+
if (flowStepSchema && flowStepSchema.properties.scope) {
|
|
727
|
+
const _enum = schema.properties.scope.enum;
|
|
728
|
+
if (_enum.find((scope) => ['REQUEST', 'REQUEST_CONTENT', 'RESPONSE', 'RESPONSE_CONTENT'].includes(scope)) != null) {
|
|
729
|
+
const filtered = this._currentFlowStep.group === 'pre' ? ['REQUEST', 'REQUEST_CONTENT'] : ['RESPONSE', 'RESPONSE_CONTENT'];
|
|
730
|
+
schema.properties.scope.enum = _enum.filter((scope) => filtered.includes(scope));
|
|
731
|
+
const scope = this._currentFlowStep.step.configuration.scope;
|
|
732
|
+
if (scope == null || !schema.properties.scope.enum.includes(scope)) {
|
|
733
|
+
schema.properties.scope.default = schema.properties.scope.enum[0];
|
|
734
|
+
this._currentFlowStep.step.configuration.scope = schema.properties.scope.enum[0];
|
|
735
|
+
this._currentFlowStep._initialValues.scope = schema.properties.scope.enum[0];
|
|
736
|
+
if (this._currentFlowStep._values) {
|
|
737
|
+
this._currentFlowStep._values.scope = schema.properties.scope.enum[0];
|
|
738
|
+
}
|
|
704
739
|
}
|
|
705
740
|
}
|
|
706
741
|
}
|
|
707
742
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
743
|
+
else {
|
|
744
|
+
this._currentFlowStep = null;
|
|
745
|
+
}
|
|
746
|
+
this._flowStepSchema = schema;
|
|
747
|
+
});
|
|
713
748
|
}
|
|
714
749
|
_refresh(closeStepForm = true) {
|
|
715
750
|
if (closeStepForm) {
|
|
@@ -717,32 +752,36 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
717
752
|
}
|
|
718
753
|
this._definition = deepClone(this._definition);
|
|
719
754
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
755
|
+
_onSelectFlows({ detail }) {
|
|
756
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
757
|
+
try {
|
|
758
|
+
yield this._closeFlowStepForm();
|
|
759
|
+
this._onCloseDocumentation();
|
|
760
|
+
this._updateSelectedFlows(detail.flows);
|
|
761
|
+
this._onDesign();
|
|
762
|
+
}
|
|
763
|
+
catch (e) {
|
|
764
|
+
this._currentAskConfirmation = null;
|
|
765
|
+
}
|
|
766
|
+
});
|
|
730
767
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
this.
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
768
|
+
_onOpenDocumentationFromMenu({ detail: { policy } }) {
|
|
769
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
770
|
+
try {
|
|
771
|
+
if (this.documentation == null || this.documentation.id !== policy.id) {
|
|
772
|
+
yield this._closeFlowStepForm();
|
|
773
|
+
this._currentPolicyId = policy.id;
|
|
774
|
+
if (this.getSelectedFlow()) {
|
|
775
|
+
this._splitMainViews();
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
this._maximizeBottomView();
|
|
779
|
+
}
|
|
780
|
+
dispatchCustomEvent(this, 'fetch-documentation', { policy });
|
|
741
781
|
}
|
|
742
|
-
dispatchCustomEvent(this, 'fetch-documentation', { policy });
|
|
743
782
|
}
|
|
744
|
-
|
|
745
|
-
|
|
783
|
+
catch (e) { }
|
|
784
|
+
});
|
|
746
785
|
}
|
|
747
786
|
_fetchDocumentation(policy) {
|
|
748
787
|
if (this.documentation == null || this.documentation.id !== policy.id) {
|
|
@@ -783,7 +822,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
783
822
|
this._currentFlowStep._values = detail.values;
|
|
784
823
|
}
|
|
785
824
|
_writeFlowStep(values) {
|
|
786
|
-
const { commonDescription, commonCondition,
|
|
825
|
+
const { commonDescription, commonCondition } = values, configuration = __rest(values, ["commonDescription", "commonCondition"]);
|
|
787
826
|
if (this._currentFlowStep.step._new ||
|
|
788
827
|
this._currentFlowStep.step.description !== commonDescription ||
|
|
789
828
|
this._currentFlowStep.step.condition !== commonCondition ||
|
|
@@ -801,10 +840,12 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
801
840
|
this._currentFlowStep.step = flow[this._currentFlowStep.group][position];
|
|
802
841
|
}
|
|
803
842
|
}
|
|
804
|
-
|
|
805
|
-
this
|
|
806
|
-
|
|
807
|
-
|
|
843
|
+
_onSubmitFlowStep({ detail }) {
|
|
844
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
845
|
+
this._writeFlowStep(detail.values);
|
|
846
|
+
yield this.requestUpdate('_definition');
|
|
847
|
+
this.getChildren().forEach((c) => c.requestUpdate());
|
|
848
|
+
});
|
|
808
849
|
}
|
|
809
850
|
_onCancelFlow() {
|
|
810
851
|
this._onDesign();
|
|
@@ -830,29 +871,31 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
830
871
|
_onChangeTab({ detail }) {
|
|
831
872
|
this._changeTab(detail.value);
|
|
832
873
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
else if (from === 'resources') {
|
|
841
|
-
const component = this.shadowRoot.querySelector('gv-resources');
|
|
842
|
-
if (component.dirty) {
|
|
843
|
-
return component.confirm();
|
|
874
|
+
_changeTabValidator({ from, to }) {
|
|
875
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
876
|
+
if (from === 'properties') {
|
|
877
|
+
const component = this.shadowRoot.querySelector('gv-properties');
|
|
878
|
+
if (component.dirty) {
|
|
879
|
+
return component.confirm();
|
|
880
|
+
}
|
|
844
881
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
882
|
+
else if (from === 'resources') {
|
|
883
|
+
const component = this.shadowRoot.querySelector('gv-resources');
|
|
884
|
+
if (component.dirty) {
|
|
885
|
+
return component.confirm();
|
|
886
|
+
}
|
|
849
887
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
888
|
+
else {
|
|
889
|
+
try {
|
|
890
|
+
return yield this._askToValidateForms();
|
|
891
|
+
}
|
|
892
|
+
catch (e) {
|
|
893
|
+
this._currentAskConfirmation = null;
|
|
894
|
+
throw e;
|
|
895
|
+
}
|
|
853
896
|
}
|
|
854
|
-
|
|
855
|
-
|
|
897
|
+
return Promise.resolve();
|
|
898
|
+
});
|
|
856
899
|
}
|
|
857
900
|
_changeTab(tabId) {
|
|
858
901
|
if (this._currentAskConfirmation == null) {
|
|
@@ -982,7 +1025,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
982
1025
|
}
|
|
983
1026
|
}
|
|
984
1027
|
if (force || e._id == null) {
|
|
985
|
-
return {
|
|
1028
|
+
return Object.assign(Object.assign({}, e), { _id });
|
|
986
1029
|
}
|
|
987
1030
|
return e;
|
|
988
1031
|
});
|
|
@@ -995,9 +1038,14 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
995
1038
|
...Array.from(this.shadowRoot.querySelectorAll('gv-resizable-views')),
|
|
996
1039
|
];
|
|
997
1040
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1041
|
+
getUpdateComplete() {
|
|
1042
|
+
const _super = Object.create(null, {
|
|
1043
|
+
getUpdateComplete: { get: () => super.getUpdateComplete }
|
|
1044
|
+
});
|
|
1045
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1046
|
+
yield _super.getUpdateComplete.call(this);
|
|
1047
|
+
yield Promise.all(this.getChildren().map((e) => e.updateComplete));
|
|
1048
|
+
});
|
|
1001
1049
|
}
|
|
1002
1050
|
shouldUpdate(changedProperties) {
|
|
1003
1051
|
// Just refresh gv-flow components
|
|
@@ -1094,33 +1142,35 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1094
1142
|
get definedProperties() {
|
|
1095
1143
|
return this._definition && this._definition.properties ? this._definition.properties : [];
|
|
1096
1144
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1145
|
+
_onDuplicateFlow({ detail }) {
|
|
1146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1147
|
+
try {
|
|
1148
|
+
yield this._askToValidateForms();
|
|
1149
|
+
const flowId = detail.content._id;
|
|
1150
|
+
const { plan, flows } = this._findFlowCollection(flowId);
|
|
1151
|
+
this._addFlow(flows, this._findFlowById(flowId));
|
|
1152
|
+
if (plan != null) {
|
|
1153
|
+
let planIndex = null;
|
|
1154
|
+
this.definedPlans.find((p, i) => {
|
|
1155
|
+
if (p.id === plan.id) {
|
|
1156
|
+
planIndex = i;
|
|
1157
|
+
return true;
|
|
1158
|
+
}
|
|
1159
|
+
return false;
|
|
1160
|
+
});
|
|
1161
|
+
plan.flows = flows;
|
|
1162
|
+
this.definedPlans[planIndex].flows = this._generatePlanFlowsId(plan, true);
|
|
1163
|
+
this._updateSelectedFlows([this.definedPlans[planIndex].flows[flows.length - 1]._id]);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
this._definition.flows = this._generateFlowsId(this._definition.flows);
|
|
1167
|
+
this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
|
|
1168
|
+
}
|
|
1115
1169
|
}
|
|
1116
|
-
|
|
1117
|
-
this.
|
|
1118
|
-
this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
|
|
1170
|
+
catch (err) {
|
|
1171
|
+
this._currentAskConfirmation = null;
|
|
1119
1172
|
}
|
|
1120
|
-
}
|
|
1121
|
-
catch (err) {
|
|
1122
|
-
this._currentAskConfirmation = null;
|
|
1123
|
-
}
|
|
1173
|
+
});
|
|
1124
1174
|
}
|
|
1125
1175
|
_onChangeFlowState({ detail }) {
|
|
1126
1176
|
const flow = this._findFlowById(detail.content._id);
|
|
@@ -1128,38 +1178,38 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1128
1178
|
flow._dirty = true;
|
|
1129
1179
|
this.isDirty = true;
|
|
1130
1180
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1181
|
+
_onAddFlowPlan({ detail }) {
|
|
1182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1183
|
+
try {
|
|
1184
|
+
yield this._askToValidateForms();
|
|
1185
|
+
this._addFlow(this.definedPlans[detail.planIndex].flows);
|
|
1186
|
+
this.definedPlans[detail.planIndex].flows = this._generatePlanFlowsId(this.definedPlans[detail.planIndex]);
|
|
1187
|
+
this._updateSelectedFlows([this.definedPlans[detail.planIndex].flows[this.definedPlans[detail.planIndex].flows.length - 1]._id]);
|
|
1188
|
+
}
|
|
1189
|
+
catch (err) {
|
|
1190
|
+
this._currentAskConfirmation = null;
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1141
1193
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1194
|
+
_onAddFlow() {
|
|
1195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1196
|
+
try {
|
|
1197
|
+
yield this._askToValidateForms();
|
|
1198
|
+
this._addFlow(this._definition.flows);
|
|
1199
|
+
this._definition.flows = this._generateFlowsId(this._definition.flows);
|
|
1200
|
+
this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
|
|
1201
|
+
}
|
|
1202
|
+
catch (err) {
|
|
1203
|
+
this._currentAskConfirmation = null;
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1152
1206
|
}
|
|
1153
1207
|
_addFlow(collection, duplicate = null) {
|
|
1154
1208
|
const flow = duplicate == null
|
|
1155
1209
|
? this._createFlowFromSchema()
|
|
1156
|
-
: {
|
|
1157
|
-
...duplicate,
|
|
1158
|
-
_id: null,
|
|
1210
|
+
: Object.assign(Object.assign({}, duplicate), { _id: null,
|
|
1159
1211
|
// reset the id to avoid issue with AM that persists the ID
|
|
1160
|
-
id: null,
|
|
1161
|
-
_dirty: true,
|
|
1162
|
-
};
|
|
1212
|
+
id: null, _dirty: true });
|
|
1163
1213
|
collection.push(flow);
|
|
1164
1214
|
this.isDirty = true;
|
|
1165
1215
|
return collection;
|
|
@@ -1174,7 +1224,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1174
1224
|
return this._instantiate(this.flowSchema.properties, newFlow);
|
|
1175
1225
|
}
|
|
1176
1226
|
_instantiate(propertiesDefinition, initiator = {}) {
|
|
1177
|
-
const property = {
|
|
1227
|
+
const property = Object.assign({}, initiator);
|
|
1178
1228
|
if (propertiesDefinition) {
|
|
1179
1229
|
for (const key of Object.keys(propertiesDefinition)) {
|
|
1180
1230
|
const entry = propertiesDefinition[key];
|
|
@@ -1216,34 +1266,36 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1216
1266
|
});
|
|
1217
1267
|
return index;
|
|
1218
1268
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1269
|
+
_onReorderFlows({ detail: { plan } }) {
|
|
1270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1271
|
+
try {
|
|
1272
|
+
yield this._askToValidateForms();
|
|
1273
|
+
this.isDirty = true;
|
|
1274
|
+
if (plan != null) {
|
|
1275
|
+
const newOrder = this._generatePlanFlowsId(plan, true);
|
|
1276
|
+
if (this.selectedFlowsId) {
|
|
1277
|
+
this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
|
|
1278
|
+
const index = this._findFlowIndex(plan.flows, flowId);
|
|
1279
|
+
return index != null ? newOrder[index]._id : flowId;
|
|
1280
|
+
}));
|
|
1281
|
+
}
|
|
1282
|
+
plan.flows = newOrder;
|
|
1230
1283
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1284
|
+
else {
|
|
1285
|
+
const newOrder = this._generateFlowsId(this._definition.flows, true);
|
|
1286
|
+
if (this.selectedFlowsId) {
|
|
1287
|
+
this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
|
|
1288
|
+
const index = this._findFlowIndex(this._definition.flows, flowId);
|
|
1289
|
+
return index != null ? newOrder[index]._id : flowId;
|
|
1290
|
+
}));
|
|
1291
|
+
}
|
|
1292
|
+
this._definition.flows = newOrder;
|
|
1240
1293
|
}
|
|
1241
|
-
this._definition.flows = newOrder;
|
|
1242
1294
|
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1295
|
+
catch (err) {
|
|
1296
|
+
this._currentAskConfirmation = false;
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1247
1299
|
}
|
|
1248
1300
|
_onSearchPolicy({ detail }) {
|
|
1249
1301
|
this._searchPolicyQuery = detail;
|
|
@@ -1257,20 +1309,22 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1257
1309
|
_onClearFlows() {
|
|
1258
1310
|
this._searchFlowQuery = null;
|
|
1259
1311
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1312
|
+
_onResetAll() {
|
|
1313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1314
|
+
try {
|
|
1315
|
+
yield this._closeFlowStepForm();
|
|
1316
|
+
this.definition = deepClone(this._initialDefinition);
|
|
1317
|
+
}
|
|
1318
|
+
catch (e) {
|
|
1319
|
+
this._currentAskConfirmation = null;
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1268
1322
|
}
|
|
1269
1323
|
_filterNotValidStep(step) {
|
|
1270
1324
|
return step._new !== true;
|
|
1271
1325
|
}
|
|
1272
1326
|
_removePrivateProperties(o) {
|
|
1273
|
-
const copy = {
|
|
1327
|
+
const copy = Object.assign({}, o);
|
|
1274
1328
|
Object.keys(o)
|
|
1275
1329
|
.filter((key) => key.startsWith('_'))
|
|
1276
1330
|
.forEach((key) => {
|
|
@@ -1295,21 +1349,23 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1295
1349
|
getPropertiesElement() {
|
|
1296
1350
|
return this.shadowRoot.querySelector('gv-properties');
|
|
1297
1351
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1352
|
+
_checkCurrentFlowStep() {
|
|
1353
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1354
|
+
if (this._currentFlowStep && this.selectedFlowsId) {
|
|
1355
|
+
const closePromises = this.selectedFlowsId
|
|
1356
|
+
.map((flowId) => {
|
|
1357
|
+
const flow = this._findFlowById(flowId);
|
|
1358
|
+
const currentStep = [...flow.pre, ...flow.post].find((step) => step._id === this._currentFlowStep.step._id);
|
|
1359
|
+
if (currentStep == null) {
|
|
1360
|
+
return this._closeFlowStepForm(true);
|
|
1361
|
+
}
|
|
1362
|
+
return null;
|
|
1363
|
+
})
|
|
1364
|
+
.filter((p) => p !== null);
|
|
1365
|
+
return Promise.all(closePromises);
|
|
1366
|
+
}
|
|
1367
|
+
return Promise.resolve();
|
|
1368
|
+
});
|
|
1313
1369
|
}
|
|
1314
1370
|
saved() {
|
|
1315
1371
|
if (this.isDirty) {
|
|
@@ -1333,7 +1389,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1333
1389
|
flow.post = flow.post.filter(this._filterNotValidStep);
|
|
1334
1390
|
return flow;
|
|
1335
1391
|
});
|
|
1336
|
-
let definition = {
|
|
1392
|
+
let definition = Object.assign(Object.assign({}, this._definition), { flows });
|
|
1337
1393
|
if (this._definition.plans != null) {
|
|
1338
1394
|
const plans = this._definition.plans.map((plan) => {
|
|
1339
1395
|
const flows = plan.flows.map((flow) => {
|
|
@@ -1341,9 +1397,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1341
1397
|
flow.post = flow.post.filter(this._filterNotValidStep);
|
|
1342
1398
|
return flow;
|
|
1343
1399
|
});
|
|
1344
|
-
return {
|
|
1400
|
+
return Object.assign(Object.assign({}, plan), { flows });
|
|
1345
1401
|
});
|
|
1346
|
-
definition = {
|
|
1402
|
+
definition = Object.assign(Object.assign({}, definition), { plans });
|
|
1347
1403
|
}
|
|
1348
1404
|
return definition;
|
|
1349
1405
|
}
|
|
@@ -1355,7 +1411,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1355
1411
|
flow.post = flow.post.map(this._removePrivateProperties);
|
|
1356
1412
|
return flow;
|
|
1357
1413
|
});
|
|
1358
|
-
let definition = {
|
|
1414
|
+
let definition = Object.assign(Object.assign({}, this._definition), { flows });
|
|
1359
1415
|
if (this._definition.plans != null) {
|
|
1360
1416
|
const plans = definitionToSave.plans.map((plan) => {
|
|
1361
1417
|
const flows = plan.flows.map((f) => {
|
|
@@ -1364,17 +1420,17 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
|
|
|
1364
1420
|
flow.post = flow.post.map(this._removePrivateProperties);
|
|
1365
1421
|
return flow;
|
|
1366
1422
|
});
|
|
1367
|
-
return {
|
|
1423
|
+
return Object.assign(Object.assign({}, plan), { flows });
|
|
1368
1424
|
});
|
|
1369
|
-
definition = {
|
|
1425
|
+
definition = Object.assign(Object.assign({}, definition), { plans });
|
|
1370
1426
|
}
|
|
1371
1427
|
if (this._definition.properties != null) {
|
|
1372
1428
|
const properties = this._definition.properties.map(this._removePrivateProperties);
|
|
1373
|
-
definition = {
|
|
1429
|
+
definition = Object.assign(Object.assign({}, definition), { properties });
|
|
1374
1430
|
}
|
|
1375
1431
|
if (this._definition.resources != null) {
|
|
1376
1432
|
const resources = this._definition.resources.map(this._removePrivateProperties);
|
|
1377
|
-
definition = {
|
|
1433
|
+
definition = Object.assign(Object.assign({}, definition), { resources });
|
|
1378
1434
|
}
|
|
1379
1435
|
return definition;
|
|
1380
1436
|
}
|