@gravitee/ui-policy-studio-angular 7.3.0 → 7.4.0
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/esm2020/lib/components/flow-details/gio-ps-flow-details.component.mjs +45 -8
- package/esm2020/lib/components/flow-form-dialog/gio-ps-flow-form-dialog.component.mjs +87 -0
- package/esm2020/lib/components/flows-menu/gio-ps-flows-menu.component.mjs +53 -14
- package/esm2020/lib/gio-policy-studio.component.mjs +29 -4
- package/esm2020/lib/gio-policy-studio.module.mjs +49 -7
- package/fesm2015/gravitee-ui-policy-studio-angular.mjs +254 -51
- package/fesm2015/gravitee-ui-policy-studio-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-policy-studio-angular.mjs +262 -49
- package/fesm2020/gravitee-ui-policy-studio-angular.mjs.map +1 -1
- package/lib/components/flow-details/gio-ps-flow-details.component.d.ts +10 -1
- package/lib/components/flow-form-dialog/gio-ps-flow-form-dialog.component.d.ts +20 -0
- package/lib/components/flows-menu/gio-ps-flows-menu.component.d.ts +8 -2
- package/lib/gio-policy-studio.component.d.ts +4 -0
- package/lib/gio-policy-studio.module.d.ts +11 -5
- package/package.json +1 -1
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Component, Inject, EventEmitter, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/material/button';
|
|
4
4
|
import { MatButtonModule } from '@angular/material/button';
|
|
5
5
|
import { GioIconsModule } from '@gravitee/ui-particles-angular';
|
|
6
|
-
import * as
|
|
6
|
+
import * as i5$1 from '@angular/common';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
8
|
-
import * as
|
|
8
|
+
import * as i4$1 from '@angular/material/tooltip';
|
|
9
9
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import * as i1 from '@angular/material/dialog';
|
|
11
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
12
|
+
import * as i4 from '@angular/material/form-field';
|
|
13
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
+
import * as i9 from '@angular/material/input';
|
|
15
|
+
import { MatInputModule } from '@angular/material/input';
|
|
16
|
+
import * as i5 from '@angular/material/select';
|
|
17
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
18
|
+
import * as i8 from '@angular/forms';
|
|
19
|
+
import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
20
|
+
import { cloneDeep, uniqueId, capitalize, flatten } from 'lodash';
|
|
21
|
+
import * as i3 from '@angular/material/icon';
|
|
22
|
+
import * as i6 from '@angular/material/core';
|
|
23
|
+
import { tap } from 'rxjs/operators';
|
|
12
24
|
|
|
13
25
|
/*
|
|
14
26
|
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
@@ -106,6 +118,140 @@ import * as i1 from '@angular/material/icon';
|
|
|
106
118
|
* limitations under the License.
|
|
107
119
|
*/
|
|
108
120
|
|
|
121
|
+
/*
|
|
122
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
123
|
+
*
|
|
124
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
125
|
+
* you may not use this file except in compliance with the License.
|
|
126
|
+
* You may obtain a copy of the License at
|
|
127
|
+
*
|
|
128
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
129
|
+
*
|
|
130
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
131
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
132
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
133
|
+
* See the License for the specific language governing permissions and
|
|
134
|
+
* limitations under the License.
|
|
135
|
+
*/
|
|
136
|
+
class GioPolicyStudioFlowFormDialogComponent {
|
|
137
|
+
constructor(dialogRef, flowDialogData) {
|
|
138
|
+
this.dialogRef = dialogRef;
|
|
139
|
+
this.entrypoints = [];
|
|
140
|
+
this.mode = 'create';
|
|
141
|
+
this.entrypoints = flowDialogData?.entrypoints ?? [];
|
|
142
|
+
this.existingFlow = cloneDeep(flowDialogData?.flow);
|
|
143
|
+
this.mode = this.existingFlow ? 'edit' : 'create';
|
|
144
|
+
const channelSelector = flowDialogData?.flow?.selectors?.find(s => s.type === 'CHANNEL');
|
|
145
|
+
const conditionSelector = flowDialogData?.flow?.selectors?.find(s => s.type === 'CONDITION');
|
|
146
|
+
this.flowFormGroup = new FormGroup({
|
|
147
|
+
name: new FormControl(flowDialogData?.flow?.name ?? ''),
|
|
148
|
+
channelOperator: new FormControl(channelSelector?.channelOperator ?? ''),
|
|
149
|
+
channel: new FormControl(channelSelector?.channel ?? ''),
|
|
150
|
+
operations: new FormControl(channelSelector?.operations ?? []),
|
|
151
|
+
entrypoints: new FormControl(channelSelector?.entrypoints ?? []),
|
|
152
|
+
condition: new FormControl(conditionSelector?.condition ?? ''),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
onSubmit() {
|
|
156
|
+
const chanelSelectorToSave = {
|
|
157
|
+
type: 'CHANNEL',
|
|
158
|
+
channel: this.flowFormGroup?.get('channel')?.value,
|
|
159
|
+
channelOperator: this.flowFormGroup?.get('channelOperator')?.value,
|
|
160
|
+
operations: this.flowFormGroup?.get('operations')?.value,
|
|
161
|
+
entrypoints: this.flowFormGroup?.get('entrypoints')?.value,
|
|
162
|
+
};
|
|
163
|
+
const conditionValue = this.flowFormGroup?.get('condition')?.value;
|
|
164
|
+
const conditionSelectorToSave = conditionValue
|
|
165
|
+
? {
|
|
166
|
+
type: 'CONDITION',
|
|
167
|
+
condition: conditionValue,
|
|
168
|
+
}
|
|
169
|
+
: undefined;
|
|
170
|
+
const flowToSave = {
|
|
171
|
+
// New id for new flow
|
|
172
|
+
_id: uniqueId('flow_'),
|
|
173
|
+
// If existing flow, keep root props
|
|
174
|
+
...this.existingFlow,
|
|
175
|
+
name: this.flowFormGroup?.get('name')?.value,
|
|
176
|
+
selectors: conditionSelectorToSave ? [chanelSelectorToSave, conditionSelectorToSave] : [chanelSelectorToSave],
|
|
177
|
+
enabled: true,
|
|
178
|
+
};
|
|
179
|
+
this.dialogRef.close({
|
|
180
|
+
...flowToSave,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
GioPolicyStudioFlowFormDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioFlowFormDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
185
|
+
GioPolicyStudioFlowFormDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioFlowFormDialogComponent, selector: "gio-ps-flow-form-dialog", ngImport: i0, template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<h2 mat-dialog-title class=\"title\">\n {{ mode === 'create' ? 'Create a new flow' : 'Edit flow' }}\n\n <button class=\"title__closeBtn\" mat-icon-button aria-label=\"Close dialog\" [mat-dialog-close]=\"false\">\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n</h2>\n\n<mat-dialog-content *ngIf=\"flowFormGroup\" class=\"content\" [formGroup]=\"flowFormGroup\">\n <p>Flows allow you to apply different policies per event phases. For example you can reroute calls based on the URL specified.</p>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Flow name</mat-label>\n <input matInput formControlName=\"name\" cdkFocusInitial />\n <mat-hint>Names will be automatically generated with channel and operation if left blank</mat-hint>\n </mat-form-field>\n </div>\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n <mat-select formControlName=\"channelOperator\">\n <mat-option value=\"EQUALS\">Equals</mat-option>\n <mat-option value=\"STARTS_WITH\">Starts with</mat-option>\n </mat-select>\n <mat-hint>Channel operator</mat-hint>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Channel</mat-label>\n <input matInput formControlName=\"channel\" />\n <mat-hint>Publish or Subscribe channel. This is the path of your request.</mat-hint>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Entrypoints</mat-label>\n <mat-select multiple formControlName=\"entrypoints\">\n <mat-option *ngFor=\"let entrypoint of entrypoints\" [value]=\"entrypoint\">{{ entrypoint }}</mat-option>\n </mat-select>\n <mat-hint>Entrypoints where your flow will be executed</mat-hint>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Entrypoints supported operations</mat-label>\n <mat-select multiple formControlName=\"operations\">\n <mat-option value=\"PUBLISH\">Publish</mat-option>\n <mat-option value=\"SUBSCRIBE\">Subscribe</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Condition</mat-label>\n <input matInput formControlName=\"condition\" />\n <mat-hint>Condition to execute the flow, supports Expression Language</mat-hint>\n </mat-form-field>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions class=\"actions\">\n <button class=\"actions__cancelBtn\" mat-flat-button [mat-dialog-close]=\"false\">Cancel</button>\n <button class=\"actions__saveBtn\" color=\"primary\" mat-stroked-button role=\"dialog\" (click)=\"onSubmit()\">\n {{ mode === 'create' ? 'Create' : 'Save' }}\n </button>\n</mat-dialog-actions>\n", styles: [".title__closeBtn{top:-20px;right:-20px;float:right}.content__row{display:flex;gap:16px}.content__row mat-form-field{flex:1 1 auto}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioFlowFormDialogComponent, decorators: [{
|
|
187
|
+
type: Component,
|
|
188
|
+
args: [{ selector: 'gio-ps-flow-form-dialog', template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<h2 mat-dialog-title class=\"title\">\n {{ mode === 'create' ? 'Create a new flow' : 'Edit flow' }}\n\n <button class=\"title__closeBtn\" mat-icon-button aria-label=\"Close dialog\" [mat-dialog-close]=\"false\">\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n</h2>\n\n<mat-dialog-content *ngIf=\"flowFormGroup\" class=\"content\" [formGroup]=\"flowFormGroup\">\n <p>Flows allow you to apply different policies per event phases. For example you can reroute calls based on the URL specified.</p>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Flow name</mat-label>\n <input matInput formControlName=\"name\" cdkFocusInitial />\n <mat-hint>Names will be automatically generated with channel and operation if left blank</mat-hint>\n </mat-form-field>\n </div>\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n <mat-select formControlName=\"channelOperator\">\n <mat-option value=\"EQUALS\">Equals</mat-option>\n <mat-option value=\"STARTS_WITH\">Starts with</mat-option>\n </mat-select>\n <mat-hint>Channel operator</mat-hint>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Channel</mat-label>\n <input matInput formControlName=\"channel\" />\n <mat-hint>Publish or Subscribe channel. This is the path of your request.</mat-hint>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Entrypoints</mat-label>\n <mat-select multiple formControlName=\"entrypoints\">\n <mat-option *ngFor=\"let entrypoint of entrypoints\" [value]=\"entrypoint\">{{ entrypoint }}</mat-option>\n </mat-select>\n <mat-hint>Entrypoints where your flow will be executed</mat-hint>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Entrypoints supported operations</mat-label>\n <mat-select multiple formControlName=\"operations\">\n <mat-option value=\"PUBLISH\">Publish</mat-option>\n <mat-option value=\"SUBSCRIBE\">Subscribe</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"content__row\">\n <mat-form-field>\n <mat-label>Condition</mat-label>\n <input matInput formControlName=\"condition\" />\n <mat-hint>Condition to execute the flow, supports Expression Language</mat-hint>\n </mat-form-field>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions class=\"actions\">\n <button class=\"actions__cancelBtn\" mat-flat-button [mat-dialog-close]=\"false\">Cancel</button>\n <button class=\"actions__saveBtn\" color=\"primary\" mat-stroked-button role=\"dialog\" (click)=\"onSubmit()\">\n {{ mode === 'create' ? 'Create' : 'Save' }}\n </button>\n</mat-dialog-actions>\n", styles: [".title__closeBtn{top:-20px;right:-20px;float:right}.content__row{display:flex;gap:16px}.content__row mat-form-field{flex:1 1 auto}\n"] }]
|
|
189
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
190
|
+
type: Inject,
|
|
191
|
+
args: [MAT_DIALOG_DATA]
|
|
192
|
+
}] }]; } });
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
196
|
+
*
|
|
197
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
|
+
* you may not use this file except in compliance with the License.
|
|
199
|
+
* You may obtain a copy of the License at
|
|
200
|
+
*
|
|
201
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
+
*
|
|
203
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
204
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
205
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
206
|
+
* See the License for the specific language governing permissions and
|
|
207
|
+
* limitations under the License.
|
|
208
|
+
*/
|
|
209
|
+
class GioPolicyStudioDetailsComponent {
|
|
210
|
+
constructor(matDialog) {
|
|
211
|
+
this.matDialog = matDialog;
|
|
212
|
+
this.flow = undefined;
|
|
213
|
+
this.entrypoints = [];
|
|
214
|
+
this.flowChange = new EventEmitter();
|
|
215
|
+
this.deleteFlow = new EventEmitter();
|
|
216
|
+
}
|
|
217
|
+
onEditFlow() {
|
|
218
|
+
this.matDialog
|
|
219
|
+
.open(GioPolicyStudioFlowFormDialogComponent, {
|
|
220
|
+
data: {
|
|
221
|
+
flow: this.flow,
|
|
222
|
+
entrypoints: this.entrypoints,
|
|
223
|
+
},
|
|
224
|
+
role: 'alertdialog',
|
|
225
|
+
id: 'gioPsFlowFormDialog',
|
|
226
|
+
})
|
|
227
|
+
.afterClosed()
|
|
228
|
+
.pipe(tap(createdOrEdited => {
|
|
229
|
+
if (!createdOrEdited) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.flowChange.emit(createdOrEdited);
|
|
233
|
+
}))
|
|
234
|
+
.subscribe();
|
|
235
|
+
}
|
|
236
|
+
onDeleteFlow() {
|
|
237
|
+
this.deleteFlow.emit(this.flow);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
GioPolicyStudioDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioDetailsComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
241
|
+
GioPolicyStudioDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioDetailsComponent, selector: "gio-ps-flow-details", inputs: { flow: "flow", entrypoints: "entrypoints" }, outputs: { flowChange: "flowChange", deleteFlow: "deleteFlow" }, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<ng-container *ngIf=\"flow; else emptyFlows\">\n <div class=\"header\">\n <div class=\"header__label\">Flow details</div>\n <div class=\"header__configBtn\">\n <button class=\"header__configBtn__edit\" mat-stroked-button mat-icon-button (click)=\"onEditFlow()\">\n <mat-icon svgIcon=\"gio:edit-pencil\"></mat-icon>\n </button>\n <button class=\"header__configBtn__delete\" mat-stroked-button mat-icon-button (click)=\"onDeleteFlow()\">\n <mat-icon svgIcon=\"gio:trash\"></mat-icon>\n </button>\n </div>\n </div>\n\n <div class=\"content\">\n \uD83D\uDEA7 Work in progress \uD83D\uDEA7 <br />\n {{ flow | json }}\n </div>\n</ng-container>\n\n<ng-template #emptyFlows>\n <div class=\"emptyFlows\">\n <h2>No flows yet</h2>\n <p class=\"mat-body-1\">Flows allow you to customize the behavior of your API event phases through configurable policies</p>\n </div>\n</ng-template>\n", styles: [".emptyFlows{display:flex;width:500px;height:100%;flex-direction:column;justify-content:center;margin:auto;text-align:center}.header{display:flex;align-items:center;margin-bottom:16px}.header__label{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;margin-bottom:0;gap:8px}.header__configBtn{display:flex;align-items:center;margin-left:8px;gap:8px}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i5$1.JsonPipe } });
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioDetailsComponent, decorators: [{
|
|
243
|
+
type: Component,
|
|
244
|
+
args: [{ selector: 'gio-ps-flow-details', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<ng-container *ngIf=\"flow; else emptyFlows\">\n <div class=\"header\">\n <div class=\"header__label\">Flow details</div>\n <div class=\"header__configBtn\">\n <button class=\"header__configBtn__edit\" mat-stroked-button mat-icon-button (click)=\"onEditFlow()\">\n <mat-icon svgIcon=\"gio:edit-pencil\"></mat-icon>\n </button>\n <button class=\"header__configBtn__delete\" mat-stroked-button mat-icon-button (click)=\"onDeleteFlow()\">\n <mat-icon svgIcon=\"gio:trash\"></mat-icon>\n </button>\n </div>\n </div>\n\n <div class=\"content\">\n \uD83D\uDEA7 Work in progress \uD83D\uDEA7 <br />\n {{ flow | json }}\n </div>\n</ng-container>\n\n<ng-template #emptyFlows>\n <div class=\"emptyFlows\">\n <h2>No flows yet</h2>\n <p class=\"mat-body-1\">Flows allow you to customize the behavior of your API event phases through configurable policies</p>\n </div>\n</ng-template>\n", styles: [".emptyFlows{display:flex;width:500px;height:100%;flex-direction:column;justify-content:center;margin:auto;text-align:center}.header{display:flex;align-items:center;margin-bottom:16px}.header__label{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;margin-bottom:0;gap:8px}.header__configBtn{display:flex;align-items:center;margin-left:8px;gap:8px}\n"] }]
|
|
245
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { flow: [{
|
|
246
|
+
type: Input
|
|
247
|
+
}], entrypoints: [{
|
|
248
|
+
type: Input
|
|
249
|
+
}], flowChange: [{
|
|
250
|
+
type: Output
|
|
251
|
+
}], deleteFlow: [{
|
|
252
|
+
type: Output
|
|
253
|
+
}] } });
|
|
254
|
+
|
|
109
255
|
/*
|
|
110
256
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
111
257
|
*
|
|
@@ -122,15 +268,18 @@ import * as i1 from '@angular/material/icon';
|
|
|
122
268
|
* limitations under the License.
|
|
123
269
|
*/
|
|
124
270
|
class GioPolicyStudioFlowsMenuComponent {
|
|
125
|
-
constructor() {
|
|
271
|
+
constructor(matDialog) {
|
|
272
|
+
this.matDialog = matDialog;
|
|
126
273
|
this.flowsGroups = [];
|
|
127
274
|
this.selectedFlow = undefined;
|
|
275
|
+
this.entrypoints = [];
|
|
128
276
|
this.selectedFlowChange = new EventEmitter();
|
|
129
|
-
this.
|
|
277
|
+
this.flowsGroupsChange = new EventEmitter();
|
|
278
|
+
this.flowsGroupsVMSelected = [];
|
|
130
279
|
}
|
|
131
280
|
ngOnChanges(changes) {
|
|
132
281
|
if (changes.flowsGroups || changes.selectedFlow) {
|
|
133
|
-
this.
|
|
282
|
+
this.flowsGroupsVMSelected = this.flowsGroups.map(flowGroup => {
|
|
134
283
|
return {
|
|
135
284
|
...flowGroup,
|
|
136
285
|
flows: flowGroup.flows.map(flow => {
|
|
@@ -142,10 +291,12 @@ class GioPolicyStudioFlowsMenuComponent {
|
|
|
142
291
|
PUBLISH: 'PUB',
|
|
143
292
|
SUBSCRIBE: 'SUB',
|
|
144
293
|
};
|
|
145
|
-
const operationBadges = channelSelector.operations
|
|
294
|
+
const operationBadges = (channelSelector.operations ?? [])
|
|
295
|
+
.map(operation => ({
|
|
146
296
|
label: operationToBadge[operation],
|
|
147
297
|
class: 'gio-badge-neutral',
|
|
148
|
-
}))
|
|
298
|
+
}))
|
|
299
|
+
.sort((a, b) => a.label.localeCompare(b.label));
|
|
149
300
|
operationBadges && badges.push(...operationBadges);
|
|
150
301
|
pathOrChannelLabel = `${channelSelector.channel}${channelSelector.channelOperator === 'STARTS_WITH' ? '**' : ''}`;
|
|
151
302
|
}
|
|
@@ -185,47 +336,48 @@ class GioPolicyStudioFlowsMenuComponent {
|
|
|
185
336
|
selectFlow(flow) {
|
|
186
337
|
this.selectedFlowChange.emit(flow);
|
|
187
338
|
}
|
|
339
|
+
onAddFlow(flowGroup) {
|
|
340
|
+
this.matDialog
|
|
341
|
+
.open(GioPolicyStudioFlowFormDialogComponent, {
|
|
342
|
+
data: {
|
|
343
|
+
flow: undefined,
|
|
344
|
+
entrypoints: this.entrypoints,
|
|
345
|
+
},
|
|
346
|
+
role: 'alertdialog',
|
|
347
|
+
id: 'gioPsFlowFormDialog',
|
|
348
|
+
})
|
|
349
|
+
.afterClosed()
|
|
350
|
+
.pipe(tap(createdOrEdited => {
|
|
351
|
+
if (!createdOrEdited) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const editedFlowsGroups = cloneDeep(this.flowsGroups);
|
|
355
|
+
const flowsGroupToEdit = editedFlowsGroups.find(fg => fg._id === flowGroup._id);
|
|
356
|
+
if (!flowsGroupToEdit) {
|
|
357
|
+
throw new Error(`Flow group ${flowGroup._id} not found`);
|
|
358
|
+
}
|
|
359
|
+
flowsGroupToEdit.flows.push(createdOrEdited);
|
|
360
|
+
this.flowsGroupsChange.emit(editedFlowsGroups);
|
|
361
|
+
this.selectedFlowChange.emit(createdOrEdited);
|
|
362
|
+
}))
|
|
363
|
+
.subscribe();
|
|
364
|
+
}
|
|
188
365
|
}
|
|
189
|
-
GioPolicyStudioFlowsMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioFlowsMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
190
|
-
GioPolicyStudioFlowsMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioFlowsMenuComponent, selector: "gio-ps-flows-menu", inputs: { flowsGroups: "flowsGroups", selectedFlow: "selectedFlow" }, outputs: { selectedFlowChange: "selectedFlowChange" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__label\">\n Flows <mat-icon svgIcon=\"gio:info\" matTooltip=\"Flows allow you to apply different policies on your API event phases\"></mat-icon>\n </div>\n <div class=\"header__configBtn\">\n <button mat-stroked-button mat-icon-button><mat-icon svgIcon=\"gio:settings\"></mat-icon></button>\n </div>\n</div>\n\n<div class=\"list\">\n <div *ngFor=\"let
|
|
366
|
+
GioPolicyStudioFlowsMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioFlowsMenuComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
367
|
+
GioPolicyStudioFlowsMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioFlowsMenuComponent, selector: "gio-ps-flows-menu", inputs: { flowsGroups: "flowsGroups", selectedFlow: "selectedFlow", entrypoints: "entrypoints" }, outputs: { selectedFlowChange: "selectedFlowChange", flowsGroupsChange: "flowsGroupsChange" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__label\">\n Flows <mat-icon svgIcon=\"gio:info\" matTooltip=\"Flows allow you to apply different policies on your API event phases\"></mat-icon>\n </div>\n <div class=\"header__configBtn\">\n <button mat-stroked-button mat-icon-button><mat-icon svgIcon=\"gio:settings\"></mat-icon></button>\n </div>\n</div>\n\n<div class=\"list\">\n <div *ngFor=\"let flowsGroup of flowsGroupsVMSelected\" class=\"list__flowsGroup\">\n <div class=\"list__flowsGroup__header\">\n <div class=\"list__flowsGroup__header__label\">\n <mat-icon *ngIf=\"flowsGroup.icon\" [svgIcon]=\"flowsGroup.icon\"></mat-icon>\n <span>{{ flowsGroup.name }}</span>\n </div>\n <div class=\"list__flowsGroup__header__addBtn\">\n <button mat-icon-button (click)=\"onAddFlow(flowsGroup)\"><mat-icon svgIcon=\"gio:plus\" matTooltip=\"New flow\"></mat-icon></button>\n </div>\n </div>\n\n <div\n *ngFor=\"let flow of flowsGroup.flows\"\n class=\"list__flowsGroup__flow\"\n [class.selected]=\"flow.selected\"\n (click)=\"selectFlow(flow)\"\n (mouseout)=\"flow.mouseOver = false\"\n (mouseover)=\"flow.mouseOver = true\"\n >\n <div *ngIf=\"flow.name\" class=\"list__flowsGroup__flow__name\" [attr.title]=\"flow.name\">\n {{ flow.name }}\n </div>\n <div class=\"list__flowsGroup__flow__infos\">\n <div class=\"list__flowsGroup__flow__infos__badges\">\n <span *ngFor=\"let badge of flow.badges\" class=\"list__flowsGroup__flow__infos__badges__badge\" [ngClass]=\"badge.class\">{{\n badge.label\n }}</span>\n </div>\n <div class=\"list__flowsGroup__flow__infos__pathOrChannelLabel\">{{ flow.pathOrChannelLabel }}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{display:flex;max-height:100%;flex-direction:column;padding-top:16px}.header{display:flex;align-items:center;padding:0 16px;margin-bottom:16px}.header__label{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;margin-bottom:0;gap:8px}.header__configBtn{margin-left:8px}.list{padding:0 16px;overflow-y:overlay}.list__flowsGroup{display:flex;flex-direction:column;padding-bottom:8px;gap:8px}.list__flowsGroup__header{display:flex;align-items:center;padding:8px 8px 8px 10px;border-radius:8px;background-color:#cdc5f7}.list__flowsGroup__header__label{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;gap:8px}.list__flowsGroup__header__label>mat-icon{width:22px;height:22px;flex:0 0 auto}.list__flowsGroup__header__label>span{display:-webkit-box;overflow:hidden;flex:1 1 auto;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list__flowsGroup__header__addBtn{margin-left:8px}.list__flowsGroup__flow{display:flex;height:68px;flex-direction:column;justify-content:center;padding:7px;border:1px solid #d3d5dc;border-radius:8px;gap:8px}.list__flowsGroup__flow:hover,.list__flowsGroup__flow.selected{padding:6px;border:2px solid #876fec;cursor:pointer}.list__flowsGroup__flow__name{overflow:hidden;padding-left:4px;text-overflow:ellipsis;white-space:nowrap}.list__flowsGroup__flow__infos{display:flex;align-items:center}.list__flowsGroup__flow__infos__badges{flex:0 0 auto}.list__flowsGroup__flow__infos__badges__badge{width:auto}.list__flowsGroup__flow__infos__pathOrChannelLabel{flex:1 1 auto}\n"], components: [{ type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
191
368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioFlowsMenuComponent, decorators: [{
|
|
192
369
|
type: Component,
|
|
193
|
-
args: [{ selector: 'gio-ps-flows-menu', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__label\">\n Flows <mat-icon svgIcon=\"gio:info\" matTooltip=\"Flows allow you to apply different policies on your API event phases\"></mat-icon>\n </div>\n <div class=\"header__configBtn\">\n <button mat-stroked-button mat-icon-button><mat-icon svgIcon=\"gio:settings\"></mat-icon></button>\n </div>\n</div>\n\n<div class=\"list\">\n <div *ngFor=\"let
|
|
194
|
-
}], propDecorators: { flowsGroups: [{
|
|
370
|
+
args: [{ selector: 'gio-ps-flows-menu', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__label\">\n Flows <mat-icon svgIcon=\"gio:info\" matTooltip=\"Flows allow you to apply different policies on your API event phases\"></mat-icon>\n </div>\n <div class=\"header__configBtn\">\n <button mat-stroked-button mat-icon-button><mat-icon svgIcon=\"gio:settings\"></mat-icon></button>\n </div>\n</div>\n\n<div class=\"list\">\n <div *ngFor=\"let flowsGroup of flowsGroupsVMSelected\" class=\"list__flowsGroup\">\n <div class=\"list__flowsGroup__header\">\n <div class=\"list__flowsGroup__header__label\">\n <mat-icon *ngIf=\"flowsGroup.icon\" [svgIcon]=\"flowsGroup.icon\"></mat-icon>\n <span>{{ flowsGroup.name }}</span>\n </div>\n <div class=\"list__flowsGroup__header__addBtn\">\n <button mat-icon-button (click)=\"onAddFlow(flowsGroup)\"><mat-icon svgIcon=\"gio:plus\" matTooltip=\"New flow\"></mat-icon></button>\n </div>\n </div>\n\n <div\n *ngFor=\"let flow of flowsGroup.flows\"\n class=\"list__flowsGroup__flow\"\n [class.selected]=\"flow.selected\"\n (click)=\"selectFlow(flow)\"\n (mouseout)=\"flow.mouseOver = false\"\n (mouseover)=\"flow.mouseOver = true\"\n >\n <div *ngIf=\"flow.name\" class=\"list__flowsGroup__flow__name\" [attr.title]=\"flow.name\">\n {{ flow.name }}\n </div>\n <div class=\"list__flowsGroup__flow__infos\">\n <div class=\"list__flowsGroup__flow__infos__badges\">\n <span *ngFor=\"let badge of flow.badges\" class=\"list__flowsGroup__flow__infos__badges__badge\" [ngClass]=\"badge.class\">{{\n badge.label\n }}</span>\n </div>\n <div class=\"list__flowsGroup__flow__infos__pathOrChannelLabel\">{{ flow.pathOrChannelLabel }}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{display:flex;max-height:100%;flex-direction:column;padding-top:16px}.header{display:flex;align-items:center;padding:0 16px;margin-bottom:16px}.header__label{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;margin-bottom:0;gap:8px}.header__configBtn{margin-left:8px}.list{padding:0 16px;overflow-y:overlay}.list__flowsGroup{display:flex;flex-direction:column;padding-bottom:8px;gap:8px}.list__flowsGroup__header{display:flex;align-items:center;padding:8px 8px 8px 10px;border-radius:8px;background-color:#cdc5f7}.list__flowsGroup__header__label{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;display:flex;flex:1 1 auto;align-items:center;gap:8px}.list__flowsGroup__header__label>mat-icon{width:22px;height:22px;flex:0 0 auto}.list__flowsGroup__header__label>span{display:-webkit-box;overflow:hidden;flex:1 1 auto;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list__flowsGroup__header__addBtn{margin-left:8px}.list__flowsGroup__flow{display:flex;height:68px;flex-direction:column;justify-content:center;padding:7px;border:1px solid #d3d5dc;border-radius:8px;gap:8px}.list__flowsGroup__flow:hover,.list__flowsGroup__flow.selected{padding:6px;border:2px solid #876fec;cursor:pointer}.list__flowsGroup__flow__name{overflow:hidden;padding-left:4px;text-overflow:ellipsis;white-space:nowrap}.list__flowsGroup__flow__infos{display:flex;align-items:center}.list__flowsGroup__flow__infos__badges{flex:0 0 auto}.list__flowsGroup__flow__infos__badges__badge{width:auto}.list__flowsGroup__flow__infos__pathOrChannelLabel{flex:1 1 auto}\n"] }]
|
|
371
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { flowsGroups: [{
|
|
195
372
|
type: Input
|
|
196
373
|
}], selectedFlow: [{
|
|
197
374
|
type: Input
|
|
375
|
+
}], entrypoints: [{
|
|
376
|
+
type: Input
|
|
198
377
|
}], selectedFlowChange: [{
|
|
199
378
|
type: Output
|
|
200
|
-
}]
|
|
201
|
-
|
|
202
|
-
/*
|
|
203
|
-
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
204
|
-
*
|
|
205
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
206
|
-
* you may not use this file except in compliance with the License.
|
|
207
|
-
* You may obtain a copy of the License at
|
|
208
|
-
*
|
|
209
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
210
|
-
*
|
|
211
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
212
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
213
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
|
-
* See the License for the specific language governing permissions and
|
|
215
|
-
* limitations under the License.
|
|
216
|
-
*/
|
|
217
|
-
class GioPolicyStudioDetailsComponent {
|
|
218
|
-
constructor() {
|
|
219
|
-
this.flow = undefined;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
GioPolicyStudioDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
223
|
-
GioPolicyStudioDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioDetailsComponent, selector: "gio-ps-flow-details", inputs: { flow: "flow" }, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<ng-container *ngIf=\"flow; else emptyFlows\">\n <div class=\"header\">\n <div class=\"mat-h4\">Flow details</div>\n </div>\n\n <div class=\"content\">\n \uD83D\uDEA7 Work in progress \uD83D\uDEA7 <br />\n {{ flow | json }}\n </div>\n</ng-container>\n\n<ng-template #emptyFlows>\n <div class=\"emptyFlows\">\n <h2>No flows yet</h2>\n <p class=\"mat-body-1\">Flows allow you to customize the behavior of your API event phases through configurable policies</p>\n </div>\n</ng-template>\n", styles: [".emptyFlows{display:flex;width:500px;height:100%;flex-direction:column;justify-content:center;margin:auto;text-align:center}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4.JsonPipe } });
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioDetailsComponent, decorators: [{
|
|
225
|
-
type: Component,
|
|
226
|
-
args: [{ selector: 'gio-ps-flow-details', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<ng-container *ngIf=\"flow; else emptyFlows\">\n <div class=\"header\">\n <div class=\"mat-h4\">Flow details</div>\n </div>\n\n <div class=\"content\">\n \uD83D\uDEA7 Work in progress \uD83D\uDEA7 <br />\n {{ flow | json }}\n </div>\n</ng-container>\n\n<ng-template #emptyFlows>\n <div class=\"emptyFlows\">\n <h2>No flows yet</h2>\n <p class=\"mat-body-1\">Flows allow you to customize the behavior of your API event phases through configurable policies</p>\n </div>\n</ng-template>\n", styles: [".emptyFlows{display:flex;width:500px;height:100%;flex-direction:column;justify-content:center;margin:auto;text-align:center}\n"] }]
|
|
227
|
-
}], propDecorators: { flow: [{
|
|
228
|
-
type: Input
|
|
379
|
+
}], flowsGroupsChange: [{
|
|
380
|
+
type: Output
|
|
229
381
|
}] } });
|
|
230
382
|
|
|
231
383
|
/*
|
|
@@ -258,12 +410,14 @@ class GioPolicyStudioComponent {
|
|
|
258
410
|
this.connectorsTooltip = '';
|
|
259
411
|
this.selectedFlow = undefined;
|
|
260
412
|
this.flowsGroups = [];
|
|
413
|
+
this.entrypointsType = [];
|
|
261
414
|
}
|
|
262
415
|
ngOnChanges(changes) {
|
|
263
416
|
if (changes.entrypointsInfo || changes.endpointsInfo) {
|
|
264
417
|
this.connectorsTooltip = `Entrypoints: ${(this.entrypointsInfo ?? []).map(e => capitalize(e.type)).join(', ')}\nEndpoints: ${(this.endpointsInfo ?? [])
|
|
265
418
|
.map(e => capitalize(e.type))
|
|
266
419
|
.join(', ')}`;
|
|
420
|
+
this.entrypointsType = (this.entrypointsInfo ?? []).map(e => e.type);
|
|
267
421
|
}
|
|
268
422
|
if (changes.commonFlows || changes.plans) {
|
|
269
423
|
this.flowsGroups = getFlowsGroups(this.commonFlows, this.plans);
|
|
@@ -273,12 +427,35 @@ class GioPolicyStudioComponent {
|
|
|
273
427
|
}
|
|
274
428
|
}
|
|
275
429
|
}
|
|
430
|
+
onFlowsGroupsChange(flowsGroups) {
|
|
431
|
+
this.flowsGroups = flowsGroups;
|
|
432
|
+
}
|
|
433
|
+
onSelectedFlowChange(flow) {
|
|
434
|
+
this.flowsGroups = this.flowsGroups.map(flowGroup => ({
|
|
435
|
+
...flowGroup,
|
|
436
|
+
flows: flowGroup.flows.map(f => (f._id === flow._id ? flow : f)),
|
|
437
|
+
}));
|
|
438
|
+
this.selectedFlow = flow;
|
|
439
|
+
}
|
|
440
|
+
onDeleteSelectedFlow(flow) {
|
|
441
|
+
// Define next selected flow and remove flow from flowsGroups
|
|
442
|
+
const allFLowsId = flatten(this.flowsGroups.map(flowGroup => flowGroup.flows)).map(f => f._id);
|
|
443
|
+
const flowToDeleteIndex = allFLowsId.indexOf(flow._id);
|
|
444
|
+
const nextSelectedFlow = allFLowsId[flowToDeleteIndex + 1] ?? allFLowsId[flowToDeleteIndex - 1];
|
|
445
|
+
this.flowsGroups = this.flowsGroups.map(flowGroup => ({
|
|
446
|
+
...flowGroup,
|
|
447
|
+
flows: flowGroup.flows.filter(f => f._id !== flow._id),
|
|
448
|
+
}));
|
|
449
|
+
this.selectedFlow = this.flowsGroups
|
|
450
|
+
.find(flowGroup => flowGroup.flows.some(f => f._id === nextSelectedFlow))
|
|
451
|
+
?.flows.find(f => f._id === nextSelectedFlow);
|
|
452
|
+
}
|
|
276
453
|
}
|
|
277
454
|
GioPolicyStudioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
278
|
-
GioPolicyStudioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioComponent, selector: "gio-policy-studio", inputs: { apiType: "apiType", entrypointsInfo: "entrypointsInfo", endpointsInfo: "endpointsInfo", commonFlows: "commonFlows", plans: "plans" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__apiInfo\">\n <span class=\"gio-badge-primary\">\n {{ apiType | titlecase }}\n </span>\n <span\n class=\"gio-badge-neutral\"\n [matTooltip]=\"connectorsTooltip\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"gio-policy-studio__tooltip-line-break\"\n >\n <mat-icon *ngFor=\"let entrypoint of entrypointsInfo\" class=\"gio-left\" [svgIcon]=\"entrypoint.icon\"></mat-icon>\n <mat-icon *ngFor=\"let endpoint of endpointsInfo\" class=\"gio-left\" [svgIcon]=\"endpoint.icon\"></mat-icon>\n </span>\n </div>\n\n <div class=\"header__btn\">\n <button mat-stroked-button color=\"primary\">Save</button>\n </div>\n</div>\n\n<div class=\"wrapper\">\n <div class=\"wrapper__flowsMenu\">\n <gio-ps-flows-menu
|
|
455
|
+
GioPolicyStudioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPolicyStudioComponent, selector: "gio-policy-studio", inputs: { apiType: "apiType", entrypointsInfo: "entrypointsInfo", endpointsInfo: "endpointsInfo", commonFlows: "commonFlows", plans: "plans" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__apiInfo\">\n <span class=\"gio-badge-primary\">\n {{ apiType | titlecase }}\n </span>\n <span\n class=\"gio-badge-neutral\"\n [matTooltip]=\"connectorsTooltip\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"gio-policy-studio__tooltip-line-break\"\n >\n <mat-icon *ngFor=\"let entrypoint of entrypointsInfo\" class=\"gio-left\" [svgIcon]=\"entrypoint.icon\"></mat-icon>\n <mat-icon *ngFor=\"let endpoint of endpointsInfo\" class=\"gio-left\" [svgIcon]=\"endpoint.icon\"></mat-icon>\n </span>\n </div>\n\n <div class=\"header__btn\">\n <button mat-stroked-button color=\"primary\">Save</button>\n </div>\n</div>\n\n<div class=\"wrapper\">\n <div class=\"wrapper__flowsMenu\">\n <gio-ps-flows-menu\n [flowsGroups]=\"flowsGroups\"\n [entrypoints]=\"entrypointsType\"\n (flowsGroupsChange)=\"onFlowsGroupsChange($event)\"\n [(selectedFlow)]=\"selectedFlow\"\n ></gio-ps-flows-menu>\n </div>\n\n <div class=\"wrapper__flowDetails\">\n <gio-ps-flow-details\n [flow]=\"selectedFlow\"\n [entrypoints]=\"entrypointsType\"\n (flowChange)=\"onSelectedFlowChange($event)\"\n (deleteFlow)=\"onDeleteSelectedFlow($event)\"\n ></gio-ps-flow-details>\n </div>\n</div>\n", styles: [":host{display:flex;height:100%;flex-direction:column;padding:8px;background-color:#fff}::ng-deep .gio-policy-studio__tooltip-line-break{white-space:pre-line}.header{display:flex;align-items:center;padding-bottom:16px}.header__apiInfo{flex:1 1 auto}.wrapper{display:flex;min-height:0;flex:1 1 auto;flex-direction:row;gap:16px}.wrapper__flowsMenu{max-width:400px;flex:0 1 400px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__flowDetails{flex:1 1 auto;padding:16px;border:1px solid #d3d5dc;border-radius:8px}\n"], components: [{ type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: GioPolicyStudioFlowsMenuComponent, selector: "gio-ps-flows-menu", inputs: ["flowsGroups", "selectedFlow", "entrypoints"], outputs: ["selectedFlowChange", "flowsGroupsChange"] }, { type: GioPolicyStudioDetailsComponent, selector: "gio-ps-flow-details", inputs: ["flow", "entrypoints"], outputs: ["flowChange", "deleteFlow"] }], directives: [{ type: i4$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "titlecase": i5$1.TitleCasePipe } });
|
|
279
456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioComponent, decorators: [{
|
|
280
457
|
type: Component,
|
|
281
|
-
args: [{ selector: 'gio-policy-studio', template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__apiInfo\">\n <span class=\"gio-badge-primary\">\n {{ apiType | titlecase }}\n </span>\n <span\n class=\"gio-badge-neutral\"\n [matTooltip]=\"connectorsTooltip\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"gio-policy-studio__tooltip-line-break\"\n >\n <mat-icon *ngFor=\"let entrypoint of entrypointsInfo\" class=\"gio-left\" [svgIcon]=\"entrypoint.icon\"></mat-icon>\n <mat-icon *ngFor=\"let endpoint of endpointsInfo\" class=\"gio-left\" [svgIcon]=\"endpoint.icon\"></mat-icon>\n </span>\n </div>\n\n <div class=\"header__btn\">\n <button mat-stroked-button color=\"primary\">Save</button>\n </div>\n</div>\n\n<div class=\"wrapper\">\n <div class=\"wrapper__flowsMenu\">\n <gio-ps-flows-menu
|
|
458
|
+
args: [{ selector: 'gio-policy-studio', template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<div class=\"header\">\n <div class=\"header__apiInfo\">\n <span class=\"gio-badge-primary\">\n {{ apiType | titlecase }}\n </span>\n <span\n class=\"gio-badge-neutral\"\n [matTooltip]=\"connectorsTooltip\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"gio-policy-studio__tooltip-line-break\"\n >\n <mat-icon *ngFor=\"let entrypoint of entrypointsInfo\" class=\"gio-left\" [svgIcon]=\"entrypoint.icon\"></mat-icon>\n <mat-icon *ngFor=\"let endpoint of endpointsInfo\" class=\"gio-left\" [svgIcon]=\"endpoint.icon\"></mat-icon>\n </span>\n </div>\n\n <div class=\"header__btn\">\n <button mat-stroked-button color=\"primary\">Save</button>\n </div>\n</div>\n\n<div class=\"wrapper\">\n <div class=\"wrapper__flowsMenu\">\n <gio-ps-flows-menu\n [flowsGroups]=\"flowsGroups\"\n [entrypoints]=\"entrypointsType\"\n (flowsGroupsChange)=\"onFlowsGroupsChange($event)\"\n [(selectedFlow)]=\"selectedFlow\"\n ></gio-ps-flows-menu>\n </div>\n\n <div class=\"wrapper__flowDetails\">\n <gio-ps-flow-details\n [flow]=\"selectedFlow\"\n [entrypoints]=\"entrypointsType\"\n (flowChange)=\"onSelectedFlowChange($event)\"\n (deleteFlow)=\"onDeleteSelectedFlow($event)\"\n ></gio-ps-flow-details>\n </div>\n</div>\n", styles: [":host{display:flex;height:100%;flex-direction:column;padding:8px;background-color:#fff}::ng-deep .gio-policy-studio__tooltip-line-break{white-space:pre-line}.header{display:flex;align-items:center;padding-bottom:16px}.header__apiInfo{flex:1 1 auto}.wrapper{display:flex;min-height:0;flex:1 1 auto;flex-direction:row;gap:16px}.wrapper__flowsMenu{max-width:400px;flex:0 1 400px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__flowDetails{flex:1 1 auto;padding:16px;border:1px solid #d3d5dc;border-radius:8px}\n"] }]
|
|
282
459
|
}], propDecorators: { apiType: [{
|
|
283
460
|
type: Input
|
|
284
461
|
}], entrypointsInfo: [{
|
|
@@ -325,13 +502,49 @@ const getFlowsGroups = (commonFlows = [], plans = []) => {
|
|
|
325
502
|
class GioPolicyStudioModule {
|
|
326
503
|
}
|
|
327
504
|
GioPolicyStudioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
328
|
-
GioPolicyStudioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioModule, declarations: [GioPolicyStudioComponent,
|
|
329
|
-
|
|
505
|
+
GioPolicyStudioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioModule, declarations: [GioPolicyStudioComponent,
|
|
506
|
+
GioPolicyStudioFlowsMenuComponent,
|
|
507
|
+
GioPolicyStudioDetailsComponent,
|
|
508
|
+
GioPolicyStudioFlowFormDialogComponent], imports: [CommonModule,
|
|
509
|
+
ReactiveFormsModule,
|
|
510
|
+
MatButtonModule,
|
|
511
|
+
MatTooltipModule,
|
|
512
|
+
MatFormFieldModule,
|
|
513
|
+
MatInputModule,
|
|
514
|
+
MatSelectModule,
|
|
515
|
+
MatDialogModule,
|
|
516
|
+
GioIconsModule], exports: [GioPolicyStudioComponent] });
|
|
517
|
+
GioPolicyStudioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioModule, imports: [[
|
|
518
|
+
CommonModule,
|
|
519
|
+
ReactiveFormsModule,
|
|
520
|
+
MatButtonModule,
|
|
521
|
+
MatTooltipModule,
|
|
522
|
+
MatFormFieldModule,
|
|
523
|
+
MatInputModule,
|
|
524
|
+
MatSelectModule,
|
|
525
|
+
MatDialogModule,
|
|
526
|
+
GioIconsModule,
|
|
527
|
+
]] });
|
|
330
528
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPolicyStudioModule, decorators: [{
|
|
331
529
|
type: NgModule,
|
|
332
530
|
args: [{
|
|
333
|
-
declarations: [
|
|
334
|
-
|
|
531
|
+
declarations: [
|
|
532
|
+
GioPolicyStudioComponent,
|
|
533
|
+
GioPolicyStudioFlowsMenuComponent,
|
|
534
|
+
GioPolicyStudioDetailsComponent,
|
|
535
|
+
GioPolicyStudioFlowFormDialogComponent,
|
|
536
|
+
],
|
|
537
|
+
imports: [
|
|
538
|
+
CommonModule,
|
|
539
|
+
ReactiveFormsModule,
|
|
540
|
+
MatButtonModule,
|
|
541
|
+
MatTooltipModule,
|
|
542
|
+
MatFormFieldModule,
|
|
543
|
+
MatInputModule,
|
|
544
|
+
MatSelectModule,
|
|
545
|
+
MatDialogModule,
|
|
546
|
+
GioIconsModule,
|
|
547
|
+
],
|
|
335
548
|
exports: [GioPolicyStudioComponent],
|
|
336
549
|
}]
|
|
337
550
|
}] });
|