You've already forked AstralRinth
forked from didirus/AstralRinth
Reset version page state when currently selected version changes (#543)
* reset versions state on current version change * 'mode' should not be reset
This commit is contained in:
@@ -616,7 +616,6 @@ export default {
|
|||||||
mode: 'version',
|
mode: 'version',
|
||||||
primaryFile: {},
|
primaryFile: {},
|
||||||
version: {},
|
version: {},
|
||||||
popup_data: null,
|
|
||||||
|
|
||||||
changelogViewMode: 'source',
|
changelogViewMode: 'source',
|
||||||
|
|
||||||
@@ -652,7 +651,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
reset() {
|
||||||
|
this.changelogViewMode = 'source'
|
||||||
|
this.dependencyAddMode = 'project'
|
||||||
|
this.newDependencyId = ''
|
||||||
|
this.newDependencyType = 'required'
|
||||||
|
|
||||||
|
this.primaryFile = {}
|
||||||
|
this.version = {}
|
||||||
|
this.newFiles = []
|
||||||
|
this.deleteFiles = []
|
||||||
|
},
|
||||||
async setVersion() {
|
async setVersion() {
|
||||||
|
this.reset()
|
||||||
const path = this.$route.name.split('-')
|
const path = this.$route.name.split('-')
|
||||||
this.mode = path[path.length - 1]
|
this.mode = path[path.length - 1]
|
||||||
|
|
||||||
@@ -687,11 +698,8 @@ export default {
|
|||||||
)
|
)
|
||||||
|
|
||||||
this.version = JSON.parse(JSON.stringify(this.version))
|
this.version = JSON.parse(JSON.stringify(this.version))
|
||||||
this.primaryFile = this.version.files.find((file) => file.primary)
|
this.primaryFile =
|
||||||
|
this.version.files.find((file) => file.primary) ?? this.version.files[0]
|
||||||
if (!this.primaryFile) {
|
|
||||||
this.primaryFile = this.version.files[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.version.changelog && this.version.changelog_url) {
|
if (!this.version.changelog && this.version.changelog_url) {
|
||||||
this.version.changelog = (
|
this.version.changelog = (
|
||||||
@@ -845,10 +853,7 @@ export default {
|
|||||||
|
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
|
|
||||||
const fileParts = []
|
const fileParts = this.newFiles.map((f, idx) => `${f.name}-${idx}`)
|
||||||
for (let i = 0; i < this.newFiles.length; i++) {
|
|
||||||
fileParts.push(this.newFiles[i].name.concat('-' + i))
|
|
||||||
}
|
|
||||||
|
|
||||||
const newVersion = {
|
const newVersion = {
|
||||||
project_id: this.version.project_id,
|
project_id: this.version.project_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user