This is an automated email from the ASF dual-hosted git repository.
nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-paimon-webui.git
The following commit(s) were added to refs/heads/main by this push:
new 95c2674 [Feature] Introduce login models and api demo (#53)
95c2674 is described below
commit 95c2674a6d3161e3e2cf50055a007ca111e9ebe4
Author: labbomb <[email protected]>
AuthorDate: Mon Oct 16 10:50:44 2023 +0800
[Feature] Introduce login models and api demo (#53)
---
.../src/api/models/{login.ts => login/index.ts} | 25 +++++++++++++++-------
.../api/models/{login.ts => login/interface.ts} | 9 +-------
.../src/components/context-menu/index.module.scss | 2 +-
paimon-web-ui-new/src/store/config/index.ts | 20 +++++++++++++++--
.../views/playground/components/slider/index.tsx | 14 ++++++++++--
5 files changed, 49 insertions(+), 21 deletions(-)
diff --git a/paimon-web-ui-new/src/api/models/login.ts
b/paimon-web-ui-new/src/api/models/login/index.ts
similarity index 71%
copy from paimon-web-ui-new/src/api/models/login.ts
copy to paimon-web-ui-new/src/api/models/login/index.ts
index a10545b..0a7f91a 100644
--- a/paimon-web-ui-new/src/api/models/login.ts
+++ b/paimon-web-ui-new/src/api/models/login/index.ts
@@ -15,16 +15,25 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. */
-import httpRequest from '../request'
-import type ResponseOptions from '../types'
+import httpRequest from '../../request'
+import type ResponseOptions from '@/api/types'
+import type { LoginOptions } from './interface'
-interface LoginOptions {
- ldapLogin: boolean
- password: string
- rememberMe: boolean
- username: string
-}
+// #region login-controller
+/**
+ * # Login
+ * @param {LoginOptions} options
+ */
export const onLogin = () => {
return httpRequest.post<LoginOptions, ResponseOptions<any>>('/login')
}
+
+/**
+ * # Logout
+ */
+export const onLogout = () => {
+ return httpRequest.post<ResponseOptions<any>>('/logout')
+}
+
+// #endregion
diff --git a/paimon-web-ui-new/src/api/models/login.ts
b/paimon-web-ui-new/src/api/models/login/interface.ts
similarity index 79%
rename from paimon-web-ui-new/src/api/models/login.ts
rename to paimon-web-ui-new/src/api/models/login/interface.ts
index a10545b..8282ddf 100644
--- a/paimon-web-ui-new/src/api/models/login.ts
+++ b/paimon-web-ui-new/src/api/models/login/interface.ts
@@ -15,16 +15,9 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. */
-import httpRequest from '../request'
-import type ResponseOptions from '../types'
-
-interface LoginOptions {
+export interface LoginOptions {
ldapLogin: boolean
password: string
rememberMe: boolean
username: string
}
-
-export const onLogin = () => {
- return httpRequest.post<LoginOptions, ResponseOptions<any>>('/login')
-}
diff --git a/paimon-web-ui-new/src/components/context-menu/index.module.scss
b/paimon-web-ui-new/src/components/context-menu/index.module.scss
index 7d9d27b..34ff6af 100644
--- a/paimon-web-ui-new/src/components/context-menu/index.module.scss
+++ b/paimon-web-ui-new/src/components/context-menu/index.module.scss
@@ -16,6 +16,6 @@ specific language governing permissions and limitations
under the License. */
.context-menu {
- width: 200px;
+ width: 100%;
height: 100%;
}
diff --git a/paimon-web-ui-new/src/store/config/index.ts
b/paimon-web-ui-new/src/store/config/index.ts
index 0b7e99c..02669ad 100644
--- a/paimon-web-ui-new/src/store/config/index.ts
+++ b/paimon-web-ui-new/src/store/config/index.ts
@@ -18,12 +18,16 @@ under the License. */
import { LANGUAGES } from "@/locales"
type Theme = 'dark' | 'light'
+type NavBar = 'playground' | 'cdc' | 'system' | 'settings'
+type Menu = 'Query' | 'Workbench'
export const useConfigStore = defineStore({
id: 'config',
- state: (): { theme: Theme, locale: LANGUAGES } => ({
+ state: (): { theme: Theme, locale: LANGUAGES, navActive: NavBar, menuActive:
Menu } => ({
theme: 'light',
- locale: LANGUAGES.ZH
+ locale: LANGUAGES.ZH,
+ navActive: 'playground',
+ menuActive: 'Query',
}),
persist: true,
getters: {
@@ -32,6 +36,12 @@ export const useConfigStore = defineStore({
},
getCurrentTheme(): Theme {
return this.theme
+ },
+ getCurrentNavActive(): NavBar {
+ return this.navActive
+ },
+ getCurrentMenuActive(): Menu {
+ return this.menuActive
}
},
actions: {
@@ -40,6 +50,12 @@ export const useConfigStore = defineStore({
},
setCurrentTheme(theme: Theme): void {
this.theme = theme
+ },
+ setCurrentNavActive(navActive: NavBar ): void {
+ this.navActive = navActive
+ },
+ setCurrentMenuActive(menuActive: Menu): void {
+ this.menuActive = menuActive
}
}
})
diff --git a/paimon-web-ui-new/src/views/playground/components/slider/index.tsx
b/paimon-web-ui-new/src/views/playground/components/slider/index.tsx
index 8194769..dfbcbcb 100644
--- a/paimon-web-ui-new/src/views/playground/components/slider/index.tsx
+++ b/paimon-web-ui-new/src/views/playground/components/slider/index.tsx
@@ -35,14 +35,14 @@ export default defineComponent({
workspaceList: [
{
icon: renderIcon(Layers),
- title: 'Layers',
+ title: 'Query',
description: computed(() => (t('playground.query'))),
isClick: true,
path: '/playground/query'
},
{
icon: renderIcon(CodeSlashSharp),
- title: 'Code',
+ title: 'Workbench',
description: computed(() => (t('playground.workbench'))),
isClick: false,
path: '/playground/workbench'
@@ -73,10 +73,20 @@ export default defineComponent({
sliderVariables.workspaceList[i].isClick = false
}
sliderVariables.workspaceList[index].isClick = true
+
configStore.setCurrentMenuActive(sliderVariables.workspaceList[index].title as
any)
router.push(sliderVariables.workspaceList[index].path)
}
}
+ onMounted(() => {
+ for (const i in sliderVariables.workspaceList) {
+ sliderVariables.workspaceList[i].isClick = false
+ if (sliderVariables.workspaceList[i].title ===
configStore.getCurrentMenuActive) {
+ sliderVariables.workspaceList[i].isClick = true
+ }
+ }
+ })
+
return {
configStore,
handleClick,