Skip to content

Commit

Permalink
Merge branch 'labring:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bearslyricattack committed Sep 5, 2024
2 parents 5ad0080 + 9ca435c commit d958379
Show file tree
Hide file tree
Showing 39 changed files with 674 additions and 477 deletions.
14 changes: 13 additions & 1 deletion docs/website/scripts/sync-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ async function generateVersionsJson () {
await fs.writeJson(versionsJsonPath, versions, { spaces: 2 })
}

function safeJoin (base, ...parts) {
const joined = [base, ...parts].join(path.sep)
const normalized = path.normalize(joined)

const normalizedBase = path.normalize(base)
if (!normalized.startsWith(normalizedBase) || normalized === normalizedBase) {
throw new Error('Path traversal attempt blocked')
}

return normalized
}

async function syncDocs () {
try {
// Remove specified directories
Expand All @@ -19,7 +31,7 @@ async function syncDocs () {
'i18n/zh-Hans/docusaurus-plugin-content-docs',
'versioned_docs',
'versioned_sidebars'
].map(dir => path.join(websiteDir, dir))
].map(dir => safeJoin(websiteDir, dir))

await Promise.all(dirsToRemove.map(dir => fs.remove(dir)))

Expand Down
2 changes: 1 addition & 1 deletion frontend/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"**/src/**/*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"],
"**/src/**/*.{js,jsx,ts,tsx}": ["prettier --write"],
"**/src/**/*.{json,css,scss,md}": ["prettier --write"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const LogsModal = ({
const watchLogs = useCallback(() => {
// podName is empty. pod may has been deleted
if (!podName) return closeFn();
setIsLoading(true);

const controller = new AbortController();
streamFetch({
Expand All @@ -60,6 +61,7 @@ const LogsModal = ({
abortSignal: controller,
firstResponse() {
setIsLoading(false);
setLogs('');
setTimeout(() => {
if (!LogBox.current) return;

Expand Down Expand Up @@ -96,7 +98,7 @@ const LogsModal = ({
return () => {
controller?.abort();
};
}, []);
}, [watchLogs]);

const exportLogs = useCallback(async () => {
const allLogs = await getPodLogs({
Expand All @@ -116,7 +118,7 @@ const LogsModal = ({
<Box fontSize={'xl'} fontWeight={'bold'}>
Pod {t('Log')}
</Box>
<Box px={3}>
<Box px={3} zIndex={10000}>
<SealosMenu
width={240}
Button={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const Pods = ({
const [detailPodIndex, setDetailPodIndex] = useState<number>();
const [detailFilePodIndex, setDetailFilePodIndex] = useState<number>();

const closeFn = useCallback(() => setLogsPodIndex(undefined), [setLogsPodIndex]);

const { Loading } = useLoading();
const { openConfirm: openConfirmRestart, ConfirmChild: RestartConfirmChild } = useConfirm({
content: 'Please confirm to restart the Pod?'
Expand Down Expand Up @@ -306,7 +308,7 @@ const Pods = ({
setLogsPodName={(name: string) =>
setLogsPodIndex(pods.findIndex((item) => item.podName === name))
}
closeFn={() => setLogsPodIndex(undefined)}
closeFn={closeFn}
/>
)}
{detailPodIndex !== undefined && (
Expand Down
45 changes: 23 additions & 22 deletions frontend/providers/template/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"Advanced Configuration": "Advanced",
"Age": "Uptime",
"AnticipatedPrice": "Estimated Cost",
"app": {
"Resource Quota": "Resource Quota",
"The applied CPU exceeds the quota": "Requested CPU exceeds your quota. Please contact admin.",
"The applied GPU exceeds the quota": "Requested GPU exceeds your quota. Please contact admin.",
"The applied memory exceeds the quota": "Requested storage exceeds your quota. Please contact admin.",
"The applied storage exceeds the quota": "The applied storage exceeds the quota"
},
"App Name": "App Name",
"Application Deployment": "App Deployment",
"Application List": " App List",
Expand All @@ -24,7 +17,6 @@
"Auto scaling": "Scaling",
"Basic Information": "Basic",
"Button Effect": "Button Appearance",
"cpu": "CPU",
"CPU": "CPU",
"CPU target is the CPU utilization rate of any container": "CPU target represents the CPU utilization rate of any container",
"CPU target value": "CPU Target",
Expand All @@ -33,10 +25,6 @@
"Command": "Command",
"Command parameters": "Command parameters",
"Component": "Component",
"common": {
"Surplus": "Surplus",
"Used": "Used"
},
"Config Form": "Form",
"ConfigMap Path Conflict": "ConfigMap Path Conflict",
"Configuration File": "Configmap",
Expand Down Expand Up @@ -79,7 +67,6 @@
"File Value can not empty": "File content is required",
"Filename can not empty": "File name is required",
"Fixed instance": "Fixed",
"gpu": "GPU",
"Heading to sealos soon": "Redirecting to Sealos shortly",
"Home Page": "Project Home",
"Html Part": "HTML Snippet",
Expand All @@ -102,15 +89,13 @@
"Log": "Log",
"Markdown Part": "Markdown Snippet",
"Max Storage Value": "Maximum storage: ",
"memory": "Memory",
"Memory": "Memory",
"Memory target value": "Memory Target",
"Min Storage Value": "Minimum storage: ",
"Mount Path Auth": "Mount path must match: /^[0-9a-zA-Z_/][0-9a-zA-Z_/.-]*[0-9a-zA-Z_/]$/",
"Name": "Name",
"Network Configuration": "Network",
"Next Execution Time": "Next Scheduled",
"Port": "Port",
"No Applications": "No Apps Available",
"None": "None",
"Not Configured": "Not Configured",
Expand All @@ -121,7 +106,6 @@
"One click deploy button": "One-Click deploy button",
"Operation": "Operation",
"Option": "Optional",
"others": "Others",
"Parameters": "Parameters",
"Password": "Password",
"Password for the image registry": "Image Registry Password",
Expand All @@ -135,6 +119,7 @@
"Pod": "Pod",
"Pod Name": "Pod Name",
"Pods List": "Pods List",
"Port": "Port",
"Private": "Private",
"Problem Analysis": "Issue Analysis",
"Prompt": "Notice",
Expand Down Expand Up @@ -169,7 +154,6 @@
"Stateful": "Stateful",
"Stateless": "Stateless",
"Status": "Status",
"storage": "Storage",
"Storage": "Storage",
"Storage Range": "Storage Range",
"Storage Value can not empty": "Storage capacity is required",
Expand All @@ -180,7 +164,6 @@
"TemplateNameError": "Template name is required",
"Templates": "Template Marketplace",
"Terminal": "Terminal",
"There is no resource of this type": "No resources of this type available",
"Total": "Total",
"TotalPrice": "Total Price",
"Type": "Type",
Expand All @@ -194,13 +177,25 @@
"Username for the image registry": "Image Registry Username",
"YAML File": "YAML",
"You haven't created any application yet.": "You don't have any apps yet.",
"app": {
"Resource Quota": "Resource Quota",
"The applied CPU exceeds the quota": "Requested CPU exceeds your quota. Please contact admin.",
"The applied GPU exceeds the quota": "Requested GPU exceeds your quota. Please contact admin.",
"The applied memory exceeds the quota": "Requested storage exceeds your quota. Please contact admin.",
"The applied storage exceeds the quota": "The applied storage exceeds the quota"
},
"capacity": "capacity",
"common": {
"Surplus": "Surplus",
"Used": "Used"
},
"cpu": "CPU",
"cronjob": "CronJob",
"database": "DataBase",
"delete message": "Are you sure you want to delete this app? If you proceed, all project data will be permanently deleted.",
"develop": {
"Configure Form": "Configure Form",
"Debugging Template": "Debugging Template",
"Debugging Template": "Debugging",
"Development": "Development",
"Dryrun Deploy": "Test Deployment",
"Formal Deploy": "Deploy",
Expand All @@ -213,23 +208,29 @@
"file": "file",
"file value": "File Content",
"filename": "Filename",
"gpu": "GPU",
"grpcs": "gRPCS",
"https": "HTTPS",
"jump_message": "This app can't be used independently. Click 'OK' to use it in Sealos Desktop.",
"jump_prompt": "Redirect Notice",
"launchpad": "App Launchpad",
"local storage": "Local Storage",
"memory": "Memory",
"mount path": "mount path",
"multiple instances do not share data": "Storage volumes are not shared between instances",
"no_resource_type": "There are currently no resources of this type",
"object_storage": "Object Storage",
"others": "Others",
"pause_message": "Pausing will stop CPU and memory charges, but storage and external network port fees will continue. Pause now?",
"permission": "Permission",
"price": "Price",
"private": "private",
"protocol": "protocol",
"public": "public",
"storage": "Storage",
"success": "success",
"target_value": "Target Value",
"total_price_tip": "The estimated cost does not include traffic fees, and is subject to actual usage.",
"users installed the app": "{{count}} users have installed this app",
"websocket": "WebSocket",
"total_price_tip": "The estimated cost does not include port fees and traffic fees, and is subject to actual usage."
}
"websocket": "WebSocket"
}
39 changes: 20 additions & 19 deletions frontend/providers/template/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"Advanced Configuration": "高级配置",
"Age": "启动时长",
"AnticipatedPrice": "预估价格",
"app": {
"Resource Quota": "资源配额",
"The applied CPU exceeds the quota": "申请的 CPU 超出配额限制,请联系管理员",
"The applied GPU exceeds the quota": "申请的 GPU 超出配额限制,请联系管理员",
"The applied memory exceeds the quota": "申请的 '内存' 超出配额限制,请联系管理员",
"The applied storage exceeds the quota": "申请的 '存储' 超出配额限制,请联系管理员"
},
"App Name": "应用名称",
"Application Deployment": "应用部署",
"Application List": " 应用列表",
Expand All @@ -24,7 +17,6 @@
"Auto scaling": "弹性伸缩",
"Basic Information": "基本信息",
"Button Effect": "按钮效果",
"cpu": "CPU",
"CPU": "CPU",
"CPU target is the CPU utilization rate of any container": "CPU 目标值为任一容器的 CPU 利用率",
"CPU target value": "CPU 目标值",
Expand All @@ -33,10 +25,6 @@
"Command": "启动命令",
"Command parameters": "命令参数",
"Component": "组件",
"common": {
"Surplus": "剩余",
"Used": "已用"
},
"Config Form": "配置表单",
"ConfigMap Path Conflict": "配置文件路径冲突",
"Configuration File": "配置文件",
Expand Down Expand Up @@ -101,15 +89,13 @@
"Log": "日志",
"Markdown Part": "Markdown 片段",
"Max Storage Value": "容量最大为",
"memory": "内存",
"Memory": "内存",
"Memory target value": "内存目标值",
"Min Storage Value": "容量最小为",
"Mount Path Auth": "挂载路径需满足: /^[0-9a-zA-Z_/][0-9a-zA-Z_/.-]*[0-9a-zA-Z_/]$/",
"Name": "名字",
"Network Configuration": "网络配置",
"Next Execution Time": "下次执行时间",
"Port": "端口",
"No Applications": "暂无应用",
"None": "暂无",
"Not Configured": "未配置",
Expand All @@ -120,7 +106,6 @@
"One click deploy button": "一键部署按钮",
"Operation": "操作",
"Option": "选填",
"others": "其他资源",
"Parameters": "运行参数",
"Password": "密码",
"Password for the image registry": "镜像仓库的密码",
Expand All @@ -134,6 +119,7 @@
"Pod": "实例",
"Pod Name": "实例名",
"Pods List": "实例列表",
"Port": "端口",
"Private": "私有",
"Problem Analysis": "问题分析",
"Prompt": "提示",
Expand Down Expand Up @@ -169,7 +155,6 @@
"Stateless": "无状态",
"Status": "状态",
"Storage": "存储卷",
"storage": "存储卷",
"Storage Range": "容量范围",
"Storage Value can not empty": "容量不能为空",
"Storage path can not empty": "挂载路径不能为空",
Expand All @@ -179,7 +164,7 @@
"TemplateNameError": "模板名称不能为空",
"Templates": "模板市场",
"Terminal": "终端",
"There is no resource of this type": "没有此类型的资源",
"no_resource_type": "暂无此类型的资源",
"Total": "总计",
"TotalPrice": "总价",
"Type": "类型",
Expand All @@ -193,7 +178,19 @@
"Username for the image registry": "镜像仓库的用户名",
"YAML File": "YAML 文件",
"You haven't created any application yet.": "您还没有新建应用。",
"app": {
"Resource Quota": "资源配额",
"The applied CPU exceeds the quota": "申请的 CPU 超出配额限制,请联系管理员",
"The applied GPU exceeds the quota": "申请的 GPU 超出配额限制,请联系管理员",
"The applied memory exceeds the quota": "申请的 '内存' 超出配额限制,请联系管理员",
"The applied storage exceeds the quota": "申请的 '存储' 超出配额限制,请联系管理员"
},
"capacity": "容量",
"common": {
"Surplus": "剩余",
"Used": "已用"
},
"cpu": "CPU",
"cronjob": "定时任务",
"database": "数据库",
"delete message": "您确定要删除此应用程序吗?\n如果继续,该项目的所有数据都将被删除。",
Expand All @@ -219,17 +216,21 @@
"jump_prompt": "跳转提示",
"launchpad": "应用管理",
"local storage": "本地存储",
"memory": "内存",
"mount path": "挂载路径",
"multiple instances do not share data": "存储卷不支持多个实例共享",
"object_storage": "对象存储",
"others": "其他资源",
"pause_message": "暂停服务将停止计算 CPU 和内存等费用,但存储和外网端口仍将产生费用。是否现在暂停?",
"permission": "权限",
"price": "价格",
"private": "私有",
"protocol": "协议",
"public": "公共",
"storage": "存储卷",
"success": "成功",
"target_value": "目标值",
"total_price_tip": "预估费用不包括流量费用,以实际使用为准",
"users installed the app": "已有 {{count}} 名用户安装该应用",
"websocket": "WebSocket",
"total_price_tip": "预估费用不包括端口费用和流量费用,以实际使用为准"
"websocket": "WebSocket"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d958379

Please sign in to comment.