mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-18 13:29:03 +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"`
|
Name string `gorm:"not null" json:"name"`
|
||||||
Type string `gorm:"not null" json:"type"`
|
Type string `gorm:"not null" json:"type"`
|
||||||
GroupID uint `json:"groupID"`
|
GroupID uint `gorm:"not null;default:0" json:"groupID"`
|
||||||
SpecCustom bool `json:"specCustom"`
|
SpecCustom bool `json:"specCustom"`
|
||||||
Spec string `gorm:"not null" json:"spec"`
|
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["status"] = constant.StatusEnable
|
||||||
}
|
}
|
||||||
upMap["name"] = req.Name
|
upMap["name"] = req.Name
|
||||||
|
upMap["group_id"] = req.GroupID
|
||||||
upMap["spec_custom"] = req.SpecCustom
|
upMap["spec_custom"] = req.SpecCustom
|
||||||
upMap["spec"] = spec
|
upMap["spec"] = spec
|
||||||
upMap["script"] = req.Script
|
upMap["script"] = req.Script
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ export namespace Cronjob {
|
||||||
export interface CronjobOperate {
|
export interface CronjobOperate {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
groupID: number;
|
||||||
type: string;
|
type: string;
|
||||||
specCustom: boolean;
|
specCustom: boolean;
|
||||||
spec: string;
|
spec: string;
|
||||||
|
|
|
||||||
|
|
@ -398,16 +398,20 @@ const onSubmitExport = async () => {
|
||||||
const loadGroups = async () => {
|
const loadGroups = async () => {
|
||||||
const res = await getGroupList('cronjob');
|
const res = await getGroupList('cronjob');
|
||||||
groupOptions.value = res.data || [];
|
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) {
|
for (const item of data.value) {
|
||||||
if (item.groupID === 0) {
|
if (item.groupID === 0) {
|
||||||
item.groupBelong = 'Default';
|
item.groupBelong = 'Default';
|
||||||
|
item.groupID = defaultGroupID.value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let hasGroup = false;
|
let hasGroup = false;
|
||||||
for (const group of groupOptions.value) {
|
for (const group of groupOptions.value) {
|
||||||
if (group.name === 'Default') {
|
|
||||||
defaultGroupID.value = group.id;
|
|
||||||
}
|
|
||||||
if (item.groupID === group.id) {
|
if (item.groupID === group.id) {
|
||||||
hasGroup = true;
|
hasGroup = true;
|
||||||
item.groupBelong = group.name;
|
item.groupBelong = group.name;
|
||||||
|
|
|
||||||
|
|
@ -852,6 +852,7 @@ const search = async () => {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
form.name = res.data.name;
|
form.name = res.data.name;
|
||||||
|
form.groupID = res.data.groupID || null;
|
||||||
form.type = res.data.type;
|
form.type = res.data.type;
|
||||||
form.specCustom = res.data.specCustom;
|
form.specCustom = res.data.specCustom;
|
||||||
form.spec = res.data.spec;
|
form.spec = res.data.spec;
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,6 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import type { ElForm } from 'element-plus';
|
import type { ElForm } from 'element-plus';
|
||||||
import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth';
|
import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth';
|
||||||
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||||
|
|
@ -269,7 +268,6 @@ const captcha = reactive({
|
||||||
|
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const mfaShow = ref<boolean>(false);
|
const mfaShow = ref<boolean>(false);
|
||||||
const router = useRouter();
|
|
||||||
const dropdownText = ref('中文(简体)');
|
const dropdownText = ref('中文(简体)');
|
||||||
|
|
||||||
function handleCommand(command: string) {
|
function handleCommand(command: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue