mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-13 18:15:31 +08:00
fix: Fix grouping exception issue for cronjob (#9841)
This commit is contained in:
parent
6a5e1ebaa5
commit
c131061f81
6 changed files with 11 additions and 6 deletions
|
@ -11,7 +11,7 @@ type Cronjob struct {
|
|||
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Type string `gorm:"not null" json:"type"`
|
||||
GroupID uint `json:"groupID"`
|
||||
GroupID uint `gorm:"not null;default:0" json:"groupID"`
|
||||
SpecCustom bool `json:"specCustom"`
|
||||
Spec string `gorm:"not null" json:"spec"`
|
||||
|
||||
|
|
|
@ -710,6 +710,7 @@ func (u *CronjobService) Update(id uint, req dto.CronjobOperate) error {
|
|||
upMap["status"] = constant.StatusEnable
|
||||
}
|
||||
upMap["name"] = req.Name
|
||||
upMap["group_id"] = req.GroupID
|
||||
upMap["spec_custom"] = req.SpecCustom
|
||||
upMap["spec"] = spec
|
||||
upMap["script"] = req.Script
|
||||
|
|
|
@ -71,6 +71,7 @@ export namespace Cronjob {
|
|||
export interface CronjobOperate {
|
||||
id: number;
|
||||
name: string;
|
||||
groupID: number;
|
||||
type: string;
|
||||
specCustom: boolean;
|
||||
spec: string;
|
||||
|
|
|
@ -398,16 +398,20 @@ const onSubmitExport = async () => {
|
|||
const loadGroups = async () => {
|
||||
const res = await getGroupList('cronjob');
|
||||
groupOptions.value = res.data || [];
|
||||
for (const group of groupOptions.value) {
|
||||
if (group.name === 'Default') {
|
||||
defaultGroupID.value = group.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const item of data.value) {
|
||||
if (item.groupID === 0) {
|
||||
item.groupBelong = 'Default';
|
||||
item.groupID = defaultGroupID.value;
|
||||
continue;
|
||||
}
|
||||
let hasGroup = false;
|
||||
for (const group of groupOptions.value) {
|
||||
if (group.name === 'Default') {
|
||||
defaultGroupID.value = group.id;
|
||||
}
|
||||
if (item.groupID === group.id) {
|
||||
hasGroup = true;
|
||||
item.groupBelong = group.name;
|
||||
|
|
|
@ -852,6 +852,7 @@ const search = async () => {
|
|||
.then((res) => {
|
||||
loading.value = false;
|
||||
form.name = res.data.name;
|
||||
form.groupID = res.data.groupID || null;
|
||||
form.type = res.data.type;
|
||||
form.specCustom = res.data.specCustom;
|
||||
form.spec = res.data.spec;
|
||||
|
|
|
@ -182,7 +182,6 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import type { ElForm } from 'element-plus';
|
||||
import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth';
|
||||
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||
|
@ -269,7 +268,6 @@ const captcha = reactive({
|
|||
|
||||
const loading = ref<boolean>(false);
|
||||
const mfaShow = ref<boolean>(false);
|
||||
const router = useRouter();
|
||||
const dropdownText = ref('中文(简体)');
|
||||
|
||||
function handleCommand(command: string) {
|
||||
|
|
Loading…
Add table
Reference in a new issue