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
5 changes: 4 additions & 1 deletion agent/app/service/backup_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ func (u *BackupRecordService) ListAppRecords(name, detailName, fileName string)

func (u *BackupRecordService) ListFiles(req dto.OperateByID) []string {
var datas []string
_, client, err := NewBackupClientWithID(req.ID)
backupItem, client, err := NewBackupClientWithID(req.ID)
if err != nil {
return datas
}
prefix := "system_snapshot"
if len(backupItem.BackupPath) != 0 {
prefix = path.Join(backupItem.BackupPath, prefix)
}
files, err := client.ListObjects(prefix)
if err != nil {
global.LOG.Debugf("load files failed, err: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion agent/utils/cloud_storage/client/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (o upClient) ListBuckets() ([]interface{}, error) {

func (s upClient) Upload(src, target string) (bool, error) {
if _, err := s.client.GetInfo(path.Dir(src)); err != nil {
_ = s.client.Mkdir(path.Dir(src))
_ = s.client.Mkdir(path.Dir(target))
}
if err := s.client.Put(&upyun.PutObjectConfig{
Path: target,
Expand Down
2 changes: 1 addition & 1 deletion core/app/service/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (u *UpgradeService) Upgrade(req dto.Upgrade) error {
_ = settingRepo.Update("SystemStatus", "Free")
return
}
itemLog := model.UpgradeLog{NodeID: 0, OldVersion: global.CONF.Base.Version, NewVersion: req.Version, BackupFile: originalDir}
itemLog := model.UpgradeLog{NodeID: 0, OldVersion: global.CONF.Base.Version, NewVersion: req.Version, BackupFile: baseDir}
_ = upgradeLogRepo.Create(&itemLog)

global.LOG.Info("backup original data successful, now start to upgrade!")
Expand Down
5 changes: 3 additions & 2 deletions core/cmd/server/cmd/listen-ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"

"github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/i18n"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -51,11 +52,11 @@ func updateBindInfo(protocol string) error {
if err != nil {
return err
}
ipv6 := "disable"
ipv6 := constant.StatusDisable
tcp := "tcp4"
address := "0.0.0.0"
if protocol == "ipv6" {
ipv6 = "enable"
ipv6 = constant.StatusEnable
tcp = "tcp6"
address = "::"
}
Expand Down
5 changes: 3 additions & 2 deletions core/cmd/server/cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"

"github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/i18n"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -43,7 +44,7 @@ var resetMFACmd = &cobra.Command{
return err
}

return setSettingByKey(db, "MFAStatus", "disable")
return setSettingByKey(db, "MFAStatus", constant.StatusDisable)
},
}
var resetSSLCmd = &cobra.Command{
Expand All @@ -59,7 +60,7 @@ var resetSSLCmd = &cobra.Command{
return err
}

return setSettingByKey(db, "SSL", "disable")
return setSettingByKey(db, "SSL", constant.StatusDisable)
},
}
var resetEntranceCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion core/cmd/server/cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var restoreCmd = &cobra.Command{
}
fmt.Println(i18n.GetMsgByKeyForCmd("RestoreStep4"))
if _, err := os.Stat(path.Join(tmpPath, "db")); err == nil {
dbPath := path.Join(baseDir, "1panel/db")
dbPath := path.Join(baseDir, "1panel")
if err := files.CopyItem(true, true, path.Join(tmpPath, "db"), dbPath); err != nil {
global.LOG.Errorf("rollback 1panel db failed, err: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion core/cmd/server/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"unicode"

"github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global"
"github.com/1Panel-dev/1Panel/core/i18n"
"github.com/1Panel-dev/1Panel/core/utils/cmd"
Expand Down Expand Up @@ -136,7 +137,7 @@ func password() {
return
}
complexSetting := getSettingByKey(db, "ComplexityVerification")
if complexSetting == "enable" {
if complexSetting == constant.StatusEnable {
if isValidPassword("newPassword") {
fmt.Println("\n" + i18n.GetMsgByKeyForCmd("UpdatePasswordFormat"))
return
Expand Down
3 changes: 2 additions & 1 deletion core/cmd/server/cmd/user-info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"

"github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global"
"github.com/1Panel-dev/1Panel/core/i18n"
"github.com/1Panel-dev/1Panel/core/utils/encrypt"
Expand Down Expand Up @@ -41,7 +42,7 @@ var userinfoCmd = &cobra.Command{
address := getSettingByKey(db, "SystemIP")

protocol := "http"
if ssl == "enable" {
if ssl == constant.StatusEnable {
protocol = "https"
}
if address == "" {
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "The current free node has reached its limit, please check an
ErrNoSuchNode: "Node information not found, please check and retry!"
ErrNodeUnbind: "This node is not within the license binding range, please check and retry!"
ErrNodeBind: "This node is already bound to a license, please check and retry!"
ErrNodeLocalRollback: "The primary node does not support direct rollback. Please manually execute the '1pctl restore' command to rollback!"

# alert
ErrAlertSync: "Alert information sync error, please check and retry!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ErrNodeBoundLimit: "現在の無料ノードは上限に達しました。確認
ErrNoSuchNode: "そのノード情報が見つかりませんでした、確認して再試行してください!"
ErrNodeUnbind: "そのノードはライセンスのバインド範囲内ではありません、確認して再試行してください!"
ErrNodeBind: "そのノードはライセンスにバインドされています、確認して再試行してください!"
ErrNodeLocalRollback: "マスターノードは直接ロールバックをサポートしていません。手動で「1pctl restore」コマンドを実行してロールバックしてください!"

# alert
ErrAlertSync: "アラート情報の同期エラーです。後で再試行してください!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "현재 무료 노드가 한도에 도달했습니다. 확인
ErrNoSuchNode: "노드 정보를 찾을 수 없습니다. 다시 확인하고 시도해 주세요!"
ErrNodeUnbind: "이 노드가 라이선스 바인딩 범위에 있지 않음을 감지하였습니다. 다시 확인하고 시도해 주세요!"
ErrNodeBind: "이 노드가 이미 라이선스에 바인딩되어 있음을 감지하였습니다. 다시 확인하고 시도해 주세요!"
ErrNodeLocalRollback: "마스터 노드는 직접 롤백을 지원하지 않습니다. 수동으로 '1pctl restore' 명령어를 실행하여 롤백하세요!"

# alert
ErrAlertSync: "경고 정보 동기화 오류, 다시 확인하고 시도해 주세요!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "Nod percuma semasa telah mencapai had, sila semak dan cuba l
ErrNoSuchNode: "Maklumat nod tidak ditemui, sila semak dan cuba lagi!"
ErrNodeUnbind: "Nod di luar skop lesen dikesan, sila semak dan cuba lagi!"
ErrNodeBind: "Nod ini telah diikat dengan lesen, sila semak dan cuba lagi!"
ErrNodeLocalRollback: "Nod utama tidak menyokong rollback secara langsung. Sila laksanakan arahan '1pctl restore' secara manual untuk rollback!"

# alert
ErrAlertSync: "Ralat penyinkronan maklumat amaran, sila semak dan cuba lagi!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/pt-BR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "O nó gratuito atual atingiu seu limite, por favor verifique
ErrNoSuchNode: "As informações deste nó não foram encontradas, por favor verifique e tente novamente!"
ErrNodeUnbind: "Nó fora do escopo da licença detectado, por favor verifique e tente novamente!"
ErrNodeBind: "Este nó já está vinculado a uma licença, por favor verifique e tente novamente!"
ErrNodeLocalRollback: "O nó principal não suporta rollback direto. Por favor, execute manualmente o comando '1pctl restore' para fazer o rollback!"

# alert
ErrAlertSync: "Erro na sincronização das informações de alerta, verifique e tente novamente!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "Текущий бесплатный узел достиг п
ErrNoSuchNode: "Информация об узле не найдена, проверьте и повторите попытку!"
ErrNodeUnbind: "Обнаружен узел вне области действия лицензии, проверьте и повторите попытку!"
ErrNodeBind: "Этот узел уже связан с лицензией, проверьте и повторите попытку!"
ErrNodeLocalRollback: "Основной узел не поддерживает прямой откат. Пожалуйста, вручную выполните команду '1pctl restore' для отката!"

# alert
ErrAlertSync: "Ошибка синхронизации информации об оповещениях, пожалуйста, проверьте и повторите попытку!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/zh-Hant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ErrNodeBoundLimit: "當前免費節點已達上限,請檢查後重試!"
ErrNoSuchNode: "未能找到該節點信息,請檢查後重試!"
ErrNodeUnbind: "檢測到該節點未在許可證綁定範圍內,請檢查後重試!"
ErrNodeBind: "檢測到該節點已綁定許可證,請檢查後重試!"
ErrNodeLocalRollback: "主節點暫不支援直接回滾,請手動執行「1pctl restore」命令回滾!"

# alert
ErrAlertSync: "告警信息同步錯誤,請檢查後重試!"
Expand Down
1 change: 1 addition & 0 deletions core/i18n/lang/zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ErrNodeBoundLimit: "当前免费节点已经达到上限,请检查后重试!
ErrNoSuchNode: "未能找到该节点信息,请检查后重试!"
ErrNodeUnbind: "检测到该节点未在许可证绑定范围内,请检查后重试!"
ErrNodeBind: "检测到该节点已绑定许可证,请检查后重试!"
ErrNodeLocalRollback: "主节点暂不支持直接回滚,请手动执行 1pctl restore 命令回滚!"

# alert
ErrAlertSync: "告警信息同步错误,请检查后重试!"
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1835,17 +1835,16 @@ const message = {
noUpgrade: 'It is currently the latest version',
versionHelper:
'Name rules: [major version].[functional version].[Bug fix version], as shown in the following example:',
versionHelper1: 'v1.0.1 is a Bug fix after v1.0.0',
versionHelper2: 'v1.1.0 is a feature release after v1.0.0',
rollbackLocalHelper:
'The primary node does not support direct rollback. Please manually execute the [1pctl restore] command to rollback!',
upgradeCheck: 'Check for updates',
upgradeNotes: 'Release note',
upgradeNow: 'Upgrade now',
source: 'Download source',
hasNewVersion: 'New version Available',
versionHigher:
'Detected that node {0} version is higher than the main node, switching is not supported at this time. Please upgrade the main node system version and try again!',
versionLower:
'Detected that node {0} version is lower than the main node, switching is not supported at this time. Please upgrade the system version of this node and try again!',
versionNotSame:
'The version of this node does not match the primary node. Switching is not supported at this time. Please check and try again!',
versionCompare:
'Detected that node {0} is already at the latest upgradable version. Please check the primary node version and try again!',

about: 'About',
project: 'Project Address',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are several improvements and optimizations that can be made to the code snippet you provided:

  1. Simplify Version Helper Text:

    • Combine versionHelper, rollbackLocalHelper, etc., into a single explanation if they share similar content.
  2. Consistency in Upgrade Messages:

    • Ensure consistency between upgradeCheck and other messages related to upgrades.
    • Simplify or remove redundant text about upgrade notes unless necessary.
  3. Optimize About Section:

    • Refactor the "About" section to improve readability and reduce redundancy, if applicable.
  4. Consider Adding Default Values or Null Checks:

    • In functions like switchNode, add default values for options or null checks.

Here's an optimized version of the code snippets with comments for clarity:

const message = {
    // ... existing properties ...

    versionHelper: `
        Name rules: [major version].[functional version].[bug fix version],
        as shown in the following examples:
        v1.0.1 -> Bug fix after v1.0.0
        v1.1.0 -> Feature release after v1.0.0
    `,
    
    /*
        The primary node does not support direct rollback. Please manually execute the [1pctl restore] command to rollback!
        
        Example usage:
        ```
        sudo 1pctl restore <previous_version>
        ```
    */
    
    upgradeCheck: 'Check for Updates',
    upgradeNotes: 'Release Note',
    upgradeNow: 'Upgrade Now',
    source: 'Download Source',

    hasNewVersion: 'New Version Available', // Consider renaming to something more specific
    versionHigher: (
        'Detected that node {0} version is higher than the main node, '
        + 'switching is not supported at this time. '
        + 'Please upgrade the main node system version and try again!'
    ),
    versionLower: (
        'Detected that node {0} version is lower than the main node, '
        + 'switching is not supported at this time. '
        + 'Please upgrade the system version of this node and try again!'
    ),

    /* 
       The current node's version does not match the primary node's version,
       switch is unsupported until resolved.
       
       To resolve this issue:
       1. Check the primary node version.
       2. Update the local node.
    */  
      
    versionNotSame: 'The version of this node does not match the primary node. ', 

    versionCompare: (
        'Detected that node {0} is already at the latest upgradable version. '
        + 'Please check the primary node version and try again!'
    ),    

    about: `
        Software Information:
        Project Address: https://example.com
        
        Version: v1.x.x (Updated on YYYY-MM-DD)
    `,
};

// ... rest of the code ...

Key Changes/Updates Summary:

  • Combined related version helper text under one key.
  • Added clear examples in the versionHelper.
  • Used formatted strings (\n) and backticks (``) for multi-line string handling.
  • Simplified version logic and error messages where possible.
  • Provided context in the "about" section regarding software information and version status.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The provided code snippet contains several changes and minor adjustments aimed at improving clarity and robustness:

Changes and Adjustments:

  1. Removal of versionHelper1 and versionHelper2:

    • These helper strings are no longer needed due to the introduction of better version management features.
  2. Replacement of hasNewVersion with a more descriptive prompt:

    • The message "Have New Version Available" is replaced with a clearer one indicating available upgrades, which makes it more actionable.
  3. Introduction of rollbackLocalHelper:

    • A new error message specific to local rollbacks when the primary node does not support it has been added. This provides guidance on how to proceed.
  4. Clarification of versionHigher, versionLower, and improvements in versionNotSame:

    • Updated messages for version comparison situations while clarifying conditions under which switching between nodes is unsupported.
  5. Revised versionCompare:

    • Corrected the phrase to indicate that the current node is already at its latest upgradable version, suggesting checking with the primary node for further instructions.

Summary of Changes:

  • Removed unnecessary helper text.
  • Renamed hasNewVersion to improve user understanding.
  • Added a comprehensive error message for local rollbacks.
  • Clarified messages related to version comparisons and restrictions on switching.

These changes ensure that the interface remains intuitive and maintainable, addressing both usability and operational efficiency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes you've made appear to be consistent with the intended functionality of the application. However, there are a few points noted:

  1. rollbackLocalHelper Change: The helper text for local rollbacks is clear and concise.

  2. Consistency in Version Messages:

    • In versionCompare, it mentions "primary node version" twice, which should only reference one instance based on context unless it's meant to imply both nodes sharing the same version.
  3. Error Messages: Ensure that error messages like versionLower and versionHigher are correctly formatted and handle edge cases where the versions are equal (e.g., when they don't need to switch).

  4. Optimization Suggestions:

    • Since you're working within a development phase, consider using more descriptive and comprehensive comments to aid future maintenance.
    • If the app will have multiple instances interacting with each other in a scalable manner, ensure that the error handling can manage network latency or intermittent failures gracefully.

Overall, the logic seems sound, but adding some additional detail or validation could improve robustness and maintainability.

Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1739,10 +1739,16 @@ const message = {
'この回復をロールバックすると、この回復からすべてのファイルを置き換え、Dockerサービスと1パネルサービスを再起動する必要がある場合があります。続けたいですか?',

upgradeHelper: 'アップグレードには、1パネルサービスを再起動する必要があります。続けたいですか?',
rollbackLocalHelper:
'マスターノードは直接ロールバックをサポートしていません。手動で「1pctl restore」コマンドを実行してロールバックしてください!',
noUpgrade: '現在、最新バージョンです',
upgradeNotes: 'リリースノート',
upgradeNow: '今すぐアップグレードしてください',
source: 'ソースをダウンロードします',
versionNotSame:
'このノードのバージョンがマスターノードと一致しません。現在は切り替えをサポートしていません。確認後、再試行してください!',
versionCompare:
'ノード {0} は既にアップグレード可能な最新バージョンです。マスターノードのバージョンを確認後、再試行してください!',

about: 'について',
project: 'GitHub',
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lang/modules/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1713,10 +1713,16 @@ const message = {
'이 복구를 롤백하면 해당 복구의 모든 파일이 대체되며 Docker 및 1Panel 서비스를 재시작해야 할 수 있습니다. 계속하시겠습니까?',

upgradeHelper: '업그레이드에는 1Panel 서비스를 재시작해야 합니다. 계속하시겠습니까?',
rollbackLocalHelper:
'마스터 노드는 직접 롤백을 지원하지 않습니다. 수동으로 [1pctl restore] 명령어를 실행하여 롤백하세요!',
noUpgrade: '현재 최신 버전입니다',
upgradeNotes: '릴리스 노트',
upgradeNow: '지금 업그레이드',
source: '다운로드 소스',
versionNotSame:
'이 노드의 버전이 마스터 노드와 일치하지 않습니다. 현재 전환을 지원하지 않습니다. 확인 후 다시 시도하세요!',
versionCompare:
'노드 {0}이(가) 이미 업그레이드 가능한 최신 버전입니다. 마스터 노드 버전을 확인 후 다시 시도하세요!',

about: '정보',
project: 'GitHub',
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1797,10 +1797,16 @@ const message = {
'Pulangkan semula pemulihan ini akan menggantikan semua fail dari pemulihan ini, dan mungkin memerlukan mulakan semula perkhidmatan Docker dan 1Panel. Adakah anda mahu meneruskan?',

upgradeHelper: 'Kemas kini memerlukan mulakan semula perkhidmatan 1Panel. Adakah anda mahu meneruskan?',
rollbackLocalHelper:
'Nod utama tidak menyokong rollback secara langsung. Sila laksanakan arahan [1pctl restore] secara manual untuk rollback!',
noUpgrade: 'Ia adalah versi terbaru pada masa ini',
upgradeNotes: 'Nota pelepasan',
upgradeNow: 'Kemas kini sekarang',
source: 'Sumber muat turun',
versionNotSame:
'Versi nod ini tidak sepadan dengan nod utama. Penukaran tidak disokong buat masa ini. Sila periksa dan cuba lagi!',
versionCompare:
'Nod {0} telah berada pada versi terkini yang boleh dinaik taraf. Sila periksa versi nod utama dan cuba lagi!',

about: 'Mengenai',
project: 'GitHub',
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1782,10 +1782,16 @@ const message = {
'Reverter essa recuperação substituirá todos os arquivos dessa recuperação e pode exigir reiniciar os serviços Docker e 1Panel. Você deseja continuar?',

upgradeHelper: 'A atualização requer reiniciar o serviço 1Panel. Você deseja continuar?',
rollbackLocalHelper:
'O nó principal não suporta rollback direto. Por favor, execute manualmente o comando [1pctl restore] para fazer o rollback!',
noUpgrade: 'Esta é a versão mais recente',
upgradeNotes: 'Notas de versão',
upgradeNow: 'Atualizar agora',
source: 'Fonte para download',
versionNotSame:
'A versão deste nó não corresponde ao nó principal. A troca não é suportada no momento. Por favor, verifique e tente novamente!',
versionCompare:
'Detectado que o nó {0} já está na última versão atualizável. Por favor, verifique a versão do nó principal e tente novamente!',

about: 'Sobre',
project: 'GitHub',
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1783,10 +1783,17 @@ const message = {
rollbackHelper:
'Откат этого восстановления заменит все файлы из этого восстановления и может потребовать перезапуска служб Docker и 1Panel. Хотите продолжить?',
upgradeHelper: 'Обновление требует перезапуска службы 1Panel. Хотите продолжить?',
rollbackLocalHelper:
'Основной узел не поддерживает прямой откат. Пожалуйста, вручную выполните команду [1pctl restore] для отката!',
noUpgrade: 'В настоящее время это последняя версия',
upgradeNotes: 'Примечания к выпуску',
upgradeNow: 'Обновить сейчас',
source: 'Источник загрузки',
versionNotSame:
'Версия этого узла не соответствует основной. Переключение в данный момент не поддерживается. Пожалуйста, проверьте и повторите попытку!',
versionCompare:
'Обнаружено, что узел {0} уже имеет последнюю обновляемую версию. Пожалуйста, проверьте версию основного узла и повторите попытку!',

about: 'О программе',
project: 'GitHub',
issue: 'Проблема',
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/lang/modules/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1629,15 +1629,13 @@ const message = {
upgradeHelper: '升級操作需要重啟 1Panel 服務,是否繼續?',
noUpgrade: '當前已經是最新版本',
versionHelper: '1Panel 版本號命名規則為: [大版本].[功能版本].[Bug 修復版本],例:',
versionHelper1: 'v1.0.1 是 v1.0.0 之後的 Bug 修復版本',
versionHelper2: 'v1.1.0 是 v1.0.0 之後的功能版本',
rollbackLocalHelper: '主節點暫不支援直接回滾,請手動執行「1pctl restore」命令回滾!',
upgradeCheck: '檢查更新',
upgradeNotes: '更新內容',
upgradeNow: '立即更新',
source: '下載源',
hasNewVersion: '有新版本',
versionHigher: '檢測到節點 {0} 版本高於主節點,暫不支持切換,請先升級主節點系統版本後重試!',
versionLower: '檢測到節點 {0} 版本低於主節點,暫不支持切換,請先升級該節點系統版本後重試!',
versionNotSame: '檢測到該節點版本與主節點不一致,暫不支援切換,請檢查後重試!',
versionCompare: '檢測到節點 {0} 版本已是當前可升級最新版本,請檢查主節點版本後重試!',

safe: '安全',
bindInfo: '監聽地址',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The provided code snippet seems to contain several inconsistencies, potential issues, or optimization suggestions:

  1. Version Helper Updates:

    • The comments have been updated regarding how versions are named (e.g., major.minor.patch).
    • A new helper rollbackLocalHelper was added for explaining that local upgrades are unsupported and users need to manually restore with 1pctl restore.
  2. Update Messages:

    • There is a minor mistake in "hasNewVersion" which refers to having a new release instead of just checking.
  3. Version Check Issues:

    • The logic for determining whether to allow switching between nodes based on version should be consistent across conditions (version higher/low/ not same). It's suggested to clarify these cases.
  4. Optimization Suggestions:

    • Consider replacing hard-coded messages with dynamic ones if they can vary depending on user input or context.

To address these points more effectively, it would help to gather additional details about the broader functionality and intended use case before making further changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code Differences Analysis:

1. versionHigher translation change

  • Old: "檢測到節點 {0} 版本高於主節點"
  • New: "檢测到节点 {0} 的版本高于主节点"

Explanation:
This suggests that there might be an issue with how the phrase is translated or formatted.

2. versionLower translation change

  • Old: "檢測到節點 {0} 版本低於主節點"
  • New: "检测到节点 {0} 的版本低于主节点"

Explanation:
Similarly, this indicates a potential mismatched translation or incorrect formatting.

3. New entries:

  • rollbackLocalHelper: Provides guidance on not rolling back directly from nodes.
  • versionHigher, versionLower, and versionNotSame now contain error messages related to node versions being inconsistent, which seems like they should align more closely with each other regarding context.

Potential Issues:

  • Mismatched translations between versionHigher/versionLower and versionNotSame.
  • Inconsistent naming conventions (e.g., different formats in multiple places).

These discrepancies could potentially lead to user confusion and errors when using the application.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, there seem to be a few inconsistencies in the code:

  1. Typographical Errors:

    • In versionHelper, "命名規則" should be capitalized as "命名規则".
    • In hasNewVersion (in messages.js), capitalization of words doesn't follow standard conventions.
  2. Incorrect Phrases:

    • The phrase "降級操作需要重啟 1Panel 服務,是否繼續" translates to "Upgrade operation requires restarting 1Panel service. Continue?" and isn't grammatically correct.
  3. Redundant Messages:

    • There appear to be redundant strings like rollbackLocalHelper.
  4. Semantic Issues:

    • The terms "版本高於主節點" and "版本低於主節點" might not clearly convey their intended meanings within this context.
  5. Inconsistent Versioning Logic:

    • The version comparison logic seems inconsistent and may need refinement based on actual requirements.

These findings suggest improvements in terminology, readability, consistency, and potentially in the logic governing version checks. It would also be beneficial to have consistent use of naming conventions throughout similar contexts in other files related to version handling.

Expand Down
8 changes: 3 additions & 5 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1622,15 +1622,13 @@ const message = {
upgradeHelper: '升级操作需要重启 1Panel 服务,是否继续?',
noUpgrade: '当前已经是最新版本',
versionHelper: '1Panel 版本号命名规则为: [大版本].[功能版本].[Bug 修复版本],例:',
versionHelper1: 'v1.0.1 是 v1.0.0 之后的 Bug 修复版本',
versionHelper2: 'v1.1.0 是 v1.0.0 之后的功能版本',
rollbackLocalHelper: '主节点暂不支持直接回滚,请手动执行 1pctl restore 命令回滚!',
upgradeCheck: '检查更新',
upgradeNotes: '更新内容',
upgradeNow: '立即更新',
source: '下载源',
hasNewVersion: '有新版本',
versionHigher: '检测到节点 {0} 版本高于主节点,暂不支持切换,请先升级主节点系统版本后重试!',
versionLower: '检测到节点 {0} 版本低于主节点,暂不支持切换,请先升级该节点系统版本后重试!',
versionNotSame: '检测该节点版本与主节点不一致,暂不支持切换,请检查后重试!',
versionCompare: '检测到节点 {0} 版本已是当前可升级最新版本,请检查主节点版本后重试!',

safe: '安全',
bindInfo: '监听地址',
Expand Down
Loading
Loading