diff --git a/public/pages/CreatePolicy/components/DefinePolicy/DefinePolicy.tsx b/public/pages/CreatePolicy/components/DefinePolicy/DefinePolicy.tsx index 7789db8cc..247dc329e 100644 --- a/public/pages/CreatePolicy/components/DefinePolicy/DefinePolicy.tsx +++ b/public/pages/CreatePolicy/components/DefinePolicy/DefinePolicy.tsx @@ -26,10 +26,11 @@ interface DefinePolicyProps { hasJSONError: boolean; onChange: (value: string) => void; onAutoIndent: () => void; + useNewUx?: boolean; } // TODO: Add custom autocomplete for Policy syntax -const DefinePolicy = ({ jsonString, onChange, onAutoIndent, hasJSONError }: DefinePolicyProps) => ( +const DefinePolicy = ({ jsonString, onChange, onAutoIndent, hasJSONError, useNewUx }: DefinePolicyProps) => ( {(copy: () => void) => ( - + Copy )} , - + Auto indent , ]} diff --git a/public/pages/CreatePolicy/containers/CreatePolicy/CreatePolicy.tsx b/public/pages/CreatePolicy/containers/CreatePolicy/CreatePolicy.tsx index 855e6acfb..1fba864d7 100644 --- a/public/pages/CreatePolicy/containers/CreatePolicy/CreatePolicy.tsx +++ b/public/pages/CreatePolicy/containers/CreatePolicy/CreatePolicy.tsx @@ -286,7 +286,13 @@ export class CreatePolicy extends Component - + {submitError && ( @@ -296,12 +302,18 @@ export class CreatePolicy extends Component - + Cancel - + {isEdit ? "Update" : "Create"} diff --git a/public/pages/Policies/containers/Policies/Policies.tsx b/public/pages/Policies/containers/Policies/Policies.tsx index 5d3640827..24960f203 100644 --- a/public/pages/Policies/containers/Policies/Policies.tsx +++ b/public/pages/Policies/containers/Policies/Policies.tsx @@ -26,6 +26,8 @@ import { EuiCompressedFieldSearch, EuiPopover, EuiContextMenuPanel, + EuiContextMenu, + EuiIcon, } from "@elastic/eui"; import _ from "lodash"; import { ContentPanel, ContentPanelActions } from "../../../../components/ContentPanel"; @@ -442,33 +444,31 @@ export class Policies extends MDSEnabledComponent ); - const popoverActionItems = [ - { - this.closePopover(); - this.onShowEditModal(); - }} - > - Edit - , - { - this.closePopover(); - this.onShowDeleteModal(); - }} - > - Delete - , + const popoverItems = [ + { + id: 0, + width: 159, + items: [ + { + name: "Edit", + icon: "pencil", + disabled: selectedItems.length != 1, + onClick: () => { + this.closePopover(); + this.onShowEditModal(); + }, + }, + { + name: "Delete", + icon: , + disabled: !selectedItems.length, + onClick: () => { + this.closePopover(); + this.onShowDeleteModal(); + }, + }, + ], + }, ]; return !useNewUX ? ( @@ -543,8 +543,9 @@ export class Policies extends MDSEnabledComponent isOpen={isPopoverOpen} closePopover={this.closePopover} anchorPosition="downRight" + panelPaddingSize="none" > - + diff --git a/public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.tsx b/public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.tsx index 0f8dc80e4..286284da7 100644 --- a/public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.tsx +++ b/public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.tsx @@ -18,6 +18,7 @@ interface ChannelNotificationProps { onChangeChannelId: (value: ChangeEvent) => void; onChangeMessage?: (value: ChangeEvent) => void; getChannels: () => void; + useNewUx?: boolean; actionNotification?: boolean; // to tell if this is rendering in actions or in error notification as they both show up on page together } @@ -29,6 +30,7 @@ const ChannelNotification = ({ onChangeChannelId, onChangeMessage, getChannels, + useNewUx, actionNotification = false, }: ChannelNotificationProps) => { return ( @@ -38,6 +40,7 @@ const ChannelNotification = ({ - + Manage channels diff --git a/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx b/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx index 48ea74ad9..db823e6bd 100644 --- a/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx +++ b/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx @@ -15,17 +15,34 @@ interface FlyoutFooterProps { save?: boolean; restore?: boolean; text?: string; + useNewUx?: boolean; } -const FlyoutFooter = ({ edit, action, disabledAction = false, onClickCancel, onClickAction, save, restore, text }: FlyoutFooterProps) => ( +const FlyoutFooter = ({ + edit, + action, + disabledAction = false, + onClickCancel, + onClickAction, + save, + restore, + text, + useNewUx, +}: FlyoutFooterProps) => ( - + Cancel - + {text ? text : restore ? "Restore snapshot" : !save ? `${edit ? "Edit" : "Add"} ${action}` : save ? "Save" : "Create"} diff --git a/public/pages/VisualCreatePolicy/components/ISMTemplate/ISMTemplate.tsx b/public/pages/VisualCreatePolicy/components/ISMTemplate/ISMTemplate.tsx index 714429b9e..f07e94e0d 100644 --- a/public/pages/VisualCreatePolicy/components/ISMTemplate/ISMTemplate.tsx +++ b/public/pages/VisualCreatePolicy/components/ISMTemplate/ISMTemplate.tsx @@ -15,9 +15,10 @@ interface ISMTemplateProps { onUpdateTemplate: (template: ISMTemplateData) => void; onRemoveTemplate: () => void; isFirst: boolean; + useNewUx?: boolean; } -const ISMTemplate = ({ template, onUpdateTemplate, onRemoveTemplate, isFirst }: ISMTemplateProps) => { +const ISMTemplate = ({ template, onUpdateTemplate, onRemoveTemplate, isFirst, useNewUx }: ISMTemplateProps) => { // TODO: Move this top top of form submition const [isInvalid, setInvalid] = useState(false); return ( @@ -25,6 +26,7 @@ const ISMTemplate = ({ template, onUpdateTemplate, onRemoveTemplate, isFirst }: ) => { const priority = e.target.valueAsNumber; @@ -78,7 +81,7 @@ const ISMTemplate = ({ template, onUpdateTemplate, onRemoveTemplate, isFirst }: - + Remove diff --git a/public/pages/VisualCreatePolicy/components/ISMTemplates/ISMTemplates.tsx b/public/pages/VisualCreatePolicy/components/ISMTemplates/ISMTemplates.tsx index 223ea6e63..e196ba1a2 100644 --- a/public/pages/VisualCreatePolicy/components/ISMTemplates/ISMTemplates.tsx +++ b/public/pages/VisualCreatePolicy/components/ISMTemplates/ISMTemplates.tsx @@ -18,12 +18,14 @@ import { makeId } from "../../../../utils/helpers"; interface ISMTemplatesProps { policy: Policy; onChangePolicy: (policy: Policy) => void; + useNewUx?: boolean; } -const ISMTemplates = ({ policy, onChangePolicy }: ISMTemplatesProps) => { +const ISMTemplates = ({ policy, onChangePolicy, useNewUx }: ISMTemplatesProps) => { const templates = convertTemplatesToArray(policy.ism_template); const addTemplateButton = ( { onChangePolicy({ ...policy, ism_template: [...templates, { index_patterns: [], priority: 1 }] }); }} @@ -32,6 +34,7 @@ const ISMTemplates = ({ policy, onChangePolicy }: ISMTemplatesProps) => { Add template ); + const paddingStyle = useNewUx ? { padding: "0px 0px" } : { padding: "5px 0px" }; return ( { } titleSize="s" subTitleText={ - +

