feat(ui): Reset CWD to project path

This commit is contained in:
Guillaume Chau
2018-03-10 01:13:49 +01:00
parent 921e99f305
commit 601fb1f08f
5 changed files with 25 additions and 2 deletions

View File

@@ -107,6 +107,7 @@ import FOLDERS_FAVORITE from '../graphql/foldersFavorite.gql'
import FOLDER_OPEN from '../graphql/folderOpen.gql'
import FOLDER_OPEN_PARENT from '../graphql/folderOpenParent.gql'
import FOLDER_SET_FAVORITE from '../graphql/folderSetFavorite.gql'
import PROJECT_CWD_RESET from '../graphql/projectCwdReset.gql'
export default {
components: {
@@ -132,6 +133,10 @@ export default {
foldersFavorite: FOLDERS_FAVORITE
},
beforeDestroy () {
this.resetProjectCwd()
},
methods: {
async openFolder (path) {
this.editingPath = false
@@ -209,6 +214,12 @@ export default {
refreshFolder () {
this.openFolder(this.folderCurrent.path)
},
resetProjectCwd () {
this.$apollo.mutate({
mutation: PROJECT_CWD_RESET
})
}
}
}

View File

@@ -322,6 +322,12 @@ async function getPlugins (id, context) {
return []
}
function resetCwd (context) {
if (currentProject) {
cwd.set(currentProject.path, context)
}
}
module.exports = {
list,
getCurrent,
@@ -333,5 +339,6 @@ module.exports = {
import: importProject,
open,
remove,
getPlugins
getPlugins,
resetCwd
}

View File

@@ -52,7 +52,8 @@ module.exports = {
projectCreate: (root, { input }, context) => projects.create(input, context),
projectImport: (root, { input }, context) => projects.import(input, context),
projectOpen: (root, { id }, context) => projects.open(id, context),
projectRemove: (root, { id }, context) => projects.remove(id, context)
projectRemove: (root, { id }, context) => projects.remove(id, context),
projectCwdReset: (root, args, context) => projects.resetCwd(context)
},
Subscription: {

View File

@@ -172,6 +172,7 @@ type Mutation {
projectOpen (id: ID!): Project!
projectSetFavorite (id: ID!, favorite: Int!): Project!
projectRemove (id: ID!): Boolean!
projectCwdReset: String
presetApply (id: ID!): ProjectCreation
featureSetEnabled (id: ID!, enabled: Boolean): Feature
pluginAdd (id: ID!): Plugin

View File

@@ -0,0 +1,3 @@
mutation projectCwdReset {
projectCwdReset
}