Fix let/const usage in components.

This commit is contained in:
Dannon Baker
2019-04-30 16:45:24 -04:00
parent d13e4bd902
commit 852773ed27
17 changed files with 84 additions and 84 deletions
@@ -99,7 +99,7 @@ export default {
},
/** Add highlighting for record variations, i.e. datasets vs. libraries/collections **/
formatRows() {
for (let item of this.items) {
for (const item of this.items) {
let _rowVariant = "active";
if (item.isDataset) {
_rowVariant = this.model.exists(item.id) ? "success" : "default";
@@ -121,7 +121,7 @@ export default {
},
/** Called when selection is complete, values are formatted and parsed to external callback **/
finalize: function() {
let results = this.model.finalize();
const results = this.model.finalize();
this.modalShow = false;
this.callback(results);
},
@@ -56,13 +56,13 @@ export default {
});
},
_updateHistoryData: function(response) {
let historyItems = response.data;
const historyItems = response.data;
this.historyTemplate = historyItems.template;
this.historyJSON = historyItems.history_json;
},
makeHistoryView: function(historyDict) {
window.hdas = historyDict.map(hda => {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
return new HDAListItemEdit.HDAListItemEdit({
model: new HDAModel.HistoryDatasetAssociation(hda),
el: $("#hda-" + hda.id),
@@ -74,7 +74,7 @@ export default {
// toggle the body section of each item in the structure
$(function() {
$(".workflow, .tool").each((index, element) => {
let body = $(element).children(".body");
const body = $(element).children(".body");
$(element)
.children(".header")
.click(e => {
@@ -36,7 +36,7 @@ export default {
if (!this.sourceFile && !this.sourceURL) {
this.errorMessage = "You must provide a history archive URL or file.";
} else {
let formData = new FormData();
const formData = new FormData();
formData.append("archive_file", this.sourceFile);
formData.append("archive_source", this.sourceURL);
axios
@@ -47,7 +47,7 @@ export default {
}&status=success`;
})
.catch(error => {
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.errorMessage = message || "Import failed for an unknown reason.";
});
}
@@ -59,7 +59,7 @@ export default {
};
},
created: function() {
let url = getAppRoot() + "history/view/" + this.id;
const url = getAppRoot() + "history/view/" + this.id;
this.ajaxCall(url, this.updateHistoryView);
},
methods: {
@@ -86,7 +86,7 @@ export default {
},
makeHistoryView: function(history) {
$(function() {
let options = {
const options = {
hasMasthead: history.use_panels ? "true" : "false",
userIsOwner: history.user_is_owner ? "true" : "false",
isCurrent: history.history_is_current ? "true" : "false",
@@ -104,14 +104,14 @@ export default {
});
},
showStructure: function() {
let Galaxy = getGalaxyInstance();
let displayStructureInstance = Vue.extend(DisplayStructure),
const Galaxy = getGalaxyInstance();
const displayStructureInstance = Vue.extend(DisplayStructure),
mountView = document.createElement("div");
Galaxy.page.center.display(mountView);
new displayStructureInstance({ propsData: { id: QueryStringParsing.get("id") } }).$mount(mountView);
},
switchHistory: function() {
let url = getAppRoot() + "history/switch_to_history?hist_id=" + this.historyHistory["id"];
const url = getAppRoot() + "history/switch_to_history?hist_id=" + this.historyHistory["id"];
this.ajaxCall(url, this.reloadPage);
},
reloadPage: function() {
@@ -22,7 +22,7 @@ export default {
return;
}
let galaxy = getGalaxyInstance();
const galaxy = getGalaxyInstance();
// old backbone view
if (!galaxy.masthead) {
@@ -30,7 +30,7 @@ export default {
}
// bolt the rendered DOM onto the vue component's element
let backboneDom = galaxy.masthead.render();
const backboneDom = galaxy.masthead.render();
this.$el.appendChild(backboneDom.$el[0]);
}
}
@@ -14,7 +14,7 @@ export default {
return this.tag.startsWith("name:") ? this.tag.replace("name:", "") : this.tag;
},
tagStyles() {
let { primary, contrasting, darker } = keyedColorScheme(this.tag);
const { primary, contrasting, darker } = keyedColorScheme(this.tag);
return {
"background-color": primary,
color: contrasting,
@@ -73,9 +73,9 @@ export default {
};
},
created() {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
let url = `${getAppRoot()}api/plugins`;
let dataset_id = Galaxy.params.dataset_id;
const dataset_id = Galaxy.params.dataset_id;
if (dataset_id) {
this.fixed = true;
this.selected = dataset_id;
@@ -95,8 +95,8 @@ export default {
if (this.fixed) {
this.create(plugin);
} else {
let Galaxy = getGalaxyInstance();
let history_id = Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model.id;
const Galaxy = getGalaxyInstance();
const history_id = Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model.id;
if (history_id) {
axios
.get(`${getAppRoot()}api/plugins/${plugin.name}?history_id=${history_id}`)
@@ -116,7 +116,7 @@ export default {
}
},
create: function(plugin) {
let href = `${plugin.href}?dataset_id=${this.selected}`;
const href = `${plugin.href}?dataset_id=${this.selected}`;
if (plugin.target == "_top") {
window.location.href = href;
} else {
@@ -131,7 +131,7 @@ export default {
);
},
_errorMessage: function(e) {
let message = e && e.response && e.response.data && e.response.data.err_msg;
const message = e && e.response && e.response.data && e.response.data.err_msg;
return message || "Request failed for an unknown reason.";
}
}
@@ -670,7 +670,7 @@ const ColumnSelector = {
return colHeaders;
}
const remaining = {};
for (let key in colHeaders) {
for (const key in colHeaders) {
if (this.target.indexOf(parseInt(key)) === -1) {
remaining[key] = colHeaders[key];
}
@@ -685,7 +685,7 @@ const ColumnSelector = {
handleInput(value) {
if (this.multiple) {
// https://stackoverflow.com/questions/262427/why-does-parseint-yield-nan-with-arraymap
let val = value.map(idx => parseInt(idx));
const val = value.map(idx => parseInt(idx));
this.$emit("update:target", val);
} else {
let val = parseInt(value);
@@ -951,7 +951,7 @@ export default {
if (this.initialElements !== null) {
const collectionType = this.initialElements.collection_type;
const collectionTypeRanks = collectionType.split(":");
for (let index in collectionTypeRanks) {
for (const index in collectionTypeRanks) {
rules.push({
type: "add_column_metadata",
value: "identifier" + index
@@ -1187,7 +1187,7 @@ export default {
},
mappedTargets() {
const targets = [];
for (let mapping of this.mapping) {
for (const mapping of this.mapping) {
targets.push(mapping.type);
}
return targets;
@@ -1195,7 +1195,7 @@ export default {
unmappedTargets() {
const targets = [];
const mappedTargets = this.mappedTargets;
for (let target in MAPPING_TARGETS) {
for (const target in MAPPING_TARGETS) {
const targetModes = MAPPING_TARGETS[target].modes;
if (targetModes && targetModes.indexOf(this.elementsType) < 0) {
@@ -1217,16 +1217,16 @@ export default {
return targets;
},
colHeaders() {
let { data, columns } = this.hotData;
const { data, columns } = this.hotData;
return RuleDefs.colHeadersFor(data, columns);
},
colHeadersDisplay() {
const formattedHeaders = [];
for (let colIndex in this.colHeaders) {
for (const colIndex in this.colHeaders) {
const colHeader = this.colHeaders[colIndex];
formattedHeaders[colIndex] = `<b>${_.escape(colHeader)}</b>`;
const mappingDisplay = [];
for (let mapping of this.mapping) {
for (const mapping of this.mapping) {
if (mapping.columns.indexOf(parseInt(colIndex)) !== -1) {
const mappingDef = MAPPING_TARGETS[mapping.type];
mappingDisplay.push(`<i>${_.escape(mappingDef.columnHeader || mappingDef.label)}</i>`);
@@ -1245,7 +1245,7 @@ export default {
},
mappingAsDict() {
const asDict = {};
for (let mapping of this.mapping) {
for (const mapping of this.mapping) {
asDict[mapping.type] = mapping;
}
return asDict;
@@ -1261,7 +1261,7 @@ export default {
collectionType = "list:list:list:paired";
}
const collectionTypeRanks = collectionType.split(":");
for (let index in collectionTypeRanks) {
for (const index in collectionTypeRanks) {
const collectionTypeRank = collectionTypeRanks[index];
if (collectionTypeRank == "list") {
// TODO: drop the numeral at the end if only flat list
@@ -1487,7 +1487,7 @@ export default {
this.mapping.splice(index, 1);
},
refreshAndWait(response) {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
if (Galaxy && Galaxy.currHistoryPanel) {
Galaxy.currHistoryPanel.refreshContents();
}
@@ -1506,7 +1506,7 @@ export default {
"Unknown error encountered while running your upload job, this could be a server issue or a problem with the upload definition.";
this.doFullJobCheck(jobId);
} else {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
const history = Galaxy && Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model;
history.refresh();
this.oncreate();
@@ -1592,13 +1592,13 @@ export default {
this.oncreate();
}
} else {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
const historyId = Galaxy.currHistoryPanel.model.id;
let elements, targets;
if (collectionType) {
targets = [];
const elementsByCollectionName = this.creationElementsForFetch();
for (let collectionName in elementsByCollectionName) {
for (const collectionName in elementsByCollectionName) {
const target = {
destination: { type: "hdca" },
elements: elementsByCollectionName[collectionName],
@@ -1656,11 +1656,11 @@ export default {
const collectionType = this.collectionType;
const elementsByName = {};
let dataByCollection = {};
const dataByCollection = {};
const collectionNameMap = this.mappingAsDict.collection_name;
if (collectionNameMap) {
const collectionNameTarget = collectionNameMap.columns[0];
for (let dataIndex in data) {
for (const dataIndex in data) {
const row = data[dataIndex];
const name = row[collectionNameTarget];
if (!dataByCollection[name]) {
@@ -1673,11 +1673,11 @@ export default {
dataByCollection[this.collectionName] = data;
}
for (let collectionName in dataByCollection) {
for (const collectionName in dataByCollection) {
const elements = [];
const identifiers = [];
for (let dataIndex in dataByCollection[collectionName]) {
for (const dataIndex in dataByCollection[collectionName]) {
const rowData = data[dataIndex];
// For each row, find place in depth for this element.
@@ -1724,7 +1724,7 @@ export default {
.slice(1)
.join(":");
let found = false;
for (let element of elementsAtDepth) {
for (const element of elementsAtDepth) {
if (element["name"] == identifier) {
elementsAtDepth = element[subElementProp];
identifiersAtDepth = identifiersAtDepth[identifier];
@@ -1795,7 +1795,7 @@ export default {
const datasets = [];
for (let dataIndex in data) {
for (const dataIndex in data) {
const res = this._datasetFor(dataIndex, data, mappingAsDict);
datasets.push(res);
}
@@ -1806,7 +1806,7 @@ export default {
const parentIdentifiers = parentIdentifiers_ ? parentIdentifiers_ : [];
let data = [];
let sources = [];
for (let element of elements) {
for (const element of elements) {
const elementObject = element.object;
const identifiers = parentIdentifiers.concat([element.element_identifier]);
const collectionTypeLevelSepIndex = collectionType.indexOf(":");
@@ -1818,7 +1818,7 @@ export default {
sources.push(source);
} else {
const restCollectionType = collectionType.slice(collectionTypeLevelSepIndex + 1);
let elementObj = this.populateElementsFromCollectionDescription(
const elementObj = this.populateElementsFromCollectionDescription(
elementObject.elements,
restCollectionType,
identifiers
@@ -1919,7 +1919,7 @@ export default {
if (this.elementsType !== "collection_contents") {
let columnCount = null;
if (this.elementsType == "datasets") {
for (let element of this.initialElements) {
for (const element of this.initialElements) {
if (element.history_content_type == "dataset_collection") {
this.errorMessage =
"This component can only be used with datasets, you have specified one or more collections.";
@@ -1927,7 +1927,7 @@ export default {
}
}
} else {
for (let row of this.initialElements) {
for (const row of this.initialElements) {
if (columnCount == null) {
columnCount = row.length;
} else {
+5 -5
View File
@@ -175,8 +175,8 @@ export default {
}`;
},
item_url_parts() {
let str = this.item_url;
let index = str.lastIndexOf("/");
const str = this.item_url;
const index = str.lastIndexOf("/");
return [str.substring(0, index + 1), str.substring(index + 1)];
},
published_url() {
@@ -196,7 +196,7 @@ export default {
}
},
data() {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
return {
ready: false,
has_username: Galaxy.user.get("username"),
@@ -232,7 +232,7 @@ export default {
.catch(error => (this.err_msg = error.response.data.err_msg));
},
setUsername: function() {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
axios
.put(`${getAppRoot()}api/users/${Galaxy.user.id}/information/inputs`, {
username: this.new_username || ""
@@ -245,7 +245,7 @@ export default {
.catch(error => (this.err_msg = error.response.data.err_msg));
},
setSharing: function(action, user_id) {
let data = {
const data = {
action: action,
user_id: user_id
};
@@ -44,7 +44,7 @@ export default {
},
data() {
// initialize toggle value
let isClosed = this.useToggleLink && this.value.length > this.maxVisibleTags;
const isClosed = this.useToggleLink && this.value.length > this.maxVisibleTags;
return {
tagText: "",
@@ -92,13 +92,13 @@ export default {
},
beforeAddingTag($event) {
if (!this.emitHookEvent("before-adding-tag", $event)) {
let { tag, addTag } = $event;
const { tag, addTag } = $event;
addTag(tag);
}
},
beforeDeletingTag($event) {
if (!this.emitHookEvent("before-deleting-tag", $event)) {
let { tag, deleteTag } = $event;
const { tag, deleteTag } = $event;
deleteTag(tag);
}
},
@@ -31,7 +31,7 @@ Vue.use(BootstrapVue);
export default {
data() {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
return {
sourceFile: null,
sourceURL: null,
@@ -52,7 +52,7 @@ export default {
if (!this.sourceFile && !this.sourceURL) {
this.errorMessage = "You must provide a workflow archive URL or file.";
} else {
let formData = new FormData();
const formData = new FormData();
formData.append("archive_file", this.sourceFile);
formData.append("archive_source", this.sourceURL);
axios
@@ -63,7 +63,7 @@ export default {
}&status=success`;
})
.catch(error => {
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.errorMessage = message || "Import failed for an unknown reason.";
});
}
@@ -133,7 +133,7 @@ export default {
];
},
tableFields() {
let tableFields = this.fields.slice(0);
const tableFields = this.fields.slice(0);
if (this.showCommandLine) {
tableFields.splice(5, 0, {
key: "commandLine",
@@ -143,9 +143,9 @@ export default {
return tableFields;
},
tableItems() {
let tableItems = this.jobs.slice(0);
const tableItems = this.jobs.slice(0);
for (let item of tableItems) {
for (const item of tableItems) {
// Nicer time formatting
item["updateTime"] = item["updateTime"].replace("T", "\n");
@@ -58,15 +58,15 @@ export default {
},
computed: {
applicationsIndex: function() {
let result = {};
for (let app of this.applications) {
const result = {};
for (const app of this.applications) {
result[app.id] = app;
}
return result;
},
applicationsAll: function() {
let result = [];
for (let app of this.applications) {
const result = [];
for (const app of this.applications) {
result.push(app.id);
}
return result;
@@ -99,8 +99,8 @@ export default {
this._reload([id]);
},
reloadAll: function() {
let ids = [];
for (let app of this.applications) {
const ids = [];
for (const app of this.applications) {
ids.push(app.id);
}
this._reload(ids);
@@ -119,15 +119,15 @@ export default {
});
},
_highlightRows: function(appList, status) {
for (let appIndex of appList) {
let app = this.applicationsIndex[appIndex];
for (const appIndex of appList) {
const app = this.applicationsIndex[appIndex];
if (app) {
app._rowVariant = status;
}
}
},
_errorMessage: function(e) {
let message = e && e.response && e.response.data && e.response.data.err_msg;
const message = e && e.response && e.response.data && e.response.data.err_msg;
this.messageText = message || "Request failed for an unknown reason.";
this.messageVariant = "danger";
}
@@ -40,7 +40,7 @@ export default {
this.errorStackLoaded = true;
})
.catch(e => {
let message = e && e.response && e.response.data && e.response.data.err_msg;
const message = e && e.response && e.response.data && e.response.data.err_msg;
this.messageText = message || "Request failed for an unknown reason.";
});
}
@@ -60,10 +60,10 @@ export default {
}
},
data() {
let galaxy = getGalaxyInstance();
let oidc_idps = galaxy.config.oidc;
const galaxy = getGalaxyInstance();
const oidc_idps = galaxy.config.oidc;
// Icons to use for each IdP
let oidc_idps_icons = { google: "fa fa-google" };
const oidc_idps_icons = { google: "fa fa-google" };
// Add default icons to IdPs without icons
oidc_idps
.filter(function(key) {
@@ -99,7 +99,7 @@ export default {
}
},
submitGalaxyLogin: function(method) {
let rootUrl = getAppRoot();
const rootUrl = getAppRoot();
axios
.post(`${rootUrl}user/login`, this.$data)
.then(response => {
@@ -116,12 +116,12 @@ export default {
})
.catch(error => {
this.messageVariant = "danger";
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.messageText = message || "Login failed for an unknown reason.";
});
},
submitOIDCLogin: function(idp) {
let rootUrl = getAppRoot();
const rootUrl = getAppRoot();
axios
.post(`${rootUrl}authnz/${idp}/login`)
.then(response => {
@@ -132,12 +132,12 @@ export default {
})
.catch(error => {
this.messageVariant = "danger";
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.messageText = message || "Login failed for an unknown reason.";
});
},
reset: function(ev) {
let rootUrl = getAppRoot();
const rootUrl = getAppRoot();
ev.preventDefault();
axios
.post(`${rootUrl}user/reset_password`, { email: this.login })
@@ -147,7 +147,7 @@ export default {
})
.catch(error => {
this.messageVariant = "danger";
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.messageText = message || "Password reset failed for an unknown reason.";
});
}
@@ -22,7 +22,7 @@ Vue.use(BootstrapVue);
export default {
data() {
let Galaxy = getGalaxyInstance();
const Galaxy = getGalaxyInstance();
return {
token: Galaxy.params.token,
user: Galaxy.params.expired_user,
@@ -40,7 +40,7 @@ export default {
},
methods: {
submit: function(ev) {
let urlRoot = getAppRoot();
const urlRoot = getAppRoot();
ev.preventDefault();
axios
.post(`${urlRoot}user/change_password`, {
@@ -55,7 +55,7 @@ export default {
})
.catch(error => {
this.messageVariant = "danger";
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.messageText = message || "Password change failed for an unknown reason.";
});
}
@@ -71,7 +71,7 @@ export default {
}
},
data() {
let galaxy = getGalaxyInstance();
const galaxy = getGalaxyInstance();
return {
email: null,
password: null,
@@ -95,7 +95,7 @@ export default {
}
},
submit: function(method) {
let rootUrl = getAppRoot();
const rootUrl = getAppRoot();
axios
.post(`${rootUrl}user/create`, this.$data)
.then(response => {
@@ -106,7 +106,7 @@ export default {
})
.catch(error => {
this.messageVariant = "danger";
let message = error.response.data && error.response.data.err_msg;
const message = error.response.data && error.response.data.err_msg;
this.messageText = message || "Registration failed for an unknown reason.";
});
}