This commit is contained in:
bwcx_jzy 2024-06-15 22:00:48 +08:00
parent 85e9e85cf2
commit 6e1a6fd711
19 changed files with 232 additions and 269 deletions

View File

@ -8,6 +8,12 @@
2. 【agent】优化 DSL 项目支持引用脚本库中的脚本G@xxxxxxxx 为脚本标记 2. 【agent】优化 DSL 项目支持引用脚本库中的脚本G@xxxxxxxx 为脚本标记
3. 【all】优化 新增系统语言配置 `jpom.system.lang` 3. 【all】优化 新增系统语言配置 `jpom.system.lang`
### ⚠️ 注意
- 后端已翻译语言可以度80%(部分异步执行日志等目前未支持)
后端日志国际化需要新增或者修改 `jpom.system.lang` 配置项
------ ------
## 2.11.6.4-beta (2024-06-14) ## 2.11.6.4-beta (2024-06-14)

View File

@ -1,5 +1,5 @@
#i18n en #i18n en
#Sat Jun 15 19:51:06 CST 2024 #Sat Jun 15 21:59:48 CST 2024
i18n.ssh_info_does_not_exist.5ed0=SSH information does not exist i18n.ssh_info_does_not_exist.5ed0=SSH information does not exist
i18n.incompatible_program_versions.5291=The current program version {} The new version of the program is minimum compatible {} and cannot be upgraded directly i18n.incompatible_program_versions.5291=The current program version {} The new version of the program is minimum compatible {} and cannot be upgraded directly
i18n.no_projects_configured.e873=No items are configured i18n.no_projects_configured.e873=No items are configured
@ -274,6 +274,7 @@ i18n.alias_code_validation.8b99=The alias code can only be English and numbers.
i18n.configure_run_path_property.356c=Please configure the run path property [jpom.path] i18n.configure_run_path_property.356c=Please configure the run path property [jpom.path]
i18n.node_script_template_log.85e3=Node script template log i18n.node_script_template_log.85e3=Node script template log
i18n.compression_success.80b3=Compression success i18n.compression_success.80b3=Compression success
i18n.initialize_workspace.bc97=Initialize the {} workspace
i18n.login_name_cannot_contain_chinese_and_special_characters.48a8=Login name cannot contain Chinese characters and cannot contain special characters i18n.login_name_cannot_contain_chinese_and_special_characters.48a8=Login name cannot contain Chinese characters and cannot contain special characters
i18n.cannot_join_cluster_as_role.01d4=Cannot join cluster as {} role i18n.cannot_join_cluster_as_role.01d4=Cannot join cluster as {} role
i18n.not_an_enumeration.8244=Not an enumeration i18n.not_an_enumeration.8244=Not an enumeration
@ -590,6 +591,7 @@ i18n.system_restart_cancel_download.444e=System restart to cancel the download t
i18n.yml_config_format_error_illegal_field.16ea=The format of the yml configuration content is wrong, please check and re-operate (please check if there are illegal fields)\: i18n.yml_config_format_error_illegal_field.16ea=The format of the yml configuration content is wrong, please check and re-operate (please check if there are illegal fields)\:
i18n.delete_failure_with_colon_and_full_stop.bc42=Delete failed\: i18n.delete_failure_with_colon_and_full_stop.bc42=Delete failed\:
i18n.product_directory_cannot_skip_levels.3ad4=The product catalog cannot be upgraded\: i18n.product_directory_cannot_skip_levels.3ad4=The product catalog cannot be upgraded\:
i18n.fix_null_workspace_data.4d0b=Fix data {} {} with null workspace
i18n.soft_link_project_department_exists.fa97=The project department of Soft Chain exists i18n.soft_link_project_department_exists.fa97=The project department of Soft Chain exists
i18n.docker_info.00d2=Docker information i18n.docker_info.00d2=Docker information
i18n.log_file_does_not_exist.f6c6=Log file does not exist i18n.log_file_does_not_exist.f6c6=Log file does not exist
@ -1149,8 +1151,8 @@ i18n.verification_code_incorrect.d8c0=Verification code is incorrect
i18n.main_class_not_found.b4b7=The corresponding MainClass was not found in\: i18n.main_class_not_found.b4b7=The corresponding MainClass was not found in\:
i18n.node_not_exist.760e=The corresponding node does not exist i18n.node_not_exist.760e=The corresponding node does not exist
i18n.start_distribution_exclamation.9fc2=Start distributing\! i18n.start_distribution_exclamation.9fc2=Start distributing\!
i18n.connection_closed.6d4e=Connection closed {} {}
i18n.failure_prefix.115a=Failure\: i18n.failure_prefix.115a=Failure\:
i18n.connection_closed.6d4e=Connection closed {} {}
i18n.no_corresponding_workspace_permission.8402=No corresponding workspace permissions i18n.no_corresponding_workspace_permission.8402=No corresponding workspace permissions
i18n.post_distribution_action_required.8cc8=Please select the action after distribution i18n.post_distribution_action_required.8cc8=Please select the action after distribution
i18n.unsupported_item.bcf4=Unsupported\: i18n.unsupported_item.bcf4=Unsupported\:

