@appscode/design-system 1.0.43-alpha.17 → 1.0.43-alpha.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/base/utilities/_default.scss +269 -4
  2. package/base/utilities/_derived-variables.scss +0 -1
  3. package/base/utilities/_initial-variables.scss +17 -176
  4. package/base/utilities/_mixin.scss +1 -17
  5. package/base/utilities/_typography.scss +14 -4
  6. package/base/utilities/dark-theme.scss +25 -0
  7. package/components/_ac-alert-box.scss +13 -5
  8. package/components/_ac-card.scss +44 -8
  9. package/components/_ac-code-highlight.scss +5 -1
  10. package/components/_ac-content-layout.scss +2 -2
  11. package/components/_ac-input.scss +63 -23
  12. package/components/_ac-multi-select.scss +187 -5
  13. package/components/_ac-options.scss +24 -9
  14. package/components/_ac-select-box.scss +14 -4
  15. package/components/_ac-table.scss +5 -3
  16. package/components/_ac-tabs.scss +39 -3
  17. package/components/_ac-terminal.scss +270 -0
  18. package/components/_app-drawer.scss +2 -2
  19. package/components/_breadcumb.scss +2 -0
  20. package/components/_buttons.scss +39 -7
  21. package/components/_card-body-wrapper.scss +2 -2
  22. package/components/_dashboard-header.scss +32 -0
  23. package/components/_direct-deploy.scss +69 -0
  24. package/components/_go-to-top.scss +1 -1
  25. package/components/_graph.scss +45 -0
  26. package/components/_image-upload.scss +5 -3
  27. package/components/_left-sidebar-menu.scss +193 -39
  28. package/components/_monaco-editor.scss +1 -1
  29. package/components/_navbar.scss +124 -7
  30. package/components/_overview-info.scss +4 -4
  31. package/components/_pagination.scss +8 -0
  32. package/components/_payment-card.scss +10 -1
  33. package/components/_preview-modal.scss +15 -4
  34. package/components/_pricing-table.scss +1 -1
  35. package/components/_progress-bar.scss +4 -4
  36. package/components/_subscription-card.scss +12 -5
  37. package/components/_table-of-content.scss +1 -1
  38. package/components/_tfa.scss +69 -0
  39. package/components/_transitions.scss +261 -0
  40. package/components/_wizard.scss +15 -3
  41. package/components/ac-toaster/_ac-toasted.scss +1 -1
  42. package/components/bbum/_card-team.scss +15 -7
  43. package/components/bbum/_information-center.scss +15 -1
  44. package/components/bbum/_mobile-desktop.scss +1 -1
  45. package/components/bbum/_sign-up-notification.scss +3 -3
  46. package/components/bbum/_single-post-preview.scss +1 -1
  47. package/components/bbum/_user-profile.scss +97 -90
  48. package/components/ui-builder/_ui-builder.scss +43 -3
  49. package/components/ui-builder/_vue-open-api.scss +104 -0
  50. package/main.scss +4 -0
  51. package/package.json +2 -7
  52. package/plugins/theme.js +4 -0
  53. package/plugins/vue-toaster.js +3 -0
  54. package/vue-components/v2/banner/Banner.vue +2 -2
  55. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  56. package/vue-components/v2/button/Button.vue +5 -0
  57. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  58. package/vue-components/v2/card/PaymentCards.vue +11 -2
  59. package/vue-components/v2/content/ContentTable.vue +12 -7
  60. package/vue-components/v2/editor/Editor.vue +36 -5
  61. package/vue-components/v2/editor/FilteredFileEditor.vue +188 -0
  62. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  63. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  64. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  65. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  66. package/vue-components/v2/modal/Modal.vue +38 -13
  67. package/vue-components/v2/modals/DeleteConfirmationModal.vue +77 -0
  68. package/vue-components/v2/modals/JsonShowModal.vue +12 -2
  69. package/vue-components/v2/navbar/Appdrawer.vue +10 -9
  70. package/vue-components/v2/navbar/ThemeMode.vue +52 -45
  71. package/vue-components/v2/navbar/User.vue +202 -19
  72. package/vue-components/v2/preloader/Preloader.vue +5 -5
  73. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  74. package/vue-components/v2/sidebar/SidebarItem.vue +23 -1
  75. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  76. package/vue-components/v2/table/Table.vue +44 -8
  77. package/vue-components/v2/table/TableRow.vue +17 -8
  78. package/vue-components/v2/table/table-cell/CellValue.vue +31 -4
  79. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  80. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  81. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  82. package/vue-components/v3/button/Button.vue +5 -0
  83. package/vue-components/v3/content/ContentTable.vue +5 -0
  84. package/vue-components/v3/editor/Editor.vue +50 -30
  85. package/vue-components/v3/editor/FilteredFileEditor.vue +184 -0
  86. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  87. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  88. package/vue-components/v3/form/Form.vue +63 -0
  89. package/vue-components/v3/form-fields/Input.vue +10 -10
  90. package/vue-components/v3/header/HeaderItem.vue +5 -0
  91. package/vue-components/v3/header/HeaderItems.vue +5 -0
  92. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  93. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  94. package/vue-components/v3/modal/Modal.vue +40 -16
  95. package/vue-components/v3/modals/DeleteConfirmationModal.vue +83 -0
  96. package/vue-components/v3/modals/JsonShowModal.vue +25 -16
  97. package/vue-components/v3/navbar/Appdrawer.vue +12 -7
  98. package/vue-components/v3/navbar/ThemeMode.vue +51 -46
  99. package/vue-components/v3/navbar/User.vue +190 -16
  100. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  101. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  102. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  103. package/vue-components/v3/table/Table.vue +34 -11
  104. package/vue-components/v3/table/TableContainer.vue +34 -0
  105. package/vue-components/v3/table/TableRow.vue +10 -2
  106. package/vue-components/v3/table/table-cell/CellValue.vue +26 -3
  107. package/vue-components/v3/table/table-cell/GenericCell.vue +62 -0
  108. package/vue-components/v3/table/table-cell/ObjectCell.vue +5 -1
  109. package/vue-components/v3/tabs/EditorTabs.vue +1 -1
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <!-- modal start -->
3
+ <modal
4
+ :title="title"
5
+ modifier-classes="is-normal"
6
+ :open="open"
7
+ @closemodal="closeModal"
8
+ >
9
+ <!-- freedom content start -->
10
+ <div class="action-message pt-35 pb-35 has-text-centered">
11
+ <h5 class="is-message">{{ message }} {{ itemName ? "" : "?" }}</h5>
12
+ <p class="is-description">{{ itemName }} {{ itemName ? "?" : "" }}</p>
13
+ </div>
14
+
15
+ <!-- freedom content end -->
16
+
17
+ <!-- modal footer start -->
18
+ <template #modal-footer-controls>
19
+ <ac-button
20
+ @click.stop="closeModal"
21
+ title="Cancel"
22
+ modifier-classes="is-outlined"
23
+ />
24
+ <ac-button
25
+ modifier-classes="is-danger"
26
+ :is-loader-active="isDeleteActive"
27
+ title="Yes"
28
+ @click.stop="confirm(true)"
29
+ />
30
+ </template>
31
+ </modal>
32
+ <!-- modal end -->
33
+ </template>
34
+
35
+ <script>
36
+ import { defineComponent, defineAsyncComponent } from "vue";
37
+ export default defineComponent({
38
+ components: {
39
+ Modal: defineAsyncComponent(() =>
40
+ import("../modal/Modal.vue").then((module) => module.default)
41
+ ),
42
+ AcButton: defineAsyncComponent(() =>
43
+ import("../button/Button.vue").then((module) => module.default)
44
+ ),
45
+ },
46
+ props: {
47
+ open: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ title: {
52
+ type: String,
53
+ default: "",
54
+ },
55
+ message: {
56
+ type: String,
57
+ default: "",
58
+ },
59
+ itemName: {
60
+ type: String,
61
+ default: "",
62
+ },
63
+ isLoading: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
67
+ isDeleteActive: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
71
+ },
72
+ emits: ["closemodal", "delete-confirmation-modal$confirm"],
73
+ methods: {
74
+ confirm(response) {
75
+ this.$emit("delete-confirmation-modal$confirm", response);
76
+ },
77
+ closeModal() {
78
+ this.confirm(false);
79
+ this.$emit("closemodal", true);
80
+ },
81
+ },
82
+ });
83
+ </script>
@@ -10,14 +10,16 @@
10
10
  <ac-button
