mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Add loading spinner to repo list (#3310)
This commit is contained in:
parent
450a437cb6
commit
a801f8cbc3
1 changed files with 25 additions and 17 deletions
|
@ -5,23 +5,28 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<ListItem
|
<template v-if="repos !== undefined && repos.length > 0">
|
||||||
v-for="repo in searchedRepos"
|
<ListItem
|
||||||
:key="repo.id"
|
v-for="repo in searchedRepos"
|
||||||
class="items-center"
|
:key="repo.id"
|
||||||
:to="repo.active ? { name: 'repo', params: { repoId: repo.id } } : undefined"
|
class="items-center"
|
||||||
>
|
:to="repo.active ? { name: 'repo', params: { repoId: repo.id } } : undefined"
|
||||||
<span class="text-wp-text-100">{{ repo.full_name }}</span>
|
>
|
||||||
<span v-if="repo.active" class="ml-auto text-wp-text-alt-100">{{ $t('repo.enable.enabled') }}</span>
|
<span class="text-wp-text-100">{{ repo.full_name }}</span>
|
||||||
<div v-else class="ml-auto flex items-center">
|
<span v-if="repo.active" class="ml-auto text-wp-text-alt-100">{{ $t('repo.enable.enabled') }}</span>
|
||||||
<Badge v-if="repo.id" class="<md:hidden mr-2" :label="$t('repo.enable.disabled')" />
|
<div v-else class="ml-auto flex items-center">
|
||||||
<Button
|
<Badge v-if="repo.id" class="<md:hidden mr-2" :label="$t('repo.enable.disabled')" />
|
||||||
:text="$t('repo.enable.enable')"
|
<Button
|
||||||
:is-loading="isActivatingRepo && repoToActivate?.forge_remote_id === repo.forge_remote_id"
|
:text="$t('repo.enable.enable')"
|
||||||
@click="activateRepo(repo)"
|
:is-loading="isActivatingRepo && repoToActivate?.forge_remote_id === repo.forge_remote_id"
|
||||||
/>
|
@click="activateRepo(repo)"
|
||||||
</div>
|
/>
|
||||||
</ListItem>
|
</div>
|
||||||
|
</ListItem>
|
||||||
|
</template>
|
||||||
|
<div v-else-if="loading" class="flex justify-center text-wp-text-100">
|
||||||
|
<Icon name="spinner" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Scaffold>
|
</Scaffold>
|
||||||
</template>
|
</template>
|
||||||
|
@ -49,11 +54,14 @@ const repos = ref<Repo[]>();
|
||||||
const repoToActivate = ref<Repo>();
|
const repoToActivate = ref<Repo>();
|
||||||
const search = ref('');
|
const search = ref('');
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
const { searchedRepos } = useRepoSearch(repos, search);
|
const { searchedRepos } = useRepoSearch(repos, search);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
loading.value = true;
|
||||||
repos.value = await apiClient.getRepoList({ all: true });
|
repos.value = await apiClient.getRepoList({ all: true });
|
||||||
|
loading.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { doSubmit: activateRepo, isLoading: isActivatingRepo } = useAsyncAction(async (repo: Repo) => {
|
const { doSubmit: activateRepo, isLoading: isActivatingRepo } = useAsyncAction(async (repo: Repo) => {
|
||||||
|
|
Loading…
Reference in a new issue