feat: keep upgrade button appear (#1003)

* feat: keep upgrade button appear

Signed-off-by: Andy Lee <andy.lee@suse.com>

* refactor: copilot review

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee 2026-07-16 11:24:51 +08:00 committed by GitHub
parent 44297ada16
commit d4223ad2ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 8 deletions

View File

@ -55,8 +55,12 @@ export default {
!this.latestUpgrade.isUpgradeFailed; !this.latestUpgrade.isUpgradeFailed;
}, },
canUpgrade() {
return this.versionOptions.length > 0 && !this.isUpgradeInProgress;
},
versionOptions() { versionOptions() {
const versions = this.$store.getters['harvester/all'](HCI.VERSION); const versions = this.$store.getters['harvester/all'](HCI.VERSION) || [];
return versions.map((V) => V.metadata.name); return versions.map((V) => V.metadata.name);
}, },
@ -154,14 +158,23 @@ export default {
:cluster="currentCluster.nameDisplay" :cluster="currentCluster.nameDisplay"
/> />
</h1> </h1>
<span
v-clean-tooltip="{
content: canUpgrade ? t('harvester.upgradePage.upgradeAvailable') : t('harvester.upgradePage.upgradeUnavailable'),
triggers: ['hover', 'focus', 'touch'],
}"
class="upgrade-btn-wrap"
:tabindex="canUpgrade ? -1 : 0"
>
<button <button
v-if="versionOptions.length && !isUpgradeInProgress" :disabled="!canUpgrade"
type="button" type="button"
class="btn bg-warning btn-sm" class="btn bg-warning btn-sm"
@click="open" @click="open"
> >
<t k="harvester.upgradePage.upgrade" /> <t k="harvester.upgradePage.upgrade" />
</button> </button>
</span>
</header> </header>
<ModalWithCard <ModalWithCard
@ -296,6 +309,18 @@ export default {
line-height: 23px; line-height: 23px;
} }
.upgrade-btn-wrap {
display: inline-flex;
button {
color: #000 !important;
}
button:hover {
color: #000 !important;
}
}
.currentVersion { .currentVersion {
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;

View File

@ -1099,6 +1099,8 @@ harvester:
downloadLog: Download Log downloadLog: Download Log
logStatus: Log Download Status logStatus: Log Download Status
dismissMessage: Dismiss it dismissMessage: Dismiss it
upgradeAvailable: Upgrade Available
upgradeUnavailable: Upgrade Unavailable
upgradeInfo: upgradeInfo:
warning: WARNING warning: WARNING
doc: Read the <a href="{url}" target="_blank">documentation</a> before starting the upgrade process. Ensure that you complete procedures that are relevant to your environment and the version you are upgrading to. doc: Read the <a href="{url}" target="_blank">documentation</a> before starting the upgrade process. Ensure that you complete procedures that are relevant to your environment and the version you are upgrading to.