Skip to content

Commit

Permalink
SHIBUI-1478 Updating schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 24, 2019
1 parent 920d611 commit 1f3cf53
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@
"description": "tooltip.refresh-delay-factor",
"type": "number",
"widget": {
"id": "string",
"help": "message.real-number"
"id": "float",
"help": "message.real-number",
"step": 0.01
},
"placeholder": "label.real-number",
"default": "",
"pattern": "^(?:([0]*(\\.[0-9]+)?|[0]*\\.[0-9]*[1-9][0-9]*)|)$"
"minimum": 0.01,
"maximum": 1
},
"minCacheDuration": {
"title": "label.min-cache-duration",
Expand Down Expand Up @@ -579,14 +580,20 @@
"title": "",
"description": "",
"type": "array",
"properties": {
"RequiredValidUntil": {
"additionalItems": true,
"items": [
{
"title": "label.required-valid-until",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "RequiredValidUntil",
"widget": "hidden"
},
"maxValidityInterval": {
"title": "label.max-validity-interval",
"description": "tooltip.max-validity-interval",
Expand All @@ -611,13 +618,18 @@
}
}
},
"SignatureValidation": {
{
"title": "label.signature-validation-filter",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "SignatureValidation",
"widget": "hidden"
},
"requireSignedRoot": {
"title": "label.require-signed-root",
"description": "tooltip.require-signed-root",
Expand Down Expand Up @@ -654,13 +666,18 @@
}
]
},
"EntityRoleWhiteList": {
{
"title": "label.entity-role-whitelist",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "EntityRoleWhiteList",
"widget": "hidden"
},
"retainedRoles": {
"title": "label.retained-roles",
"description": "tooltip.retained-roles",
Expand Down Expand Up @@ -700,7 +717,7 @@
}
}
}
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@
"refreshDelayFactor": {
"title": "label.refresh-delay-factor",
"description": "tooltip.refresh-delay-factor",
"type": "string",
"type": "number",
"widget": {
"id": "string",
"help": "message.real-number"
"id": "float",
"help": "message.real-number",
"step": 0.01
},
"placeholder": "label.real-number",
"default": "",
"pattern": "^(?:([0]*(\\.[0-9]+)?|[0]*\\.[0-9]*[1-9][0-9]*)|)$"
"minimum": 0.01,
"maximum": 1
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@
"description": "tooltip.refresh-delay-factor",
"type": "number",
"widget": {
"id": "string",
"help": "message.real-number"
"id": "float",
"help": "message.real-number",
"step": 0.01
},
"placeholder": "label.real-number",
"default": "",
"pattern": "^(?:([0]*(\\.[0-9]+)?|[0]*\\.[0-9]*[1-9][0-9]*)|)$"
"minimum": 0.01,
"maximum": 1
},
"minCacheDuration": {
"title": "label.min-cache-duration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ export const DynamicHttpMetadataProviderWizard: Wizard<DynamicHttpMetadataProvid
id: 'plugins',
label: 'label.metadata-filter-plugins',
index: 4,
initialValues: [
{ key: 'metadataFilters', value: [] }
],
initialValues: [],
fields: [
'metadataFilters'
]
Expand Down Expand Up @@ -177,9 +175,7 @@ export const DynamicHttpMetadataProviderEditor: Wizard<DynamicHttpMetadataProvid
id: 'plugins',
label: 'label.metadata-filter-plugins',
index: 4,
initialValues: [
{ key: 'metadataFilters', value: [] }
],
initialValues: [],
fields: [
'metadataFilters'
]
Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/schema-form/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CustomObjectWidget } from './widget/object/object.component';
import { CustomRadioComponent } from './widget/radio/radio.component';
import { InlineObjectListComponent } from './widget/array/inline-obj-list.component';
import { InlineObjectComponent } from './widget/object/inline-obj.component';
import { CustomFloatComponent } from './widget/number/float.component';