View File

@ -1,5 +1,5 @@
#i18n zh #i18n zh
#Sat Jun 15 19:51:04 CST 2024 #Sat Jun 15 21:59:45 CST 2024
i18n.ssh_info_does_not_exist.5ed0=ssh 信息不存在啦 i18n.ssh_info_does_not_exist.5ed0=ssh 信息不存在啦
i18n.incompatible_program_versions.5291=当前程序版本 {} 新版程序最低兼容 {} 不能直接升级 i18n.incompatible_program_versions.5291=当前程序版本 {} 新版程序最低兼容 {} 不能直接升级
i18n.no_projects_configured.e873=没有配置任何项目 i18n.no_projects_configured.e873=没有配置任何项目
@ -274,6 +274,7 @@ i18n.alias_code_validation.8b99=别名码只能是英文、数字
i18n.configure_run_path_property.356c=请配置运行路径属性【jpom.path】 i18n.configure_run_path_property.356c=请配置运行路径属性【jpom.path】
i18n.node_script_template_log.85e3=节点脚本模板日志 i18n.node_script_template_log.85e3=节点脚本模板日志
i18n.compression_success.80b3=压缩成功 i18n.compression_success.80b3=压缩成功
i18n.initialize_workspace.bc97=初始化{}工作空间
i18n.login_name_cannot_contain_chinese_and_special_characters.48a8=登录名不能包含汉字并且不能包含特殊字符 i18n.login_name_cannot_contain_chinese_and_special_characters.48a8=登录名不能包含汉字并且不能包含特殊字符
i18n.cannot_join_cluster_as_role.01d4=不能以 {} 角色加入集群 i18n.cannot_join_cluster_as_role.01d4=不能以 {} 角色加入集群
i18n.not_an_enumeration.8244=不是枚举 i18n.not_an_enumeration.8244=不是枚举
@ -590,6 +591,7 @@ i18n.manager_node_not_found.df04=当前集群未找到管理节点
i18n.yml_config_format_error_illegal_field.16ea=yml 配置内容格式有误请检查后重新操作(请检查是否有非法字段): i18n.yml_config_format_error_illegal_field.16ea=yml 配置内容格式有误请检查后重新操作(请检查是否有非法字段):
i18n.delete_failure_with_colon_and_full_stop.bc42=删除失败: i18n.delete_failure_with_colon_and_full_stop.bc42=删除失败:
i18n.product_directory_cannot_skip_levels.3ad4=产物目录不能越级: i18n.product_directory_cannot_skip_levels.3ad4=产物目录不能越级:
i18n.fix_null_workspace_data.4d0b=修复工作空间为 null 的数据 {} {}
i18n.soft_link_project_department_exists.fa97=软链的项目部存在 i18n.soft_link_project_department_exists.fa97=软链的项目部存在
i18n.system_admin_not_found.6f6c=没有找到系统管理员 i18n.system_admin_not_found.6f6c=没有找到系统管理员
i18n.docker_info.00d2=docker 信息 i18n.docker_info.00d2=docker 信息

View File

@ -546,6 +546,7 @@
"i18n.file_upload_mode_not_configured.b3b2":"没有配置文件上传模式", "i18n.file_upload_mode_not_configured.b3b2":"没有配置文件上传模式",
"i18n.file_write_success.804a":"文件写入成功", "i18n.file_write_success.804a":"文件写入成功",
"i18n.fill_download_address.763c":"填写下载地址", "i18n.fill_download_address.763c":"填写下载地址",
"i18n.fix_null_workspace_data.4d0b":"修复工作空间为 null 的数据 {} {}",
"i18n.folder_download_not_supported.c3b7":"暂不支持下载文件夹", "i18n.folder_download_not_supported.c3b7":"暂不支持下载文件夹",
"i18n.folder_or_file_exists.c687":"文件夹或者文件已存在", "i18n.folder_or_file_exists.c687":"文件夹或者文件已存在",
"i18n.forbidden_operation_range.247f":"【禁止操作】{} {} 至 {}", "i18n.forbidden_operation_range.247f":"【禁止操作】{} {} 至 {}",
@ -647,6 +648,7 @@
"i18n.initialization_success.4725":"初始化成功", "i18n.initialization_success.4725":"初始化成功",
"i18n.initialize_database_failure.2ef9":"初始化数据库失败 {}", "i18n.initialize_database_failure.2ef9":"初始化数据库失败 {}",
"i18n.initialize_user_failure.fe27":"初始化用户失败", "i18n.initialize_user_failure.fe27":"初始化用户失败",
"i18n.initialize_workspace.bc97":"初始化{}工作空间",
"i18n.install_id_does_not_exist.6aee":"数据错误,安装 ID 不存在", "i18n.install_id_does_not_exist.6aee":"数据错误,安装 ID 不存在",
"i18n.installation_success.811f":"安装成功", "i18n.installation_success.811f":"安装成功",
"i18n.installation_success_with_machine_id.1cd6":"安装成功,本机安装 ID 为:{}", "i18n.installation_success_with_machine_id.1cd6":"安装成功,本机安装 ID 为:{}",

