[arvados-workbench2] updated: 2.6.0-39-g8671a18c
git repository hosting
git at public.arvados.org
Fri May 19 19:48:59 UTC 2023
Summary of changes:
.../multiselectToolbar/MultiselectToolbar.tsx | 28 ++++++----------------
1 file changed, 7 insertions(+), 21 deletions(-)
via 8671a18c6f71d9c57fa10d650c476cace51e70db (commit)
from 8360ba81b48f6883b453f13756432a3d599c3042 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 8671a18c6f71d9c57fa10d650c476cace51e70db
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri May 19 15:48:50 2023 -0400
fixed suboptimal button filtering algo Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index bd01b361..2409bc9c 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -43,29 +43,29 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
type MultiselectToolbarAction = {
name: string;
action: string;
- relevantKinds: Array<ResourceKind>;
+ relevantKinds: Set<ResourceKind>;
};
export const defaultActions: Array<MultiselectToolbarAction> = [
{
name: 'copy',
action: 'copySelected',
- relevantKinds: [ResourceKind.COLLECTION],
+ relevantKinds: new Set([ResourceKind.COLLECTION]),
},
{
name: 'move',
action: 'moveSelected',
- relevantKinds: [ResourceKind.COLLECTION, ResourceKind.PROCESS],
+ relevantKinds: new Set([ResourceKind.COLLECTION, ResourceKind.PROCESS]),
},
{
name: 'remove',
action: 'removeSelected',
- relevantKinds: [ResourceKind.COLLECTION, ResourceKind.PROCESS, ResourceKind.PROJECT],
+ relevantKinds: new Set([ResourceKind.COLLECTION, ResourceKind.PROCESS, ResourceKind.PROJECT]),
},
{
name: 'foo',
action: 'barSelected',
- relevantKinds: [ResourceKind.COLLECTION, ResourceKind.PROJECT],
+ relevantKinds: new Set([ResourceKind.COLLECTION, ResourceKind.PROJECT]),
},
];
@@ -86,12 +86,8 @@ export const MultiselectToolbar = connect(
withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
// console.log(props);
const { classes, actions, isVisible, checkedList } = props;
-
- const currentResourceKinds = selectedToArray(checkedList).map((element) => extractUuidKind(element));
-
- const buttons = actions.filter(
- (action) => currentResourceKinds.length && currentResourceKinds.every((kind) => action.relevantKinds.includes(kind as ResourceKind))
- );
+ const currentResourceKinds = Array.from(new Set(selectedToArray(checkedList).map((element) => extractUuidKind(element))));
+ const buttons = actions.filter((action) => currentResourceKinds.length && currentResourceKinds.every((kind) => action.relevantKinds.has(kind as ResourceKind)));
return (
<Toolbar className={isVisible && buttons.length ? `${classes.root} ${classes.expanded}` : classes.root} style={{ width: `${buttons.length * 5.5}rem` }}>
@@ -109,16 +105,6 @@ export const MultiselectToolbar = connect(
})
);
-function selectedToString(checkedList: TCheckedList) {
- let stringifiedSelectedList: string = '';
- for (const [key, value] of Object.entries(checkedList)) {
- if (value === true) {
- stringifiedSelectedList += key + ',';
- }
- }
- return stringifiedSelectedList.slice(0, -1);
-}
-
function selectedToArray<T>(checkedList: TCheckedList): Array<string> {
const arrayifiedSelectedList: Array<string> = [];
for (const [key, value] of Object.entries(checkedList)) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list