Skip to content

Commit

Permalink
Merge pull request #1086 from harvester/mergify/bp/release-harvester-…
Browse files Browse the repository at this point in the history
…v1.4/pr-1081

Hide Upgrade button when upgrade is in progress (backport #1081)
  • Loading branch information
torchiaf authored Jul 30, 2024
2 parents e3ecb25 + 5433792 commit 0ce97b8
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 0ce97b8

Please sign in to comment.