11
11
  modifier-classes="is-square is-primary"
12
12
  icon-class="copy"
13
- v-clipboard:copy="`${editorTitle}: &quot;${editorContent}&quot;`"
13
+ v-clipboard:copy="
14
+ `${editorTitle}: ${JSON.stringify(parsedContent, null, 4)}`
15
+ "
14
16
  v-clipboard:success="onCopy"
15
17
  v-clipboard:error="onError"
16
18
  />
17
19
  </header-item>
18
20
  </template>
19
21
  <editor
20
- :value="JSON.stringify(parsedContent, null, 4)"
22
+ :model-value="JSON.stringify(parsedContent, null, 4)"
21
23
  :read-only="true"
22
24
  language="json"
23
25
  :show-minimap="false"
@@ -28,36 +30,43 @@
28
30
  <script>
29
31
  import { defineComponent, defineAsyncComponent } from "vue";
30
32
  import { useToast } from "vue-toastification";
33
+ import Preloader from "../../v2/preloader/Preloader.vue";
34
+ import Banner from "../../v2/banner/Banner.vue";
31
35
 
32
36
  export default defineComponent({
33
37
  props: {
34
38
  open: {
35
39
  type: Boolean,
36
- default: false,
40
+ default: false
37
41
  },
38
42
  editorTitle: {
39
43
  type: String,
40
- default: "",
44
+ default: ""
41
45
  },
42
46
  editorContent: {
43
47
  type: null,
44
- default: () => ({}),
45
- },
48
+ default: () => ({})
49
+ }
46
50
  },
47
51
  emits: ["closemodal"],
48
52
  components: {
49
53
  Modal: defineAsyncComponent(() =>
50
- import("../modal/Modal.vue").then((module) => module.default)
51
- ),
52
- Editor: defineAsyncComponent(() =>
53
- import("../editor/Editor.vue").then((module) => module.default)
54
+ import("../modal/Modal.vue").then(module => module.default)
54
55
  ),
56
+ Editor: defineAsyncComponent({
57
+ loader: () =>
58
+ import("../editor/Editor.vue").then(module => module.default),
59
+ loadingComponent: Preloader,
60
+ delay: 200,
61
+ errorComponent: Banner,
62
+ timeout: 100000,
63
+ }),
55
64
  AcButton: defineAsyncComponent(() =>
56
- import("../button/Button.vue").then((module) => module.default)
65
+ import("../button/Button.vue").then(module => module.default)
57
66
  ),
58
67
  HeaderItem: defineAsyncComponent(() =>
59
- import("../../v2/header/HeaderItem.vue").then((module) => module.default)
60
- ),
68
+ import("../../v2/header/HeaderItem.vue").then(module => module.default)
69
+ )
61
70
  },