View File

@ -38,8 +38,7 @@ public class WorkspaceService extends BaseDbService<WorkspaceModel> implements I
defaultWorkspace.setName(Const.DEFAULT_GROUP_NAME.get()); defaultWorkspace.setName(Const.DEFAULT_GROUP_NAME.get());
defaultWorkspace.setDescription(I18nMessageUtil.get("i18n.default_workspace_cannot_delete.18b4")); defaultWorkspace.setDescription(I18nMessageUtil.get("i18n.default_workspace_cannot_delete.18b4"));
super.insert(defaultWorkspace); super.insert(defaultWorkspace);
log.info(I18nMessageUtil.get("i18n.initialize_workspace.bc97"), Const.DEFAULT_GROUP_NAME.get());
log.info("init created default workspace");
} }
Set<Class<?>> classes = BaseWorkspaceModel.allClass(); Set<Class<?>> classes = BaseWorkspaceModel.allClass();
@ -52,7 +51,7 @@ public class WorkspaceService extends BaseDbService<WorkspaceModel> implements I
String sql = "update " + tableName.value() + " set workspaceId=? where (workspaceId is null or workspaceId='' or workspaceId='null')"; String sql = "update " + tableName.value() + " set workspaceId=? where (workspaceId is null or workspaceId='' or workspaceId='null')";
int execute = this.execute(sql, Const.WORKSPACE_DEFAULT_ID); int execute = this.execute(sql, Const.WORKSPACE_DEFAULT_ID);
if (execute > 0) { if (execute > 0) {
log.info("convertNullWorkspaceId {} {}", tableName.value(), execute); log.info(I18nMessageUtil.get("i18n.fix_null_workspace_data.4d0b"), tableName.value(), execute);
} }
total += execute; total += execute;
} }

View File

