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

Commit 2c16b02

Browse files
fix: DIA-736: [FE] disable add to project actions when dataset sync is not complete
1 parent e02f9f5 commit 2c16b02

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/components/DataManager/Toolbar/ActionsButton.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
8888
isSeparator: action.isSeparator,
8989
isTitle: action.isTitle,
9090
danger: isDeleteAction,
91+
disabled: action.disabled,
9192
}}
9293
name='actionButton'
9394
>
94-
<Elem name='titleContainer'>
95+
<Elem name='titleContainer' {...(action.disabled ? { title: action.disabledReason } : {})}>
9596
<Elem name='title'>{action.title}</Elem>
96-
{hasChildren ? <Elem name='icon' tag={FaChevronRight} /> : null}
97+
{(hasChildren && !action.disabled) ? <Elem name='icon' tag={FaChevronRight} /> : null}
9798
</Elem>
9899
</Block>
99100
);
@@ -104,7 +105,7 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
104105
align="top-right-outside"
105106
toggle={false}
106107
ref={submenuRef}
107-
content={<Block name='actionButton-submenu' tag="ul" mod={{ newUI: isNewUI }}>{action.children.map(ActionButton, parentRef)}</Block>}
108+
content={<Block name='actionButton-submenu' tag="ul" mod={{ newUI: isNewUI }}>{(!action.disabled) && action.children.map(ActionButton, parentRef)}</Block>}
108109
>
109110
{titleContainer}
110111
</Dropdown.Trigger>
@@ -125,8 +126,9 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r
125126
key={action.id}
126127
danger={isDeleteAction}
127128
onClick={onClick}
128-
className={`actionButton${action.isSeparator ? "_isSeparator" : (action.isTitle ? "_isTitle" : "")}`}
129+
className={`actionButton${action.isSeparator ? "_isSeparator" : (action.isTitle ? "_isTitle" : "")} ${(action.disabled) ? "actionButton_disabled" : ""}`}
129130
icon={isDeleteAction && <FaTrash />}
131+
title={action.disabled ? action.disabledReason : null}
130132
>
131133
{action.title}
132134
</Menu.Item>

src/components/DataManager/Toolbar/ActionsButton.styl

+8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
background-color rgba(0,0,0,0.04)
5151
&_danger
5252
color #d00
53+
&_disabled
54+
background-color rgba(0,0,0,0.04)
55+
color rgba(0,0,0,0.25)
56+
cursor initial
57+
&:hover
58+
background-color rgba(0,0,0,0.04) !important
59+
color rgba(0,0,0,0.25) !important
60+
cursor initial
5361

5462
.actionButtonPrime
5563
gap 8px

src/stores/Action.js

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export const Action = types.model("Action", {
5959
isSeparator: types.optional(types.boolean, false),
6060
isTitle: types.optional(types.boolean, false),
6161
newStyle: types.optional(types.boolean, false),
62+
disabled: types.optional(types.boolean, false),
63+
disabledReason: types.optional(types.string, ""),
6264
} : {}),
6365
}).volatile(() => ({
6466
caller: null,

0 commit comments

Comments
 (0)