-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Modify the way of creating cronjob #8403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,10 @@ export namespace Cronjob { | |
| sourceAccountItems: Array<number>; | ||
|
|
||
| retainCopies: number; | ||
| retryTimes: number; | ||
| timeout: number; | ||
| timeoutItem: number; | ||
| timeoutUint: string; | ||
| status: string; | ||
| secret: string; | ||
| hasAlert: boolean; | ||
|
|
@@ -45,25 +49,41 @@ export namespace Cronjob { | |
| export interface Item { | ||
| val: string; | ||
| } | ||
| export interface CronjobCreate { | ||
| export interface CronjobOperate { | ||
| id: number; | ||
| name: string; | ||
| type: string; | ||
| specCustom: boolean; | ||
| spec: string; | ||
| specs: Array<string>; | ||
| specObjs: Array<SpecObj>; | ||
|
|
||
| script: string; | ||
| appID: string; | ||
| website: string; | ||
| exclusionRules: string; | ||
| dbType: string; | ||
| dbName: string; | ||
| url: string; | ||
| isDir: boolean; | ||
| sourceDir: string; | ||
|
|
||
| //shell | ||
| executor: string; | ||
| scriptMode: string; | ||
| script: string; | ||
| command: string; | ||
| containerName: string; | ||
| user: string; | ||
|
|
||
| sourceAccountIDs: string; | ||
| downloadAccountID: number; | ||
| retainCopies: number; | ||
| retryTimes: number; | ||
| timeout: number; | ||
| secret: string; | ||
|
|
||
| alertCount: number; | ||
| alertTitle: string; | ||
| } | ||
| export interface SpecObj { | ||
| specType: string; | ||
|
|
@@ -73,24 +93,6 @@ export namespace Cronjob { | |
| minute: number; | ||
| second: number; | ||
| } | ||
| export interface CronjobUpdate { | ||
| id: number; | ||
| specCustom: boolean; | ||
| spec: string; | ||
|
|
||
| script: string; | ||
| website: string; | ||
| exclusionRules: string; | ||
| dbType: string; | ||
| dbName: string; | ||
| url: string; | ||
| sourceDir: string; | ||
|
|
||
| sourceAccountIDs: string; | ||
| downloadAccountID: number; | ||
| retainCopies: number; | ||
| secret: string; | ||
| } | ||
| export interface CronjobDelete { | ||
| ids: Array<number>; | ||
| cleanData: boolean; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are several issues with this code:
To resolve these issues:
Optimization suggestions could include checking whether |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes include:
Type Renaming: The struct
CronjobCreatehas been renamed toCronjobOperate. This is beneficial because it clearly indicates that this struct is used for operations rather than creating a new cron job.Addition of Missing Fields:
ID, which can be useful for identifying specific cron jobs when performing updates.Command,ContainerName,User, etc., based on the previous structs for clarity and completeness. These should be validated appropriately according to their types.Optimization Suggestions:
CronjobCreate,CronjobUpdate) if applicable, such as using common prefixes likeApp_,Website_, etc., instead of separate fields.Overall, these changes enhance readability and functionality while providing a clear structure for handling various operations related to cron jobs.