| 1 | <template> |
| 2 | <n-dropdown :options placement="bottom-end" @select="handleSelect"> |
| 3 | <n-avatar round :size="32" :src="userPic" :img-props="{ alt: 'avatar' }" /> |
| 4 | </n-dropdown> |
| 5 | </template> |
| 6 | |
| 7 | <script lang="ts" setup> |
| 8 | import { NAvatar, NDropdown } from "naive-ui" |
| 9 | import { h, ref } from "vue" |
| 10 | import { useRouter } from "vue-router" |
| 11 | import { useAuthStore } from "@/stores/auth" |
| 12 | import { renderIcon } from "@/utils" |
| 13 | |
| 14 | const UserIcon = "ion:person-outline" |
| 15 | const LicenseIcon = "carbon:license" |
| 16 | const LogoutIcon = "ion:log-out-outline" |
| 17 | const LogsIcon = "carbon:cloud-logging" |
| 18 | const ContactIcon = "ic:outline-alternate-email" |
| 19 | const DocsIcon = "carbon:document" |
| 20 | const UsersIcon = "carbon:group-security" |
| 21 | const SSOConfigIcon = "carbon:rule-locked" |
| 22 | const SchedulerIcon = "material-symbols:autoplay" |
| 23 | const CustomerPortalIcon = "streamline-ultimate:coding-apps-website-apps-browser" |
| 24 | const ExternalServicesIcon = "carbon:ibm-cloud-direct-link-2-dedicated" |
| 25 | |
| 26 | const router = useRouter() |
| 27 | const authStore = useAuthStore() |
| 28 | |
| 29 | const userPic = authStore.userPic |
| 30 | |
| 31 | const options = ref([ |
| 32 | { |
| 33 | label: "Profile", |
| 34 | key: "route-Profile", |
| 35 | icon: renderIcon(UserIcon) |
| 36 | }, |
| 37 | { |
| 38 | label: "License", |
| 39 | key: "route-License", |
| 40 | icon: renderIcon(LicenseIcon) |
| 41 | }, |
| 42 | { |
| 43 | label: "Users", |
| 44 | key: "route-Users", |
| 45 | icon: renderIcon(UsersIcon) |
| 46 | }, |
| 47 | ...(authStore.isAdmin |
| 48 | ? [ |
| 49 | { |
| 50 | label: "SSO Config", |
| 51 | key: "route-SSOConfig", |
| 52 | icon: renderIcon(SSOConfigIcon) |
| 53 | } |
| 54 | ] |
| 55 | : []), |
| 56 | { |
| 57 | type: "divider", |
| 58 | key: "divider-1" |
| 59 | }, |
| 60 | { |
| 61 | label: "Scheduler", |
| 62 | key: "route-Scheduler", |
| 63 | icon: renderIcon(SchedulerIcon) |
| 64 | }, |
| 65 | { |
| 66 | label: "Customer Portal", |
| 67 | key: "route-CustomerPortal", |
| 68 | icon: renderIcon(CustomerPortalIcon) |
| 69 | }, |
| 70 | { |
| 71 | label: "Logs", |
| 72 | key: "route-Logs", |
| 73 | icon: renderIcon(LogsIcon) |
| 74 | }, |
| 75 | { |
| 76 | type: "divider", |
| 77 | key: "divider-2" |
| 78 | }, |
| 79 | { |
| 80 | label: "3rd Party Integrations", |
| 81 | key: "route-ExternalServices-ThirdPartyIntegrations", |
| 82 | icon: renderIcon(ExternalServicesIcon) |
| 83 | }, |
| 84 | { |
| 85 | label: "Network Connectors", |
| 86 | key: "route-ExternalServices-NetworkConnectors", |
| 87 | icon: renderIcon(ExternalServicesIcon) |
| 88 | }, |
| 89 | { |
| 90 | label: "Shuffle App Auth", |
| 91 | key: "route-ExternalServices-ShuffleAppAuth", |
| 92 | icon: renderIcon(ExternalServicesIcon) |
| 93 | }, |
| 94 | { |
| 95 | type: "divider", |
| 96 | key: "divider-3" |
| 97 | }, |
| 98 | { |
| 99 | label: () => |
| 100 | h( |
| 101 | "a", |
| 102 | { |
| 103 | href: "https://docs.socfortress.co/", |
| 104 | target: "_blank", |
| 105 | rel: "noopener noreferrer" |
| 106 | }, |
| 107 | "Documentation" |
| 108 | ), |
| 109 | key: "documentation", |
| 110 | icon: renderIcon(DocsIcon) |
| 111 | }, |
| 112 | { |
| 113 | label: () => |
| 114 | h( |
| 115 | "a", |
| 116 | { |
| 117 | href: "https://www.socfortress.co/contact-us", |
| 118 | target: "_blank", |
| 119 | rel: "noopener noreferrer" |
| 120 | }, |
| 121 | "Contact SOCFortress" |
| 122 | ), |
| 123 | key: "contact-socfortress", |
| 124 | icon: renderIcon(ContactIcon) |
| 125 | }, |
| 126 | { |
| 127 | type: "divider", |
| 128 | key: "divider-4" |
| 129 | }, |
| 130 | { |
| 131 | label: "Logout", |
| 132 | key: "route-Logout", |
| 133 | icon: renderIcon(LogoutIcon) |
| 134 | } |
| 135 | ]) |
| 136 | function handleSelect(key: string) { |
| 137 | if (key.indexOf("route-") === 0) { |
| 138 | const path = key.split("route-")[1] |
| 139 | router.push({ name: path }) |
| 140 | } |
| 141 | } |
| 142 | </script> |