You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/06/24 14:53:47 UTC
[cloudstack-primate] branch master updated: autogenview: switch
project if a valid UUID projectid query is passed
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new 295bdaf autogenview: switch project if a valid UUID projectid query is passed
295bdaf is described below
commit 295bdafc51add3a4fc5acb613dd7a71c0c1f7607
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Jun 24 20:22:52 2020 +0530
autogenview: switch project if a valid UUID projectid query is passed
Fixes #450
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
src/views/AutogenView.vue | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue
index 9b6f73d..3afcb88 100644
--- a/src/views/AutogenView.vue
+++ b/src/views/AutogenView.vue
@@ -366,6 +366,9 @@ export default {
mounted () {
this.currentPath = this.$route.fullPath
this.fetchData()
+ if ('projectid' in this.$route.query) {
+ this.switchProject(this.$route.query.projectid)
+ }
},
beforeRouteUpdate (to, from, next) {
this.currentPath = this.$route.fullPath
@@ -383,6 +386,9 @@ export default {
this.itemCount = 0
this.selectedFilter = ''
this.fetchData()
+ if ('projectid' in to.query) {
+ this.switchProject(to.query.projectid)
+ }
}
},
'$i18n.locale' (to, from) {
@@ -395,6 +401,21 @@ export default {
}
},
methods: {
+ switchProject (projectId) {
+ if (!projectId || !projectId.length || projectId.length !== 36) {
+ return
+ }
+ api('listProjects', { id: projectId, listall: true, details: 'min' }).then(json => {
+ if (!json || !json.listprojectsresponse || !json.listprojectsresponse.project) return
+ const project = json.listprojectsresponse.project[0]
+ this.$store.dispatch('SetProject', project)
+ this.$store.dispatch('ToggleTheme', project.id === undefined ? 'light' : 'dark')
+ this.$message.success(`Switched to "${project.name}"`)
+ const query = Object.assign({}, this.$route.query)
+ delete query.projectid
+ this.$router.replace({ query })
+ })
+ },
fetchData (params = { listall: true }) {
if (this.routeName !== this.$route.name) {
this.routeName = this.$route.name