export class CustomWidgetRegistry extends WidgetRegistry {
constructor() {
Expand Down Expand Up @@ -55,6 +56,7 @@ export class CustomWidgetRegistry extends WidgetRegistry {

this.register('integer', CustomIntegerComponent);
this.register('number', CustomIntegerComponent);
this.register('float', CustomFloatComponent);

this.register('datalist', DatalistComponent);

Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/schema-form/schema-form.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CustomCheckboxComponent } from './widget/check/checkbox.component';
import { CustomTextAreaComponent } from './widget/textarea/textarea.component';
import { CustomArrayComponent } from './widget/array/array.component';
import { CustomIntegerComponent } from './widget/number/number.component';
import { CustomFloatComponent } from './widget/number/float.component';
import { FilterTargetComponent } from './widget/filter-target/filter-target.component';
import { ChecklistComponent } from './widget/check/checklist.component';
import { IconButtonComponent } from './widget/button/icon-button.component';
Expand All @@ -34,6 +35,7 @@ export const COMPONENTS = [
CustomTextAreaComponent,
CustomArrayComponent,
CustomIntegerComponent,
CustomFloatComponent,
FilterTargetComponent,
ChecklistComponent,
IconButtonComponent,
Expand Down
25 changes: 25 additions & 0 deletions ui/src/app/schema-form/widget/number/float.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="widget form-group">
<label [attr.for]="id" class="d-flex justify-content-between control-label">
<span>
<translate-i18n [key]="schema.title">{{ schema.title }}</translate-i18n>
<i class="fa fa-asterisk text-danger" aria-hidden="true" *ngIf="required"></i>
</span>
<span *ngIf="schema.description">
<info-icon [description]="schema.description | translate"></info-icon>
</span>
</label>
<span *ngIf="schema.description" class="formHelp" [translate]="schema.description">{{schema.description}}</span>
<input [attr.readonly]="schema.readOnly?true:null"
[id]="formProperty._canonicalPath"
[name]="name"
class="text-widget integer-widget form-control"
[formControl]="control"
[attr.type]="'number'"
[attr.min]="schema.minimum"
[attr.max]="schema.maximum"
[attr.placeholder]="schema.placeholder | translate"
[attr.maxLength]="schema.maxLength || null"
[attr.minLength]="schema.minLength || null"
[attr.step]="schema.multipleOf || schema.widget.step"
[attr.aria-label]="schema.title">
</div>
21 changes: 21 additions & 0 deletions ui/src/app/schema-form/widget/number/float.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
Component,
} from '@angular/core';
import { IntegerWidget } from 'ngx-schema-form';
import { SchemaService } from '../../service/schema.service';

@Component({
selector: 'float-component',
templateUrl: `./float.component.html`
})
export class CustomFloatComponent extends IntegerWidget {
constructor(
private widgetService: SchemaService
) {
super();
}

get required(): boolean {
return this.widgetService.isRequired(this.formProperty);
}
}
64 changes: 39 additions & 25 deletions ui/src/assets/schema/provider/filebacked-http.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -498,31 +498,36 @@
"refreshDelayFactor": {
"title": "label.refresh-delay-factor",
"description": "tooltip.refresh-delay-factor",
"type": "string",
"type": "number",
"widget": {
"id": "string",
"help": "message.real-number"
"id": "float",
"help": "message.real-number",
"step": 0.01
},
"placeholder": "label.real-number",
"minimum": 0,
"maximum": 1,
"default": "",
"pattern": "^(?:([0]*(\\.[0-9]+)?|[0]*\\.[0-9]*[1-9][0-9]*)|)$"
"minimum": 0.01,
"maximum": 1
}
}
},
"metadataFilters": {
"title": "",
"description": "",
"type": "object",
"properties": {
"RequiredValidUntil": {
"type": "array",
"additionalItems": true,
"items": [
{
"title": "label.required-valid-until",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "RequiredValidUntil",
"widget": "hidden"
},
"maxValidityInterval": {
"title": "label.max-validity-interval",
"description": "tooltip.max-validity-interval",
Expand All @@ -532,24 +537,33 @@
"id": "datalist",
"data": [
"PT0S",
"P14D",
"P7D",
"P1D",
"PT12H"
"PT30S",
"PT1M",
"PT10M",
"PT30M",
"PT1H",
"PT4H",
"PT12H",
"PT24H"
]
},
"default": null,
"pattern": "^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
}
}
},
"SignatureValidation": {
{
"title": "label.signature-validation-filter",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "SignatureValidation",
"widget": "hidden"
},
"requireSignedRoot": {
"title": "label.require-signed-root",
"description": "tooltip.require-signed-root",
Expand All @@ -559,8 +573,7 @@
"certificateFile": {
"title": "label.certificate-file",
"description": "tooltip.certificate-file",
"type": "string",
"widget": "textline"
"type": "string"
}
},
"anyOf": [
Expand All @@ -570,10 +583,6 @@
"enum": [
true
]
},
"certificateFile": {
"minLength": 1,
"type": "string"
}
},
"required": [
Expand All @@ -591,13 +600,18 @@
}
]
},
"EntityRoleWhiteList": {
{
"title": "label.entity-role-whitelist",
"type": "object",
"widget": {
"id": "fieldset"
},
"properties": {
"@type": {
"type": "string",
"default": "EntityRoleWhiteList",
"widget": "hidden"
},
"retainedRoles": {
"title": "label.retained-roles",
"description": "tooltip.retained-roles",
Expand All @@ -610,13 +624,13 @@
"oneOf": [
{
"enum": [
"md:SPSSODescriptor"
"SPSSODescriptor"
],
"description": "value.spdescriptor"
},
{
"enum": [
"md:AttributeAuthorityDescriptor"
"AttributeAuthorityDescriptor"
],
"description": "value.attr-auth-descriptor"
}
Expand All @@ -637,7 +651,7 @@
}
}
}
}
]
}
}
}

0 comments on commit 1f3cf53

Please sign in to comment.