diff --git a/_data/serverState.ts b/_data/serverState.ts index 9d3b78372..b0b0366dc 100644 --- a/_data/serverState.ts +++ b/_data/serverState.ts @@ -41,12 +41,13 @@ const serverState = { description: 'Fully automated media server and lab rig', guid: '9292-1111-BITE-444444444444', deviceCount: 8, + expireTime, + lanIp: '192.168.0.1', + locale: 'en', + registered: false, site: 'http://localhost:4321', state, - locale: 'en', - expireTime, uptime, - lanIp: '192.168.0.1', }; export default serverState; \ No newline at end of file diff --git a/components/UserProfile.ce.vue b/components/UserProfile.ce.vue index 50d816877..c470f9df3 100644 --- a/components/UserProfile.ce.vue +++ b/components/UserProfile.ce.vue @@ -85,7 +85,6 @@ onBeforeMount(() => { {{ description }} - {{ 'LAN IP Copied' }} diff --git a/components/UserProfile/Dropdown.vue b/components/UserProfile/Dropdown.vue index a536077b1..3be0fd813 100644 --- a/components/UserProfile/Dropdown.vue +++ b/components/UserProfile/Dropdown.vue @@ -11,7 +11,7 @@ const myServersEnv = ref('Staging'); const devEnv = ref('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', + }] + : [] + ), ]; }) @@ -64,7 +75,7 @@ const links = computed(():UserProfileLink[] => { -
  • +
  • diff --git a/store/server.ts b/store/server.ts index 68c398ab4..184a2ce08 100644 --- a/store/server.ts +++ b/store/server.ts @@ -16,14 +16,23 @@ export const useServerStore = defineStore('server', () => { */ const description = ref(); const deviceCount = ref(); + const expireTime = ref(); + const flashProduct = ref(); + const flashVendor = ref(); const guid = ref(); - const locale = ref(); + const keyfile = ref(); const lanIp = ref(); + const license = ref(); + const locale = ref(); const name = ref(); + const pluginInstalled = ref(); + const registered = ref(); + const regGen = ref(); + const regGuid = ref(); const site = ref(); const state = ref(); // @todo implement ServerState ENUM const uptime = ref(); - const expireTime = ref(); + const wanFQDN = ref(); /** * Getters @@ -32,14 +41,23 @@ export const useServerStore = defineStore('server', () => { return { description: description.value, deviceCount: deviceCount.value, + expireTime: expireTime.value, + flashProduct: flashProduct.value, + flashVendor: flashVendor.value, guid: guid.value, + keyfile: keyfile.value, + lanIp: lanIp.value, + license: license.value, locale: locale.value, name: name.value, + pluginInstalled: pluginInstalled.value, + registered: registered.value, + regGen: regGen.value, + regGuid: regGuid.value, site: site.value, state: state.value, uptime: uptime.value, - expireTime: expireTime.value, - lanIp: lanIp.value, + wanFQDN: wanFQDN.value, } }); @@ -172,28 +190,41 @@ export const useServerStore = defineStore('server', () => { console.debug('[setServer]', data); description.value = data?.description; deviceCount.value = data?.deviceCount; + expireTime.value = data?.expireTime; + flashProduct.value = data?.flashProduct; + flashVendor.value = data?.flashVendor; guid.value = data?.guid; + keyfile.value = data?.keyfile; + lanIp.value = data?.lanIp; + license.value = data?.license; locale.value = data?.locale; name.value = data?.name; + pluginInstalled.value = data?.pluginInstalled; + registered.value = data?.registered; + regGen.value = data?.regGen; + regGuid.value = data?.regGuid; site.value = data?.site; state.value = data?.state; uptime.value = data?.uptime; - expireTime.value = data?.expireTime; - lanIp.value = data?.lanIp; + wanFQDN.value = data?.wanFQDN; }; return { // state - name, description, + deviceCount, + expireTime, guid, locale, lanIp, - deviceCount, + name, + pluginInstalled, + registered, + regGen, + regGuid, site, - uptime, - expireTime, state, + uptime, // getters server, stateData, diff --git a/types/server.ts b/types/server.ts index 867e1b2cd..814013243 100644 --- a/types/server.ts +++ b/types/server.ts @@ -20,24 +20,26 @@ export enum ServerState { ENOCONN = 'ENOCONN', } export interface Server { - // state?: ServerState; - state?: string; - name?: string; description?: string; deviceCount?: number; + expireTime?: number; flashProduct?: string; flashVendor?: string; guid?: string; + keyfile?: string; + lanIp?: string; + license?: string; + locale?: string; + name?: string; + pluginInstalled?: boolean; + registered?: boolean; + regGen?: number; regGuid?: string; site?: string; - wanFQDN?: string; - regGen?: number; - license?: string; - keyfile?: string; - locale?: string; + // state?: ServerState; + state: string; uptime?: number; - expireTime?: number; - lanIp?: string; + wanFQDN?: string; } // @todo convert to object with text and click payload