Skip to content

Commit

Permalink
Merge pull request #1155 from PrefectHQ/projects
Browse files Browse the repository at this point in the history
Bugfix:  Go to Project button on dashboard
  • Loading branch information
zhen0 authored Dec 30, 2021
2 parents 1520a64 + de1f51d commit 2180801
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
21 changes: 14 additions & 7 deletions src/pages/Dashboard/NewProject-Dialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
import { clearCache } from '@/vue-apollo'
export default {
props: {
Expand Down Expand Up @@ -43,6 +44,7 @@ export default {
}
},
methods: {
...mapActions('data', ['activateProject']),
async createProject() {
this.projectLoading = true
try {
Expand Down Expand Up @@ -79,18 +81,23 @@ export default {
throw Error
}
},
goToProject() {
async goToProject() {
clearCache()
await this.activateProject(this.projectId)
this.$emit('project-select', this.projectId)
this.$router
.push({
name: 'project',
params: {
id: this.projectId,
tenant: this.tenant.slug
}
params: { ...this.$route.params, id: this.projectId },
query: { ...this.$route.query }
})
.catch(e => e)
this.reset()
},
close() {
this.$emit('close')
this.reset()
},
reset() {
this.$emit('update:show', false)
this.projectName = ''
Expand Down Expand Up @@ -180,7 +187,7 @@ export default {
id="close"
text
data-cy="project-select-cancel"
@click="reset"
@click="close"
>Cancel</v-btn
>
</v-card-actions>
Expand Down
20 changes: 13 additions & 7 deletions src/pages/Dashboard/Project-Selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ export default {
.catch(e => e)
if (!val) this.projectSelect = { name: 'All Projects', id: null }
},
newProjectDialog(val) {
if (!val) {
this.projectSelect =
this.$route.params.id === '' ? null : this.$route.params.id
}
},
'$route.params.id'(val) {
if (!val && this.projectId !== null) {
this.projectSelect = null
Expand All @@ -85,6 +79,14 @@ export default {
}
},
methods: {
handleProjectSelect(event) {
this.projectId = event
this.projectSelect = event
this.$emit('project-select', event)
},
handleClose() {
this.projectSelect = null
},
projectSelectTitleClass(item) {
return {
'new-project': item.id == 'new_project',
Expand Down Expand Up @@ -132,7 +134,11 @@ export default {
</template>
</v-autocomplete>

<NewProjectDialog :show.sync="newProjectDialog" />
<NewProjectDialog
@project-select="handleProjectSelect"
@close="handleClose"
:show.sync="newProjectDialog"
/>
</div>
</template>

Expand Down

0 comments on commit 2180801

Please sign in to comment.