Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix: DIA-736: [FE] disable add to project actions when dataset sync i…
Browse files Browse the repository at this point in the history
…s not complete
  • Loading branch information
yyassi-heartex committed Nov 29, 2023
1 parent e02f9f5 commit 2c16b02
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/DataManager/Toolbar/ActionsButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
isSeparator: action.isSeparator,
isTitle: action.isTitle,
danger: isDeleteAction,
disabled: action.disabled,
}}
name='actionButton'
>
<Elem name='titleContainer'>
<Elem name='titleContainer' {...(action.disabled ? { title: action.disabledReason } : {})}>
<Elem name='title'>{action.title}</Elem>
{hasChildren ? <Elem name='icon' tag={FaChevronRight} /> : null}
{(hasChildren && !action.disabled) ? <Elem name='icon' tag={FaChevronRight} /> : null}
</Elem>
</Block>
);
Expand All @@ -104,7 +105,7 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
align="top-right-outside"
toggle={false}
ref={submenuRef}
content={<Block name='actionButton-submenu' tag="ul" mod={{ newUI: isNewUI }}>{action.children.map(ActionButton, parentRef)}</Block>}
content={<Block name='actionButton-submenu' tag="ul" mod={{ newUI: isNewUI }}>{(!action.disabled) && action.children.map(ActionButton, parentRef)}</Block>}
>
{titleContainer}
</Dropdown.Trigger>
Expand All @@ -125,8 +126,9 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
key={action.id}
danger={isDeleteAction}
onClick={onClick}
className={`actionButton${action.isSeparator ? "_isSeparator" : (action.isTitle ? "_isTitle" : "")}`}
className={`actionButton${action.isSeparator ? "_isSeparator" : (action.isTitle ? "_isTitle" : "")} ${(action.disabled) ? "actionButton_disabled" : ""}`}
icon={isDeleteAction && <FaTrash />}
title={action.disabled ? action.disabledReason : null}
>
{action.title}
</Menu.Item>
Expand Down
8 changes: 8 additions & 0 deletions src/components/DataManager/Toolbar/ActionsButton.styl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
background-color rgba(0,0,0,0.04)
&_danger
color #d00
&_disabled
background-color rgba(0,0,0,0.04)
color rgba(0,0,0,0.25)
cursor initial
&:hover
background-color rgba(0,0,0,0.04) !important
color rgba(0,0,0,0.25) !important
cursor initial

.actionButtonPrime
gap 8px
Expand Down
2 changes: 2 additions & 0 deletions src/stores/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export const Action = types.model("Action", {
isSeparator: types.optional(types.boolean, false),
isTitle: types.optional(types.boolean, false),
newStyle: types.optional(types.boolean, false),
disabled: types.optional(types.boolean, false),
disabledReason: types.optional(types.string, ""),
} : {}),
}).volatile(() => ({
caller: null,
Expand Down

0 comments on commit 2c16b02

Please sign in to comment.