Skip to content

Commit ab07b43

Browse files
feat(filtering): add workflow list filters (#431)
Closes reanahub/reana-server#661
1 parent af8c32b commit ab07b43

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

reana-ui/src/pages/workflowList/WorkflowList.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ import {
2323
loadingWorkflows,
2424
userHasWorkflows,
2525
getWorkflowRefresh,
26+
getUsersSharedWithYou,
2627
} from "~/selectors";
2728
import { NON_DELETED_STATUSES } from "~/config";
28-
import { Title } from "~/components";
29-
import { Pagination, Search } from "~/components";
29+
import { Pagination, Search, Title } from "~/components";
3030
import { applyFilter } from "~/components/Search";
3131
import BasePage from "../BasePage";
3232
import Welcome from "./components/Welcome";
3333
import WorkflowFilters from "./components/WorkflowFilters";
3434
import WorkflowList from "./components/WorkflowList";
3535

3636
import styles from "./WorkflowList.module.scss";
37+
import _ from "lodash";
3738

3839
const PAGE_SIZE = 5;
3940

@@ -63,6 +64,7 @@ function Workflows() {
6364
const loading = useSelector(loadingWorkflows);
6465
const reanaToken = useSelector(getReanaToken);
6566
const configLoaded = useSelector(isConfigLoaded);
67+
const usersSharedWithYou = useSelector(getUsersSharedWithYou, _.isEqual);
6668
const interval = useRef(null);
6769
const hideWelcomePage = !workflows || !configLoaded;
6870
const { pollingSecs } = config;
@@ -75,10 +77,15 @@ function Workflows() {
7577
useEffect(() => {
7678
let shared = false;
7779
let sharedBy = null;
80+
7881
if (ownedByFilter === "anybody") {
7982
shared = true;
8083
sharedBy = null;
84+
} else if (ownedByFilter === "others") {
85+
shared = true;
86+
sharedBy = `${usersSharedWithYou.map((user) => user.email)}`;
8187
} else if (ownedByFilter !== "you") {
88+
// Owned by specific user
8289
sharedBy = ownedByFilter;
8390
}
8491

@@ -125,6 +132,7 @@ function Workflows() {
125132
sharedWithFilter,
126133
sortDir,
127134
workflowRefresh,
135+
usersSharedWithYou,
128136
]);
129137

130138
const cleanPolling = () => {

reana-ui/src/pages/workflowList/components/WorkflowSharingFilter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default function WorkflowSharingFilters({
4141
() => [
4242
{ key: "you", text: "you", value: "you" },
4343
{ key: "anybody", text: "anybody", value: "anybody" },
44+
{ key: "others", text: "others", value: "others" },
4445
...usersSharedWithYou.map((user, index) => ({
4546
key: index,
4647
text: user.email,
@@ -53,6 +54,7 @@ export default function WorkflowSharingFilters({
5354
const usersYouSharedWithOptions = useMemo(
5455
() => [
5556
{ key: "anybody", text: "anybody", value: "anybody" },
57+
{ key: "nobody", text: "nobody", value: "nobody" },
5658
...usersYouSharedWith.map((user, index) => ({
5759
key: index,
5860
text: user.email,

0 commit comments

Comments
 (0)