@ -2428,7 +2428,8 @@
"bf4a219b": "Please enter the project name", "bf4a219b": "Please enter the project name",
"4551702c": "Please select the project run mode", "4551702c": "Please select the project run mode",
"b5d7203a": "Please enter the project folder", "b5d7203a": "Please enter the project folder",
"d074a68": "For independent project distribution, please modify in distribution management" "d074a68": "For independent project distribution, please modify in distribution management",
"f6a317f0": "ScriptId can also be imported into the script library and needs to be synchronized to the machine node in advance"
}, },
"project-file-backup": { "project-file-backup": {
"64408008": "Directory", "64408008": "Directory",
@ -4907,35 +4908,11 @@
"utils": { "utils": {
"const": { "const": {
"4fcd2be0": "Total {total} items", "4fcd2be0": "Total {total} items",
"1397b7fa": "Cancel timing and no longer execute on schedule (supports! Prefix disabling scheduled execution, such as:! 0 0/1 * *?)", "3509a9f8": "day",
"f397fdb9": "Minute level", "e3db239d": "hour",
"19a1647f": "1 minute", "3b1bb444": "minute",
"edee406c": "5 minutes", "acabc771": "second",
"eff3c3f": "10 minutes", "4a28d11c": "millisecond"
"4cda3b42": "30 minutes",
"5057c1d0": "Hour level",
"f00f01ca": "Every hour",
"f661cf9a": "Day level",
"597995d3": "At midnight and noon",
"c9219cc4": "At midnight",
"c2d566f2": "Second level (seconds level is not enabled by default and needs to be modified in the configuration file: [system. timerMatchSecond])",
"a5ef245b": "Once every 5 seconds",
"222fa259": "Once every 10 seconds",
"7a431b98": "Once every 30 seconds",
"3d7f1632": "<strong>[Recommendation] WeChat Mini Program Search for Number Shield OTP</strong>",
"ee0d1cb6": "<strong>[Recommended] Tencent Authentication Code</strong>Simple and user-friendly<a href=_##_ https://a.app.qq.com/o/simple.jsp?pkgname=com.tencent.authenticator Android</a>",
"316edf4e": "<strong>Authy</strong>Rich features specially designed for two-step verification codes<a href=_##_ https://authy.com/download/ \"IOS/Android/Windows/Mac/Linux</a>&nbsp;<a=\" https://chrome.google.com/webstore/detail/authy/gaedmjdfmmahhbjefcbgaolhhanlaolb?hl=cn Chrome extension</a>",
"571efa83": "<strong>Google Authenticator</strong>Simple and easy to use, but does not support key export backup<a href=_##_ https://apps.apple.com/us/app/google-authenticator/id388497605 \"IOS</a><a=\" https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&amp ; Hl=cn>Android</a>",
"4c20714f": "<strong>Microsoft Authenticator</strong>Recommendation for using Microsoft Family Bucket<a href=_##_ https://www.microsoft.com/zh-cn/account/authenticator IOS/Android</a>",
"c0f69a6e": "<strong>1Password</strong>Powerful and secure password management paid application<a href=_##_ https://1password.com/zh-cn/downloads/ IOS/Android/Windows/Mac/Linux/ChromeOS</a>",
"ba767044": "#ScriptId can be the script file name in the project path or the script template ID in the system",
"59e55b4": "Description: Testing",
"42cca3ee": "#Execute in the specified directory:/ The project directory/root/specific directory defaults to {'${jpom-agent_data_path}'}/script_run_cache",
"5b2ef0bb": "#Number of backup files retained",
"c4682b3f": "#Restrict backup of specified file suffixes (supports regularization)",
"1f958da6": "#Project file backup path",
"ae41f11b": "#Is the log backup function enabled",
"95d754a0": "#ScriptId can reference scripts in the script library (G{'@'}xxx), where xxx is the script tag in the script library, provided that the corresponding script is extracted and synchronized to the corresponding machine node"
}, },
"upload-pieces": { "upload-pieces": {
"ea2d7f82": "The file cannot be empty", "ea2d7f82": "The file cannot be empty",

View File

@ -2428,7 +2428,8 @@
"bf4a219b": "请输入项目名称", "bf4a219b": "请输入项目名称",
"4551702c": "请选择项目运行方式", "4551702c": "请选择项目运行方式",
"b5d7203a": "请输入项目文件夹", "b5d7203a": "请输入项目文件夹",
"d074a68": "独立的项目分发请到分发管理中去修改" "d074a68": "独立的项目分发请到分发管理中去修改",
"f6a317f0": "scriptId也可以引入脚本库中的脚本,需要提前同步至机器节点中"
}, },
"project-file-backup": { "project-file-backup": {
"64408008": "目录", "64408008": "目录",
@ -4907,35 +4908,11 @@
"utils": { "utils": {
"const": { "const": {
"4fcd2be0": "总计 {total} 条", "4fcd2be0": "总计 {total} 条",
"1397b7fa": "取消定时,不再定时执行(支持 ! 前缀禁用定时执行,如:!0 0/1 * * * ?", "3509a9f8": "天",
"f397fdb9": "分钟级别", "e3db239d": "小时",
"19a1647f": "1分钟", "3b1bb444": "分钟",
"edee406c": "5分钟", "acabc771": "秒",
"eff3c3f": "10分钟", "4a28d11c": "毫秒"
"4cda3b42": "30分钟",
"5057c1d0": "小时级别",
"f00f01ca": "每小时",
"f661cf9a": "天级别",
"597995d3": "凌晨0点和中午12点",
"c9219cc4": "凌晨0点",
"c2d566f2": "秒级别(默认未开启秒级别,需要去修改配置文件中:[system.timerMatchSecond]",
"a5ef245b": "5秒一次",
"222fa259": "10秒一次",
"7a431b98": "30秒一次",
"3d7f1632": "<strong>【推荐】微信小程序搜索 数盾OTP</strong>",
"ee0d1cb6": "<strong>【推荐】腾讯身份验证码</strong> 简单好用 <a href=_##_https://a.app.qq.com/o/simple.jsp?pkgname=com.tencent.authenticator\">Android</a>",
"316edf4e": "<strong>Authy</strong> 功能丰富 专为两步验证码 <a href=_##_https://authy.com/download/\">iOS/Android/Windows/Mac/Linux</a> &nbsp; <a href=\"https://chrome.google.com/webstore/detail/authy/gaedmjdfmmahhbjefcbgaolhhanlaolb?hl=cn\">Chrome 扩展</a>",
"571efa83": "<strong>Google Authenticator</strong> 简单易用,但不支持密钥导出备份 <a href=_##_https://apps.apple.com/us/app/google-authenticator/id388497605\">iOS</a> <a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&amp;hl=cn\">Android</a>",
"4c20714f": "<strong>Microsoft Authenticator</strong> 使用微软全家桶的推荐 <a href=_##_https://www.microsoft.com/zh-cn/account/authenticator\">iOS/Android</a>",
"c0f69a6e": "<strong>1Password</strong> 强大安全的密码管理付费应用<a href=_##_https://1password.com/zh-cn/downloads/\">iOS/Android/Windows/Mac/Linux/ChromeOS</a>",
"ba767044": "# scriptId 可以是项目路径下脚本文件名或者系统中的脚本模版ID",
"59e55b4": "description: 测试",
"42cca3ee": "# 在指定目录执行: ./ 项目目录 /root/ 特定目录 默认在 {'${jpom_agent_data_path}'}/script_run_cache ",
"5b2ef0bb": "# 备份文件保留个数",
"c4682b3f": "# 限制备份指定文件后缀(支持正则)",
"1f958da6": "# 项目文件备份路径",
"ae41f11b": "# 是否开启日志备份功能",
"95d754a0": "# scriptId 可以引用脚本库中的脚本G{'@'}xxx其中 xxx 为脚本库中的脚本标记,前提需要提取将对应脚本同步至对应机器节点"
}, },
"upload-pieces": { "upload-pieces": {
"ea2d7f82": "文件不能为空", "ea2d7f82": "文件不能为空",

View File

@ -1371,7 +1371,8 @@ import { getRepositoryInfo } from '@/api/repository'
import { getNodeListAll, getProjectListAll } from '@/api/node' import { getNodeListAll, getProjectListAll } from '@/api/node'
// import { getScriptListAll } from "@/api/server-script"; // import { getScriptListAll } from "@/api/server-script";
import { getDishPatchListAll } from '@/api/dispatch' import { getDishPatchListAll } from '@/api/dispatch'
import { itemGroupBy, CRON_DATA_SOURCE, randomStr } from '@/utils/const' import { itemGroupBy, randomStr } from '@/utils/const'
import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
import { useGuideStore } from '@/stores/guide' import { useGuideStore } from '@/stores/guide'
import { afterOptListSimple } from '@/api/dispatch' import { afterOptListSimple } from '@/api/dispatch'

View File

@ -1061,11 +1061,11 @@ import {
CHANGE_PAGE, CHANGE_PAGE,
COMPUTED_PAGINATION, COMPUTED_PAGINATION,
PAGE_DEFAULT_LIST_QUERY, PAGE_DEFAULT_LIST_QUERY,
PROJECT_DSL_DEFATUL,
randomStr, randomStr,
itemGroupBy, itemGroupBy,
parseTime parseTime
} from '@/utils/const' } from '@/utils/const'
import { PROJECT_DSL_DEFATUL } from '@/utils/const-i18n'
import scriptPage from '@/pages/script/script-list' import scriptPage from '@/pages/script/script-list'
import CustomSelect from '@/components/customSelect' import CustomSelect from '@/components/customSelect'
import whiteList from '@/pages/dispatch/white-list' import whiteList from '@/pages/dispatch/white-list'

View File

@ -541,7 +541,8 @@ import {
import sha1 from 'js-sha1' import sha1 from 'js-sha1'
// import Vue from 'vue' // import Vue from 'vue'
import { MFA_APP_TIP_ARRAY, itemGroupBy } from '@/utils/const' import { itemGroupBy } from '@/utils/const'
import { MFA_APP_TIP_ARRAY } from '@/utils/const-i18n'
import UserLog from './user-log.vue' import UserLog from './user-log.vue'
import { mapState } from 'pinia' import { mapState } from 'pinia'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'

View File

@ -157,7 +157,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { bindMfa } from '@/api/user/user' import { bindMfa } from '@/api/user/user'
import { MFA_APP_TIP_ARRAY } from '@/utils/const' import { MFA_APP_TIP_ARRAY } from '@/utils/const-i18n'
import sha1 from 'js-sha1' import sha1 from 'js-sha1'
import { checkSystem } from '@/api/install' import { checkSystem } from '@/api/install'
import { initInstall } from '@/api/install' import { initInstall } from '@/api/install'

View File

@ -255,14 +255,8 @@ import { deleteMonitor, editMonitor, getMonitorList } from '@/api/monitor'
import { noFileModes } from '@/api/node-project' import { noFileModes } from '@/api/node-project'
import { getUserListAll } from '@/api/user/user' import { getUserListAll } from '@/api/user/user'
import { getNodeListAll, getProjectListAll } from '@/api/node' import { getNodeListAll, getProjectListAll } from '@/api/node'
import { import { CHANGE_PAGE, COMPUTED_PAGINATION, PAGE_DEFAULT_LIST_QUERY, itemGroupBy, parseTime } from '@/utils/const'
CHANGE_PAGE, import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
COMPUTED_PAGINATION,
CRON_DATA_SOURCE,
PAGE_DEFAULT_LIST_QUERY,
itemGroupBy,
parseTime
} from '@/utils/const'
export default { export default {
data() { data() {

View File

@ -220,7 +220,7 @@
{{ $t('pages.node.node-layout.project.project-edit.41ceb72c') }} {{ $t('pages.node.node-layout.project.project-edit.41ceb72c') }}
</a-button> </a-button>
</div> </div>
<div>scriptId也可以引入脚本库中的脚本,需要提前同步至机器节点中</div> <div>{{ $t('pages.node.node-layout.project.project-edit.f6a317f0') }}</div>
<!-- </a-space> --> <!-- </a-space> -->
</template> </template>
<a-form-item-rest> <a-form-item-rest>
@ -470,7 +470,8 @@
import CustomSelect from '@/components/customSelect' import CustomSelect from '@/components/customSelect'
import NodeFunc from '@/pages/node/node-func' import NodeFunc from '@/pages/node/node-func'
import codeEditor from '@/components/codeEditor' import codeEditor from '@/components/codeEditor'
import { PROJECT_DSL_DEFATUL, randomStr } from '@/utils/const' import { randomStr } from '@/utils/const'
import { PROJECT_DSL_DEFATUL } from '@/utils/const-i18n'
import whiteList from '@/pages/node/node-layout/system/white-list.vue' import whiteList from '@/pages/node/node-layout/system/white-list.vue'
import { import {

View File

@ -110,7 +110,7 @@
<script> <script>
import codeEditor from '@/components/codeEditor' import codeEditor from '@/components/codeEditor'
import { editScript, itemScript } from '@/api/node-other' import { editScript, itemScript } from '@/api/node-other'
import { CRON_DATA_SOURCE } from '@/utils/const' import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
import { getNodeListAll } from '@/api/node' import { getNodeListAll } from '@/api/node'
export default { export default {
components: { components: {

View File

@ -441,8 +441,8 @@ import {
import codeEditor from '@/components/codeEditor' import codeEditor from '@/components/codeEditor'
import { getNodeListAll } from '@/api/node' import { getNodeListAll } from '@/api/node'
import ScriptConsole from '@/pages/script/script-console' import ScriptConsole from '@/pages/script/script-console'
import { CHANGE_PAGE, COMPUTED_PAGINATION, CRON_DATA_SOURCE, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const' import { CHANGE_PAGE, COMPUTED_PAGINATION, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const'
import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
import { getWorkSpaceListAll } from '@/api/workspace' import { getWorkSpaceListAll } from '@/api/workspace'
import ScriptLog from '@/pages/script/script-log' import ScriptLog from '@/pages/script/script-log'

View File

@ -421,7 +421,8 @@
</template> </template>
<script> <script>
import { deleteCommand, editCommand, executeBatch, getCommandList, syncToWorkspace, getTriggerUrl } from '@/api/command' import { deleteCommand, editCommand, executeBatch, getCommandList, syncToWorkspace, getTriggerUrl } from '@/api/command'
import { CHANGE_PAGE, COMPUTED_PAGINATION, CRON_DATA_SOURCE, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const' import { CHANGE_PAGE, COMPUTED_PAGINATION, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const'
import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
import { getSshListAll } from '@/api/ssh' import { getSshListAll } from '@/api/ssh'
import codeEditor from '@/components/codeEditor' import codeEditor from '@/components/codeEditor'
import CommandLog from './command-view-log' import CommandLog from './command-view-log'

View File

@ -166,8 +166,8 @@
import { getScriptLibraryList, editScriptLibrary, delScriptLibrary } from '@/api/system/script-library' import { getScriptLibraryList, editScriptLibrary, delScriptLibrary } from '@/api/system/script-library'
import codeEditor from '@/components/codeEditor' import codeEditor from '@/components/codeEditor'
import { machineSearch } from '@/api/system/assets-machine' import { machineSearch } from '@/api/system/assets-machine'
import { CRON_DATA_SOURCE } from '@/utils/const-i18n'
import { CHANGE_PAGE, COMPUTED_PAGINATION, CRON_DATA_SOURCE, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const' import { CHANGE_PAGE, COMPUTED_PAGINATION, PAGE_DEFAULT_LIST_QUERY, parseTime } from '@/utils/const'
// import { getWorkSpaceListAll } from '@/api/workspace' // import { getWorkSpaceListAll } from '@/api/workspace'

View File

@ -0,0 +1,147 @@
import { t } from '@/i18n'
/**
* mfa app
*/
export const MFA_APP_TIP_ARRAY = [
t('utils.const.3d7f1632'),
t('utils.const.ee0d1cb6'),
t('utils.const.316edf4e'),
t('utils.const.571efa83'),
t('utils.const.4c20714f'),
t('utils.const.c0f69a6e')
]
/**
* DSL
*/
export const PROJECT_DSL_DEFATUL =
t('utils.const.ba767044') +
'\n' +
t('utils.const.95d754a0') +
'\n' +
t('utils.const.59e55b4') +
'\n' +
'run:\r\n' +
' start:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: start\r\n' +
' scriptEnv:\r\n' +
' "boot_active": test\r\n' +
' status:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: status\r\n' +
' stop:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: stop\r\n' +
'# restart:\r\n' +
'## scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
'# scriptId: \r\n' +
'# scriptArgs: restart\r\n' +
'# scriptEnv:\r\n' +
'# "boot_active": test\r\n' +
'# reload:\r\n' +
'## scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
'# scriptId: \r\n' +
'# scriptArgs: reload\r\n' +
'# scriptEnv:\r\n' +
'# "boot_active": test\r\n' +
'# fileChangeReload: true\r\n' +
t('utils.const.42cca3ee') +
'# execPath: ./\r\n' +
'file:\r\n' +
t('utils.const.5b2ef0bb') +
'# backupCount: 5\r\n' +
t('utils.const.c4682b3f') +
"# backupSuffix: [ '.jar','.html','^.+\\.(?i)(txt)$' ]\r\n" +
t('utils.const.1f958da6') +
'# backupPath: /data/jpom_backup\r\n' +
'config:\r\n' +
t('utils.const.ae41f11b') +
'# autoBackToFile: true\r\n' +
'\r\n'
/**
* cron
*
* https://www.npmjs.com/package/cron-parser
*/
export const CRON_DATA_SOURCE = [
{
title: t('utils.const.1397b7fa'),
options: [
{
title: '',
value: ''
}
]
},
{
title: t('utils.const.f397fdb9'),
options: [
{
title: t('utils.const.19a1647f'),
value: '0 0/1 * * * ?'
},
{
title: t('utils.const.edee406c'),
value: '0 0/5 * * * ?'
},
{
title: t('utils.const.eff3c3f'),
value: '0 0/10 * * * ?'
},
{
title: t('utils.const.4cda3b42'),
value: '0 0/30 * * * ?'
}
]
},
{
title: t('utils.const.5057c1d0'),
options: [
{
title: t('utils.const.f00f01ca'),
value: '0 0 0/1 * * ?'
}
]
},
{
title: t('utils.const.f661cf9a'),
options: [
{
title: t('utils.const.597995d3'),
value: '0 0 0,12 * * ?'
},
{
title: t('utils.const.c9219cc4'),
value: '0 0 0 * * ?'
}
]
},
{
title: t('utils.const.c2d566f2'),
options: [
{
title: t('utils.const.a5ef245b'),
value: '0/5 * * * * ?'
},
{
title: t('utils.const.222fa259'),
value: '0/10 * * * * ?'
},
{
title: t('utils.const.7a431b98'),
value: '0/30 * * * * ?'
}
]
}
]

View File

@ -1,4 +1,3 @@
import { t } from '@/i18n'
/// ///
/// Copyright (c) 2019 Of Him Code Technology Studio /// Copyright (c) 2019 Of Him Code Technology Studio
/// Jpom is licensed under Mulan PSL v2. /// Jpom is licensed under Mulan PSL v2.
@ -9,6 +8,9 @@ import { t } from '@/i18n'
/// See the Mulan PSL v2 for more details. /// See the Mulan PSL v2 for more details.
/// ///
import { t } from '@/i18n'
import dayjs from 'dayjs'
// 常量池 // 常量池
export const USER_NAME_KEY = 'Jpom-UserName' export const USER_NAME_KEY = 'Jpom-UserName'
@ -44,17 +46,31 @@ export const NO_NOTIFY_KEY = 'tip'
export const NO_LOADING_KEY = 'loading' export const NO_LOADING_KEY = 'loading'
const cachePageLimitKeyName = 'page_limit'
import dayjs from 'dayjs'
export function getCachePageLimit(): number {
return parseInt(localStorage.getItem(cachePageLimitKeyName) || '10')
}
/** /**
* *
*/ */
export const PAGE_DEFAULT_SIZW_OPTIONS = ['5', '10', '15', '20', '25', '30', '35', '40', '50'] export const PAGE_DEFAULT_SIZW_OPTIONS = ['5', '10', '15', '20', '25', '30', '35', '40', '50']
/**
* ID
*/
export const CACHE_WORKSPACE_ID = 'workspaceId'
/**
*
*/
export const RESTART_UPGRADE_WAIT_TIME_COUNT = 80
/**
*
*/
export const ZIP_ACCEPT = '.tar,.bz2,.gz,.zip,.tar.bz2,.tar.gz'
const cachePageLimitKeyName = 'page_limit'
export function getCachePageLimit(): number {
return parseInt(localStorage.getItem(cachePageLimitKeyName) || '10')
}
/** /**
* *
* @param {Number} total * @param {Number} total
@ -125,167 +141,6 @@ export function CHANGE_PAGE(listQuery, { pagination, sorter }) {
return listQuery return listQuery
} }
/**
* ID
*/
export const CACHE_WORKSPACE_ID = 'workspaceId'
/**
*
*/
export const RESTART_UPGRADE_WAIT_TIME_COUNT = 80
/**
* cron
*
* https://www.npmjs.com/package/cron-parser
*/
export const CRON_DATA_SOURCE = [
{
title: t('utils.const.1397b7fa'),
options: [
{
title: '',
value: ''
}
]
},
{
title: t('utils.const.f397fdb9'),
options: [
{
title: t('utils.const.19a1647f'),
value: '0 0/1 * * * ?'
},
{
title: t('utils.const.edee406c'),
value: '0 0/5 * * * ?'
},
{
title: t('utils.const.eff3c3f'),
value: '0 0/10 * * * ?'
},
{
title: t('utils.const.4cda3b42'),
value: '0 0/30 * * * ?'
}
]
},
{
title: t('utils.const.5057c1d0'),
options: [
{
title: t('utils.const.f00f01ca'),
value: '0 0 0/1 * * ?'
}
]
},
{
title: t('utils.const.f661cf9a'),
options: [
{
title: t('utils.const.597995d3'),
value: '0 0 0,12 * * ?'
},
{
title: t('utils.const.c9219cc4'),
value: '0 0 0 * * ?'
}
]
},
{
title: t('utils.const.c2d566f2'),
options: [
{
title: t('utils.const.a5ef245b'),
value: '0/5 * * * * ?'
},
{
title: t('utils.const.222fa259'),
value: '0/10 * * * * ?'
},
{
title: t('utils.const.7a431b98'),
value: '0/30 * * * * ?'
}
]
}
]
/**
*
*/
export const ZIP_ACCEPT = '.tar,.bz2,.gz,.zip,.tar.bz2,.tar.gz'
/**
* mfa app
*/
export const MFA_APP_TIP_ARRAY = [
t('utils.const.3d7f1632'),
t('utils.const.ee0d1cb6'),
t('utils.const.316edf4e'),
t('utils.const.571efa83'),
t('utils.const.4c20714f'),
t('utils.const.c0f69a6e')
]
/**
* DSL
*/
export const PROJECT_DSL_DEFATUL =
t('utils.const.ba767044') +
'\n' +
t('utils.const.95d754a0') +
'\n' +
t('utils.const.59e55b4') +
'\n' +
'run:\r\n' +
' start:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: start\r\n' +
' scriptEnv:\r\n' +
' "boot_active": test\r\n' +
' status:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: status\r\n' +
' stop:\r\n' +
'# scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
' scriptId: \r\n' +
' scriptArgs: stop\r\n' +
'# restart:\r\n' +
'## scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
'# scriptId: \r\n' +
'# scriptArgs: restart\r\n' +
'# scriptEnv:\r\n' +
'# "boot_active": test\r\n' +
'# reload:\r\n' +
'## scriptId: project.sh\r\n' +
'# scriptId: G@xxxx\r\n' +
'# scriptId: \r\n' +
'# scriptArgs: reload\r\n' +
'# scriptEnv:\r\n' +
'# "boot_active": test\r\n' +
'# fileChangeReload: true\r\n' +
t('utils.const.42cca3ee') +
'# execPath: ./\r\n' +
'file:\r\n' +
t('utils.const.5b2ef0bb') +
'# backupCount: 5\r\n' +
t('utils.const.c4682b3f') +
"# backupSuffix: [ '.jar','.html','^.+\\.(?i)(txt)$' ]\r\n" +
t('utils.const.1f958da6') +
'# backupPath: /data/jpom_backup\r\n' +
'config:\r\n' +
t('utils.const.ae41f11b') +
'# autoBackToFile: true\r\n' +
'\r\n'
/** /**
* *
* @params list {Array} - * @params list {Array} -
@ -473,7 +328,7 @@ export function itemGroupBy(arr, groupKey, key, dataKey) {
* @param {String} levelCount * @param {String} levelCount
* @returns * @returns
*/ */
export function formatDuration(ms: any, seg: string = '', levelCount: number = 5) { export function formatDuration(ms: any, seg: string = ',', levelCount: number = 5) {
let msNum = Number(ms) let msNum = Number(ms)
if (isNaN(msNum)) { if (isNaN(msNum)) {
return ms return ms
@ -485,13 +340,12 @@ export function formatDuration(ms: any, seg: string = '', levelCount: number = 5
seg = seg || '' seg = seg || ''
levelCount = levelCount || 5 levelCount = levelCount || 5
if (msNum < 0) msNum = -msNum if (msNum < 0) msNum = -msNum
const time = { const time = {} as any
: Math.floor(msNum / 86400000), ;(time[t('utils.const.3509a9f8')] = Math.floor(msNum / 86400000)),
小时: Math.floor(msNum / 3600000) % 24, (time[t('utils.const.e3db239d')] = Math.floor(msNum / 3600000) % 24),
分钟: Math.floor(msNum / 60000) % 60, (time[t('utils.const.3b1bb444')] = Math.floor(msNum / 60000) % 60),
: Math.floor(msNum / 1000) % 60, (time[t('utils.const.acabc771')] = Math.floor(msNum / 1000) % 60),
毫秒: Math.floor(msNum) % 1000 (time[t('utils.const.4a28d11c')] = Math.floor(msNum) % 1000)
}
return Object.entries(time) return Object.entries(time)
.filter((val) => val[1] !== 0) .filter((val) => val[1] !== 0)
.map(([key, val]) => `${val}${key}`) .map(([key, val]) => `${val}${key}`)
@ -508,13 +362,12 @@ export function formatPercent(point, keep = 2) {
} }
//小数转换为分数(小数先转换成number类型并且保留2位小数) //小数转换为分数(小数先转换成number类型并且保留2位小数)
export function formatPercent2(point, keep = 2) { export function formatPercent2(point: any, keep = 2) {
if (null == point) { if (null == point) {
return '-' return '-'
} }
let percent = Number(Number(point).toFixed(keep)) const percent = Number(Number(point).toFixed(keep))
percent += '%' return percent + '%'
return percent
} }
//小数转换为分数(小数先转换成number类型再乘以100并且保留2位小数) //小数转换为分数(小数先转换成number类型再乘以100并且保留2位小数)
@ -565,9 +418,9 @@ export function compareVersion(version1, version2) {
// 当前页面构建信息 // 当前页面构建信息
export function pageBuildInfo() { export function pageBuildInfo() {
const htmlVersion = document.head.querySelector('[name~=jpom-version][content]').content const htmlVersion = document.head.querySelector('[name~=jpom-version][content]')?.content
const buildTime = document.head.querySelector('[name~=build-time][content]').content const buildTime = document.head.querySelector('[name~=build-time][content]')?.content
const buildEnv = document.head.querySelector('[name~=build-env][content]').content const buildEnv = document.head.querySelector('[name~=build-env][content]')?.content
return { return {
v: htmlVersion, v: htmlVersion,
t: buildTime, t: buildTime,