62
71
  computed: {
63
72
  parsedContent() {
@@ -66,7 +75,7 @@ export default defineComponent({
66
75
  } catch (e) {
67
76
  return this.editorContent;
68
77
  }
69
- },
78
+ }
70
79
  },
71
80
  setup() {
72
81
  const toast = useToast();
@@ -81,7 +90,7 @@ export default defineComponent({
81
90
  },
82
91
  closeModal() {
83
92
  this.$emit("closemodal", true);
84
- },
85
- },
93
+ }
94
+ }
86
95
  });
87
96
  </script>
@@ -1,10 +1,13 @@
1
1
  <template>
2
- <div class="app-drawer-wrapper">
3
- <div class="drawer-icon">
2
+ <div class="app-drawer-wrapper is-flex">
3
+ <div
4
+ class="drawer-icon is-flex is-justify-content-center is-align-items-center"
5
+ >
4
6
  <svg
5
7
  class="gb_We"
6
8
  focusable="false"
7
9
  viewBox="0 0 24 24"
10
+ style="width: 22px;margin-top: 2px;"
8
11
  :style="{ fill: 'white' }"
9
12
  >
10
13
  <path
@@ -46,13 +49,15 @@ export default defineComponent({
46
49
  props: {
47
50
  apps: {
48
51
  type: Array,
49
- default: () => [],
50
- },
52
+ default: () => []
53
+ }
51
54
  },
52
55
  components: {
53
56
  NavbarItemContent: defineAsyncComponent(() =>
54
- import("../../v2/navbar/NavbarItemContent.vue").then((module) => module.default)
55
- ),
56
- },
57
+ import("../../v2/navbar/NavbarItemContent.vue").then(
58
+ module => module.default
59
+ )
60
+ )
61
+ }
57
62
  });
