Fixes based on review.
This commit is contained in:
parent
4618802457
commit
35af7b2b6a
|
@ -49,7 +49,7 @@ export interface ColorRulesOperator {
|
|||
label: string;
|
||||
method: Operator;
|
||||
value?: unknown;
|
||||
isValueConstant?: boolean;
|
||||
hideValueSelector?: boolean;
|
||||
}
|
||||
|
||||
const defaultSecondaryName = i18n.translate(
|
||||
|
@ -92,7 +92,7 @@ export const colorRulesOperatorsList: ColorRulesOperator[] = [
|
|||
defaultMessage: 'empty',
|
||||
}),
|
||||
method: Operator.Empty,
|
||||
isValueConstant: true,
|
||||
hideValueSelector: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -148,7 +148,7 @@ export class ColorRules extends Component<ColorRulesProps> {
|
|||
(operator) => model.operator === operator.method
|
||||
);
|
||||
|
||||
const hideValueSelectorField = selectedOperator?.isValueConstant ?? false;
|
||||
const hideValueSelectorField = selectedOperator?.hideValueSelector ?? false;
|
||||
const labelStyle = { marginBottom: 0 };
|
||||
|
||||
let secondary;
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
commonAddSupportOfDualIndexSelectionModeInTSVB,
|
||||
commonHideTSVBLastValueIndicator,
|
||||
commonRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel,
|
||||
commonAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules,
|
||||
commonAddEmptyValueColorRule,
|
||||
} from '../migrations/visualization_common_migrations';
|
||||
|
||||
const byValueAddSupportOfDualIndexSelectionModeInTSVB = (state: SerializableState) => {
|
||||
|
@ -42,7 +42,7 @@ const byValueAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRule = (
|
|||
) => {
|
||||
return {
|
||||
...state,
|
||||
savedVis: commonAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules(state.savedVis),
|
||||
savedVis: commonAddEmptyValueColorRule(state.savedVis),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ export const commonRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel = (visStat
|
|||
return visState;
|
||||
};
|
||||
|
||||
export const commonAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules = (
|
||||
visState: any
|
||||
) => {
|
||||
export const commonAddEmptyValueColorRule = (visState: any) => {
|
||||
if (visState && visState.type === 'metrics') {
|
||||
const params: any = get(visState, 'params') || {};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
commonAddSupportOfDualIndexSelectionModeInTSVB,
|
||||
commonHideTSVBLastValueIndicator,
|
||||
commonRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel,
|
||||
commonAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules,
|
||||
commonAddEmptyValueColorRule,
|
||||
} from './visualization_common_migrations';
|
||||
|
||||
const migrateIndexPattern: SavedObjectMigrationFn<any, any> = (doc) => {
|
||||
|
@ -967,10 +967,7 @@ const removeDefaultIndexPatternAndTimeFieldFromTSVBModel: SavedObjectMigrationFn
|
|||
};
|
||||
};
|
||||
|
||||
const addEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules: SavedObjectMigrationFn<
|
||||
any,
|
||||
any
|
||||
> = (doc) => {
|
||||
const addEmptyValueColorRule: SavedObjectMigrationFn<any, any> = (doc) => {
|
||||
const visStateJSON = get(doc, 'attributes.visState');
|
||||
let visState;
|
||||
|
||||
|
@ -980,9 +977,7 @@ const addEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules: SavedObje
|
|||
} catch (e) {
|
||||
// Let it go, the data is invalid and we'll leave it as is
|
||||
}
|
||||
const newVisState = commonAddEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules(
|
||||
visState
|
||||
);
|
||||
const newVisState = commonAddEmptyValueColorRule(visState);
|
||||
|
||||
return {
|
||||
...doc,
|
||||
|
@ -1041,5 +1036,5 @@ export const visualizationSavedObjectTypeMigrations = {
|
|||
hideTSVBLastValueIndicator,
|
||||
removeDefaultIndexPatternAndTimeFieldFromTSVBModel
|
||||
),
|
||||
'7.14.0': flow(addEmptyValueRuleForSavedObjectsWithLessAndGreaterThenZeroRules),
|
||||
'7.14.0': flow(addEmptyValueColorRule),
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue