From d09c418941e28d3622cb8d9375e40996902b0669 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:35:12 +0200 Subject: [PATCH] Improve user settings (#2087) Make the user settings tabbed as well, currently only holding "Settings" (language) and "API". Can be extended with user secrets (#1739) etc. later. ![Screenshot 2023-08-02 at 09-56-00 Woodpecker](https://github.com/woodpecker-ci/woodpecker/assets/80460567/15d82800-8a4d-47fe-aa77-33462f63585e) ![Screenshot 2023-08-02 at 09-56-05 Woodpecker](https://github.com/woodpecker-ci/woodpecker/assets/80460567/de2640be-144c-4190-adb6-56d43a38bdda) --------- Co-authored-by: Robert Kaussow --- web/components.d.ts | 2 + web/src/assets/locales/en.json | 27 +++-- web/src/components/layout/header/Navbar.vue | 2 +- web/src/components/user/UserAPITab.vue | 95 ++++++++++++++++ web/src/components/user/UserGeneralTab.vue | 48 ++++++++ web/src/router.ts | 18 +-- web/src/views/User.vue | 117 ++------------------ web/src/views/admin/Admin.vue | 24 ---- web/src/views/org/OrgRepos.vue | 2 +- web/src/views/org/OrgWrapper.vue | 11 +- 10 files changed, 190 insertions(+), 156 deletions(-) create mode 100644 web/src/components/user/UserAPITab.vue create mode 100644 web/src/components/user/UserGeneralTab.vue delete mode 100644 web/src/views/admin/Admin.vue diff --git a/web/components.d.ts b/web/components.d.ts index 0aa7ba65d..75639a486 100644 --- a/web/components.d.ts +++ b/web/components.d.ts @@ -101,6 +101,8 @@ declare module '@vue/runtime-core' { Tab: typeof import('./src/components/layout/scaffold/Tab.vue')['default'] Tabs: typeof import('./src/components/layout/scaffold/Tabs.vue')['default'] TextField: typeof import('./src/components/form/TextField.vue')['default'] + UserAPITab: typeof import('./src/components/user/UserAPITab.vue')['default'] + UserGeneralTab: typeof import('./src/components/user/UserGeneralTab.vue')['default'] Warning: typeof import('./src/components/atomic/Warning.vue')['default'] } } diff --git a/web/src/assets/locales/en.json b/web/src/assets/locales/en.json index 2a8f61ff7..3c0fda8a7 100644 --- a/web/src/assets/locales/en.json +++ b/web/src/assets/locales/en.json @@ -425,16 +425,27 @@ } }, "user": { - "settings": "User Settings", + "settings": { + "settings": "User Settings", + "general": { + "general": "General", + "language": "Language" + }, + "api": { + "api": "API", + "desc": "Personal Access Token and API usage", + "token": "Personal Access Token", + "shell_setup": "Shell setup", + "api_usage": "Example API Usage", + "cli_usage": "Example CLI Usage", + "dl_cli": "Download CLI", + "shell_setup_before": "do shell setup steps before", + "reset_token": "Reset token", + "swagger_ui": "Swagger UI", + } + }, "oauth_error": "Error while authenticating against OAuth provider", "internal_error": "Some internal error occurred", "access_denied": "You are not allowed to login", - "token": "Personal Access Token", - "shell_setup": "Shell setup", - "api_usage": "Example API Usage", - "cli_usage": "Example CLI Usage", - "dl_cli": "Download CLI", - "shell_setup_before": "do shell setup steps before", - "reset_token": "Reset token" } } diff --git a/web/src/components/layout/header/Navbar.vue b/web/src/components/layout/header/Navbar.vue index acd1a4275..55f48f5b8 100644 --- a/web/src/components/layout/header/Navbar.vue +++ b/web/src/components/layout/header/Navbar.vue @@ -44,7 +44,7 @@ - + diff --git a/web/src/components/user/UserAPITab.vue b/web/src/components/user/UserAPITab.vue new file mode 100644 index 000000000..aa0909f91 --- /dev/null +++ b/web/src/components/user/UserAPITab.vue @@ -0,0 +1,95 @@ + + + diff --git a/web/src/components/user/UserGeneralTab.vue b/web/src/components/user/UserGeneralTab.vue new file mode 100644 index 000000000..0ac44d949 --- /dev/null +++ b/web/src/components/user/UserGeneralTab.vue @@ -0,0 +1,48 @@ + + + diff --git a/web/src/router.ts b/web/src/router.ts index ea33cc561..0abee7e0a 100644 --- a/web/src/router.ts +++ b/web/src/router.ts @@ -131,22 +131,10 @@ const routes: RouteRecordRaw[] = [ }, { path: '/admin', - component: (): Component => import('~/views/RouterView.vue'), + name: 'admin-settings', + component: (): Component => import('~/views/admin/AdminSettings.vue'), + props: true, meta: { authentication: 'required' }, - children: [ - { - path: '', - name: 'admin', - component: (): Component => import('~/views/admin/Admin.vue'), - props: true, - }, - { - path: 'settings', - name: 'admin-settings', - component: (): Component => import('~/views/admin/AdminSettings.vue'), - props: true, - }, - ], }, { diff --git a/web/src/views/User.vue b/web/src/views/User.vue index 4f0d84b7c..19f7f242d 100644 --- a/web/src/views/User.vue +++ b/web/src/views/User.vue @@ -1,114 +1,21 @@ diff --git a/web/src/views/admin/Admin.vue b/web/src/views/admin/Admin.vue deleted file mode 100644 index 26747d761..000000000 --- a/web/src/views/admin/Admin.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/web/src/views/org/OrgRepos.vue b/web/src/views/org/OrgRepos.vue index 44509d397..ca96403a8 100644 --- a/web/src/views/org/OrgRepos.vue +++ b/web/src/views/org/OrgRepos.vue @@ -6,7 +6,7 @@