refactor: add & organize server store

This commit is contained in:
Zack Spear
2023-05-31 16:08:18 -07:00
committed by Zack Spear
parent 2ef113dcb2
commit a69066324e
5 changed files with 70 additions and 26 deletions
-1
View File
@@ -85,7 +85,6 @@ onBeforeMount(() => {
<span>{{ description }}</span>
<span class="text-grey-mid px-8px">&bull;</span>
</template>
<!-- @todo click to copy ip -->
<button @click="copyLanIp()" :title="`LAN IP ${lanIp}`">{{ name }}</button>
<span v-if="copied" class="text-12px absolute right-0 bg-gradient-to-r from-red to-orange text-center block w-100px rounded">{{ 'LAN IP Copied' }}</span>
<span v-if="showCopyNotSupported" class="text-12px font-semibold px-4px absolute right-0 bg-gradient-to-r from-red to-orange text-center block rounded">
+13 -2
View File
@@ -11,7 +11,7 @@ const myServersEnv = ref<string>('Staging');
const devEnv = ref<string>('development');
const serverStore = useServerStore();
const { stateData } = storeToRefs(serverStore);
const { registered, stateData } = storeToRefs(serverStore);
// Intended to hide sign in and sign out from actions v-for in UPC dropdown so we can display them separately
const stateDataKeyActions = computed((): ServerStateDataAction[] | undefined => {
@@ -20,6 +20,8 @@ const stateDataKeyActions = computed((): ServerStateDataAction[] | undefined =>
return stateData.value.actions.filter(action => !notAllowed.includes(action.name));
});
console.log('[registered]', registered.value);
const links = computed(():UserProfileLink[] => {
return [
{
@@ -43,6 +45,15 @@ const links = computed(():UserProfileLink[] => {
text: 'Settings',
title: 'Go to Connect plugin settings',
},
...(registered.value
? [{
click: () => { console.debug('signOut') },
icon: ArrowRightOnRectangleIcon,
text: 'Sign Out',
title: 'Sign Out to Unregister your server with Connect',
}]
: []
),
];
})
</script>
@@ -64,7 +75,7 @@ const links = computed(():UserProfileLink[] => {
</li>
</template>
<li class="my-8px mx-12px">
<li class="m-8px">
<upc-keyline />
</li>