Skip to content

Commit

Permalink
NCL-7216 Render 'Add selected' and 'Remove selected' buttons only whe…
Browse files Browse the repository at this point in the history
…n data are available
  • Loading branch information
patrikk0123 committed Oct 4, 2023
1 parent 6f617e9 commit 1fe6be8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,29 @@ export const BuildConfigsAddList = ({
</ToolbarItem>
</Toolbar>

<Toolbar disablePaddingTop>
<ToolbarItem>
<Button
variant="tertiary"
onClick={() => {
checkedItems.forEach((checkedItem) => {
onBuildConfigAdd(checkedItem);
toggleItemCheck(checkedItem, false);
});
}}
isDisabled={!checkedItems.length}
>
Add selected
</Button>
</ToolbarItem>
{!!checkedItems.length && (
{!!serviceContainerBuildConfigs.data?.content?.length && (
<Toolbar disablePaddingTop>
<ToolbarItem>
<b>{checkedItems.length}</b> to be added
<Button
variant="tertiary"
onClick={() => {
checkedItems.forEach((checkedItem) => {
onBuildConfigAdd(checkedItem);
toggleItemCheck(checkedItem, false);
});
}}
isDisabled={!checkedItems.length}
>
Add selected
</Button>
</ToolbarItem>
)}
</Toolbar>
{!!checkedItems.length && (
<ToolbarItem>
<b>{checkedItems.length}</b> to be added
</ToolbarItem>
)}
</Toolbar>
)}

<ContentBox borderTop>
<ServiceContainerLoading {...serviceContainerBuildConfigs} title={PageTitles.buildConfigs}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,29 @@ export const BuildConfigsRemoveList = ({
</ToolbarItem>
</Toolbar>

<Toolbar disablePaddingTop>
<ToolbarItem>
<Button
variant="tertiary"
onClick={() => {
checkedItems.forEach((checkedItem) => {
onBuildConfigRemove(checkedItem);
toggleItemCheck(checkedItem, false);
});
}}
isDisabled={!checkedItems.length}
>
Remove selected
</Button>
</ToolbarItem>
{!!checkedItems.length && (
{!!serviceContainerBuildConfigs.data?.content?.length && (
<Toolbar disablePaddingTop>
<ToolbarItem>
<b>{checkedItems.length}</b> to be removed
<Button
variant="tertiary"
onClick={() => {
checkedItems.forEach((checkedItem) => {
onBuildConfigRemove(checkedItem);
toggleItemCheck(checkedItem, false);
});
}}
isDisabled={!checkedItems.length}
>
Remove selected
</Button>
</ToolbarItem>
)}
</Toolbar>
{!!checkedItems.length && (
<ToolbarItem>
<b>{checkedItems.length}</b> to be removed
</ToolbarItem>
)}
</Toolbar>
)}

<ContentBox borderTop>
<ServiceContainerLoading {...serviceContainerBuildConfigs} title={PageTitles.buildConfigs}>
Expand Down

0 comments on commit 1fe6be8

Please sign in to comment.