Skip to content

Commit

Permalink
feat(ui): allow to specify rf region in OTA fw updates when it's unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 6, 2024
1 parent cf7142e commit 88184ef
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions src/components/nodes-table/OTAUpdates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<v-row justify="center" class="mb-2 text-center" dense>
<v-btn
:disabled="loading"
text
outlined
class="my-auto"
color="green"
@click="checkUpdates"
>Check updates</v-btn
Expand All @@ -15,17 +16,33 @@
hide-details
dense
label="Include pre-releases"
class="ml-1"
class="ml-2 my-auto"
>
</v-checkbox>
<v-checkbox
v-model="showDowngrades"
hide-details
dense
label="Show downgrades"
class="ml-1"
class="ml-2 my-auto"
>
</v-checkbox>
<v-select
v-if="
controllerNode &&
controllerNode.rfRegion === undefined
"
style="max-width: 200px"
class="ml-2 mb-2"
label="Rf Region"
hide-details
:items="rfRegions"
v-model="rfRegion"
>
<template v-slot:prepend>
<v-icon>signal_cellular_alt</v-icon>
</template>
</v-select>
</v-row>
</v-col>

Expand Down Expand Up @@ -139,8 +156,9 @@

<script>
import useBaseStore from '../../stores/base.js'
import { mapActions } from 'pinia'
import { mapActions, mapState } from 'pinia'
import InstancesMixin from '../../mixins/InstancesMixin.js'
import { rfRegions } from '../../lib/items.js'
export default {
components: {},
Expand All @@ -151,13 +169,16 @@ export default {
mixins: [InstancesMixin],
data() {
return {
rfRegions,
rfRegion: null,
fwUpdates: [],
loading: false,
includePrereleases: false,
showDowngrades: false,
}
},
computed: {
...mapState(useBaseStore, ['controllerNode']),
filteredUpdates() {
return this.fwUpdates.filter(
(u) => !u.downgrade || (u.downgrade && this.showDowngrades),
Expand All @@ -172,15 +193,22 @@ export default {
async checkUpdates() {
this.loading = true
this.fwUpdates = []
const options = {
includePrereleases: this.includePrereleases,
}
if (
this.controllerNode &&
this.controllerNode.rfRegion === undefined
) {
options.rfRegion = this.rfRegion
}
const response = await this.app.apiRequest(
'getAvailableFirmwareUpdates',
[
this.node.id,
{
includePrereleases: this.includePrereleases,
},
],
[this.node.id, options],
)
this.loading = false
if (response.success) {
Expand Down

0 comments on commit 88184ef

Please sign in to comment.