refactor: update os translations & auto callback for Tools > Update to account

This commit is contained in:
Zack Spear
2023-10-11 15:22:05 -05:00
committed by Zack Spear
parent 749eab85bd
commit 8903371409
7 changed files with 65 additions and 17 deletions

View File

@@ -38,7 +38,7 @@ const { rebootType } = storeToRefs(updateOsActionsStore);
:showUpdateCheck="true"
:title="t('Update Unraid OS')"
:t="t" />
<UpdateOsUpdateIneligible
<!-- <UpdateOsUpdateIneligible
v-if="availableWithRenewal && rebootType === ''"
:t="t" />
<UpdateOsUpdate
@@ -46,7 +46,7 @@ const { rebootType } = storeToRefs(updateOsActionsStore);
:t="t" />
<UpdateOsThirdPartyDrivers
v-if="rebootType === 'thirdPartyDriversDownloading'"
:t="t" />
:t="t" /> -->
</UiPageContainer>
</template>

View File

@@ -0,0 +1,34 @@
<script setup lang="ts">
import { ArrowPathIcon, ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/solid';
import { storeToRefs } from 'pinia';
import { onBeforeMount } from 'vue';
import { WEBGUI_TOOLS_UPDATE } from '~/helpers/urls';
import { useUpdateOsActionsStore } from '~/store/updateOsActions';
const props = defineProps<{
t: any;
}>();
const updateOsActionsStore = useUpdateOsActionsStore();
const { rebootType } = storeToRefs(updateOsActionsStore);
onBeforeMount(() => {
// On /Tools/Update automatically send the user to account.unraid.net/server/update-os when we're not prompting for reboot
if (window.location.pathname === WEBGUI_TOOLS_UPDATE.pathname && rebootType.value === '') {
updateOsActionsStore.executeUpdateOsCallback();
}
});
</script>
<template>
<div class="flex flex-col sm:flex-shrink-0 sm:flex-grow-0 items-center">
<BrandButton
@click="updateOsActionsStore.executeUpdateOsCallback()"
:icon="ArrowPathIcon"
:icon-right="ArrowTopRightOnSquareIcon"
:text="t('Check for OS Updates')"
class="flex-0" />
</div>
</template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
/**
* @todo require keyfile to be set before allowing user to check for updates
* @todo require keyfile to be set before allowing user to check for OS updates
* @todo require keyfile to update
* @todo require valid guid / server state to update
* @todo detect downgrade possibility
@@ -33,7 +33,7 @@ const buttonText = computed(() => {
if (status.value === 'checking') {
return props.t('Checking...');
}
return props.t('Check For Updates');
return props.t('Check for OS Updates');
});
const check = async () => {

View File

@@ -125,7 +125,7 @@ const regExpOutput = computed(() => {
</div>
<div class="shrink-0">
<UpdateOsCheckButton
<UpdateOsCallbackButton
v-if="showUpdateCheck && rebootType === ''"
:t="t" />
<BrandButton

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup>
/**
* @todo require keyfile to be set before allowing user to check for updates
* @todo require keyfile to be set before allowing user to check for OS updates
* @todo require keyfile to update
* @todo require valid guid / server state to update
*/
@@ -52,7 +52,7 @@ const heading = computed(() => {
if (available.value && updateButton?.value?.text && updateButton?.value?.textParams) {
return props.t(updateButton?.value.text, updateButton?.value.textParams);
}
return props.t('Check for Updates');
return props.t('Check for OS Updates');
});
const headingIcon = computed(() => {

View File

@@ -222,10 +222,10 @@
"Downgrade Unraid OS to {0}": "Downgrade Unraid OS to {0}",
"Begin restore to Unraid {0}": "Begin restore to Unraid {0}",
"Version available for restore {0}": "Version available for restore {0}",
"Check for Updates": "Check for Updates",
"check for OS updates": "check for OS updates",
"Check for Prereleases": "Check for Prereleases",
"Receive the latest and greatest for Unraid OS. Whether it new features, security patches, or bug fixes keeping your server up-to-date ensures the best experience that Unraid has to offer.": "Receive the latest and greatest for Unraid OS. Whether it new features, security patches, or bug fixes keeping your server up-to-date ensures the best experience that Unraid has to offer.",
"Check For Updates": "Check For Updates",
"Check for OS Updates": "Check for OS Updates",
"Checking...": "Checking...",
"View release notes": "View release notes",
"View Changelog for {0}": "View Changelog for {0}",
@@ -242,7 +242,7 @@
"Up-to-date": "Up-to-date",
"Open a bug report": "Open a bug report",
"Go to Tools > Update": "Go to Tools > Update",
"A valid keyfile and USB Flash boot device are required to check for updates.": "A valid keyfile and USB Flash boot device are required to check for updates.",
"A valid keyfile and USB Flash boot device are required to check for OS updates.": "A valid keyfile and USB Flash boot device are required to check for OS updates.",
"Please fix any errors and try again.": "Please fix any errors and try again.",
"Go to Tools > Registration to fix": "Go to Tools > Registration to fix",
"Original release date {0}": "Original release date {0}",
@@ -257,7 +257,7 @@
"{0} out of {1} allowed devices upgrade your key to support more devices": "{0} out of {1} allowed devices upgrade your key to support more devices",
"{0} devices": "{0} devices",
"unlimited": "unlimited",
"Unable to check for updates": "Unable to check for updates",
"Unable to check for OS updates": "Unable to check for OS updates",
"License key actions": "License key actions",
"License key type": "License key type",
"OS Update Eligibility Expiration": "OS Update Eligibility Expiration",
@@ -280,9 +280,9 @@
"Lifetime": "Lifetime",
"Pay your annual fee to continue receiving OS updates.": "Pay your annual fee to continue receiving OS updates.",
"Renew Key": "Renew Key",
"A valid GUID is required to check for updates.": "A valid GUID is required to check for updates.",
"A valid keyfile is required to check for updates.": "A valid keyfile is required to check for updates.",
"A valid OS version is required to check for updates.": "A valid OS version is required to check for updates.",
"A valid GUID is required to check for OS updates.": "A valid GUID is required to check for OS updates.",
"A valid keyfile is required to check for OS updates.": "A valid keyfile is required to check for OS updates.",
"A valid OS version is required to check for OS updates.": "A valid OS version is required to check for OS updates.",
"Your license key's OS update eligibility has expired. Please renew your license key to enable updates released after your expiration date.": "Your license key's OS update eligibility has expired. Please renew your license key to enable updates released after your expiration date.",
"Key ineligible for new updates": "Key ineligible for new updates",
"Ineligible for Unraid OS updates": "Ineligible for Unraid OS updates",

View File

@@ -57,13 +57,13 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => {
const ineligible = computed(() => !serverStore.guid || !serverStore.keyfile || !osVersion.value || regUpdatesExpired.value);
const ineligibleText = computed(() => { // translated in components
if (!serverStore.guid) {
return 'A valid GUID is required to check for updates.';
return 'A valid GUID is required to check for OS updates.';
}
if (!serverStore.keyfile) {
return 'A valid keyfile is required to check for updates.';
return 'A valid keyfile is required to check for OS updates.';
}
if (!osVersion.value) {
return 'A valid OS version is required to check for updates.';
return 'A valid OS version is required to check for OS updates.';
}
if (regUpdatesExpired.value) {
const base = `Your {0} license included one year of free updates at the time of purchase. You are now eligible to extend your license and access the latest OS updates.`;
@@ -107,6 +107,19 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => {
}
};
const executeUpdateOsCallback = async () => {
callbackStore.send(
ACCOUNT_CALLBACK.toString(),
[{
server: {
...serverStore.serverAccountPayload,
},
type: 'updateOs',
}],
serverStore.inIframe,
);
};
/**
* @description When receiving the callback the Account update page we'll use the provided sha256 of the release to get the release from the keyserver
*/
@@ -188,6 +201,7 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => {
confirmUpdateOs,
installOsUpdate,
initUpdateOsCallback,
executeUpdateOsCallback,
rebootServer,
setStatus,
setRebootType,