Specify ISM template patterns that match the index to apply the policy.{" "} @@ -97,6 +100,7 @@ const ISMTemplates = ({ policy, onChangePolicy }: ISMTemplatesProps) => { ism_template: templates.slice(0, idx).concat(templates.slice(idx + 1)), }); }} + useNewUx={useNewUx} /> ))} diff --git a/public/pages/VisualCreatePolicy/components/States/States.tsx b/public/pages/VisualCreatePolicy/components/States/States.tsx index 086b71e67..11a130ba6 100644 --- a/public/pages/VisualCreatePolicy/components/States/States.tsx +++ b/public/pages/VisualCreatePolicy/components/States/States.tsx @@ -31,16 +31,26 @@ interface StatesProps { onClickDeleteState: (idx: number) => void; onChangeDefaultState: (event: ChangeEvent) => void; isReadOnly: boolean; + useNewUx?: boolean; } -const States = ({ onOpenFlyout, policy, onClickEditState, onClickDeleteState, onChangeDefaultState, isReadOnly = false }: StatesProps) => { +const States = ({ + onOpenFlyout, + policy, + onClickEditState, + onClickDeleteState, + onChangeDefaultState, + isReadOnly = false, + useNewUx, +}: StatesProps) => { + const paddingStyle = useNewUx ? { padding: "0px 0px" } : { padding: "5px 0px" }; return ( +

You can think of policies as state machines. "Actions" are the operations ISM performs when an index is in a certain state.
@@ -89,7 +99,7 @@ const States = ({ onOpenFlyout, policy, onClickEditState, onClickDeleteState, on (!!policy.states.length ? ( <> - + Add state @@ -99,7 +109,12 @@ const States = ({ onOpenFlyout, policy, onClickEditState, onClickDeleteState, on titleSize="s" body={

Your policy currently has no states defined. Add states to manage your index lifecycle.

} actions={ - + Add state } diff --git a/public/pages/VisualCreatePolicy/components/Transition/Transition.tsx b/public/pages/VisualCreatePolicy/components/Transition/Transition.tsx index 7d209e5cc..e2e878cc9 100644 --- a/public/pages/VisualCreatePolicy/components/Transition/Transition.tsx +++ b/public/pages/VisualCreatePolicy/components/Transition/Transition.tsx @@ -24,9 +24,10 @@ const conditionTypeOptions = [ interface TransitionProps { uiTransition: UITransition; onChangeTransition: (transition: UITransition) => void; + useNewUx?: boolean; } -const Transition = ({ uiTransition, onChangeTransition }: TransitionProps) => { +const Transition = ({ uiTransition, onChangeTransition, useNewUx }: TransitionProps) => { // We currently only support one transition condition const conditionType = Object.keys(uiTransition.transition.conditions || []).pop() || "none"; const conditions = uiTransition.transition.conditions; @@ -35,6 +36,7 @@ const Transition = ({ uiTransition, onChangeTransition }: TransitionProps) => { | null; onClickCancelAction: () => void; onClickSaveAction: (action: UIAction) => void; + useNewUx?: boolean; } interface CreateActionState { @@ -53,7 +54,7 @@ export default class CreateAction extends Component ) => void; onDragEndActions: (dropResult: DropResult) => void; onClickAddAction: () => void; + useNewUx?: boolean; } -const Actions = ({ actions, onClickDeleteAction, onClickEditAction, onDragEndActions, onClickAddAction }: ActionsProps) => { +const Actions = ({ actions, onClickDeleteAction, onClickEditAction, onDragEndActions, onClickAddAction, useNewUx }: ActionsProps) => { return ( <> @@ -55,7 +56,9 @@ const Actions = ({ actions, onClickDeleteAction, onClickEditAction, onDragEndAct - + Add action + + + Add action + ); }; diff --git a/public/pages/VisualCreatePolicy/containers/CreateState/CreateState.tsx b/public/pages/VisualCreatePolicy/containers/CreateState/CreateState.tsx index 5bb97e203..9b3594c89 100644 --- a/public/pages/VisualCreatePolicy/containers/CreateState/CreateState.tsx +++ b/public/pages/VisualCreatePolicy/containers/CreateState/CreateState.tsx @@ -37,6 +37,7 @@ interface CreateStateProps { onSaveState: (state: State, states: State[], order: string, afterBeforeState: string) => void; onCloseFlyout: () => void; state: State | null; + useNewUx?: boolean; } interface CreateStateState { @@ -190,7 +191,7 @@ export default class CreateState extends Component { - const { policy, state } = this.props; + const { policy, state, useNewUx } = this.props; const { actions, name, nameError, afterBeforeState, order, disableOrderSelections } = this.state; // If we are editing a state filter it out from the selectable options const stateOptions = policy.states.map((state) => ({ value: state.name, text: state.name })).filter((s) => s.value !== state?.name); @@ -203,6 +204,7 @@ export default class CreateState extends Component @@ -266,24 +271,25 @@ export default class CreateState extends Component ); }; renderDefaultFooter = () => { - const { onCloseFlyout, state } = this.props; + const { onCloseFlyout, state, useNewUx } = this.props; const { name, nameError } = this.state; const isEditing = !!state; return ( - + Cancel - + {isEditing ? "Update state" : "Save state"} @@ -292,7 +298,7 @@ export default class CreateState extends Component ); if (createTransition || editTransition) @@ -321,6 +328,7 @@ export default class CreateState extends Component this.setState({ createTransition: false, editTransition: null })} onClickSaveTransition={this.onClickSaveTransition} + useNewUx={useNewUx} /> ); if (!flyoutContent) diff --git a/public/pages/VisualCreatePolicy/containers/CreateState/Transitions.tsx b/public/pages/VisualCreatePolicy/containers/CreateState/Transitions.tsx index de09d619d..d8700a733 100644 --- a/public/pages/VisualCreatePolicy/containers/CreateState/Transitions.tsx +++ b/public/pages/VisualCreatePolicy/containers/CreateState/Transitions.tsx @@ -16,6 +16,7 @@ interface TransitionsProps { onClickEditTransition: (transition: UITransition) => void; onDragEndTransitions: (dropResult: DropResult) => void; onClickAddTransition: () => void; + useNewUx?: boolean; } const Transitions = ({ @@ -24,6 +25,7 @@ const Transitions = ({ onClickEditTransition, onDragEndTransitions, onClickAddTransition, + useNewUx, }: TransitionsProps) => { return ( <> @@ -64,7 +66,9 @@ const Transitions = ({ - + Add Transition + + + Add Transition + ); }; diff --git a/public/pages/VisualCreatePolicy/containers/CreateTransition/CreateTransition.tsx b/public/pages/VisualCreatePolicy/containers/CreateTransition/CreateTransition.tsx index 1972d3209..542ba9635 100644 --- a/public/pages/VisualCreatePolicy/containers/CreateTransition/CreateTransition.tsx +++ b/public/pages/VisualCreatePolicy/containers/CreateTransition/CreateTransition.tsx @@ -17,6 +17,7 @@ interface CreateTransitionProps { onCloseCreateTransition: () => void; onClickSaveTransition: (uiTransition: UITransition) => void; stateOptions: string[]; + useNewUx?: boolean; } interface CreateTransitionState { @@ -76,7 +77,7 @@ export default class CreateTransition extends Component - {!!uiTransition && } + {!!uiTransition && } void; onSwitchToChannels: () => void; notificationService: NotificationService; + useNewUx?: boolean; } interface ErrorNotificationState { @@ -71,6 +72,7 @@ export default class ErrorNotification extends Component ); @@ -97,7 +100,7 @@ export default class ErrorNotification extends Component ); } - + const paddingStyle = useNewUx ? { padding: "0px 0px" } : { padding: "5px 0px" }; return ( +

You can set up an error notification for when a policy execution fails.{" "} diff --git a/public/pages/VisualCreatePolicy/containers/VisualCreatePolicy/VisualCreatePolicy.tsx b/public/pages/VisualCreatePolicy/containers/VisualCreatePolicy/VisualCreatePolicy.tsx index db528c814..8532b6a9f 100644 --- a/public/pages/VisualCreatePolicy/containers/VisualCreatePolicy/VisualCreatePolicy.tsx +++ b/public/pages/VisualCreatePolicy/containers/VisualCreatePolicy/VisualCreatePolicy.tsx @@ -345,9 +345,10 @@ export class VisualCreatePolicy extends Component - + {showFlyout && ( - + )} - Cancel + + Cancel + - + {isEdit ? "Update" : "Create"}