Show forge icons in UI (#987)

This commit is contained in:
qwerty287
2022-06-17 20:14:01 +02:00
committed by GitHub
parent 99f1b70570
commit 42c745362b
13 changed files with 84 additions and 4 deletions

View File

@@ -21,7 +21,9 @@
<i-ph-prohibit v-else-if="name === 'status-skipped'" class="h-8 w-8" />
<i-entypo-dots-two-vertical v-else-if="name === 'status-started'" class="h-8 w-8" />
<i-ph-check-circle v-else-if="name === 'status-success'" class="h-8 w-8" />
<i-cib-gitea v-else-if="name === 'gitea'" class="h-8 w-8" />
<i-simple-icons-gitea v-else-if="name === 'gitea'" class="h-8 w-8" />
<i-ph-gitlab-logo-simple-fill v-else-if="name === 'gitlab'" class="h-8 w-8" />
<i-mdi-bitbucket v-else-if="name === 'bitbucket'" class="h-8 w-8" />
<i-vaadin-question-circle-o v-else-if="name === 'question'" class="h-6 w-6" />
<i-ic-twotone-add v-else-if="name === 'plus'" class="h-6 w-6" />
<i-mdi-format-list-bulleted v-else-if="name === 'list'" class="h-6 w-6" />
@@ -64,6 +66,8 @@ export type IconNames =
| 'status-started'
| 'status-success'
| 'gitea'
| 'gitlab'
| 'bitbucket'
| 'question'
| 'list'
| 'loading'

View File

@@ -7,6 +7,7 @@ declare global {
WOODPECKER_DOCS: string | undefined;
WOODPECKER_VERSION: string | undefined;
WOODPECKER_CSRF: string | undefined;
WOODPECKER_FORGE: string | undefined;
}
}
@@ -16,4 +17,5 @@ export default () => ({
docs: window.WOODPECKER_DOCS || null,
version: window.WOODPECKER_VERSION,
csrf: window.WOODPECKER_CSRF || null,
forge: window.WOODPECKER_FORGE || null,
});

View File

@@ -13,7 +13,10 @@
target="_blank"
class="flex ml-4 p-1 rounded-full text-color hover:bg-gray-200 hover:text-gray-700 dark:hover:bg-gray-600"
>
<Icon v-if="repo.link_url.startsWith('https://github.com/')" name="github" />
<Icon v-if="forge === 'github'" name="github" />
<Icon v-else-if="forge === 'gitea'" name="gitea" />
<Icon v-else-if="forge === 'gitlab'" name="gitlab" />
<Icon v-else-if="forge === 'bitbucket' || forge === 'stash'" name="bitbucket" />
<Icon v-else name="repo" />
</a>
<IconButton v-if="repoPermissions.admin" class="ml-2" :to="{ name: 'repo-settings' }" icon="settings" />
@@ -41,6 +44,7 @@ import Tab from '~/components/tabs/Tab.vue';
import Tabs from '~/components/tabs/Tabs.vue';
import useApiClient from '~/compositions/useApiClient';
import useAuthentication from '~/compositions/useAuthentication';
import useConfig from '~/compositions/useConfig';
import useNotifications from '~/compositions/useNotifications';
import { RepoPermissions } from '~/lib/api/types';
import BuildStore from '~/store/builds';
@@ -79,6 +83,7 @@ export default defineComponent({
const router = useRouter();
const i18n = useI18n();
const { forge } = useConfig();
const repo = repoStore.getRepo(repoOwner, repoName);
const repoPermissions = ref<RepoPermissions>();
const builds = buildStore.getSortedBuilds(repoOwner, repoName);
@@ -129,7 +134,7 @@ export default defineComponent({
},
});
return { repo, repoPermissions, badgeUrl, activeTab };
return { repo, repoPermissions, badgeUrl, activeTab, forge };
},
});
</script>