forked from woodpecker-ci/woodpecker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show yml config of pipeline in UI (woodpecker-ci#649)
closes woodpecker-ci#89
- Loading branch information
Showing
8 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// A config for a build. | ||
export type BuildConfig = { | ||
hash: string; | ||
name: string; | ||
data: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<FluidContainer v-if="buildConfigs" class="flex flex-col gap-y-6 text-gray-500 justify-between !py-0"> | ||
<Panel v-for="buildConfig in buildConfigs" :key="buildConfig.hash" :title="buildConfig.name"> | ||
<span class="font-mono whitespace-pre">{{ buildConfig.data }}</span> | ||
</Panel> | ||
</FluidContainer> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, inject, onMounted, Ref, ref, watch } from 'vue'; | ||
import FluidContainer from '~/components/layout/FluidContainer.vue'; | ||
import Panel from '~/components/layout/Panel.vue'; | ||
import useApiClient from '~/compositions/useApiClient'; | ||
import { Build, BuildConfig, Repo } from '~/lib/api/types'; | ||
export default defineComponent({ | ||
name: 'BuildConfig', | ||
components: { | ||
FluidContainer, | ||
Panel, | ||
}, | ||
setup() { | ||
const build = inject<Ref<Build>>('build'); | ||
const apiClient = useApiClient(); | ||
const repo = inject<Ref<Repo>>('repo'); | ||
if (!repo || !build) { | ||
throw new Error('Unexpected: "repo" & "build" should be provided at this place'); | ||
} | ||
const buildConfigs = ref<BuildConfig[]>(); | ||
async function loadBuildConfig() { | ||
if (!repo || !build) { | ||
throw new Error('Unexpected: "repo" & "build" should be provided at this place'); | ||
} | ||
buildConfigs.value = (await apiClient.getBuildConfig(repo.value.owner, repo.value.name, build.value.number)).map( | ||
(i) => ({ | ||
...i, | ||
data: atob(i.data), | ||
}), | ||
); | ||
} | ||
onMounted(() => { | ||
loadBuildConfig(); | ||
}); | ||
watch(build, () => { | ||
loadBuildConfig(); | ||
}); | ||
return { buildConfigs }; | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters