Skip to content

Commit 9efdfaf

Browse files
author
Guillaume Chau
committed
fix(ui): project creation not reset
1 parent 8957c3a commit 9efdfaf

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
lines changed

packages/@vue/cli-ui/src/graphql-api/connectors/projects.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ function removeCreator (context) {
178178
installProgress.removeListener('log', onInstallLog)
179179
creator = null
180180
}
181+
return true
181182
}
182183

183184
async function getCreation (context) {
@@ -426,5 +427,7 @@ module.exports = {
426427
open,
427428
remove,
428429
resetCwd,
429-
setFavorite
430+
setFavorite,
431+
initCreator,
432+
removeCreator
430433
}

packages/@vue/cli-ui/src/graphql-api/schema/project.js

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ extend type Query {
1111
}
1212
1313
extend type Mutation {
14+
projectInitCreation: ProjectCreation
15+
projectCancelCreation: Boolean
1416
projectCreate (input: ProjectCreateInput!): Project!
1517
projectImport (input: ProjectImportInput!): Project!
1618
projectOpen (id: ID!): Project!
@@ -80,6 +82,8 @@ exports.resolvers = {
8082
},
8183

8284
Mutation: {
85+
projectInitCreation: (root, args, context) => projects.initCreator(context),
86+
projectCancelCreation: (root, args, context) => projects.removeCreator(context),
8387
projectCreate: (root, { input }, context) => projects.create(input, context),
8488
projectImport: (root, { input }, context) => projects.import(input, context),
8589
projectOpen: (root, { id }, context) => projects.open(id, context),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mutation projectCancelCreation {
2+
projectCancelCreation
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#import "./projectCreationFragment.gql"
2+
3+
mutation projectInitCreation {
4+
projectInitCreation {
5+
...projectCreation
6+
}
7+
}

packages/@vue/cli-ui/src/views/ProjectCreate.vue

+12-6
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@
362362
:label="$t('views.project-create.tabs.details.modal.buttons.clear')"
363363
icon-left="delete_forever"
364364
class="danger"
365-
@click="reset()"
366365
/>
367366
</div>
368367
</VueModal>
@@ -425,6 +424,7 @@ import PROJECT_CREATION from '../graphql/projectCreation.gql'
425424
import FEATURE_SET_ENABLED from '../graphql/featureSetEnabled.gql'
426425
import PRESET_APPLY from '../graphql/presetApply.gql'
427426
import PROJECT_CREATE from '../graphql/projectCreate.gql'
427+
import PROJECT_CANCEL_CREATION from '../graphql/projectCancelCreation.gql'
428428
429429
function formDataFactory () {
430430
return {
@@ -510,11 +510,11 @@ export default {
510510
}
511511
},
512512
513-
methods: {
514-
reset () {
515-
formData = formDataFactory()
516-
},
513+
beforeDestroy () {
514+
this.cancel()
515+
},
517516
517+
methods: {
518518
async selectPreset (id) {
519519
if (id === 'remote') {
520520
this.showRemotePreset = true
@@ -571,14 +571,20 @@ export default {
571571
}
572572
}
573573
})
574-
this.reset()
575574
this.$router.push({ name: 'project-home' })
576575
await this.$nextTick()
577576
} catch (e) {
578577
// eslint-disable-next-line no-console
579578
console.error(e)
580579
this.debug = `ERROR: ${e}`
581580
}
581+
},
582+
583+
async cancel () {
584+
formData = formDataFactory()
585+
await this.$apollo.mutate({
586+
mutation: PROJECT_CANCEL_CREATION
587+
})
582588
}
583589
}
584590
}

packages/@vue/cli-ui/src/views/ProjectSelect.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
icon-left="add"
3131
:label="$route.query.hideTabs ? $t('views.project-create.tabs.details.form.folder.action') : $t('views.project-select.buttons.create')"
3232
class="big primary create-project"
33-
:to="{ name: 'project-create' }"
33+
@click="createProject()"
3434
/>
3535
</div>
3636
</VueTab>
@@ -70,6 +70,7 @@
7070

7171
<script>
7272
import FOLDER_CURRENT from '../graphql/folderCurrent.gql'
73+
import PROJECT_INIT_CREATION from '../graphql/projectInitCreation.gql'
7374
import PROJECT_IMPORT from '../graphql/projectImport.gql'
7475
7576
export default {
@@ -101,6 +102,14 @@ export default {
101102
},
102103
103104
methods: {
105+
async createProject () {
106+
await this.$apollo.mutate({
107+
mutation: PROJECT_INIT_CREATION
108+
})
109+
110+
this.$router.push({ name: 'project-create' })
111+
},
112+
104113
async importProject () {
105114
await this.$apollo.mutate({
106115
mutation: PROJECT_IMPORT,

0 commit comments

Comments
 (0)