From 3d6adcc39d9bf18ef03cfece8776f51c3fbf18f5 Mon Sep 17 00:00:00 2001 From: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:17:25 +0530 Subject: [PATCH] refactor: consolidated admin dashboard improvements (#3790) Co-authored-by: jamesgeorge007 --- .../assets/images/add_group.svg | 37 ++++ packages/hoppscotch-sh-admin/locales/en.json | 27 ++- .../hoppscotch-sh-admin/src/components.d.ts | 87 +++++---- .../src/components/settings/ServerRestart.vue | 9 +- .../src/components/teams/Add.vue | 17 +- .../src/components/teams/Details.vue | 100 +++++++--- .../src/components/teams/Invite.vue | 153 ++++++++------- .../src/components/teams/Members.vue | 153 ++++++++------- .../src/components/teams/PendingInvites.vue | 137 ++++++------- .../src/components/users/Details.vue | 8 +- .../src/components/users/InviteModal.vue | 10 +- .../src/components/users/SharedRequests.vue | 180 +++++++++--------- .../src/composables/useClientHandler.ts | 25 ++- .../src/composables/useConfigHandler.ts | 57 ++++-- .../src/pages/settings.vue | 36 +++- .../src/pages/teams/_id.vue | 128 ++++--------- .../src/pages/teams/index.vue | 82 ++++---- .../src/pages/users/_id.vue | 102 +++++----- .../src/pages/users/index.vue | 125 ++++++------ .../src/pages/users/invited.vue | 6 +- 20 files changed, 763 insertions(+), 716 deletions(-) create mode 100644 packages/hoppscotch-sh-admin/assets/images/add_group.svg diff --git a/packages/hoppscotch-sh-admin/assets/images/add_group.svg b/packages/hoppscotch-sh-admin/assets/images/add_group.svg new file mode 100644 index 000000000..4350ea15c --- /dev/null +++ b/packages/hoppscotch-sh-admin/assets/images/add_group.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/hoppscotch-sh-admin/locales/en.json b/packages/hoppscotch-sh-admin/locales/en.json index 7a2d74f30..fc1077263 100644 --- a/packages/hoppscotch-sh-admin/locales/en.json +++ b/packages/hoppscotch-sh-admin/locales/en.json @@ -15,6 +15,7 @@ "update_failure": "Failed to update authentication provider configurations!!" }, "confirm_changes": "Hoppscotch server must restart to reflect the new changes. Confirm changes made to the server configurations?", + "input_empty": "Please fill all the fields before updating the configurations", "load_error": "Unable to load server configurations", "mail_configs": { "description": " Configure the smtp configurations", @@ -47,15 +48,11 @@ "total_teams": "Total Teams", "total_users": "Total Users" }, - "role": { - "editor": "EDITOR", - "owner": "OWNER", - "viewer": "VIEWER" - }, "settings": { "settings": "Settings" }, "shared_requests": { + "action": "Action", "clear_filter": "Clear Filter", "confirm_request_deletion": "Confirm deletion of the selected shared request?", "copy": "Copy", @@ -113,6 +110,7 @@ "microsoft_signin_failure": "Failed to login with Microsoft", "non_admin_logged_in": "Logged in as non admin user.", "non_admin_login": "You are logged in. But you're not an admin", + "owner_not_present": "Atleast one owner should be present in the team!!", "privacy_policy": "Privacy Policy", "reenter_email": "Re-enter email", "remove_admin_failure": "Failed to remove admin status!!", @@ -132,11 +130,13 @@ "sign_in_agreement": "By signing in, you are agreeing to our", "sign_in_options": "All sign in option", "sign_out": "Sign out", - "team_name_long": "Team name should be atleast 6 characters long!!", + "team_name_too_short": "Team name should be atleast 6 characters long!!", "user_not_found": "User not found in the infra!!" }, "teams": { + "add_member": "Add Member", "add_members": "Add Members", + "add_new": "Add New", "admin": "Admin", "admin_Email": "Admin Email", "admin_id": "Admin ID", @@ -147,8 +147,12 @@ "delete_team": "Delete Team", "details": "Details", "edit": "Edit", + "editor": "EDITOR", + "editor_description": "Editors can add, edit, and delete requests and collections.", "email": "Team owner email", "email_address": "Email Address", + "email_title": "Email", + "empty_name": "Team name cannot be empty!!", "error": "Something went wrong. Please try again later.", "id": "Team ID", "invited_email": "Invitee Email", @@ -158,13 +162,20 @@ "load_list_error": "Unable to Load Teams List", "members": "Number of members", "name": "Team Name", + "no_invite": "No invites", "no_members": "No members in this team. Add members to this team to collaborate", "no_pending_invites": "No pending invites", "no_teams": "No teams found", + "owner": "OWNER", + "owner_description": " Owners can add, edit, and delete requests, collections and team members.", + "permissions": "Permissions", "pending_invites": "Pending invites", + "roles": "Roles", + "roles_description": "Roles are used to control access to the shared collections.", "remove": "Remove", "rename": "Rename", "save": "Save", + "save_changes": "Save Changes", "send_invite": "Send Invite", "show_more": "Show more", "team_details": "Team details", @@ -174,7 +185,9 @@ "uid": "UID", "unnamed": "(Unnamed Team)", "valid_name": "Please enter a valid team name", - "valid_owner_email": "Please enter a valid owner email" + "valid_owner_email": "Please enter a valid owner email", + "viewer": "VIEWER", + "viewer_description": "Viewers can only view and use requests" }, "users": { "admin": "Admin", diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index 25ffe9aa3..8deeb2b83 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -1,51 +1,54 @@ // generated by unplugin-vue-components // We suggest you to commit this file into source control // Read more: https://github.com/vuejs/core/pull/3399 -import '@vue/runtime-core' +import '@vue/runtime-core'; -export {} +export {}; declare module '@vue/runtime-core' { export interface GlobalComponents { - AppHeader: typeof import('./components/app/Header.vue')['default'] - AppLogin: typeof import('./components/app/Login.vue')['default'] - AppLogout: typeof import('./components/app/Logout.vue')['default'] - AppModal: typeof import('./components/app/Modal.vue')['default'] - AppSidebar: typeof import('./components/app/Sidebar.vue')['default'] - AppToast: typeof import('./components/app/Toast.vue')['default'] - DashboardMetricsCard: typeof import('./components/dashboard/MetricsCard.vue')['default'] - HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary'] - HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary'] - HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor'] - HoppSmartAutoComplete: typeof import('@hoppscotch/ui')['HoppSmartAutoComplete'] - HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal'] - HoppSmartInput: typeof import('@hoppscotch/ui')['HoppSmartInput'] - HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem'] - HoppSmartLink: typeof import('@hoppscotch/ui')['HoppSmartLink'] - HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal'] - HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture'] - HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner'] - HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab'] - HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable'] - HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs'] - HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle'] - IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] - IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] - SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default'] - SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default'] - SettingsReset: typeof import('./components/settings/Reset.vue')['default'] - SettingsServerRestart: typeof import('./components/settings/ServerRestart.vue')['default'] - SettingsSmtpConfiguration: typeof import('./components/settings/SmtpConfiguration.vue')['default'] - TeamsAdd: typeof import('./components/teams/Add.vue')['default'] - TeamsDetails: typeof import('./components/teams/Details.vue')['default'] - TeamsInvite: typeof import('./components/teams/Invite.vue')['default'] - TeamsMembers: typeof import('./components/teams/Members.vue')['default'] - TeamsPendingInvites: typeof import('./components/teams/PendingInvites.vue')['default'] - Tippy: typeof import('vue-tippy')['Tippy'] - UiAutoResetIcon: typeof import('./components/ui/AutoResetIcon.vue')['default'] - UsersDetails: typeof import('./components/users/Details.vue')['default'] - UsersInviteModal: typeof import('./components/users/InviteModal.vue')['default'] - UsersSharedRequests: typeof import('./components/users/SharedRequests.vue')['default'] + AppHeader: typeof import('./components/app/Header.vue')['default']; + AppLogin: typeof import('./components/app/Login.vue')['default']; + AppLogout: typeof import('./components/app/Logout.vue')['default']; + AppModal: typeof import('./components/app/Modal.vue')['default']; + AppSidebar: typeof import('./components/app/Sidebar.vue')['default']; + AppToast: typeof import('./components/app/Toast.vue')['default']; + DashboardMetricsCard: typeof import('./components/dashboard/MetricsCard.vue')['default']; + HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary']; + HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary']; + HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor']; + HoppSmartAutoComplete: typeof import('@hoppscotch/ui')['HoppSmartAutoComplete']; + HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal']; + HoppSmartInput: typeof import('@hoppscotch/ui')['HoppSmartInput']; + HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem']; + HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal']; + HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture']; + HoppSmartPlaceholder: typeof import('@hoppscotch/ui')['HoppSmartPlaceholder']; + HoppSmartSelectWrapper: typeof import('@hoppscotch/ui')['HoppSmartSelectWrapper']; + HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner']; + HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab']; + HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable']; + HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs']; + HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle']; + IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']; + IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']; + IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default']; + IconLucideInbox: typeof import('~icons/lucide/inbox')['default']; + IconLucideUser: typeof import('~icons/lucide/user')['default']; + SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default']; + SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default']; + SettingsReset: typeof import('./components/settings/Reset.vue')['default']; + SettingsServerRestart: typeof import('./components/settings/ServerRestart.vue')['default']; + SettingsSmtpConfiguration: typeof import('./components/settings/SmtpConfiguration.vue')['default']; + TeamsAdd: typeof import('./components/teams/Add.vue')['default']; + TeamsDetails: typeof import('./components/teams/Details.vue')['default']; + TeamsInvite: typeof import('./components/teams/Invite.vue')['default']; + TeamsMembers: typeof import('./components/teams/Members.vue')['default']; + TeamsPendingInvites: typeof import('./components/teams/PendingInvites.vue')['default']; + Tippy: typeof import('vue-tippy')['Tippy']; + UiAutoResetIcon: typeof import('./components/ui/AutoResetIcon.vue')['default']; + UsersDetails: typeof import('./components/users/Details.vue')['default']; + UsersInviteModal: typeof import('./components/users/InviteModal.vue')['default']; + UsersSharedRequests: typeof import('./components/users/SharedRequests.vue')['default']; } - } diff --git a/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue b/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue index 495e5f56e..8d27964cf 100644 --- a/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue +++ b/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue @@ -72,13 +72,14 @@ onMounted(async () => { success = await resetInfraConfigs(resetInfraConfigsMutation); if (!success) return; } else { + const infraResult = await updateInfraConfigs(updateInfraConfigsMutation); + + if (!infraResult) return; + const authResult = await updateAuthProvider( updateAllowedAuthProviderMutation ); - const infraResult = await updateInfraConfigs(updateInfraConfigsMutation); - - success = authResult && infraResult; - if (!success) return; + if (!authResult) return; } restart.value = true; diff --git a/packages/hoppscotch-sh-admin/src/components/teams/Add.vue b/packages/hoppscotch-sh-admin/src/components/teams/Add.vue index 9818f9844..7d94fc8c3 100644 --- a/packages/hoppscotch-sh-admin/src/components/teams/Add.vue +++ b/packages/hoppscotch-sh-admin/src/components/teams/Add.vue @@ -3,7 +3,7 @@ v-if="show" dialog :title="t('teams.create_team')" - @close="$emit('hide-modal')" + @close="emit('hide-modal')" >