diff --git a/frontend/javascripts/dashboard/dataset_folder_view.tsx b/frontend/javascripts/dashboard/dataset_folder_view.tsx
index 228d9a0a24b..9f46f89c4f6 100644
--- a/frontend/javascripts/dashboard/dataset_folder_view.tsx
+++ b/frontend/javascripts/dashboard/dataset_folder_view.tsx
@@ -4,11 +4,15 @@ import { APIDatasetCompact, APIUser } from "types/api_flow_types";
import DatasetCollectionContextProvider, {
useDatasetCollectionContext,
} from "./dataset/dataset_collection_context";
-
-import DatasetView from "./dataset_view";
+import { Button, Card, Col, Row } from "antd";
+import { Link } from "react-router-dom";
+import * as Utils from "libs/utils";
+import DatasetView, { DatasetAddButton, DatasetRefreshButton } from "./dataset_view";
import { DetailsSidebar } from "./folders/details_sidebar";
import { EditFolderModal } from "./folders/edit_folder_modal";
import { FolderTreeSidebar } from "./folders/folder_tree";
+import features, { getDemoDatasetUrl } from "features";
+import { RenderToPortal } from "oxalis/view/layouting/portal_utils";
type Props = {
user: APIUser;
@@ -70,6 +74,91 @@ function DatasetFolderViewInner(props: Props) {
);
}, [context.datasets]);
+ const renderNoDatasetsPlaceHolder = () => {
+ const openPublicDatasetCard = (
+
+ }>
+
+ Check out a published community dataset to experience WEBKNOSSOS in action.
+
+ Open a Community Dataset
+
+ >
+ }
+ />
+
+
+ );
+
+ const uploadPlaceholderCard = (
+
+ }>
+
+
+ WEBKNOSSOS supports a variety of (remote){" "}
+
+ file formats
+ {" "}
+ and is also able to convert them when necessary.
+
+
+
+ Open Dataset Upload & Import
+
+
+ ,
+ >
+ }
+ />
+
+
+ );
+
+ const adminHeader =
+ Utils.isUserAdminOrDatasetManager(props.user) || Utils.isUserTeamManager(props.user) ? (
+
+
+
+
+ ) : null;
+
+ return (
+
+ {adminHeader} ;
+
+ {features().isWkorgInstance ? openPublicDatasetCard : null}
+ {Utils.isUserAdminOrDatasetManager(props.user) ? uploadPlaceholderCard : null}
+
+
+ );
+ };
+
+ if (context.datasets.length === 0) {
+ return renderNoDatasetsPlaceHolder();
+ }
+
return (
setJobs(newJobs));
}
}, []);
+
useEffect(() => {
let interval: ReturnType
| null = null;
@@ -126,6 +125,7 @@ function DatasetView(props: Props) {
return () => (interval != null ? clearInterval(interval) : undefined);
}, []);
+
useEffect(() => {
persistence.persist({
searchQuery: searchQuery || "",
@@ -164,10 +164,6 @@ function DatasetView(props: Props) {
);
}
- const margin = {
- marginRight: 5,
- };
-
const createFilteringModeRadio = (key: DatasetFilteringMode, label: string) => (
{
@@ -223,7 +219,6 @@ function DatasetView(props: Props) {
) : (
searchBox
);
- const showLoadingIndicator = context.isLoading || context.isChecking;
const adminHeader = (
{isUserAdminOrDatasetManagerOrTeamManager ? (
-
- context.fetchDatasets()}
- disabled={context.isChecking}
- >
- {showLoadingIndicator ? : } Refresh
-
-
-
-
- }>
- Add Dataset
-
-
+
+
{context.activeFolderId != null && (
}
onClick={() =>
context.activeFolderId != null &&
@@ -318,6 +288,44 @@ function DatasetView(props: Props) {
);
}
+export function DatasetRefreshButton({ context }: { context: DatasetCollectionContextValue }) {
+ const showLoadingIndicator = context.isLoading || context.isChecking;
+
+ return (
+
+ context.fetchDatasets()}
+ disabled={context.isChecking}
+ >
+ {showLoadingIndicator ? : } Refresh
+
+
+ );
+}
+
+export function DatasetAddButton({ context }: { context: DatasetCollectionContextValue }) {
+ const { data: folder } = useFolderQuery(context.activeFolderId);
+
+ return (
+
+ }>
+ Add Dataset
+
+
+ );
+}
+
const SEARCH_OPTIONS = [
{ label: "Search everywhere", value: "everywhere" },
{ label: "Search current folder", value: "folder" },
@@ -485,85 +493,24 @@ function renderPlaceholder(
}
if (searchQuery) {
- return searchQuery.length >= MINIMUM_SEARCH_QUERY_LENGTH ? "No datasets found." : null;
+ return searchQuery.length >= MINIMUM_SEARCH_QUERY_LENGTH
+ ? "No datasets match your search."
+ : null;
}
- const openPublicDatasetCard = (
-
- }>
-
- Check out a published community dataset to experience WEBKNOSSOS in action.
-
- Open a Community Dataset
-
- >
- }
- />
-
-
- );
-
- const uploadPlaceholderCard = (
-
- }>
-
-
- WEBKNOSSOS supports a variety of (remote){" "}
-
- file formats
- {" "}
- and is also able to convert them when necessary.
-
-
-
- Open Dataset Upload & Import
-
-
- ,
- >
- }
- />
-
-
- );
-
const emptyListHintText = Utils.isUserAdminOrDatasetManager(user)
? "There are no datasets in this folder. Import one or move a dataset from another folder."
: "There are no datasets in this folder. Please ask an admin or dataset manager to import a dataset or to grant you permissions to add datasets to this folder.";
return (
-
-
-
- {features().isWkorgInstance ? openPublicDatasetCard : null}
- {Utils.isUserAdminOrDatasetManager(user) ? uploadPlaceholderCard : null}
-
-
- {emptyListHintText}
-
-
-
+ {emptyListHintText}
+
);
}