Skip to content

Commit

Permalink
core: frontend: components: version-chooser: Add button to update boo…
Browse files Browse the repository at this point in the history
…tstrap

Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Jul 13, 2023
1 parent ca9efed commit 4079176
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
15 changes: 15 additions & 0 deletions core/frontend/src/components/version-chooser/VersionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@
Update to latest {{ image.tag }}
</div>
</v-btn>
<v-btn
v-if="settings.is_pirate_mode && current && !updateAvailable && isFromBR"
color="warning"
class="mx-2 my-1 scroll-container"
width="195"
:disabled="working"
@click="$emit('update-bootstrap', `bluerobotics/blueos-bootstrap:master`)"
>
<div class="scroll-text">
Update Bootstrap
</div>
</v-btn>
<v-btn
v-if="newBetaAvailable"
color="primary"
Expand Down Expand Up @@ -182,6 +194,9 @@ export default Vue.extend({
working(): boolean {
return this.loading || this.deleting
},
isFromBR(): boolean {
return this.image.repository === 'patrickelectric/blueos-core'
},
},
methods: {
asTimeAgo(value: string) {
Expand Down
20 changes: 18 additions & 2 deletions core/frontend/src/components/version-chooser/VersionChooser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
@delete="deleteVersion"
@apply="setVersion"
@pull-and-apply="pullAndSetVersion"
@update-bootstrap="updateBootstrap"
/>
<spinning-logo
v-if="local_versions.loading"
Expand Down Expand Up @@ -433,7 +434,7 @@ export default Vue.extend({
})
}
},
async pullAndSetVersion(args: string | string[]) {
async pullAndSetVersion(args: string | string[], wait = true) {
const fullname: string = Array.isArray(args) ? args[0] : args
// This streams the output of docker pull
this.pull_output = 'Fetching remote image...'
Expand Down Expand Up @@ -461,7 +462,22 @@ export default Vue.extend({
this.status_text = tracker.overall_status
this.show_pull_output = true
},
}).then(() => { this.waitForBackendToRestart(true) })
}).then(() => { this.waitForBackendToRestart(wait) })
},
async updateBootstrap(image: string) {
const [_, tag] = image.split(':')
await this.pullAndSetVersion(image, false)
.then(() => { this.setBootstrapVersion(tag) })
.then(() => { this.waitForBackendToRestart(true) })
},
async setBootstrapVersion(version: string) {
await back_axios({
method: 'post',
url: '/version-chooser/v1.0/bootstrap/current',
data: {
tag: version,
},
})
},
async setVersion(args: string | string[]) {
const fullname: string = Array.isArray(args) ? args[0] : args
Expand Down

0 comments on commit 4079176

Please sign in to comment.