mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-09-25 05:00:05 +00:00
cleanup
This commit is contained in:
parent
5ee4a0f7d3
commit
dfb59b92b9
3 changed files with 10 additions and 50 deletions
|
@ -172,8 +172,8 @@ func apiRoutes(e *gin.RouterGroup) {
|
|||
readGlobalSecrets := apiBase.Group("/secrets")
|
||||
{
|
||||
readGlobalSecrets.Use(session.MustUser())
|
||||
readGlobalSecrets.GET("", api.GetSecretList)
|
||||
readGlobalSecrets.GET("/:secret", api.GetSecret)
|
||||
readGlobalSecrets.GET("", api.GetGlobalSecretList)
|
||||
readGlobalSecrets.GET("/:secret", api.GetGlobalSecret)
|
||||
}
|
||||
secrets := apiBase.Group("/secrets")
|
||||
{
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-if="loading">loading ...</div>
|
||||
<div v-else>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<Button v-if="hasMore" :is-loading="loading" text="Load more" class="mx-auto mt-4" @click="nextPage" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick } from 'vue';
|
||||
|
||||
import Button from '~/components/atomic/Button.vue';
|
||||
import { usePagination } from '~/compositions/usePaginate';
|
||||
|
||||
const props = defineProps<{
|
||||
pagination: ReturnType<typeof usePagination>;
|
||||
}>();
|
||||
|
||||
const loading = computed(() => props.pagination.loading.value);
|
||||
const hasMore = computed(() => props.pagination.hasMore.value);
|
||||
|
||||
function scrollDown() {
|
||||
window.scrollTo({
|
||||
top: document.body.scrollHeight,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
|
||||
function nextPage() {
|
||||
props.pagination.nextPage();
|
||||
nextTick(() => {
|
||||
setTimeout(scrollDown, 100);
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -14,15 +14,14 @@
|
|||
<Button v-else :text="$t('repo.settings.secrets.add')" start-icon="plus" @click="showAddSecret" />
|
||||
</template>
|
||||
|
||||
<Pagination v-if="!selectedSecret" :pagination="secretsPagination">
|
||||
<SecretList
|
||||
:model-value="secrets"
|
||||
i18n-prefix="repo.settings.secrets."
|
||||
:is-deleting="isDeleting"
|
||||
@edit="editSecret"
|
||||
@delete="deleteSecret"
|
||||
/>
|
||||
</Pagination>
|
||||
<SecretList
|
||||
v-if="!selectedSecret"
|
||||
:model-value="secrets"
|
||||
i18n-prefix="repo.settings.secrets."
|
||||
:is-deleting="isDeleting"
|
||||
@edit="editSecret"
|
||||
@delete="deleteSecret"
|
||||
/>
|
||||
|
||||
<SecretEdit
|
||||
v-else
|
||||
|
@ -84,7 +83,6 @@ async function loadSecrets(page: number, level: 'repo' | 'org' | 'global'): Prom
|
|||
|
||||
const secretsPagination = usePagination(loadSecrets, () => !selectedSecret.value, {
|
||||
each: ['repo', 'org', 'global'],
|
||||
scrollElement: null,
|
||||
pageSize: 50,
|
||||
});
|
||||
const { resetPage, data: _secrets } = secretsPagination;
|
||||
|
|
Loading…
Reference in a new issue