Skip to content

Commit

Permalink
Merge pull request #1199 from fdm-monster/fix/fdmm-3216-software-upgr…
Browse files Browse the repository at this point in the history
…ade-wrong-latest-downgrade

fix: another regression fixed for software upgrade page + release note - 1.5.12
  • Loading branch information
davidzwa authored Apr 18, 2024
2 parents 13a8450 + 5a1364b commit e43e9bd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 20 deletions.
7 changes: 7 additions & 0 deletions RELEASE_NOTES.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Client develop

# Client 18/04/2024 1.5.12

Fixes:

- Settings: software upgrade page for client upgrades would not calculate ability to upgrade correctly (again). Now fixed.


# Client 18/04/2024 1.5.11

Fixes:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fdm-monster/client",
"version": "1.5.11",
"version": "1.5.12",
"author": "David Zwart",
"license": "AGPL-3.0-or-later",
"repository": {
Expand Down
54 changes: 35 additions & 19 deletions src/components/Settings/SoftwareUpgradeSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
<v-list-item>
<v-list-item-content>
<v-list-item-title> Current versions in use:</v-list-item-title>
<v-list-item-action-text>
<strong>Your server's version is:</strong> {{ serverVersion }}
<br />
<strong>Your client's version is:</strong> {{ version }}
<br />
<v-list-item-subtitle>
Your server's version is: {{ serverVersion }}
</v-list-item-subtitle>
<v-list-item-subtitle> Your client's version is: {{ version }} </v-list-item-subtitle>
<v-list-item-subtitle>
<div v-if="monsterPiVersion">
MonsterPi:
<strong> Your MonsterPi version is: </strong>
<div>Your MonsterPi version is:</div>
{{ monsterPiVersion }}<br />
</div>
<div v-else>
<strong>MonsterPi:</strong>
MonsterPi:
<div>No MonsterPi distro was detected.</div>
</div>
</v-list-item-action-text>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list-item-content>
Expand Down Expand Up @@ -78,16 +78,8 @@
<v-radio
v-for="release in filteredReleases"
:key="release.tag_name"
:disabled="
isCurrentRelease(release) ||
!isUpgradeOrAllowedDowngrade(release, current) ||
isBelowMinimum(release)
"
:label="`${release.tag_name}${
isCurrentRelease(release) ? ', currently installed' : ''
}${!isUpgradeOrAllowedDowngrade(release, current) ? ', downgrade not allowed' : ''}${
isBelowMinimum(release) ? ', below minimum' : ''
}${isVersionUnstable(release) ? ', unstable version' : ''}`"
:disabled="isDisabledRelease(release)"
:label="calculateLabelDisabledReason(release)"
:value="release.tag_name"
>
</v-radio>
Expand Down Expand Up @@ -226,6 +218,30 @@ function isCurrentUnstable() {
return isVersionUnstable(currentRelease);
}
function isDisabledRelease(release: IRelease) {
return (
isCurrentRelease(release) ||
!isUpgradeOrAllowedDowngrade(release, current.value) ||
isBelowMinimum(release)
);
}
function calculateLabelDisabledReason(release: IRelease) {
const prefix = isVersionUnstable(release) ? `${release.tag_name}, unstable` : release.tag_name;
if (isCurrentRelease(release)) {
return `${prefix}, currently installed`;
}
if (isBelowMinimum(release)) {
return `${prefix}, below minimum`;
}
if (!isUpgradeOrAllowedDowngrade(release, current.value)) {
return `${prefix}, downgrade not allowed`;
}
return prefix;
}
function isVersionUnstable(release?: IRelease) {
if (release?.tag_name?.length) {
return (
Expand All @@ -250,7 +266,7 @@ function isUpgradeOrAllowedDowngrade(release: IRelease, current?: IRelease) {
return (
compare(release.tag_name, current.tag_name) !== -1 &&
compare(minimum.value!.tag_name, current.tag_name) !== -1
compare(release.tag_name, minimum.value!.tag_name) !== -1
);
}
Expand Down

0 comments on commit e43e9bd

Please sign in to comment.