From bbf64868441a250f6300c9777c2b16918c0594ee Mon Sep 17 00:00:00 2001 From: Max Behzadi <69126271+MaxTheGeeek@users.noreply.github.com> Date: Tue, 6 Feb 2024 19:06:43 +0100 Subject: [PATCH] FIX: login (#1682) * FIX: login * FIX: add new server --- .../server-management/MultiServerScreen.vue | 28 +++++++++++-------- .../components/ServerBody.vue | 28 +++++++++++-------- .../components/login-form/LoginForm.vue | 25 +++++++++-------- .../components/login-form/LoginPanel.vue | 7 ++++- .../UI/welcome-page/WelcomeScreen.vue | 2 +- 5 files changed, 53 insertions(+), 37 deletions(-) diff --git a/launcher/src/components/UI/server-management/MultiServerScreen.vue b/launcher/src/components/UI/server-management/MultiServerScreen.vue index 75beab74f..b22965de0 100644 --- a/launcher/src/components/UI/server-management/MultiServerScreen.vue +++ b/launcher/src/components/UI/server-management/MultiServerScreen.vue @@ -5,6 +5,7 @@ import ServerHeader from './components/ServerHeader.vue'; > { //Methods +//Server Management Login Handler + +const loginHandler = async () => { + if (router.currentRoute.value.path === "/login") { + await login(); + } else { + await ControlService.logout(); + await login(); + } +}; + //Server Management Tab Picker const tabPicker = (tab) => { serverStore.setActiveTab(tab); }; -//Load stored connections - -const loadStoredConnections = async () => { - const savedConnections = await ControlService.readConfig(); - serverStore.selectedServerConnection = savedConnections.savedConnections.find( - (item) => item.host === controlStore.ipAddress - ); -}; - //Click handling on a server in the saved servers list const serverHandler = (server) => { serverStore.tabs.forEach((tab) => { @@ -145,6 +148,7 @@ const closeWindow = () => { const closeErrorDialog = () => { serverStore.errorMsgExists = false; + serverStore.connectingProcess = false; }; const removeServerHandler = async () => { diff --git a/launcher/src/components/UI/server-management/components/ServerBody.vue b/launcher/src/components/UI/server-management/components/ServerBody.vue index 82cbd754f..a1217bfe9 100644 --- a/launcher/src/components/UI/server-management/components/ServerBody.vue +++ b/launcher/src/components/UI/server-management/components/ServerBody.vue @@ -5,7 +5,7 @@
- + @@ -27,7 +27,7 @@ import SshPanel from "./ssh-management/SshPanel.vue"; import ControlService from "@/store/ControlService"; import { useServers } from "@/store/servers"; import { useControlStore } from "@/store/theControl"; -import { computed } from "vue"; +import { computed, watch } from "vue"; import { useRoute } from "vue-router"; const emit = defineEmits(["selectServer", "serverLogin", "changePassword", "fileUpload", "deleteKey"]); @@ -41,15 +41,15 @@ const isSSHActive = computed(() => route.path !== "/login" && serverStore.isServ const isDetailsActive = computed(() => route.path !== "/login" && serverStore.isServerDetailsActive); const isUpdateActive = computed(() => route.path !== "/login" && serverStore.isServerUpdateActive); -// watch( -// () => serverStore.selectedServerConnection, -// async (newVal) => { -// if (newVal) { -// serverStore.isServerLoginActive = false; -// serverStore.isServerManagementActive = true; -// } -// } -// ); +watch( + () => serverStore.selectedServerConnection, + async (newVal) => { + if (newVal) { + serverStore.isServerLoginActive = false; + serverStore.isServerManagementActive = true; + } + } +); //Methods @@ -86,6 +86,8 @@ const addNewServer = () => { } serverStore.addNewServer = true; serverStore.isServerLoginActive = true; + serverStore.isServerDetailsActive = false; + serverStore.setActiveTab("login"); serverStore.isServerManagementActive = false; }; @@ -100,4 +102,8 @@ const fileUpload = (file) => { const deleteKey = (key) => { emit("deleteKey", key); }; + +const serverLogin = () => { + emit("serverLogin"); +}; diff --git a/launcher/src/components/UI/server-management/components/login-form/LoginForm.vue b/launcher/src/components/UI/server-management/components/login-form/LoginForm.vue index efcd66f0b..d2840fe6c 100644 --- a/launcher/src/components/UI/server-management/components/login-form/LoginForm.vue +++ b/launcher/src/components/UI/server-management/components/login-form/LoginForm.vue @@ -248,14 +248,15 @@ import { V2_MetaFunction } from "@remix-run/react"; import { computed, onMounted diff --git a/launcher/src/components/UI/welcome-page/WelcomeScreen.vue b/launcher/src/components/UI/welcome-page/WelcomeScreen.vue index b426a0aa2..e20e8adc5 100644 --- a/launcher/src/components/UI/welcome-page/WelcomeScreen.vue +++ b/launcher/src/components/UI/welcome-page/WelcomeScreen.vue @@ -4,7 +4,7 @@ - +