55 lines
1.4 KiB
Vue
55 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted, provide } from "vue";
|
|
|
|
import AppHeader from "./components/AppHeader.vue";
|
|
import AppToast from "./components/AppToast.vue";
|
|
import LoginView from "./components/LoginView.vue";
|
|
import ProxyList from "./components/ProxyList.vue";
|
|
import ProxyWorkbench from "./components/ProxyWorkbench.vue";
|
|
import {
|
|
controlPlaneKey,
|
|
useControlPlane,
|
|
} from "./composables/useControlPlane";
|
|
|
|
const plane = useControlPlane();
|
|
provide(controlPlaneKey, plane);
|
|
|
|
onMounted(() => {
|
|
if (plane.token) void plane.refreshAll();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<LoginView
|
|
v-if="!plane.token"
|
|
v-model:username="plane.username"
|
|
v-model:password="plane.password"
|
|
:loading="plane.loading"
|
|
:error="plane.authMessage || plane.loginError"
|
|
@submit="plane.signIn"
|
|
/>
|
|
|
|
<main v-else class="app-shell">
|
|
<AppToast v-if="plane.notice" :message="plane.notice" />
|
|
|
|
<AppHeader
|
|
:loading="plane.loading"
|
|
:show-discovery="Boolean(plane.selectedProxy)"
|
|
@discovery="plane.openDiscovery"
|
|
@refresh="plane.refreshAll"
|
|
@create="plane.openCreateWizard()"
|
|
@logout="plane.signOut"
|
|
/>
|
|
|
|
<div class="app-body">
|
|
<ProxyList
|
|
:proxies="plane.proxies"
|
|
:selected-port="plane.selectedPort"
|
|
@select="plane.selectedPort = $event"
|
|
/>
|
|
|
|
<ProxyWorkbench />
|
|
</div>
|
|
</main>
|
|
</template>
|