From 2983d677b28268038d6c709fa701df7eb5fcb256 Mon Sep 17 00:00:00 2001 From: joaquinvanschoren Date: Sat, 2 Dec 2023 23:46:33 +0100 Subject: [PATCH] Added a version history button for datasets --- .../client/app/src/pages/search/Dataset.js | 45 +++++++++++++------ .../client/app/src/pages/search/MetaItems.js | 3 ++ .../app/src/pages/search/SearchPanel.js | 35 ++++++++------- 3 files changed, 52 insertions(+), 31 deletions(-) diff --git a/server/src/client/app/src/pages/search/Dataset.js b/server/src/client/app/src/pages/search/Dataset.js index 6805411d..81f9c8ef 100644 --- a/server/src/client/app/src/pages/search/Dataset.js +++ b/server/src/client/app/src/pages/search/Dataset.js @@ -148,15 +148,31 @@ export class DatasetItem extends React.Component { - - - - - {" "} - {this.props.object.date.split(" ")[0]} -
+ + + + + + {" "} + {this.props.object.date.split(" ")[0]} + + + } + href={"search?type=data&sort=version&order=asc&exact_name=" + this.props.object.name} + component="a" + clickable + /> + + + + {" "} - - + + - + + /> +
diff --git a/server/src/client/app/src/pages/search/MetaItems.js b/server/src/client/app/src/pages/search/MetaItems.js index 8fe3abb9..1ad73286 100644 --- a/server/src/client/app/src/pages/search/MetaItems.js +++ b/server/src/client/app/src/pages/search/MetaItems.js @@ -15,6 +15,9 @@ export class MetaTag extends React.Component { case "format": icon = "table"; break; + case "version": + icon = "code-branch"; + break; case "licence": icon = "closed-captioning"; break; diff --git a/server/src/client/app/src/pages/search/SearchPanel.js b/server/src/client/app/src/pages/search/SearchPanel.js index b5ed3591..f160a153 100644 --- a/server/src/client/app/src/pages/search/SearchPanel.js +++ b/server/src/client/app/src/pages/search/SearchPanel.js @@ -72,25 +72,26 @@ export default class SearchPanel extends React.Component { getQueryParams = () => { let qstring = queryString.parse(this.props.location.search); - // Sensible defaults - if (qstring.type === "data" && qstring.status === undefined) { - qstring.status = "active"; - this.updateQuery("status", "active"); - } else if (qstring.type === "measure" && qstring.measure_type === undefined) { - qstring.measure_type = "data_quality"; - this.updateQuery("measure_type", "data_quality"); - } else if ((qstring.type === "study" || qstring.type === "benchmark") && qstring.study_type === undefined) { - qstring.study_type = "task"; - this.updateQuery("study_type", "task"); - } else if ((qstring.type === "study" || qstring.type === "benchmark") && - this.context.filters.study_type !== undefined && qstring.study_type !== this.context.filters.study_type.value) { - //study type changed, reset active tab - this.context.activeTab = 0 - } - + // Sensible defaults + if (qstring.type === "data" && qstring.status === undefined) { + qstring.status = "active"; + this.updateQuery("status", "active"); + } else if (qstring.type === "measure" && qstring.measure_type === undefined) { + qstring.measure_type = "data_quality"; + this.updateQuery("measure_type", "data_quality"); + } else if ((qstring.type === "study" || qstring.type === "benchmark") && qstring.study_type === undefined) { + qstring.study_type = "task"; + this.updateQuery("study_type", "task"); + } else if ((qstring.type === "study" || qstring.type === "benchmark") && + this.context.filters.study_type !== undefined && qstring.study_type !== this.context.filters.study_type.value) { + //study type changed, reset active tab + this.context.activeTab = 0 + } + console.log(qstring.sort); // If no sort is defined, set a sensible default - if (this.context.sort === null || this.context.sort === undefined || this.context.type !== qstring.type) { + if (qstring.sort === undefined && (this.context.sort === null || this.context.sort === undefined || this.context.type !== qstring.type)) { if (["data", "flow", "task"].includes(qstring.type)) { + console.log("I'm overwriting sort"); qstring.sort = "runs"; } else if ((qstring.type === "study" || qstring.type === "benchmark") && qstring.study_type === "task") { qstring.sort = "tasks_included";