forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added upload utils and collection attributes to a store, other format…
…ting, test fixing
- Loading branch information
1 parent
4d58b1f
commit 6fd60f2
Showing
4 changed files
with
138 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export const state = { | ||
collectionAttributes: {}, | ||
uploadDatatypes: [], | ||
uploadGenomes: [], | ||
}; | ||
import Vue from "vue"; | ||
import { prependPath } from "utils/redirect"; | ||
import axios from "axios"; | ||
import UploadUtils from "mvc/upload/upload-utils"; | ||
|
||
const getters = { | ||
getCollectionAttributes: (state) => (collectionId) => { | ||
return state.collectionAttributes[collectionId] || null; | ||
}, | ||
getUploadDatatypes: (state) => () => { | ||
return state.uploadDatatypes; | ||
}, | ||
getUploadGenomes: (state) => () => { | ||
return state.uploadGenomes; | ||
}, | ||
}; | ||
|
||
const actions = { | ||
fetchCollectionAttributes: async ({ commit }, collectionId) => { | ||
const { data } = await axios.get(prependPath("api/dataset_collections/" + collectionId + "/attributes")); | ||
commit("saveCollectionAttributes", { collectionId, collectionAttributes: data }); | ||
}, | ||
fetchUploadDatatypes: async ({ commit }) => { | ||
await UploadUtils.getUploadDatatypes(true, UploadUtils.AUTO_EXTENSION) | ||
.then((data) => { | ||
commit("saveUploadDatatypes", { datatypes: data }); | ||
}) | ||
.catch((err) => { | ||
console.log("Error: unable to load datatypes", err); | ||
}); | ||
}, | ||
fetchUploadGenomes: async ({ commit }) => { | ||
await UploadUtils.getUploadGenomes(UploadUtils.DEFAULT_GENOME) | ||
.then((data) => { | ||
commit("saveUploadGenomes", { genomes: data }); | ||
}) | ||
.catch((err) => { | ||
console.log("Error: unable to load genomes", err); | ||
}); | ||
}, | ||
}; | ||
|
||
const mutations = { | ||
saveCollectionAttributes: (state, { collectionId, collectionAttributes }) => { | ||
Vue.set(state.collectionAttributes, collectionId, collectionAttributes); | ||
}, | ||
saveUploadDatatypes: (state, { datatypes }) => { | ||
state.uploadDatatypes = datatypes; | ||
}, | ||
saveUploadGenomes: (state, { genomes }) => { | ||
state.uploadGenomes = genomes; | ||
}, | ||
}; | ||
|
||
export const collectionStore = { | ||
state, | ||
getters, | ||
actions, | ||
mutations, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters