Skip to content

Commit

Permalink
SHIBUI-684 Implemented bug fix for validation on editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jul 26, 2018
1 parent b12d7b7 commit ddfdd21
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
4 changes: 3 additions & 1 deletion ui/src/app/shared/autocomplete/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,14 @@ export class AutoCompleteComponent implements OnInit, OnDestroy, OnChanges, Afte

handleInputChange(query: string): void {
query = query || '';

const queryEmpty = query.length === 0;
const autoselect = this.hasAutoselect;
const optionsAvailable = this.matches.length > 0;
const searchForOptions = !queryEmpty;
const focused = this.state.currentState.focused !== null;
this.state.setState({
menuOpen: searchForOptions && !this.matches.some(m => m === query),
menuOpen: searchForOptions && (focused && !this.matches.some(m => m === query)),
selected: searchForOptions ? ((autoselect && optionsAvailable) ? 0 : -1) : null
});
this.propagateChange(query);
Expand Down
21 changes: 18 additions & 3 deletions ui/src/assets/schema/provider/filebacked-http-filters.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,24 @@
"maxValidityInterval": {
"title": "Max Validity Interval",
"description": "Defines the window within which the metadata is valid.",
"type": "number",
"minimum": 0,
"default": 0
"type": "string",
"placeholder": "Duration",
"widget": {
"id": "datalist",
"data": [
"PT0S",
"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)?)?$"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"PT24H"
]
},
"default": ""
"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)?)?$"
},
"maxRefreshDelay": {
"title": "Max Refresh Delay",
Expand All @@ -44,7 +45,8 @@
"PT24H"
]
},
"default": ""
"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)?)?$"
},
"refreshDelayFactor": {
"title": "Refresh Delay Factor",
Expand Down Expand Up @@ -101,7 +103,8 @@
"PT24H"
]
},
"default": ""
"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)?)?$"
}
}
}
Expand Down

0 comments on commit ddfdd21

Please sign in to comment.