mirror of
https://github.com/unraid/api.git
synced 2026-01-06 08:39:54 -06:00
feat: WIP UpdateOs page component
This commit is contained in:
@@ -69,10 +69,8 @@ export const useUpdateOsStoreGeneric = (
|
||||
}
|
||||
|
||||
// getters
|
||||
const isOsVersionStable = computed(() => {
|
||||
const hasPrerelease = prerelease(osVersion.value);
|
||||
return !hasPrerelease;
|
||||
});
|
||||
const cachedReleasesTimestamp = computed(() => releases.value?.timestamp);
|
||||
const isOsVersionStable = computed(() => !isVersionStable(osVersion.value));
|
||||
|
||||
const filteredStableReleases = computed(() => {
|
||||
if (!osVersion.value) return undefined;
|
||||
@@ -186,9 +184,11 @@ export const useUpdateOsStoreGeneric = (
|
||||
|
||||
/**
|
||||
* If we're on stable and the user hasn't requested to include next releases in the check
|
||||
* then remove next releases from the cached data
|
||||
* then remove next releases from the data
|
||||
*/
|
||||
if (!payload.includeNext && isOsVersionStable.value && releases.value.response.next) {
|
||||
console.debug('[checkForUpdate] checking for next releases', payload.includeNext, isOsVersionStable.value, releases.value.response.next)
|
||||
if (!payload.includeNext || isOsVersionStable.value && releases.value.response.next) {
|
||||
console.debug('[checkForUpdate] removing next releases from data')
|
||||
delete releases.value.response.next;
|
||||
}
|
||||
|
||||
@@ -238,11 +238,14 @@ export const useUpdateOsStoreGeneric = (
|
||||
return releaseForReturn;
|
||||
};
|
||||
|
||||
const isVersionStable = (version: SemVer | string): boolean => prerelease(version) === null;
|
||||
|
||||
return {
|
||||
// state
|
||||
available,
|
||||
releases,
|
||||
// getters
|
||||
cachedReleasesTimestamp,
|
||||
isOsVersionStable,
|
||||
filteredStableReleases,
|
||||
filteredNextReleases,
|
||||
@@ -251,5 +254,6 @@ export const useUpdateOsStoreGeneric = (
|
||||
checkForUpdate,
|
||||
findReleaseByMd5,
|
||||
requestReleases,
|
||||
isVersionStable,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -22,8 +22,9 @@ import {
|
||||
type UpdateOsActionStore,
|
||||
} from '~/store/updateOs';
|
||||
|
||||
import { type InstallPluginPayload } from '~/composables/installPlugin';
|
||||
import type { InstallPluginPayload } from '~/composables/installPlugin';
|
||||
import type { ServerStateDataAction } from '~/types/server';
|
||||
import type { UserProfileLink } from '~/types/userProfile';
|
||||
|
||||
/**
|
||||
* @see https://stackoverflow.com/questions/73476371/using-pinia-with-vue-js-web-components
|
||||
@@ -47,7 +48,7 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => {
|
||||
const callbackUpdateRelease = ref<Release | null>(null);
|
||||
|
||||
// Actions
|
||||
const initUpdateOsCallback = (includeNextReleases: boolean = false) => {
|
||||
const initUpdateOsCallback = (includeNextReleases: boolean = false): UserProfileLink => {
|
||||
return {
|
||||
click: (includeNext: boolean = includeNextReleases) => {
|
||||
callbackStore.send(
|
||||
|
||||
Reference in New Issue
Block a user