mirror of
https://github.com/unraid/api.git
synced 2026-01-02 22:50:02 -06:00
refactor: removed old versions of meta info components
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useServerStore } from '~/store/server';
|
||||
const serverStore = useServerStore();
|
||||
const { state, stateData } = storeToRefs(serverStore);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateData.actions.includes('upgrade')">
|
||||
<button
|
||||
@click="console.log('TODO-UPGRADE_LINK')"
|
||||
class="link text-gamma"
|
||||
:title="'Upgrade'"
|
||||
>
|
||||
<h5>Unraid OS <em><strong>{{ stateData.humanReadable }}</strong></em></h5>
|
||||
</button>
|
||||
</template>
|
||||
<h5 v-else>
|
||||
Unraid OS <em :class="{ 'text-red': stateData.error || state === 'EEXPIRED' }"><strong>{{ stateData.humanReadable }}</strong></em>
|
||||
</h5>
|
||||
|
||||
<template v-if="stateData.actions.includes('purchase')">
|
||||
<button
|
||||
@click="console.log('TODO-PURCHASE_LINK')"
|
||||
class="link text-orange-dark ml-3"
|
||||
:title="'Purchase'"
|
||||
>{{ 'Purchase' }}</button>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.link {
|
||||
@apply text-sm font-semibold transition-colors duration-150 ease-in-out border-t-0 border-l-0 border-r-0 border-b-2 border-transparent;
|
||||
}
|
||||
|
||||
.link:hover,
|
||||
.link:focus {
|
||||
/* @apply text-alpha; */
|
||||
@apply border-orange-dark;
|
||||
}
|
||||
|
||||
.link:focus {
|
||||
@apply outline-none;
|
||||
}
|
||||
</style>
|
||||
@@ -1,56 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import dateDiff from '~/helpers/time/dateDiff';
|
||||
import dateFormat from '~/helpers/time/dateFormat';
|
||||
import buildStringFromValues from '~/helpers/time/buildTimeString';
|
||||
|
||||
export interface Props {
|
||||
time: string;
|
||||
state: string;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const parsedTime = ref<string>('');
|
||||
const formattedTime = computed<string>(() => {
|
||||
return dateFormat(props.time);
|
||||
});
|
||||
|
||||
const countUp = computed<boolean>(() => {
|
||||
return props.state !== 'TRIAL' && props.state === 'EEXPIRED';
|
||||
})
|
||||
|
||||
const output = computed(() => {
|
||||
if (!countUp.value) {
|
||||
return {
|
||||
title: props.state === 'EEXPIRED'
|
||||
? `Trial Key Expired at ${formattedTime.value}`
|
||||
: `Trial Key Expires at ${formattedTime.value}`,
|
||||
text: props.state === 'EEXPIRED'
|
||||
? `Trial Key Expired ${parsedTime.value}`
|
||||
: `Trial Key Expires in ${parsedTime.value}`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: `Server Up Since ${formattedTime.value}`,
|
||||
text: `Uptime ${parsedTime.value}`,
|
||||
};
|
||||
});
|
||||
|
||||
const runDiff = () => parsedTime.value = buildStringFromValues(dateDiff(props.time, countUp.value));
|
||||
|
||||
let interval: string | number | NodeJS.Timeout | undefined = undefined;
|
||||
onBeforeMount(() => {
|
||||
runDiff();
|
||||
interval = setInterval(() => {
|
||||
runDiff();
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p :title="output.title">{{ output.text }}</p>
|
||||
</template>
|
||||
Reference in New Issue
Block a user