58
63
  </script>
@@ -1,7 +1,24 @@
1
1
  <template>
2
- <button v-if="themeMode" class="button ac-nav-button" @click="toggleTheme" :title="themeModeIconTooltip" >
3
- <i :class="`fa ${themeModeIconClass} width-15`" />
4
- </button>
2
+ <li class="mt-10 b-t-1 pt-10">
3
+ <ul class="ac-vscrollbar">
4
+ <li>
5
+ <div class="ac-menu-contentt theme-choicee">
6
+ <ul class="is-flex is-flex-direction-row is-justify-content-center">
7
+ <li
8
+ v-for="theme of Object.keys(themeModes)"
9
+ :title="themeModes[theme].displayName"
10
+ @click="themeMode = theme"
11
+ class="p-10 pl-30 pr-30 is-flex-grow-1 has-text-centered"
12
+ :class="{ 'is-active': themeMode === theme }"
13
+ :key="theme"
14
+ >
15
+ <i :class="['fa', themeModes[theme].iconClass]" />
16
+ </li>
17
+ </ul>
18
+ </div>
19
+ </li>
20
+ </ul>
21
+ </li>
5
22
  </template>
6
23
  <script>
7
24
  import { defineComponent } from "vue";
@@ -10,39 +27,31 @@ export default defineComponent({
10
27
  data() {
11
28
  return {
12
29
  themeMode: "",
30
+ themeModes: {
31
+ light: {
32
+ displayName: "Light Theme",
33
+ iconClass: "fa-sun-o",
34
+ },
35
+ dark: {
36
+ displayName: "Dark Theme",
37
+ iconClass: "fa-moon-o",
38
+ },
39
+ system: {
40
+ displayName: "System Theme",
41
+ iconClass: "fa-desktop",
42
+ },
43
+ },
13
44
  };
14
45
  },
15
46
 
16
- computed: {
17
- // to set icon class for theme mode
18
- themeModeIconClass() {
19
- if(this.themeMode === "system") {
20
- return "fa-desktop";
21
- } else if(this.themeMode === "light") {
22
- return "fa-sun-o";
23
- } else if(this.themeMode === "dark") {
24
- return "fa-moon-o";
25
- }
26
- },
27
-
28
- // to set icon tooltip for theme mode
29
- themeModeIconTooltip() {
30
- if(this.themeMode === "system") {
31
- return "System theme";
32
- } else if(this.themeMode === "light") {
33
- return "Light theme";
34
- } else if(this.themeMode === "dark") {
35
- return "Dark theme";
36
- }
37
- }
38
- },
47
+ emits: ["set:theme"],
39
48
 
40
49
  mounted() {
41
50
  // get theme mode from localStorage or set default one
42
51
  this.themeMode = localStorage.getItem("themeMode") || "light";
43
52
  },
44
53
 
45
- destroyed() {
54
+ unmounted() {
46
55
  this.removeColorSchemeEventListener();
47
56
  },
48
57
 
@@ -50,19 +59,16 @@ export default defineComponent({
50
59
  themeMode: {
51
60
  handler(n) {
52
61
  this.onThemeModeChange(n);
53
- }
54
- }
62
+ },
63
+ },
55
64
  },
56
65
 
57
66
  methods: {
58
67
  // handle theme mode button click
59
68
  toggleTheme() {
60
- if(this.themeMode === "light")
61
- this.themeMode = "dark";
62
- else if(this.themeMode === "dark")
63
- this.themeMode = "system";
64
- else if(this.themeMode === "system")
65
- this.themeMode = "light";
69
+ if (this.themeMode === "light") this.themeMode = "dark";
70
+ else if (this.themeMode === "dark") this.themeMode = "system";
71
+ else if (this.themeMode === "system") this.themeMode = "light";
66
72
  },
67
73
 
68
74
  // triggered when theme mode is updated
@@ -70,19 +76,22 @@ export default defineComponent({
70
76
  localStorage.setItem("themeMode", n);
71
77
 
72
78
  let theme = n;
73
- if(n === "system") {
74
- const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
79
+ if (n === "system") {
80
+ const isDarkMode =
81
+ window.matchMedia &&
82
+ window.matchMedia("(prefers-color-scheme: dark)").matches;
75
83
  this.addColorSchemeEventListener();
76
84
  theme = isDarkMode ? "dark" : "light";
77
85
  } else {
78
86
  this.removeColorSchemeEventListener();
79
87
  }
88
+ this.$emit("set:theme", theme);
80
89
  this.handleDarkThemeClass(theme);
81
90
  },
82
91
 
83
92
  // add proper css class to update the ui theme
84
93
  handleDarkThemeClass(currentTheme) {
85
- if(currentTheme === "light") {
94
+ if (currentTheme === "light") {
86
95
  document.documentElement.classList.remove("is-dark-theme");
87
96
  } else {
88
97
  document.documentElement.classList.add("is-dark-theme");
@@ -93,23 +102,19 @@ export default defineComponent({
93
102
  addColorSchemeEventListener() {
94
103
  window
95
104
  .matchMedia("(prefers-color-scheme: dark)")
96
- .addEventListener(
97
- "change", this.handleSystemThemeChange
98
- );
105
+ .addEventListener("change", this.handleSystemThemeChange);
99
106
  },
100
107
 
101
108
  // remove system theme listener event
102
109
  removeColorSchemeEventListener() {
103
110
  window
104
111
  .matchMedia("(prefers-color-scheme: dark)")
105
- .removeEventListener(
106
- "change", this.handleSystemThemeChange
107
- );
112
+ .removeEventListener("change", this.handleSystemThemeChange);
108
113
  },
109
114
 
110
115
  handleSystemThemeChange() {
111
116
  this.onThemeModeChange(this.themeMode);
112
117
  },
113
- }
118
+ },
114
119
  });
115
- </script>
120
+ </script>
@@ -7,31 +7,114 @@
7
7
  <img :src="user.avatar_url" alt="User Photo" />
8
8
  </div>
9
9
  </button>
10
- <navbar-item-content>
11
- <div v-if="user.username" class="user-profile-wrapper">
10
+ <navbar-item-content class="navbar-dropdown-wrapper">
11
+ <div v-if="user.username" class="user-profile-wrapper" @mouseleave="onMouseLeave()">
12
12
  <div class="profile-area">
13
13
  <div class="profile-photo">
14
- <img :src="user.avatar_url" alt="User Photo" />
14
+ <img :src="user.avatar_url" alt="User Photo" class="width-50 height-50" />
15
15
  <button class="camera-icon"></button>
16
16
  </div>
17
- <div class="profile-info">
18
- <p>{{ user.username.toUpperCase() }}</p>
17
+ <div class="profile-info" style="width: calc(100% - 60px);">
18
+ <a
19
+ :href="`${serverDomain}/${user.username}`"
20
+ :title="user.username.toUpperCase()"
21
+ class="line-break-anywhere is-ellipsis-1"
22
+ >{{ user.username.toUpperCase() }}</a
23
+ >
19
24
  <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
20
25
  </div>
21
26
  </div>
22
- <ul>
23
- <li>
27
+ <transition-group name="list" tag="ul">
28
+ <li key="settings">
24
29
  <a :href="`${serverDomain}/user/settings/`">Settings</a>
25
30
  </li>
26
- <template v-if="user.is_admin">
27
- <li>
28
- <a :href="`${serverDomain}/admin`"> Site Administration </a>
29
- </li>
30
- </template>
31
- <li>
32
- <a :href="`${serverDomain}/user/logout`"> Sign out </a>
31
+ <li v-if="user.is_admin" key="site-admin">
32
+ <a :href="`${accountsDomain}/admin`">Site Administration</a>
33
33
  </li>
34
- </ul>
34
+ <li v-if="showAccountSwitcher" :class="`is-${dropDownStatus}`" key="switcher">
35
+ <a class="
36
+ ac-dropdown-button
37
+ is-fullwidth
38
+ is-flex
39
+ is-justify-content-space-between
40
+ is-align-items-center
41
+ "
42
+ @click="toggleList()"
43
+ >
44
+ <span>Switch Account</span>
45
+ <span
46
+ ><i
47
+ :class="`fa fa-angle-${
48
+ dropDownStatus === 'open' ? 'up' : 'down'
49
+ }`"
50
+ ></i
51
+ ></span>
52
+ </a>
53
+ <transition-group name="list" tag="ul"
54
+ class="ac-vscrollbar"
55
+ ref="dropdownItems"
56
+ :style="{ maxHeight: dropDownSectionHeight }"
57
+ >
58
+ <li
59
+ v-for="(org, idx) in formattedOrganizations"
60
+ :key="org.username"
61
+ >
62
+ <a
63
+ class="is-flex is-align-items-center"
64
+ @click="onOrganizationClick(org.username)"
65
+ >
66
+ <div class="width-30 height-30 image">
67
+ <img
68
+ :src="org.avatar_url"
69
+ class="ac-user-profile is-rounded"
70
+ alt="icon"
71
+ />
72
+ </div>
73
+ <div
74
+ class="
75
+ is-flex
76
+ is-align-items-center
77
+ is-justify-content-space-between
78
+ is-fullwidth
79
+ ml-10
80
+ "
81
+ >
82
+ <div class="org-info">
83
+ <strong :title="org.username" class="line-break-anywhere is-ellipsis-1">{{ org.username }}</strong>
84
+ <p>
85
+ {{
86
+ org.isPersonalAccount
87
+ ? "Personal Account"
88
+ : "Organization"
89
+ }}
90
+ </p>
91
+ </div>
92
+ <span
93
+ v-if="idx === 0"
94
+ class="
95
+ material-icons-outlined
96
+ font-size-18
97
+ ml-10
98
+ is-pulled-right
99
+ "
100
+ >
101
+ check
102
+ </span>
103
+ </div>
104
+ </a>
105
+ </li>
106
+ </transition-group>
107
+ </li>
108
+ <li key="dashboard">
109
+ <a :href="`${serverDomain}/dashboard`"> Dashboard </a>
110
+ </li>
111
+ <li key="signout">
112
+ <a :href="`${accountsDomain}/user/logout`"> Sign out </a>
113
+ </li>
114
+ <li key="theme" v-if="showThemeMode">
115
+ <theme-mode @set:theme="setTheme" />
116
+ </li>
117
+ </transition-group>
35
118
  </div>
36
119
  </navbar-item-content>
37
120
  </navbar-item>
@@ -42,6 +125,7 @@ import { defineComponent, defineAsyncComponent } from "vue";
42
125
 
43
126
  export default defineComponent({
44
127
  props: {
128
+ // active user info
45
129
  user: {
46
130
  type: Object,
47
131
  default: () => ({}),
@@ -50,7 +134,25 @@ export default defineComponent({
50
134
  type: String,
51
135
  default: "",
52
136
  },
137
+ accountsDomain: {
138
+ type: String,
139
+ default: "",
140
+ },
141
+ showAccountSwitcher: {
142
+ type: Boolean,
143
+ default: false,
144
+ },
145
+ // all available organization list including personal account
146
+ organizations: {
147
+ type: Array,
148
+ default: () => [],
149
+ },
150
+ showThemeMode: {
151
+ type: Boolean,
152
+ default: false
153
+ }
53
154
  },
155
+ emits: ["set:theme"],
54
156
 
55
157
  components: {
56
158
  NavbarItem: defineAsyncComponent(() =>
@@ -59,6 +161,78 @@ export default defineComponent({
59
161
  NavbarItemContent: defineAsyncComponent(() =>
60
162
  import("../../v2/navbar/NavbarItemContent.vue").then((module) => module.default)
61
163
  ),
164
+ ThemeMode: defineAsyncComponent(() =>
165
+ import("../../v3/navbar/ThemeMode.vue").then((module) => module.default)
166
+ ),
167
+ },
168
+
169
+ computed: {
170
+ formattedOrganizations() {
171
+ let activeUser;
172
+ const filteredList = this.organizations.filter((item) => {
173
+ if (item.username === this.user.username) {
174
+ activeUser = item;
175
+ } else {
176
+ return true;
177
+ }
178
+ return false;
179
+ });
180
+
181
+ filteredList.unshift(activeUser);
182
+
183
+ return filteredList || [];
184
+ },
185
+ },
186
+
187
+ data() {
188
+ return {
189
+ dropDownStatus: "close",
190
+ dropDownSectionHeight: null,
191
+ };
192
+ },
193
+
194
+ methods: {
195
+ toggleList() {
196
+ this.dropDownStatus = this.dropDownStatus === "open" ? "close" : "open";
197
+ this.$nextTick(() => {
198
+ this.$refs["dropdownItems"].$el.scrollTo(0, 0);
199
+ });
200
+ },
201
+ onOrganizationClick(orgName) {
202
+ this.$refs["dropdownItems"].$el.scrollTo(0, 0);
203
+ this.$emit("activeorg$set", orgName);
204
+ },
205
+ onMouseLeave() {
206
+ this.dropDownStatus = "close";
207
+ },
208
+ setTheme(val){
209
+ this.$emit("set:theme", val);
210
+ }
211
+ },
212
+
213
+ watch: {
214
+ dropDownStatus: {
215
+ immediate: true,
216
+ handler(n) {
217
+ if (n === "open") {
218
+ this.$nextTick(() => {
219
+ const dropDownUl = this.$refs["dropdownItems"];
220
+ if (dropDownUl)
221
+ this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
222
+ });
223
+ } else {
224
+ this.dropDownSectionHeight = null;
225
+ }
226
+ },
227
+ },
62
228
  },
63
229
  });
64
- </script>
230
+ </script>
231
+ <style lang="scss" scoped>
232
+ .ac-vscrollbar {
233
+ overflow: auto !important;
234
+ }
235
+ .line-break-anywhere {
236
+ line-break: anywhere;
237
+ }
238
+ </style>