Skip to content

Commit

Permalink
fix: tags not pulling in ffm
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronm-2112 committed Jan 19, 2024
1 parent cadabc0 commit ecfb79a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions src/renderer/src/scripts/collections/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $(document).ready(function () {
}

//check if old collections tags are still there
for (var [key, value] of Object.entries(currentTags)) {
for (var [key, value] of Object.entries(window.currentTags)) {
if (key.includes(",")) {
//key was modified so compare with original-name
if (!newCollectionTags.includes(value["original-name"])) {
Expand All @@ -70,24 +70,24 @@ $(document).ready(function () {
if (newCollectionTags[i].includes(",")) {
//need to compare with original name
let comparison = newCollectionTags[i].replace(/,/g, ",");
if (comparison in allCollectionTags) {
if (comparison in window.allCollectionTags) {
//modified comma name in whitelist
//check if in old tags
if (!(comparison in currentTags)) {
//modified comma name not in currentTags and is in allcollectiontags
whiteListTags.push(allCollectionTags[comparison]["id"]);
if (!(comparison in window.currentTags)) {
//modified comma name not in window.currentTags and is in window.allCollectionTags
whiteListTags.push(window.allCollectionTags[comparison]["id"]);
} //else is in whitelist but in current tags so do nothing
} else {
//not in the whitelist so either new or removed
newTags.push(newCollectionTags[i]);
}
} else {
//tag element does not have commas so just compare
if (newCollectionTags[i] in allCollectionTags) {
if (newCollectionTags[i] in window.allCollectionTags) {
//tag is in whitelist but check if already added to dataset
if (!(newCollectionTags[i] in currentTags)) {
if (!(newCollectionTags[i] in window.currentTags)) {
//not in removed ts and so tag is new
whiteListTags.push(allCollectionTags[newCollectionTags[i]]["id"]);
whiteListTags.push(window.allCollectionTags[newCollectionTags[i]]["id"]);
}
} else {
//not in whitelist so either new or removed tag
Expand Down Expand Up @@ -254,7 +254,7 @@ $(document).ready(function () {

//put the gathered collection names to the tagify whitelist
collectionDatasetTags.settings.whitelist = collectionNames;
currentCollectionTags = currentCollectionNames;
window.currentCollectionTags = currentCollectionNames;
collectionDatasetTags.removeAllTags();
collectionDatasetTags.addTags(currentCollectionNames);

Expand Down
16 changes: 8 additions & 8 deletions src/renderer/src/scripts/others/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const submitDatasetForPublication = async (
};

const getCurrentCollectionTags = async (account, dataset) => {
currentTags = {};
window.currentTags = {};
try {
let result = await client.get(`/datasets/${dataset}/collections`, {
params: {
Expand All @@ -274,20 +274,20 @@ const getCurrentCollectionTags = async (account, dataset) => {
let id = res[i]["id"];
if (name.includes(",")) {
let replaced_name = name.replace(/,/g, ",");
currentTags[replaced_name] = { id: id, "original-name": name };
window.currentTags[replaced_name] = { id: id, "original-name": name };
} else {
currentTags[name] = { id: id };
window.currentTags[name] = { id: id };
}
}
return currentTags;
return window.currentTags;
} catch (error) {
clientError(error);
}
};

//Function used to get all collections that belong to the Org
const getAllCollectionTags = async (account) => {
allCollectionTags = {};
window.allCollectionTags = {};
try {
result = await client.get(`/collections/`, {
params: { selected_account: account },
Expand All @@ -298,15 +298,15 @@ const getAllCollectionTags = async (account) => {
let id = res[i]["id"];
if (name.includes(",")) {
let replaced_name = res[i]["name"].replace(/,/g, ",");
allCollectionTags[replaced_name] = {
window.allCollectionTags[replaced_name] = {
id: id,
"original-name": name,
};
} else {
allCollectionTags[name] = { id: id };
window.allCollectionTags[name] = { id: id };
}
}
return allCollectionTags;
return window.allCollectionTags;
} catch (error) {
clientError(error);
}
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/scripts/others/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1474,9 +1474,9 @@ window.guidedManifestFilePath = window.path.join(
"guided_manifest_files"
);
// let protocolConfigPath = window.path.join(metadataPath, protocolConfigFileName);
// let allCollectionTags = {};
// let currentTags = {};
// let currentCollectionTags = [];
window.allCollectionTags = {};
window.currentTags = {};
window.currentCollectionTags = [];

// if (process.platform === "linux") {
// //check if data exists inside of the Soda folder, and if it does, move it into the capitalized SODA folder
Expand Down

0 comments on commit ecfb79a

Please sign in to comment.