mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-01 21:18:29 +00:00
Add api for forges (#3733)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<a v-if="badgeUrl" :href="badgeUrl" target="_blank">
|
||||
<img :src="badgeUrl" />
|
||||
</a>
|
||||
<IconButton :href="repo.forge_url" :title="$t('repo.open_in_forge')" :icon="forge ?? 'repo'" class="forge" />
|
||||
<IconButton :href="repo.forge_url" :title="$t('repo.open_in_forge')" :icon="forgeIcon" class="forge" />
|
||||
<IconButton
|
||||
v-if="repoPermissions.admin"
|
||||
:to="{ name: 'repo-settings' }"
|
||||
@@ -49,6 +49,7 @@ import { computed, onMounted, provide, ref, toRef, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import type { IconNames } from '~/components/atomic/Icon.vue';
|
||||
import IconButton from '~/components/atomic/IconButton.vue';
|
||||
import ManualPipelinePopup from '~/components/layout/popups/ManualPipelinePopup.vue';
|
||||
import Scaffold from '~/components/layout/scaffold/Scaffold.vue';
|
||||
@@ -56,8 +57,9 @@ import Tab from '~/components/layout/scaffold/Tab.vue';
|
||||
import useApiClient from '~/compositions/useApiClient';
|
||||
import useAuthentication from '~/compositions/useAuthentication';
|
||||
import useConfig from '~/compositions/useConfig';
|
||||
import { useForgeStore } from '~/compositions/useForgeStore';
|
||||
import useNotifications from '~/compositions/useNotifications';
|
||||
import type { RepoPermissions } from '~/lib/api/types';
|
||||
import type { Forge, RepoPermissions } from '~/lib/api/types';
|
||||
import { usePipelineStore } from '~/store/pipelines';
|
||||
import { useRepoStore } from '~/store/repos';
|
||||
|
||||
@@ -76,14 +78,21 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const i18n = useI18n();
|
||||
const config = useConfig();
|
||||
const forgeStore = useForgeStore();
|
||||
|
||||
const { forge } = useConfig(); // TODO: remove this and use the forge type from the corresponding repo
|
||||
const repo = repoStore.getRepo(repositoryId);
|
||||
const repoPermissions = ref<RepoPermissions>();
|
||||
const pipelines = pipelineStore.getRepoPipelines(repositoryId);
|
||||
provide('repo', repo);
|
||||
provide('repo-permissions', repoPermissions);
|
||||
provide('pipelines', pipelines);
|
||||
const forge = ref<Forge>();
|
||||
const forgeIcon = computed<IconNames>(() => {
|
||||
if (forge.value && forge.value.type !== 'addon') {
|
||||
return forge.value.type;
|
||||
}
|
||||
return 'repo';
|
||||
});
|
||||
|
||||
const showManualPipelinePopup = ref(false);
|
||||
|
||||
@@ -102,6 +111,10 @@ async function loadRepo() {
|
||||
|
||||
await repoStore.loadRepo(repositoryId.value);
|
||||
await pipelineStore.loadRepoPipelines(repositoryId.value);
|
||||
|
||||
if (repo.value) {
|
||||
forge.value = (await forgeStore.getForge(repo.value?.forge_id)).value;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user