satellite/web: hide project details link for project members

This change hides the project details link, introduced for the issue
linked below, if the user is only a member and not the owner of the
project.

Related: https://github.com/storj/storj/issues/5930

Change-Id: If6b0817dfa32f2f661629cc158eb4fb44dfe9ffc
This commit is contained in:
Wilfred Asomani 2023-06-09 08:39:30 +00:00 committed by Storj Robot
parent 8a01bcfb2b
commit 8f7c59de84
2 changed files with 16 additions and 2 deletions

View File

@ -47,7 +47,7 @@
<p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p> <p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p>
</div> </div>
</div> </div>
<div v-if="isAllProjectsDashboard" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick"> <div v-if="isAllProjectsDashboard && isProjectOwner" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<InfoIcon /> <InfoIcon />
<p class="project-selection__dropdown__link-container__label">Project Details</p> <p class="project-selection__dropdown__link-container__label">Project Details</p>
</div> </div>
@ -259,6 +259,13 @@ const isAccountDropdownShown = ref<boolean>(false);
const isOpened = ref<boolean>(false); const isOpened = ref<boolean>(false);
const isLoading = ref<boolean>(false); const isLoading = ref<boolean>(false);
/*
* Whether the user is the owner of the selected project.
*/
const isProjectOwner = computed((): boolean => {
return usersStore.state.user.id === projectsStore.state.selectedProject.ownerId;
});
/** /**
* Indicates if all projects dashboard should be used. * Indicates if all projects dashboard should be used.
*/ */

View File

@ -42,7 +42,7 @@
<p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p> <p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p>
</div> </div>
</div> </div>
<div v-if="isAllProjectsDashboard" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick"> <div v-if="isAllProjectsDashboard && isProjectOwner" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<InfoIcon /> <InfoIcon />
<p class="project-selection__dropdown__link-container__label">Project Details</p> <p class="project-selection__dropdown__link-container__label">Project Details</p>
</div> </div>
@ -131,6 +131,13 @@ const isOnboardingTour = computed((): boolean => {
return route.path.includes(RouteConfig.OnboardingTour.path); return route.path.includes(RouteConfig.OnboardingTour.path);
}); });
/*
* Whether the user is the owner of the selected project.
*/
const isProjectOwner = computed((): boolean => {
return userStore.state.user.id === projectsStore.state.selectedProject.ownerId;
});
/** /**
* Indicates if all projects dashboard is enabled. * Indicates if all projects dashboard is enabled.
*/ */