mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
fix back links (#529)
* fix back links * disable back navigation for now
This commit is contained in:
parent
56f957b4e6
commit
581f0ecba9
3 changed files with 23 additions and 2 deletions
14
web/src/compositions/useRouteBackOrDefault.ts
Normal file
14
web/src/compositions/useRouteBackOrDefault.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { RouteLocationRaw, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
export function useRouteBackOrDefault(to: RouteLocationRaw) {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
// TODO: use history navigation once we have found a solution for filtering external history entries
|
||||||
|
// if (window.history.length > 2) {
|
||||||
|
// router.back();
|
||||||
|
// } else {
|
||||||
|
router.replace(to);
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<template v-if="build && repo">
|
<template v-if="build && repo">
|
||||||
<FluidContainer class="flex border-b mb-4 items-center dark:border-gray-600 min-w-0">
|
<FluidContainer class="flex border-b mb-4 items-center dark:border-gray-600 min-w-0">
|
||||||
<IconButton icon="back" class="flex-shrink-0" @click="$router.back()" />
|
<IconButton icon="back" class="flex-shrink-0" @click="goBack" />
|
||||||
<h1 class="text-xl ml-2 text-gray-500 whitespace-nowrap overflow-hidden overflow-ellipsis">
|
<h1 class="text-xl ml-2 text-gray-500 whitespace-nowrap overflow-hidden overflow-ellipsis">
|
||||||
Pipeline #{{ buildId }} - {{ message }}
|
Pipeline #{{ buildId }} - {{ message }}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -83,6 +83,7 @@ import { useAsyncAction } from '~/compositions/useAsyncAction';
|
||||||
import useBuild from '~/compositions/useBuild';
|
import useBuild from '~/compositions/useBuild';
|
||||||
import { useFavicon } from '~/compositions/useFavicon';
|
import { useFavicon } from '~/compositions/useFavicon';
|
||||||
import useNotifications from '~/compositions/useNotifications';
|
import useNotifications from '~/compositions/useNotifications';
|
||||||
|
import { useRouteBackOrDefault } from '~/compositions/useRouteBackOrDefault';
|
||||||
import { Repo, RepoPermissions } from '~/lib/api/types';
|
import { Repo, RepoPermissions } from '~/lib/api/types';
|
||||||
import BuildStore from '~/store/builds';
|
import BuildStore from '~/store/builds';
|
||||||
import { findProc } from '~/utils/helpers';
|
import { findProc } from '~/utils/helpers';
|
||||||
|
@ -249,6 +250,7 @@ export default defineComponent({
|
||||||
restartBuild,
|
restartBuild,
|
||||||
approveBuild,
|
approveBuild,
|
||||||
declineBuild,
|
declineBuild,
|
||||||
|
goBack: useRouteBackOrDefault({ name: 'repo' }),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<FluidContainer>
|
<FluidContainer>
|
||||||
<div class="flex border-b items-center pb-4 mb-4 dark:border-gray-600">
|
<div class="flex border-b items-center pb-4 mb-4 dark:border-gray-600">
|
||||||
<IconButton icon="back" @click="$router.back()" />
|
<IconButton icon="back" @click="goBack" />
|
||||||
<h1 class="text-xl ml-2 text-gray-500">Settings</h1>
|
<h1 class="text-xl ml-2 text-gray-500">Settings</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import SecretsTab from '~/components/repo/settings/SecretsTab.vue';
|
||||||
import Tab from '~/components/tabs/Tab.vue';
|
import Tab from '~/components/tabs/Tab.vue';
|
||||||
import Tabs from '~/components/tabs/Tabs.vue';
|
import Tabs from '~/components/tabs/Tabs.vue';
|
||||||
import useNotifications from '~/compositions/useNotifications';
|
import useNotifications from '~/compositions/useNotifications';
|
||||||
|
import { useRouteBackOrDefault } from '~/compositions/useRouteBackOrDefault';
|
||||||
import { RepoPermissions } from '~/lib/api/types';
|
import { RepoPermissions } from '~/lib/api/types';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -71,6 +72,10 @@ export default defineComponent({
|
||||||
await router.replace({ name: 'home' });
|
await router.replace({ name: 'home' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
goBack: useRouteBackOrDefault({ name: 'repo' }),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue