mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Display fied if it's enabled * Reset model value * Fix type * Get rid of lodash dependancy
This commit is contained in:
parent
48c1781af0
commit
52da31e55a
4 changed files with 13 additions and 2 deletions
|
@ -17,10 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { AggConfig } from '../vis/agg_config';
|
||||
|
||||
interface AggParam {
|
||||
type: string;
|
||||
name: string;
|
||||
displayName?: string;
|
||||
disabled?(agg: AggConfig): boolean;
|
||||
}
|
||||
|
||||
export { AggParam };
|
||||
|
|
|
@ -23,6 +23,12 @@ import { EuiFieldText, EuiFormRow } from '@elastic/eui';
|
|||
import { AggParamEditorProps } from '../../vis/editors/default';
|
||||
|
||||
function StringParamEditor({ agg, aggParam, value, setValue }: AggParamEditorProps<string>) {
|
||||
if (aggParam.disabled && aggParam.disabled(agg)) {
|
||||
// reset model value
|
||||
setValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<EuiFormRow
|
||||
label={aggParam.displayName || aggParam.name}
|
||||
|
|
|
@ -31,7 +31,8 @@ uiModules
|
|||
['onChange', { watchDepth: 'reference' }],
|
||||
['setValidity', { watchDepth: 'reference' }],
|
||||
'value',
|
||||
'isInvalid'
|
||||
'isInvalid',
|
||||
'field'
|
||||
]))
|
||||
.directive('visAggParamEditor', function (config) {
|
||||
return {
|
||||
|
@ -58,6 +59,7 @@ uiModules
|
|||
value="paramValue"
|
||||
is-invalid="isInvalid"
|
||||
set-validity="setValidity"
|
||||
field="agg.params.field"
|
||||
></vis-agg-param-react-wrapper>`;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,6 @@ export interface AggParamEditorProps<T> {
|
|||
aggParam: AggParam;
|
||||
value: T;
|
||||
isInvalid: boolean;
|
||||
setValue(value: T): void;
|
||||
setValue(value?: T): void;
|
||||
setValidity(isValid: boolean): void;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue