Improve cron list (#3947)

This commit is contained in:
qwerty287 2024-07-20 18:15:38 +02:00 committed by GitHub
parent fed8093520
commit 8a277e7bd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -35,7 +35,7 @@ func (s storage) CronFind(repo *model.Repo, id int64) (*model.Cron, error) {
func (s storage) CronList(repo *model.Repo, p *model.ListOptions) ([]*model.Cron, error) {
var crons []*model.Cron
return crons, s.paginate(p).Where("repo_id = ?", repo.ID).Find(&crons)
return crons, s.paginate(p).Where("repo_id = ?", repo.ID).OrderBy("name").Find(&crons)
}
func (s storage) CronUpdate(_ *model.Repo, cron *model.Cron) error {

View file

@ -16,12 +16,14 @@
:key="cron.id"
class="items-center !bg-wp-background-200 !dark:bg-wp-background-100"
>
<span class="grid grid-cols-3 w-full">
<span>{{ cron.name }}</span>
<span v-if="cron.next_exec && cron.next_exec > 0" class="ml-auto">
<span v-if="cron.next_exec && cron.next_exec > 0" class="col-span-2 <md:hidden">
<!-- eslint-disable-next-line @intlify/vue-i18n/no-raw-text -->
{{ $t('repo.settings.crons.next_exec') }}: {{ date.toLocaleString(new Date(cron.next_exec * 1000)) }}
</span>
<span v-else class="ml-auto">{{ $t('repo.settings.crons.not_executed_yet') }}</span>
<span v-else class="col-span-2 <md:hidden">{{ $t('repo.settings.crons.not_executed_yet') }}</span>
</span>
<IconButton icon="play" class="ml-auto w-8 h-8" :title="$t('repo.settings.crons.run')" @click="runCron(cron)" />
<IconButton icon="edit" class="w-8 h-8" :title="$t('repo.settings.crons.edit')" @click="selectedCron = cron" />
<IconButton