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
26 changes: 22 additions & 4 deletions agent/app/service/backup_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@ func (u *BackupRecordService) SearchRecordsWithPage(search dto.RecordSearch) (in
if err != nil {
return 0, nil, err
}
accounts, _ := backupRepo.List()
var data []dto.BackupRecords
for _, account := range records {
for _, record := range records {
var item dto.BackupRecords
if err := copier.Copy(&item, &account); err != nil {
if err := copier.Copy(&item, &record); err != nil {
global.LOG.Errorf("copy backup account to dto backup info failed, err: %v", err)
}
for _, account := range accounts {
if account.ID == record.DownloadAccountID {
item.DownloadAccountID = account.ID
item.AccountName = account.Name
item.AccountType = account.Type
break
}
}
data = append(data, item)
}
return total, data, err
Expand All @@ -63,12 +72,21 @@ func (u *BackupRecordService) SearchRecordsByCronjobWithPage(search dto.RecordSe
if err != nil {
return 0, nil, err
}
accounts, _ := backupRepo.List()
var data []dto.BackupRecords
for _, account := range records {
for _, record := range records {
var item dto.BackupRecords
if err := copier.Copy(&item, &account); err != nil {
if err := copier.Copy(&item, &record); err != nil {
global.LOG.Errorf("copy backup account to dto backup info failed, err: %v", err)
}
for _, account := range accounts {
if account.ID == record.DownloadAccountID {
item.DownloadAccountID = account.ID
item.AccountName = account.Name
item.AccountType = account.Type
break
}
}
data = append(data, item)
}
return total, data, err
Copy link
Member

Choose a reason for hiding this comment

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

There do not appear to be any notable differences between your provided code snippets related to BackupRecordService. Both seem to perform the same functionality described but have been slightly rearranged.

For instance:

  1. backupRepo.List() has been placed outside of the search method, while inside it remains within this file only.
  2. In both cases, there seems to be an error handling issue with logging that could be optimized further by using different approaches to debug or track errors at various stages of processing, e.g. loggers and/or metrics monitoring rather than printing text messages on console.

However, considering you're asking specifically for a comparison without detailed implementation details, I've focused more on structure changes/notations which might impact readability or maintainability than on functional differences.

Expand Down
2 changes: 1 addition & 1 deletion agent/app/service/snapshot_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func snapUpload(snap snapHelper, accounts string, file string) error {
targetAccounts := strings.Split(accounts, ",")
for _, item := range targetAccounts {
snap.Task.LogStart(i18n.GetWithName("SnapUploadTo", fmt.Sprintf("[%s] %s", accountMap[item].name, path.Join("system_snapshot", path.Base(file)))))
_, err := accountMap[item].client.Upload(source, path.Join("system_snapshot", path.Base(file)))
_, err := accountMap[item].client.Upload(source, path.Join(accountMap[item].backupPath, "system_snapshot", path.Base(file)))
snap.Task.LogWithStatus(i18n.GetWithName("SnapUploadRes", accountMap[item].name), err)
if err != nil {
return err
Expand Down
47 changes: 0 additions & 47 deletions core/utils/cloud_storage/client/local.go

This file was deleted.

2 changes: 0 additions & 2 deletions core/utils/cloud_storage/cloud_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ type CloudStorageClient interface {

func NewCloudStorageClient(backupType string, vars map[string]interface{}) (CloudStorageClient, error) {
switch backupType {
case constant.Local:
return client.NewLocalClient(vars)
case constant.S3:
return client.NewS3Client(vars)
case constant.OSS:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/cronjob/operate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
<el-form-item v-if="dialogData.rowData!.type === 'directory'" :label="$t('cronjob.backupContent')">
<el-radio-group v-model="dialogData.rowData!.isDir">
<el-radio :value="true">{{ $t('file.dir') }}</el-radio>
<el-radio :value="false">{{ $t('menu.file') }}</el-radio>
<el-radio :value="false">{{ $t('menu.files') }}</el-radio>
</el-radio-group>
</el-form-item>

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/host/file-management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"
/>
</div>
<LayoutContent :title="$t('menu.file')" v-loading="loading">
<LayoutContent :title="$t('menu.files')" v-loading="loading">
<template #prompt>
<el-alert type="info" :closable="false">
<template #title>
Expand All @@ -73,7 +73,7 @@
</el-dropdown-item>
<el-dropdown-item command="file">
<svg-icon iconName="p-file-normal"></svg-icon>
{{ $t('menu.file') }}
{{ $t('menu.files') }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find any significant code changes from my analysis on the given code snippet. It currently adheres to standard practices and does not contain errors or redundant elements that would cause confusion or inefficiencies. However, some formatting and style might slightly vary across development environments which could potentially be adjusted by future developers.

However, since it's been quite some time since 2021, please consider updating your code if there are minor inconsistencies or discrepancies with how components were originally implemented. For more specific comments about the implementation of "Loading indicator," I can provide advice based on best practices for handling loading states in UIs.

For example:

<!-- Assuming you have a LoadingIndicator.vue component -->
<template>
  <div class="loading-indicator">...</div>  
</template>

<script setup lang="ts">
import { computed } from 'vue';

const props = defineProps({
  status: {
    type: String,
    default: 'success',
  },
});

// Computed property for creating the loader state dynamically.
computed(() => ({
  loaderStatus: prop => (prop === 'success' ? 'el-icon-check-circle' : '')
}));

In addition to identifying these common issues, feel free to raise any additional concerns related to this version history review.

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/host/file-management/upload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="button-container">
<div>
<el-button type="primary" @click="upload('file')">
{{ $t('commons.button.upload') }}{{ $t('menu.file') }}
{{ $t('commons.button.upload') }}{{ $t('menu.files') }}
</el-button>
<el-button type="primary" @click="upload('dir')">
{{ $t('commons.button.upload') }}{{ $t('file.dir') }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/host/process/process/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</el-tab-pane>
<el-tab-pane :label="$t('process.openFiles')" name="openFiles">
<el-table :data="data.openFiles" border style="width: 100%">
<el-table-column prop="path" :label="$t('menu.file')" />
<el-table-column prop="path" :label="$t('menu.files')" />
<el-table-column prop="fd" label="fd" width="100px" />
</el-table>
</el-tab-pane>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/views/setting/snapshot/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ const beforeLeave = async (stepItem: any) => {
loadCheckForSubmit(panelChecks, form.panelData);
return true;
case 'backupData':
if (!form.appData || form.appData.length === 0) {
return true;
}
if (form.backupData && form.backupData.length !== 0) {
let backupChecks = backupRef.value.getCheckedNodes();
loadCheckForSubmit(backupChecks, form.backupData);
Expand Down Expand Up @@ -497,6 +500,9 @@ const setPanelDefaultCheck = async (list: any) => {
}
};
const setBackupDefaultCheck = async (list: any) => {
if (!form.appData || form.appData.length === 0) {
return;
}
for (const item of list) {
if (item.isCheck) {
backupRef.value.setChecked(item.id, true, true);
Copy link
Member

Choose a reason for hiding this comment

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

There doesn't seem to be any specific issue or irregularity detected from checking the provided code snippet on the current date (2025-02-08). However, it's always a good practice to thoroughly review your application logic for bugs and efficiency.

If you have concerns with any particular part of this codebase that might need further examination, feel free to share more details so I can provide tailored feedback.

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/toolbox/ftp/log/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ loadOperation(row.operation) }}
</template>
</el-table-column>
<el-table-column :label="$t('menu.file')" show-overflow-tooltip>
<el-table-column :label="$t('menu.files')" show-overflow-tooltip>
<template #default="{ row }">
{{ loadFileName(row.operation) }}
</template>
Expand Down
Loading