mirror of
https://github.com/unraid/api.git
synced 2026-01-03 23:19:54 -06:00
feat(web): WIP registration page web component
This commit is contained in:
@@ -29,7 +29,7 @@ source_directory="plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dyna
|
||||
destination_directory="/usr/local/emhttp/plugins/dynamix.my.servers"
|
||||
|
||||
# Replace the value inside the rsync command with the user's input
|
||||
rsync_command="rsync -avz --progress --stats -m -e ssh \"$source_directory/\" \"root@${server_name}.local:$destination_directory/\""
|
||||
rsync_command="rsync -avz --progress --stats -m -e ssh \"$source_directory/\" \"root@${server_name}:$destination_directory/\""
|
||||
|
||||
echo "Executing the following command:"
|
||||
echo "$rsync_command"
|
||||
|
||||
@@ -61,6 +61,8 @@ $serverState = [
|
||||
"protocol" => $_SERVER['REQUEST_SCHEME'],
|
||||
"regGen" => (int)$var['regGen'],
|
||||
"regGuid" => $var['regGUID'],
|
||||
"regTo" => $var['regTo'],
|
||||
"regTm" => $var['regTm'] * 1000, // JS expects milliseconds
|
||||
"registered" => $registered,
|
||||
"registeredTime" => $myservers['remote']['regWizTime'] ?? '',
|
||||
"site" => $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'],
|
||||
|
||||
@@ -61,6 +61,8 @@ export const serverState: Server = {
|
||||
osVersion: '6.12.3',
|
||||
registered: true,
|
||||
regGen: 0,
|
||||
regTm: uptime,
|
||||
regTo: 'Zack Spear',
|
||||
// "regGuid": "0781-5583-8355-81071A2B0211",
|
||||
site: 'http://localhost:4321',
|
||||
state,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useServerStore } from '~/store/server';
|
||||
import 'tailwindcss/tailwind.css';
|
||||
import '~/assets/main.css';
|
||||
|
||||
const { t } = useI18n();
|
||||
defineProps<{
|
||||
t: any;
|
||||
}>();
|
||||
|
||||
const { keyActions } = storeToRefs(useServerStore());
|
||||
</script>
|
||||
|
||||
@@ -25,9 +25,3 @@ const { keyActions } = storeToRefs(useServerStore());
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<style lang="postcss">
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
</style>
|
||||
126
web/components/Registration.ce.vue
Normal file
126
web/components/Registration.ce.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<script lang="ts" setup>
|
||||
/**
|
||||
* @todo how are we going to update test, beta, and stable releases for internal testing?
|
||||
* @todo after install / downgrade detect if third-party drivers are installed and tell users to wait for a user to wait for a new notification
|
||||
*
|
||||
* run exec("ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}'");
|
||||
* if this returns are value assume we have third-party drivers installed and tell the user to wait for a new notification
|
||||
*
|
||||
* view https://s3.amazonaws.com/dnld.lime-technology.com/stable/unRAIDServer.plg to see how the update is handled
|
||||
# ensure writes to USB flash boot device have completed
|
||||
sync -f /boot
|
||||
if [ -z "${plg_update_helper}" ]; then
|
||||
echo "Update successful - PLEASE REBOOT YOUR SERVER"
|
||||
else
|
||||
echo "Third party plugins found - PLEASE CHECK YOUR UNRAID NOTIFICATIONS AND WAIT FOR THE MESSAGE THAT IT IS SAFE TO REBOOT!"
|
||||
fi
|
||||
*/
|
||||
import dayjs from 'dayjs'
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useServerStore } from '~/store/server';
|
||||
|
||||
import 'tailwindcss/tailwind.css';
|
||||
import '~/assets/main.css';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
export interface Props {
|
||||
restoreReleaseDate?: string;
|
||||
restoreVersion?: string;
|
||||
}
|
||||
withDefaults(defineProps<Props>(), {
|
||||
restoreReleaseDate: '',
|
||||
restoreVersion: '',
|
||||
});
|
||||
|
||||
const serverStore = useServerStore();
|
||||
const {
|
||||
deviceCount,
|
||||
guid,
|
||||
flashVendor,
|
||||
flashProduct,
|
||||
regTm,
|
||||
regTo,
|
||||
stateData,
|
||||
stateDataError,
|
||||
} = storeToRefs(serverStore);
|
||||
|
||||
const items = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: 'Registered to:',
|
||||
text: regTo.value,
|
||||
},
|
||||
{
|
||||
label: 'Registered on:',
|
||||
text: dayjs(regTm.value).format('YYYY-MM-DD HH:mm'),
|
||||
},
|
||||
{
|
||||
label: 'Updates Expire:',
|
||||
text: dayjs(regTm.value).format('YYYY-MM-DD HH:mm'),
|
||||
},
|
||||
{
|
||||
label: 'Flash GUID:',
|
||||
text: guid.value,
|
||||
},
|
||||
{
|
||||
label: 'Flash Vendor:',
|
||||
text: flashVendor.value,
|
||||
},
|
||||
{
|
||||
label: 'Flash Product:',
|
||||
text: flashProduct.value,
|
||||
},
|
||||
{
|
||||
label: 'Attached Storage Devices:',
|
||||
text: deviceCount.value,
|
||||
},
|
||||
];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UiPageContainer>
|
||||
<UiCardWrapper>
|
||||
<div class="p-16px sm:px-20px">
|
||||
<h3
|
||||
class="text-24px font-semibold"
|
||||
:class="{
|
||||
'text-red-500': stateDataError,
|
||||
'text-green-500': !stateDataError,
|
||||
}"
|
||||
>
|
||||
{{ stateData.heading }}
|
||||
</h3>
|
||||
<div
|
||||
v-if="stateData.message"
|
||||
v-html="stateData.message"
|
||||
class="text-16px leading-normal opacity-75"></div>
|
||||
</div>
|
||||
<div>
|
||||
<dl>
|
||||
<RegistrationItem
|
||||
v-for="item in items"
|
||||
:key="item.label"
|
||||
:label="item.label"
|
||||
:text="item.text"
|
||||
:t="t" />
|
||||
<div class="p-16px sm:px-20px sm:grid sm:grid-cols-3 sm:gap-16px">
|
||||
<dt class="text-16px font-medium leading-normal"> </dt>
|
||||
<dd class="mt-2 text-16px sm:col-span-2 sm:mt-0">
|
||||
<KeyActions :t="t" />
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</UiCardWrapper>
|
||||
</UiPageContainer>
|
||||
</template>
|
||||
|
||||
<style lang="postcss">
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
</style>
|
||||
22
web/components/Registration/Item.vue
Normal file
22
web/components/Registration/Item.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
export interface Props {
|
||||
label?: string;
|
||||
text?: number | string | undefined;
|
||||
t: any;
|
||||
}
|
||||
withDefaults(defineProps<Props>(), {
|
||||
label: '',
|
||||
text: '',
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="text-16px p-16px sm:px-20px sm:grid sm:grid-cols-3 sm:gap-16px even:bg-gray-200/50">
|
||||
<dt class="font-semibold">{{ t(label) }}</dt>
|
||||
<dd class="mt-4px leading-normal sm:col-span-2 sm:mt-0">
|
||||
<span v-if="text" class="opacity-75">{{ text }}</span>
|
||||
<template v-else-if="$slots['text']">
|
||||
<slot name="text"></slot>
|
||||
</template>
|
||||
</dd>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,13 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
withDefaults(defineProps<{ increasedPadding?: boolean }>(), {
|
||||
withDefaults(defineProps<{
|
||||
increasedPadding?: boolean;
|
||||
noPadding?: boolean;
|
||||
}>(), {
|
||||
increasedPadding: false,
|
||||
noPadding: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="group/card p-4 text-left relative flex flex-col flex-1 text-beta bg-alpha border-2 border-solid border-gamma-opaque rounded-md shadow-md hover:shadow-orange/50 transition-all"
|
||||
:class="increasedPadding && 'md:p-6'"
|
||||
class="group/card text-left relative flex flex-col flex-1 text-beta bg-alpha border-2 border-solid border-gamma-opaque rounded-md shadow-md hover:shadow-orange/50 transition-all"
|
||||
:class="[
|
||||
!noPadding && 'p-4',
|
||||
increasedPadding && 'md:p-6',
|
||||
]"
|
||||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
5
web/components/Ui/PageContainer.vue
Normal file
5
web/components/Ui/PageContainer.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="grid gap-y-24px max-w-1024px mx-auto px-16px">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
@@ -39,7 +39,7 @@ const { rebootType } = storeToRefs(updateOsActionsStore);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid gap-y-24px max-w-1024px mx-auto px-16px">
|
||||
<PageContainer>
|
||||
<UpdateOsStatus :t="t" />
|
||||
<UpdateOsUpdate
|
||||
v-if="rebootType === ''"
|
||||
@@ -52,7 +52,7 @@ const { rebootType } = storeToRefs(updateOsActionsStore);
|
||||
<UpdateOsThirdPartyDrivers
|
||||
v-if="rebootType === 'thirdPartyDriversDownloading'"
|
||||
:t="t" />
|
||||
</div>
|
||||
</PageContainer>
|
||||
</template>
|
||||
|
||||
<style lang="postcss">
|
||||
|
||||
@@ -88,10 +88,6 @@ export default defineNuxtConfig({
|
||||
name: 'UnraidHeaderOsVersion',
|
||||
path: '@/components/HeaderOsVersion.ce',
|
||||
},
|
||||
{
|
||||
name: 'UnraidKeyActions',
|
||||
path: '@/components/KeyActions.ce',
|
||||
},
|
||||
{
|
||||
name: 'UnraidModals',
|
||||
path: '@/components/Modals.ce',
|
||||
@@ -104,6 +100,10 @@ export default defineNuxtConfig({
|
||||
name: 'UnraidUpdateOs',
|
||||
path: '@/components/UpdateOs.ce',
|
||||
},
|
||||
{
|
||||
name: 'UnraidRegistration',
|
||||
path: '@/components/Registration.ce',
|
||||
},
|
||||
{
|
||||
name: 'UnraidWanIpCheck',
|
||||
path: '@/components/WanIpCheck.ce',
|
||||
|
||||
@@ -32,11 +32,6 @@ onBeforeMount(() => {
|
||||
</h3>
|
||||
<AuthCe />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
KeyActionsCe
|
||||
</h3>
|
||||
<KeyActionsCe />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
WanIpCheckCe
|
||||
</h3>
|
||||
@@ -52,6 +47,11 @@ onBeforeMount(() => {
|
||||
</h3>
|
||||
<UpdateOsCe :restore-version="'6.11.2'" />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
RegistrationCe
|
||||
</h3>
|
||||
<RegistrationCe :restore-version="'6.11.2'" />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
ModalsCe
|
||||
</h3>
|
||||
|
||||
@@ -30,11 +30,6 @@ onBeforeMount(() => {
|
||||
</h3>
|
||||
<unraid-auth />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
KeyActionsCe
|
||||
</h3>
|
||||
<unraid-key-actions />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
WanIpCheckCe
|
||||
</h3>
|
||||
@@ -50,6 +45,11 @@ onBeforeMount(() => {
|
||||
</h3>
|
||||
<unraid-update-os />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
RegistrationCe
|
||||
</h3>
|
||||
<unraid-registration />
|
||||
<hr class="border-black dark:border-white">
|
||||
<h3 class="text-lg font-semibold font-mono">
|
||||
ModalsCe
|
||||
</h3>
|
||||
|
||||
@@ -87,6 +87,8 @@ export const useServerStore = defineStore('server', () => {
|
||||
const registered = ref<boolean>();
|
||||
const regGen = ref<number>(0);
|
||||
const regGuid = ref<string>('');
|
||||
const regTm = ref<number>(0);
|
||||
const regTo = ref<string>('');
|
||||
const site = ref<string>('');
|
||||
const state = ref<ServerState>();
|
||||
const theme = ref<Theme>();
|
||||
@@ -720,6 +722,8 @@ export const useServerStore = defineStore('server', () => {
|
||||
if (typeof data?.uptime !== 'undefined') { uptime.value = data.uptime; }
|
||||
if (typeof data?.username !== 'undefined') { username.value = data.username; }
|
||||
if (typeof data?.wanFQDN !== 'undefined') { wanFQDN.value = data.wanFQDN; }
|
||||
if (typeof data?.regTm !== 'undefined') { regTm.value = data.regTm; }
|
||||
if (typeof data?.regTo !== 'undefined') { regTo.value = data.regTo; }
|
||||
};
|
||||
|
||||
const mutateServerStateFromApi = (data: serverStateQuery): Server => {
|
||||
@@ -835,6 +839,8 @@ export const useServerStore = defineStore('server', () => {
|
||||
description,
|
||||
deviceCount,
|
||||
expireTime,
|
||||
flashProduct,
|
||||
flashVendor,
|
||||
guid,
|
||||
keyfile,
|
||||
inIframe,
|
||||
@@ -845,6 +851,8 @@ export const useServerStore = defineStore('server', () => {
|
||||
registered,
|
||||
regGen,
|
||||
regGuid,
|
||||
regTm,
|
||||
regTo,
|
||||
site,
|
||||
state,
|
||||
theme,
|
||||
|
||||
@@ -62,6 +62,8 @@ export interface Server {
|
||||
registered?: boolean;
|
||||
regGen?: number;
|
||||
regGuid?: string;
|
||||
regTm?: number;
|
||||
regTo?: string;
|
||||
site?: string;
|
||||
state?: ServerState;
|
||||
theme?: Theme | undefined;
|
||||
|
||||
Reference in New Issue
Block a user