Skip to content

Commit

Permalink
Hide Upgrade button when upgrade is in progress
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
  • Loading branch information
torchiaf committed Jul 24, 2024
1 parent 9f9a5ce commit 652e2ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/harvester/components/HarvesterUpgrade.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ export default {
computed: {
...mapGetters(['currentCluster']),
latestUpgrade() {
return this.upgrade?.find(u => u.isLatestUpgrade);
},
isUpgradeInProgress() {
return this.latestUpgrade &&
!this.latestUpgrade.isUpgradeSucceeded &&
!this.latestUpgrade.isUpgradeFailed;
},
versionOptions() {
const versions = this.$store.getters['harvester/all'](HCI.VERSION);
Expand Down Expand Up @@ -131,7 +141,12 @@ export default {
:cluster="currentCluster.nameDisplay"
/>
</h1>
<button v-if="versionOptions.length" type="button" class="btn bg-warning btn-sm" @click="open">
<button
v-if="versionOptions.length && !isUpgradeInProgress"
type="button"
class="btn bg-warning btn-sm"
@click="open"
>
<t k="harvester.upgradePage.upgrade" />
</button>
</header>
Expand Down
4 changes: 4 additions & 0 deletions pkg/harvester/models/harvesterhci.io.upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default class HciUpgrade extends HarvesterResource {
return this?.metadata?.labels?.[HCI.LATEST_UPGRADE] === 'true';
}

get isUpgradeFailed() {
return this?.metadata?.labels?.[HCI.UPGRADE_STATE] === 'Failed';
}

get isUpgradeSucceeded() {
return this?.metadata?.labels?.[HCI.UPGRADE_STATE] === 'Succeeded';
}
Expand Down

0 comments on commit 652e2ba

Please sign in to comment.