Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/app/service/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (u *CronjobService) Delete(req dto.CronjobBatchDelete) error {
if cronjob.ID == 0 {
return errors.New("find cronjob in db failed")
}
_ = os.RemoveAll(path.Join(global.Dir.DataDir, "task/shell", cronjob.Name))
ids := strings.Split(cronjob.EntryIDs, ",")
for _, id := range ids {
idItem, _ := strconv.Atoi(id)
Expand Down
3 changes: 1 addition & 2 deletions agent/app/service/cronjob_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ func (u *CronjobService) handleShell(cronjob model.Cronjob, taskID string) error
if len(cronjob.Command) != 0 {
command = cronjob.Command
}
scriptFile, _ := os.ReadFile(cronjob.Script)
return cmd.ExecShellWithTask(taskItem, 24*time.Hour, "docker", "exec", cronjob.ContainerName, command, "-c", strings.ReplaceAll(string(scriptFile), "\"", "\\\""))
return cmd.ExecShellWithTask(taskItem, 24*time.Hour, "docker", "exec", cronjob.ContainerName, command, "-c", strings.ReplaceAll(cronjob.Script, "\"", "\\\""))
}
if len(cronjob.Executor) == 0 {
cronjob.Executor = "bash"
Expand Down
21 changes: 11 additions & 10 deletions core/constant/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ var WebUrlMap = map[string]struct{}{
"/ai/model": {},
"/ai/gpu": {},

"/containers": {},
"/containers/container": {},
"/containers/image": {},
"/containers/network": {},
"/containers/volume": {},
"/containers/repo": {},
"/containers/compose": {},
"/containers/template": {},
"/containers/setting": {},
"/containers/dashboard": {},
"/containers": {},
"/containers/container": {},
"containers/container/operate": {},
"/containers/image": {},
"/containers/network": {},
"/containers/volume": {},
"/containers/repo": {},
"/containers/compose": {},
"/containers/template": {},
"/containers/setting": {},
"/containers/dashboard": {},

"/cronjobs": {},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main difference between the two pieces of code is that one provides an array named "WebUrlMap" which contains structs as key-value pairs, while the other uses a dictionary-like structure with string keys and struct values. However, there's no significant issue detected; both implementations seem accurate and efficient for their context. It's important to maintain these structures based on current programming standards, but it seems they work perfectly for now.

Optimization Suggestions:

No significant optimization suggested as this does not impact performance or efficiency. The initial implementation has been correctly implemented according to standard practices.

References:

Both provided references point at the same place in documentation (e.g., "https://pkg.go.dev/googleapis/pkg/api") where such type definitions for maps exist. If needed, refer back to these sources if more clarification about Go's specific details or best practices around arrays/dictionaries are required.

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/complex-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
:page-sizes="[5, 10, 20, 50, 100]"
@size-change="sizeChange"
@current-change="currentChange"
:small="mobile"
:small="mobile || paginationConfig.small"
:layout="mobile ? 'total, prev, pager, next' : 'total, sizes, prev, pager, next, jumper'"
/>
</slot>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/task-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const paginationConfig = reactive({
currentPage: 1,
pageSize: 10,
total: 0,
small: true,
});
const taskLogRef = ref();
const req = reactive({
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/layout/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
<el-button link icon="CircleCheck" type="success" />
{{ $t('terminal.local') }}
</el-dropdown-item>
<el-dropdown-item v-for="item in nodes" :key="item.name" :command="item.name">
<el-dropdown-item
:disabled="item.status !== 'Healthy'"
v-for="item in nodes"
:key="item.name"
:command="item.name"
>
<el-button v-if="item.status === 'Healthy'" link icon="CircleCheck" type="success" />
<el-button v-else link icon="Warning" type="danger" />
{{ item.name }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this specific code snippet is not provided or specified to be checked, there isn't enough information given about what needs review and analysis. However, if you wish to analyze the difference between two versions of JavaScript (or another programming language) that could involve comparing syntax elements such as comments, imports, variables, control flow statements like loops and conditions.

To do so effectively, it's helpful but very detailed context which details exactly the areas where a comparison is needed would need to be provided. It seems from your recent request date of February 27th, 2025, that this might have been meant more in relation to previous code compared with current usage.

It also matters on whether the "nodes" variable inside the function represents different aspects before/after an update or simply some kind of state management within an application framework that has changed its definition or behavior.

Therefore, providing extra detail regarding when you want these kinds of diffs done – say for debugging, performance tuning, documentation improvement etc. can make answering significantly clearer and more relevant here.

Expand Down
9 changes: 6 additions & 3 deletions frontend/src/views/cronjob/operate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@
</el-card>

<el-form-item :label="$t('cronjob.shellContent')" prop="script" class="mt-5">
<el-radio-group v-model="dialogData.rowData!.scriptMode">
<el-radio-group
@change="dialogData.rowData!.script = ''"
v-model="dialogData.rowData!.scriptMode"
>
<el-radio value="input">{{ $t('commons.button.edit') }}</el-radio>
<el-radio value="select">{{ $t('container.pathSelect') }}</el-radio>
</el-radio-group>
Expand All @@ -280,8 +283,7 @@
v-model="dialogData.rowData!.script"
placeholder="#Define or paste the content of your shell file here"
mode="javascript"
:heightDiff="0"
:min-height="200"
:heightDiff="400"
/>
<el-input
v-if="dialogData.rowData!.scriptMode=== 'select'"
Expand Down Expand Up @@ -792,6 +794,7 @@ const rules = reactive({
],

script: [{ validator: verifyScript, trigger: 'blur', required: true }],
containerName: [Rules.requiredSelect],
appID: [Rules.requiredSelect],
website: [Rules.requiredSelect],
dbName: [Rules.requiredSelect],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no significant error or irregularity present at the provided snippet. The use of radio groups is consistent with React components such as el-form-element and textarea. Also, the rules for validation seem to be correct according to the data you passed through.

In terms of optimization, consider using Vue components like v-if (for conditionally rendering elements), which makes it more readable and could improve performance if implemented in front-end applications.
This applies particularly when dealing with nested components like el-card, where conditional components can help streamline complex layouts without adding unnecessary complexity to code.

Expand Down
Loading