Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/server/vue-cli/src/components/Icons/UserIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ const props = defineProps({

const color = useStrToColor();

const userIconName = computed(() => props.value.charAt(0).toUpperCase());
const userIconName = computed(
() => (props.value || "?").charAt(0).toUpperCase()
);
</script>
83 changes: 41 additions & 42 deletions web/server/vue-cli/src/components/Layout/HeaderMenuItems.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
<template>
<div>
<v-dialog
v-model="dialog"
width="500"
:scrollable="true"
>
<v-card>
<v-card-title
class="headline primary white--text"
primary-title
>
Credits
<v-dialog
v-model="dialog"
width="500"
:scrollable="true"
>
<v-card>
<v-card-title
class="headline primary black-text"
primary-title
>
Credits

<v-spacer />
<v-spacer />

<v-btn icon @click="dialog = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
<v-list>
<v-list-item
v-for="credit in credits"
:key="credit.name"
>
<template v-slot:prepend>
<v-btn
:href="`http://github.com/${credit.github}`"
target="_blank"
icon
color="primary"
>
<v-icon>mdi-github</v-icon>
</v-btn>
</template>
<v-btn icon @click="dialog = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
<v-list>
<v-list-item
v-for="credit in credits"
:key="credit.name"
>
<template v-slot:prepend>
<v-btn
:href="`http://github.com/${credit.github}`"
target="_blank"
icon
color="primary"
>
<v-icon>mdi-github</v-icon>
</v-btn>
</template>


<v-list-item-title>{{ credit.name }}</v-list-item-title>
<v-list-item-subtitle>{{ credit.email }}</v-list-item-subtitle>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</v-dialog>
<v-list-item-title>{{ credit.name }}</v-list-item-title>
<v-list-item-subtitle>{{ credit.email }}</v-list-item-subtitle>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</v-dialog>

<v-card>
<v-list>
<v-list-item
href="http://github.com/Ericsson/codechecker"
Expand Down Expand Up @@ -93,7 +92,7 @@
</v-list-item-title>
</v-list-item>
</v-list>
</div>
</v-card>
</template>

<script setup>
Expand Down
15 changes: 11 additions & 4 deletions web/server/vue-cli/src/components/Layout/UserInfoMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,16 @@ watch(currentProduct, () => {
}));
});

onMounted(() => {
getLoggedInUser();
watch(currentUser, () => {
if (!currentUser.value) {
systemPermissions.value = [];
return;
}
fetchPermissions();
}, { immediate: true });

onMounted(async () => {
await getLoggedInUser();
});

function fetchPermissions() {
Expand All @@ -151,7 +158,7 @@ function logOut() {
});
}

function getLoggedInUser() {
store.dispatch(GET_LOGGED_IN_USER);
async function getLoggedInUser() {
await store.dispatch(GET_LOGGED_IN_USER);
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function decodeValue(diffTypeStr) {

function updateReportFilter() {
let diffTypeVal = baseSelectOptionFilter.selectedItems.value.id;
if (Array.isArray(baseSelectOptionFilter.selectedItems.value)) {
if (Array.isArray(baseSelectOptionFilter.selectedItems.value) &&
baseSelectOptionFilter.selectedItems.value.length !== 0) {
diffTypeVal = baseSelectOptionFilter.selectedItems.value[0].id;
}
baseSelectOptionFilter.setCmpData({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-card
elevation="0"
elevation="4"
>
<slot name="prepend-toolbar" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ watch(menu, async show => {
items.value = await props.fetchItems();
reloadItems.value = false;
}
} else if (!preventApply.value) {
} else if (!preventApply.value && items.value.length > 0) {
applyFilters(allSelectedItems.value);
}
});
Expand Down Expand Up @@ -203,8 +203,7 @@ function filterIsChanged(_selectedItems) {
}

function cancel() {
preventApply.value = true;
menu.value = false;
closeMenu();
emit("cancel");
}

Expand Down
4 changes: 4 additions & 0 deletions web/server/vue-cli/src/composables/useStrToColor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export function useStrToColor() {
const strToColor = str => {
if (!str) {
str = "?";
}

let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
Expand Down
2 changes: 1 addition & 1 deletion web/server/vue-cli/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function login() {
error.value = false;

const returnTo = route.query["return_to"];
router.replace(returnTo || { name: "products" });
router.replace(returnTo ? { path: returnTo } : { name: "products" });
}).catch(err => {
errorMsg.value = `Failed to log in! ${err.message}`;
error.value = true;
Expand Down
15 changes: 8 additions & 7 deletions web/server/vue-cli/src/views/Products.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@
<v-spacer />

<v-col cols="auto" align="right">
<span
v-if="isSuperUser"
>
<v-spacer />

<edit-announcement-btn />
<span>
<edit-announcement-btn
v-if="isSuperUser"
/>

<edit-global-permission-btn />
<edit-global-permission-btn
v-if="isSuperUser"
/>

<new-product-btn
v-if="isSuperUser"
:is-super-user="isSuperUser"
@on-complete="onCompleteNewProduct"
/>
Expand Down
Loading