Skip to content

Commit

Permalink
SHIBUI-799 Fixed issues with schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Dec 6, 2018
1 parent fc7cb92 commit d29c301
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 155 deletions.
142 changes: 76 additions & 66 deletions backend/src/main/resources/nameid-filter.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"type": "object",
"fieldsets": [
{
"type": "group",
"type": "group-lg",
"fields": [
"name",
"entityAttributesFilterTarget",
"filterEnabled",
"@type",
"resourceId",
Expand All @@ -13,7 +14,7 @@
]
},
{
"type": "group-lg",
"type": "group",
"fields": [
"formats"
]
Expand All @@ -35,6 +36,60 @@
"type": "boolean",
"default": false
},
"entityAttributesFilterTarget": {
"title": "label.search-criteria",
"description": "tooltip.search-criteria",
"type": "object",
"widget": {
"id": "filter-target"
},
"properties": {
"entityAttributesFilterTargetType": {
"title": "",
"type": "string",
"default": "ENTITY",
"oneOf": [
{
"enum": [
"ENTITY"
],
"description": "value.entity-id"
},
{
"enum": [
"REGEX"
],
"description": "value.regex"
},
{
"enum": [
"CONDITION_SCRIPT"
],
"description": "value.script"
}
]
},
"value": {
"type": "array",
"buttons": [
{
"id": "preview",
"label": "action.preview",
"widget": "icon-button"
}
],
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string"
}
}
},
"required": [
"value",
"entityAttributesFilterTargetType"
]
},
"@type": {
"type": "string",
"widget": {
Expand All @@ -61,75 +116,30 @@
"default": false
},
"formats": {
"$ref": "#/definitions/NameIdFormatList"
}
},
"definitions": {
"NameIdFormatList": {
"title": "label.nameid-format-to-send",
"placeholder": "label.nameid-format",
"description": "tooltip.nameid-format",
"type": "array",
"widget": {
"id": "inline-obj-list"
},
"title": "label.nameid-formats",
"description": "tooltip.nameid-formats",
"uniqueItems": true,
"items": {
"type": "object",
"title": "label.nameid-format",
"type": "string",
"minLength": 1,
"maxLength": 255,
"widget": {
"id": "inline-obj"
},
"properties": {
"format": {
"$ref": "#/definitions/NameIDFormat"
},
"value": {
"type": "string",
"title": "label.nameid-formats-value",
"description": "tooltip.nameid-formats-value"
},
"type": {
"type": "string",
"title": "label.nameid-formats-type",
"description": "tooltip.nameid-formats-type",
"widget": {
"id": "select"
},
"oneOf": [
{
"enum": [
"ENTITY"
],
"description": "value.entity"
},
{
"enum": [
"CONDITION_REF"
],
"description": "value.condition-ref"
},
{
"enum": [
"CONDITION_SCRIPT"
],
"description": "value.condition-script"
}
]
}
"id": "datalist",
"data": [
"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
]
}
}
}
},
"definitions": {
"NameIDFormat": {
"type": "string",
"title": "label.nameid-formats-format",
"description": "tooltip.nameid-formats-format",
"minLength": 1,
"maxLength": 255,
"widget": {
"id": "datalist",
"data": [
"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
]
}
}
}
}
54 changes: 33 additions & 21 deletions ui/src/app/metadata/filter/container/edit-filter.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,45 @@
<div class="col-md-12">
<span class="display-6">
<i class="fa fa-fw fa-gears"></i>&nbsp;&nbsp;
<translate-i18n key="label.new-filter">Edit EntityAttributesFilter</translate-i18n>
<translate-i18n key="label.edit-filter">Edit Filter</translate-i18n> {{ type$ | async }}
</span>
</div>
</div>
</div>
<div class="section-body p-4 border border-top-0 border-info" *ngIf="schema$ | async">
<div class="mx-3 my-2 d-flex justify-content-end">
<button (click)="this.save()" type="submit" class="btn btn-primary" [disabled]="!isValid || (isSaving$ | async)">
<i class="fa fa-fw fa-lg" [ngClass]="{
'fa-save': !(isSaving$ | async),
'fa-spinner': (isSaving$ | async),
'fa-pulse': (isSaving$ | async)
}"></i>
<translate-i18n key="action.save">Save</translate-i18n>
</button>
&nbsp;
<button (click)="this.cancel()" type="reset" class="btn btn-secondary" [disabled]="isSaving$ | async">
<translate-i18n key="action.cancel">Cancel</translate-i18n>
</button>
<div class="mx-3 my-2">
<div class="d-flex justify-content-between">
<div class="d-block w-50">
<div class="form-group">
<label for="type">Filter Type</label>
<input class="form-control" type="text" readonly [value]="type$ | async" />
</div>
</div>
<div class="py-2">
<ng-container *ngIf="schema$ | async">
<button (click)="this.save()" type="submit" class="btn btn-primary" [disabled]="!isValid || (isSaving$ | async)">
<i class="fa fa-fw fa-lg" [ngClass]="{
'fa-save': !(isSaving$ | async),
'fa-spinner': (isSaving$ | async),
'fa-pulse': (isSaving$ | async)
}"></i>
<translate-i18n key="action.save">Save</translate-i18n>
</button>
&nbsp;
<button (click)="this.cancel()" type="reset" class="btn btn-secondary" [disabled]="isSaving$ | async">
<translate-i18n key="action.cancel">Cancel</translate-i18n>
</button>
</ng-container>
</div>
</div>
<sf-form
[schema]="schema$ | async"
[model]="model$ | async"
[validators]="validators$ | async"
[actions]="actions"
(onChange)="valueChangeSubject.next($event)"
(onErrorChange)="statusChangeSubject.next($event)"></sf-form>
</div>
<sf-form
[schema]="schema$ | async"
[model]="model$ | async"
[validators]="validators$ | async"
[actions]="actions"
(onChange)="valueChangeSubject.next($event)"
(onErrorChange)="statusChangeSubject.next($event)"></sf-form>
</div>
</section>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class EditFilterComponent {
isSaving$: Observable<boolean>;
filter: MetadataFilter;
isValid: boolean;
type$: Observable<string>;

validators$: Observable<{ [key: string]: any }>;

Expand Down Expand Up @@ -80,7 +81,7 @@ export class EditFilterComponent {
}
};

this.definition$.subscribe(d => console.log(d));
this.type$ = this.model$.pipe(map(f => f['@type']));
}

save(): void {
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/metadata/filter/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const detectFilterType = (changes) => changes.type ? changes.type : chang
export const getFilterWithChanges = createSelector(getFilter, getSelectedFilter, mergeFn);
export const getFilterType = createSelector(getFilter, (changes: MetadataFilter) => {
const type = changes ? detectFilterType(changes) : null;
console.log(type, changes);
return type;
});

Loading

0 comments on commit d29c301

Please sign in to comment.