Skip to content
Snippets Groups Projects
Unverified Commit 910d365a authored by Martin Weise's avatar Martin Weise
Browse files

Finalized

parent 1b5617fd
Branches
Tags
2 merge requests!163Relase 1.3.0,!161Resolve "Frontend bugs"
...@@ -232,13 +232,22 @@ ...@@ -232,13 +232,22 @@
</v-list> </v-list>
<v-card-actions> <v-card-actions>
<v-btn <v-btn
v-if="needsStart" v-if="canStartContainer && needsStart"
small small
secondary secondary
color="secondary" color="secondary"
:loading="loadingStart" :loading="loadingStart"
@click.stop="startContainer"> @click.stop="startContainer">
Start Start Container
</v-btn>
<v-btn
v-if="canStopContainer && !needsStart"
small
secondary
color="error"
:loading="loadingStop"
@click.stop="stopContainer">
Stop Container
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card-text> </v-card-text>
...@@ -286,6 +295,7 @@ export default { ...@@ -286,6 +295,7 @@ export default {
loading: false, loading: false,
loadingDelete: false, loadingDelete: false,
loadingStart: false, loadingStart: false,
loadingStop: false,
editDialog: false, editDialog: false,
deleteDialog: false, deleteDialog: false,
persistDialog: false, persistDialog: false,
...@@ -381,6 +391,21 @@ export default { ...@@ -381,6 +391,21 @@ export default {
} }
return this.roles.includes('create-identifier') && this.isOwner return this.roles.includes('create-identifier') && this.isOwner
}, },
canStartContainer () {
if (!this.roles) {
return false
}
if (this.roles.includes('modify-foreign-container-state')) {
return true
}
return this.roles.includes('modify-container-state') && this.isOwner
},
canStopContainer () {
if (!this.roles) {
return false
}
return this.roles.includes('modify-foreign-container-state')
},
canEditIdentifier () { canEditIdentifier () {
if (!this.roles || !this.hasIdentifier) { if (!this.roles || !this.hasIdentifier) {
return false return false
...@@ -445,12 +470,6 @@ export default { ...@@ -445,12 +470,6 @@ export default {
return this.database.owner.username === this.user.username return this.database.owner.username === this.user.username
}, },
needsStart () { needsStart () {
if (!this.user) {
return false
}
if (this.database.container.owner.username !== this.user.username) {
return false
}
return !this.database.container.running return !this.database.container.running
} }
}, },
...@@ -479,6 +498,18 @@ export default { ...@@ -479,6 +498,18 @@ export default {
this.loadingStart = false this.loadingStart = false
}) })
}) })
},
stopContainer () {
this.loadingStop = true
return new Promise(() => {
ContainerService.modify(this.database.container.id, 'stop')
.then(() => {
this.$store.dispatch('reloadDatabase')
})
.finally(() => {
this.loadingStop = false
})
})
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment