mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-29 10:40:47 +00:00
Show changed files of pipeline in UI (#650)
This commit is contained in:
parent
37c82b905c
commit
6eecfa4b88
|
@ -37,7 +37,7 @@ export default defineComponent({
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tab.value = {
|
tab.value = {
|
||||||
id: props.title.toLocaleLowerCase() || tabs.value.length.toString(),
|
id: props.id || props.title.toLocaleLowerCase().replace(' ', '-') || tabs.value.length.toString(),
|
||||||
title: props.title,
|
title: props.title,
|
||||||
};
|
};
|
||||||
tabs.value.push(tab.value);
|
tabs.value.push(tab.value);
|
||||||
|
|
|
@ -58,6 +58,11 @@ const routes: RouteRecordRaw[] = [
|
||||||
component: (): Component => import('~/views/repo/build/Build.vue'),
|
component: (): Component => import('~/views/repo/build/Build.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'changed-files',
|
||||||
|
name: 'repo-build-changed-files',
|
||||||
|
component: (): Component => import('~/views/repo/build/BuildChangedFiles.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'config',
|
path: 'config',
|
||||||
name: 'repo-build-config',
|
name: 'repo-build-config',
|
||||||
|
|
38
web/src/views/repo/build/BuildChangedFiles.vue
Normal file
38
web/src/views/repo/build/BuildChangedFiles.vue
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<template>
|
||||||
|
<FluidContainer v-if="build" class="flex flex-col gap-y-6 text-gray-500 justify-between py-0">
|
||||||
|
<Panel>
|
||||||
|
<div v-if="build.changed_files === undefined || build.changed_files.length < 1" class="w-full">
|
||||||
|
<span class="text-gray-500">No files have been changed.</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="file in build.changed_files" v-else :key="file" class="w-full">
|
||||||
|
<div>- {{ file }}</div>
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
</FluidContainer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent, inject, Ref } from 'vue';
|
||||||
|
|
||||||
|
import FluidContainer from '~/components/layout/FluidContainer.vue';
|
||||||
|
import Panel from '~/components/layout/Panel.vue';
|
||||||
|
import { Build } from '~/lib/api/types';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'BuildChangedFiles',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
FluidContainer,
|
||||||
|
Panel,
|
||||||
|
},
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
const build = inject<Ref<Build>>('build');
|
||||||
|
if (!build) {
|
||||||
|
throw new Error('Unexpected: "build" should be provided at this place');
|
||||||
|
}
|
||||||
|
|
||||||
|
return { build };
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -32,6 +32,7 @@
|
||||||
<Tabs v-model="activeTab" disable-hash-mode>
|
<Tabs v-model="activeTab" disable-hash-mode>
|
||||||
<Tab id="tasks" title="Tasks" />
|
<Tab id="tasks" title="Tasks" />
|
||||||
<Tab id="config" title="Config" />
|
<Tab id="config" title="Config" />
|
||||||
|
<Tab id="changed-files" :title="`Changed files (${build.changed_files?.length || 0})`" />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
<div class="flex justify-between gap-x-4 text-gray-500 flex-shrink-0 ml-auto">
|
<div class="flex justify-between gap-x-4 text-gray-500 flex-shrink-0 ml-auto">
|
||||||
|
@ -193,6 +194,10 @@ export default defineComponent({
|
||||||
|
|
||||||
const activeTab = computed({
|
const activeTab = computed({
|
||||||
get() {
|
get() {
|
||||||
|
if (route.name === 'repo-build-changed-files') {
|
||||||
|
return 'changed-files';
|
||||||
|
}
|
||||||
|
|
||||||
if (route.name === 'repo-build-config') {
|
if (route.name === 'repo-build-config') {
|
||||||
return 'config';
|
return 'config';
|
||||||
}
|
}
|
||||||
|
@ -204,6 +209,10 @@ export default defineComponent({
|
||||||
router.replace({ name: 'repo-build' });
|
router.replace({ name: 'repo-build' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tab === 'changed-files') {
|
||||||
|
router.replace({ name: 'repo-build-changed-files' });
|
||||||
|
}
|
||||||
|
|
||||||
if (tab === 'config') {
|
if (tab === 'config') {
|
||||||
router.replace({ name: 'repo-build-config' });
|
router.replace({ name: 'repo-build-config' });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue