satellite/{console,web}: prevent unneeded redirect to all projects dashboard
This change prevents the redirect to all projects dashboard when no project is selected (if all projects dash is enabled). Since a previously selected project id is saved in local storage, it is used to store it's associated project in memory. This change also makes a small change to a test that ignores potential failures. Issue: https://github.com/storj/storj/issues/5920 Change-Id: Ie758893dfb655893520c642fb47b934cd59f177e
This commit is contained in:
parent
aa64162b44
commit
eb4fd2180b
@ -1599,9 +1599,8 @@ func TestPaymentsWalletPayments(t *testing.T) {
|
||||
LogIndex int
|
||||
}
|
||||
err = json.NewDecoder(bytes.NewReader(txn.Metadata)).Decode(&meta)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
expected = append(expected, console.PaymentInfo{
|
||||
ID: fmt.Sprintf("%s#%d", meta.ReferenceID, meta.LogIndex),
|
||||
Type: txn.Source,
|
||||
|
@ -171,7 +171,6 @@ import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useAppStore } from '@/store/modules/appStore';
|
||||
import { MODALS } from '@/utils/constants/appStatePopUps';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
|
||||
import AccessGrantsItem from '@/components/accessGrants/AccessGrantsItem.vue';
|
||||
import VButton from '@/components/common/VButton.vue';
|
||||
@ -190,7 +189,6 @@ const analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
const appStore = useAppStore();
|
||||
const agStore = useAccessGrantsStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const configStore = useConfigStore();
|
||||
const notify = useNotify();
|
||||
const router = useRouter();
|
||||
|
||||
@ -335,11 +333,6 @@ function trackPageVisit(link: string): void {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (configStore.state.config.allProjectsDashboard && !projectsStore.state.selectedProject.id) {
|
||||
await router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await agStore.getAccessGrants(FIRST_PAGE, projectsStore.state.selectedProject.id);
|
||||
areGrantsFetching.value = false;
|
||||
|
@ -100,7 +100,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { User } from '@/types/users';
|
||||
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
|
||||
@ -110,19 +109,14 @@ import { useLoading } from '@/composables/useLoading';
|
||||
import { Duration } from '@/utils/time';
|
||||
import { useUsersStore } from '@/store/modules/usersStore';
|
||||
import { useAppStore } from '@/store/modules/appStore';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
|
||||
import VButton from '@/components/common/VButton.vue';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const usersStore = useUsersStore();
|
||||
const configStore = useConfigStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const notify = useNotify();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { isLoading, withLoading } = useLoading();
|
||||
|
||||
/**
|
||||
@ -139,13 +133,6 @@ const userDuration = computed((): Duration | null => {
|
||||
return usersStore.state.settings.sessionDuration;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns whether we're on the settings page on the all projects dashboard.
|
||||
*/
|
||||
const isOnAllDashboardSettings = computed((): boolean => {
|
||||
return route.path.includes(RouteConfig.AccountSettings.path);
|
||||
});
|
||||
|
||||
/**
|
||||
* Toggles enable MFA modal visibility.
|
||||
*/
|
||||
@ -220,11 +207,6 @@ async function generateNewMFARecoveryCodes(): Promise<void> {
|
||||
* Lifecycle hook after initial render where user info is fetching.
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (!isOnAllDashboardSettings.value && !projectsStore.state.selectedProject.id) {
|
||||
router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
|
||||
usersStore.getUser();
|
||||
});
|
||||
</script>
|
||||
|
@ -51,13 +51,9 @@ import { NavigationLink } from '@/types/navigation';
|
||||
import { useNotify } from '@/utils/hooks';
|
||||
import { useBillingStore } from '@/store/modules/billingStore';
|
||||
import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const billingStore = useBillingStore();
|
||||
const configStore = useConfigStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const notify = useNotify();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@ -152,11 +148,6 @@ function routeToCoupons(): void {
|
||||
* Fetches account balance.
|
||||
*/
|
||||
onMounted(async (): Promise<void> => {
|
||||
if (!isOnAllDashboardSettings.value && !projectsStore.state.selectedProject.id) {
|
||||
await router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await billingStore.getBalance();
|
||||
} catch (error) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { LocalData } from '@/utils/localData';
|
||||
import { BucketPage } from '@/types/buckets';
|
||||
@ -31,8 +30,6 @@ import { useNotify } from '@/utils/hooks';
|
||||
import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
|
||||
import EncryptionBanner from '@/components/objects/EncryptionBanner.vue';
|
||||
import BucketsTable from '@/components/objects/BucketsTable.vue';
|
||||
@ -42,9 +39,7 @@ import WhitePlusIcon from '@/../static/images/common/plusWhite.svg';
|
||||
const bucketsStore = useBucketsStore();
|
||||
const appStore = useAppStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const configStore = useConfigStore();
|
||||
const notify = useNotify();
|
||||
const router = useRouter();
|
||||
|
||||
const analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
|
||||
@ -128,11 +123,6 @@ function hideBanner(): void {
|
||||
* Sets bucket view.
|
||||
*/
|
||||
onMounted(async (): Promise<void> => {
|
||||
if (configStore.state.config.allProjectsDashboard && !projectsStore.state.selectedProject.id) {
|
||||
await router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
|
||||
isServerSideEncryptionBannerHidden.value = LocalData.getServerSideEncryptionBannerHidden();
|
||||
await setBucketsView();
|
||||
});
|
||||
|
@ -7,29 +7,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { RouteConfig } from '@/router';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
|
||||
const configStore = useConfigStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
onMounted(() => {
|
||||
// go back to all projects dashboard if there's no project selected, except on the pricing plan selection step.
|
||||
if (configStore.state.config.allProjectsDashboard
|
||||
&& !projectsStore.state.selectedProject.id
|
||||
&& route.name !== RouteConfig.PricingPlanStep.name
|
||||
) {
|
||||
router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tour-area {
|
||||
|
@ -459,10 +459,6 @@ onMounted(async (): Promise<void> => {
|
||||
|
||||
const projectID = selectedProject.value.id;
|
||||
if (!projectID) {
|
||||
if (configStore.state.config.allProjectsDashboard) {
|
||||
await router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
const onboardingPath = RouteConfig.OnboardingTour.with(configStore.firstOnboardingStep).path;
|
||||
|
||||
analytics.pageVisit(onboardingPath);
|
||||
|
@ -48,7 +48,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import {
|
||||
ProjectMember,
|
||||
@ -58,8 +57,6 @@ import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames
|
||||
import { useNotify } from '@/utils/hooks';
|
||||
import { useProjectMembersStore } from '@/store/modules/projectMembersStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { useConfigStore } from '@/store/modules/configStore';
|
||||
|
||||
import VLoader from '@/components/common/VLoader.vue';
|
||||
import HeaderArea from '@/components/team/HeaderArea.vue';
|
||||
@ -70,9 +67,7 @@ import EmptySearchResultIcon from '@/../static/images/common/emptySearchResult.s
|
||||
|
||||
const pmStore = useProjectMembersStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const configStore = useConfigStore();
|
||||
const notify = useNotify();
|
||||
const router = useRouter();
|
||||
|
||||
const FIRST_PAGE = 1;
|
||||
|
||||
@ -158,11 +153,6 @@ async function onPageChange(index: number, limit: number): Promise<void> {
|
||||
* Fetches first page of team members list of current project.
|
||||
*/
|
||||
onMounted(async (): Promise<void> => {
|
||||
if (configStore.state.config.allProjectsDashboard && !projectsStore.state.selectedProject.id) {
|
||||
await router.push(RouteConfig.AllProjectsDashboard.path);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await pmStore.getProjectMembers(FIRST_PAGE, projectsStore.state.selectedProject.id);
|
||||
|
||||
|
@ -791,12 +791,14 @@ onMounted(async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (projects.length) {
|
||||
selectProject(projects);
|
||||
}
|
||||
|
||||
if (!configStore.state.config.allProjectsDashboard) {
|
||||
try {
|
||||
if (!projects.length) {
|
||||
await projectsStore.createDefaultProject(usersStore.state.user.id);
|
||||
} else {
|
||||
selectProject(projects);
|
||||
}
|
||||
|
||||
const onboardingPath = RouteConfig.OnboardingTour.with(configStore.firstOnboardingStep).path;
|
||||
|
Loading…
Reference in New Issue
Block a user