Skip to content

Commit d0f5ed0

Browse files
authored
Merge pull request #355 from fairdataihub/fix-compare-local-and-remote-btn
fix : comparison btn appearing when no local dataset selected
2 parents a1d332d + 13b1922 commit d0f5ed0

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) <year> <copyright holders>
3+
Copyright (c) 2024 FAIR Data Innovations Hub
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

src/renderer/src/components/renderers/ReactComponentRenderer.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const componentTypeRenderers = {
3535
},
3636
"external-link": (componentSlot) => {
3737
const props = {
38-
url: componentSlot.getAttribute("data-url"),
38+
href: componentSlot.getAttribute("data-href"),
3939
buttonText: componentSlot.getAttribute("data-button-text"),
4040
buttonType: componentSlot.getAttribute("data-button-type"),
4141
};

src/renderer/src/scripts/advanced-features/compare-local-remote-dataset.js

+17-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,28 @@ document
3131
let nextQuestion = document.querySelector("#compare-local-remote-confirm-local-dataset-btn")
3232
.dataset.next;
3333
document.querySelector(`#${nextQuestion}`).style.display = "flex";
34+
35+
// if a Pennsieve dataset has already been selected then show question 3 as well
36+
if ($("#bf_dataset_load_compare_local_remote").text().trim() !== "None") {
37+
showQuestion3();
38+
}
3439
});
3540

41+
const showQuestion3 = () => {
42+
let nextQuestion = document.querySelector("#compare-local-remote-dataset-question-3");
43+
nextQuestion.style.display = "flex";
44+
nextQuestion.scrollIntoView({ behavior: "smooth", block: "start" });
45+
document.querySelector("#comparison-results-container").style.display = "none";
46+
};
47+
3648
// observer for the selected dataset label in the dataset selection card in question 2
3749
const datasetChangedObserver = new MutationObserver(() => {
3850
// once a dataset has been selected show the run validator button if the current question is active
39-
if ($("#bf_dataset_load_compare_local_remote").text().trim() !== "None") {
40-
let nextQuestion = document.querySelector("#compare-local-remote-dataset-question-3");
41-
nextQuestion.style.display = "flex";
42-
nextQuestion.scrollIntoView({ behavior: "smooth", block: "start" });
43-
document.querySelector("#comparison-results-container").style.display = "none";
51+
if (
52+
$("#bf_dataset_load_compare_local_remote").text().trim() !== "None" &&
53+
$("#compare-local-remote-dataset-local-path").val() !== ""
54+
) {
55+
showQuestion3();
4456
} else {
4557
$("#compare-local-remote-dataset-question-3").css("display", "none");
4658
}

src/renderer/src/sections/advanced-features/advanced_features.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ <h2>Compare Local and Pennsieve Dataset</h2>
15501550
>
15511551
<p class="about-text">
15521552
This tool compare your local dataset with a dataset you have uploaded on to
1553-
Pennsieve and show you the differences between the two datasets that exist, if
1553+
Pennsieve and shows you the differences between the two datasets that exist, if
15541554
any.
15551555
</p>
15561556
</div>

src/renderer/src/sections/documentation/documentation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h2 class="document_text">
2424
>
2525
<div
2626
data-component-type="external-link"
27-
data-url="https://docs.sodaforsparc.io/docs/getting-started/organize-and-submit-sparc-datasets-with-soda"
27+
data-href="https://docs.sodaforsparc.io/docs/getting-started/organize-and-submit-sparc-datasets-with-soda"
2828
data-button-text="View Documentation"
2929
data-button-type="button"
3030
></div>

0 commit comments

Comments
 (0)