@appscode/design-system 2.17.67 → 2.17.68
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.
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import type { User } from "../../types/user";
|
|
|
8
8
|
|
|
9
9
|
export interface FormatedOrgs extends User {
|
|
10
10
|
isPersonalAccount?: boolean;
|
|
11
|
+
orgType?: number;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export interface Props {
|
|
@@ -43,19 +44,28 @@ const dropDownSectionHeight = ref<string | null>(null);
|
|
|
43
44
|
const dropdownItems = ref(null as { $el: HTMLElement } | null);
|
|
44
45
|
|
|
45
46
|
const formattedOrganizations = computed(() => {
|
|
46
|
-
let activeUser:
|
|
47
|
+
let activeUser: FormatedOrgs | undefined = undefined;
|
|
47
48
|
const filteredList = props.organizations.filter((item) => {
|
|
48
49
|
if (item.username === props.user.username) {
|
|
49
50
|
activeUser = item;
|
|
50
|
-
|
|
51
|
-
return true;
|
|
51
|
+
return false;
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return true;
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
filteredList.sort((a, b) => {
|
|
57
|
+
if (a.orgType === 6 && b.orgType !== 6) return -1;
|
|
58
|
+
if (a.orgType !== 6 && b.orgType === 6) return 1;
|
|
59
|
+
return 0;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (activeUser) {
|
|
63
|
+
const insertAt = filteredList.findIndex((item) => item.orgType !== 6);
|
|
64
|
+
if (insertAt === -1) filteredList.push(activeUser);
|
|
65
|
+
else filteredList.splice(insertAt, 0, activeUser);
|
|
66
|
+
}
|
|
57
67
|
|
|
58
|
-
return filteredList
|
|
68
|
+
return filteredList;
|
|
59
69
|
});
|
|
60
70
|
|
|
61
71
|
const toggleList = () => {
|
|
@@ -65,8 +75,8 @@ const toggleList = () => {
|
|
|
65
75
|
});
|
|
66
76
|
};
|
|
67
77
|
|
|
68
|
-
const onOrganizationClick = (orgName: string
|
|
69
|
-
if (
|
|
78
|
+
const onOrganizationClick = (orgName: string) => {
|
|
79
|
+
if (orgName === props.user.username) return;
|
|
70
80
|
dropdownItems.value?.$el.scrollTo(0, 0);
|
|
71
81
|
emit("activeorg$set", orgName);
|
|
72
82
|
handleIsActiveChange("");
|
|
@@ -128,7 +138,13 @@ function handleIsActiveChange(isActive: string) {
|
|
|
128
138
|
<div class="profile-info" style="width: calc(100% - 60px)">
|
|
129
139
|
<strong> {{ user.username }} </strong>
|
|
130
140
|
<p>
|
|
131
|
-
{{
|
|
141
|
+
{{
|
|
142
|
+
user.orgType === 6
|
|
143
|
+
? "Administrative Org"
|
|
144
|
+
: user.isPersonalAccount || user.is_admin
|
|
145
|
+
? "Personal Account"
|
|
146
|
+
: "Organization"
|
|
147
|
+
}}
|
|
132
148
|
</p>
|
|
133
149
|
</div>
|
|
134
150
|
</div>
|
|
@@ -152,8 +168,8 @@ function handleIsActiveChange(isActive: string) {
|
|
|
152
168
|
ref="dropdownItems"
|
|
153
169
|
:style="{ maxHeight: dropDownSectionHeight }"
|
|
154
170
|
>
|
|
155
|
-
<li v-for="
|
|
156
|
-
<a class="is-flex is-align-items-center" @click="onOrganizationClick(org.username
|
|
171
|
+
<li v-for="org in formattedOrganizations" :key="org.username">
|
|
172
|
+
<a class="is-flex is-align-items-center" @click="onOrganizationClick(org.username)">
|
|
157
173
|
<div class="width-30 height-30 image">
|
|
158
174
|
<img :src="org.avatar_url" class="ac-user-profile is-rounded" alt="icon" />
|
|
159
175
|
</div>
|
|
@@ -163,10 +179,19 @@ function handleIsActiveChange(isActive: string) {
|
|
|
163
179
|
org.username
|
|
164
180
|
}}</strong>
|
|
165
181
|
<p>
|
|
166
|
-
{{
|
|
182
|
+
{{
|
|
183
|
+
org.orgType === 6
|
|
184
|
+
? "Administrative Org"
|
|
185
|
+
: org.isPersonalAccount
|
|
186
|
+
? "Personal Account"
|
|
187
|
+
: "Organization"
|
|
188
|
+
}}
|
|
167
189
|
</p>
|
|
168
190
|
</div>
|
|
169
|
-
<span
|
|
191
|
+
<span
|
|
192
|
+
v-if="org.username === user.username"
|
|
193
|
+
class="material-icons font-size-18 ml-10 is-pulled-right"
|
|
194
|
+
>
|
|
170
195
|
<HeroiconsCheck />
|
|
171
196
|
</span>
|
|
172
197
|
</div>
|