Try to start a deploy using admin interface
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
from django.contrib import admin,messages
|
||||
from django.utils.translation import ngettext
|
||||
from .models import Machine_Data,Schedule_Day_Data,Schedule_Week_Data
|
||||
from apps.kubernetes_connection.utils import scale_up
|
||||
# Register your models here.
|
||||
|
||||
DB = 'cloudmanager_db'
|
||||
|
||||
|
||||
@admin.action(description="scale up")
|
||||
def scale_up_deploy(modeladmin, request, queryset):
|
||||
for query in queryset.values():
|
||||
scale_up(namespace_name=query['namespace'],deploy_name=query['name'],replicas=query['replicas'])
|
||||
|
||||
|
||||
class ActiveAtHourFilter(admin.SimpleListFilter):
|
||||
title = 'Active at hour'
|
||||
parameter_name = 'active_at_hour'
|
||||
@@ -41,6 +48,7 @@ class MultiDBModelAdmin(admin.ModelAdmin):
|
||||
class MachineDataAdmin(MultiDBModelAdmin):
|
||||
list_display = ('name', 'namespace', 'schedule_week', 'schedule_day', 'replicas')
|
||||
list_filter = (ActiveAtHourFilter,)
|
||||
actions = [scale_up_deploy]
|
||||
|
||||
|
||||
@admin.register(Schedule_Day_Data)
|
||||
|
||||
Reference in New Issue
Block a user