Skip to content

Commit 5492fb3

Browse files
zjy365mlhiter
andauthored
feat: support ui 2.0 add logs view (labring#5357)
* feat: datePicker * feat: header ui * fix: DatePicker input status bug * feat: header ui * feat: log number ui * feat: LogCount ui * add layout * update layouts * add AdvancedInfo * chore: move file to page/log * chore: move log component to log/component * fix: add contains and not contains operator * feat: log list header ui * update index * feat: log table ui * chore: i18n adjust * fix: pod and container * update style * update monitor * update pages * chore: adjust logs components position * fix: select placeholder chore: stash monitor update detail page * add api * update logs * add logs & filter & logCounts * update logs * update * update MonitorChart * add prevFieldList * update api * delete table * update log api * update scroll * update common.json * update defaultRecentDate * fix * update keys * update timerange * done * update datepicker * add queryPodList api * update podname * fix init pods * fix ReleaseModal fix ReleaseModal fix ReleaseModal * delete release-modal * fix log height * fix pvc bug * update info style * fix: env info overflow --------- Co-authored-by: mlhiter <[email protected]>
1 parent 6641cd9 commit 5492fb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4681
-752
lines changed

frontend/packages/ui/src/components/Select/index.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ const MySelect = (
5454
}
5555
});
5656

57-
const activeMenu = useMemo(() => list.find((item) => item.value === value), [list, value]);
57+
const activeMenu = useMemo(() => {
58+
const foundItem = list.find((item) => item.value === value);
59+
if (!foundItem && value) {
60+
return {
61+
label: value,
62+
value: value
63+
};
64+
}
65+
return foundItem;
66+
}, [list, value]);
5867

5968
return (
6069
<Menu autoSelect={false} isOpen={isOpen} onOpen={onOpen} onClose={onClose}>

frontend/pnpm-lock.yaml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/providers/applaunchpad/data/config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ launchpad:
1919
url: http://launchpad-monitor.sealos.svc.cluster.local:8428
2020
billing:
2121
url: "http://account-service.account-system.svc:2333"
22+
log:
23+
url: "http://service-vlogs.sealos.svc.cluster.local:8428"
2224
appResourceFormSliderConfig:
2325
default:
2426
cpu: [100, 200, 500, 1000, 2000, 3000, 4000, 8000]

frontend/providers/applaunchpad/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
"@sealos/driver": "workspace:^",
2424
"@sealos/ui": "workspace:^",
2525
"@tanstack/react-query": "^4.35.3",
26+
"@tanstack/react-table": "^8.10.7",
2627
"ansi_up": "^5.2.1",
2728
"axios": "^1.5.1",
2829
"base64-stream": "^1.0.0",
30+
"date-fns": "^2.30.0",
2931
"dayjs": "^1.11.10",
3032
"decimal.js": "^10.4.3",
3133
"dns": "^0.2.2",
@@ -45,6 +47,7 @@
4547
"nprogress": "^0.2.0",
4648
"prettier": "^2.8.8",
4749
"react": "18.2.0",
50+
"react-day-picker": "^8.8.2",
4851
"react-dom": "18.2.0",
4952
"react-hook-form": "^7.46.2",
5053
"react-i18next": "^14.1.2",

frontend/providers/applaunchpad/public/locales/en/common.json

+47-7
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"ConfigMap Path Conflict": "ConfigMap Path Conflict",
5252
"ConfigMap Tip": "ConfigMap",
5353
"Configurable number of instances or automatic horizontal scaling": "Configurable replica count and auto horizontal scaling",
54-
"Configuration File": "Configmap",
55-
"Confirm": "Yes",
54+
"Configuration File": "Configmaps",
55+
"Confirm": "Confirm",
5656
"Confirm deletion": "Yes",
5757
"Confirm Deploy Application?": "Are you sure you want to deploy the application?",
5858
"Confirm to restart this application?": "Are you sure you want to update the application?",
@@ -86,7 +86,7 @@
8686
"Edit Env Variable": "Edit Environment Variables",
8787
"Edit Environment Variables": "Edit Environment Variables",
8888
"Env Placeholder": "one per line, key and value separated by colon or equals sign, e.g.:\nmongoUrl=127.0.0.1:8000\nredisUrl:127.0.0.0:8001\n-env1 =test",
89-
"Environment Variables": "Environment",
89+
"Environment Variables": "Environment Variables",
9090
"Export": "Export",
9191
"Export Domain": "Assigned Domain",
9292
"file": "File",
@@ -163,7 +163,7 @@
163163
"please enter app name": "please enter: {{appName}}",
164164
"Pod": "Pod",
165165
"Pod Name": "Pod Name",
166-
"Pods List": "Pods List",
166+
"Pods List": "Pod List",
167167
"Port": "Port",
168168
"private": "private",
169169
"Private": "Private",
@@ -197,7 +197,7 @@
197197
"Stateless": "Stateless",
198198
"Status": "Status",
199199
"storage": "Storage",
200-
"Storage": "Storage",
200+
"Storage": "Mounted Volumes",
201201
"Storage path can not empty": "Storage mount path is required",
202202
"Storage Range": "Storage Range",
203203
"Storage Value can not empty": "Storage size is required",
@@ -257,7 +257,7 @@
257257
"total_price_tip": "The estimated cost does not include port fees and traffic fees, and is subject to actual usage.",
258258
"nodeports": "NodePorts",
259259
"streaming_logs": "Streaming logs",
260-
"within_5_minutes": "Within 5 minutes",
260+
"within_5_minute": "Within 5 minute",
261261
"within_1_hour": "Within 1 hour",
262262
"within_1_day": "Within 1 day",
263263
"terminated_logs": "Terminated logs",
@@ -277,5 +277,45 @@
277277
"storage_path_placeholder": "For Example: /data"
278278
},
279279
"guide_deploy_button": "Complete creation",
280-
"shared": "Shared"
280+
"filter": "Filter",
281+
"start": "Start",
282+
"end": "End",
283+
"time_zone": "Time Zone",
284+
"recently": "Last",
285+
"minute": "minutes",
286+
"day": "days",
287+
"hour": "hours",
288+
"time": "Range",
289+
"log_number": "Log Number",
290+
"close": "Off",
291+
"normal_filter": "Normal",
292+
"advanced_filter": "Advance",
293+
"json_mode": "JSON Mode",
294+
"only_stderr": "Stderr Only",
295+
"keyword": "Keywords",
296+
"search": "Search",
297+
"equal": "equal",
298+
"greater_than": "Greater than",
299+
"less_than": "Less than",
300+
"field_name": "Select Field",
301+
"value": "Enter Value",
302+
"logNumber": "Log Counts",
303+
"overview": "Overview",
304+
"monitor": "Monitors",
305+
"logs": "Logs",
306+
"application_source": "Source",
307+
"contains": "contains",
308+
"not_contains": "not contains",
309+
"visible": "Visable",
310+
"hidden": "Hidden",
311+
"export_log": "Export",
312+
"no_data_available": "No data available",
313+
"all": "All",
314+
"hour-singular": "hour",
315+
"not_equal": "not",
316+
"field_settings": "Field Setting",
317+
"selected": "Selected",
318+
"please_select": "Please Select",
319+
"refetching_success": "Refresh Successful",
320+
"refresh": "refresh"
281321
}

frontend/providers/applaunchpad/public/locales/zh/common.json

+44-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"Auto scaling": "弹性伸缩",
3131
"Balance": "余额",
3232
"Basic Config": "基础配置",
33-
"Basic Information": "基本信息",
33+
"Basic Information": "基础信息",
3434
"Can help you deploy any Docker image": "丰富的镜像仓库,支持任意 Docker 镜像",
3535
"Can not change storage path": "不允许修改挂载路径",
3636
"Cancel": "取消",
@@ -162,8 +162,8 @@
162162
"Please enter": "请输入",
163163
"please enter app name": "请输入:{{appName}}",
164164
"Pod": "实例",
165-
"Pod Name": "实例名",
166-
"Pods List": "实例列表",
165+
"Pod Name": "Pod 名称",
166+
"Pods List": "Pod 列表",
167167
"Port": "端口",
168168
"private": "私有",
169169
"Private": "私有",
@@ -257,7 +257,7 @@
257257
"total_price_tip": "预估费用不包括端口费用和流量费用,以实际使用为准",
258258
"nodeports": "外网端口",
259259
"streaming_logs": "实时日志",
260-
"within_5_minutes": "五分钟内",
260+
"within_5_minute": "五分钟内",
261261
"within_1_hour": "一小时内",
262262
"within_1_day": "一天内",
263263
"terminated_logs": "中断前",
@@ -278,5 +278,44 @@
278278
"storage_path_placeholder": "如:/data"
279279
},
280280
"guide_deploy_button": "完成创建",
281-
"shared": "共享"
281+
"filter": "筛选",
282+
"start": "开始",
283+
"end": "结束",
284+
"time_zone": "时区",
285+
"recently": "最近",
286+
"minute": "分钟",
287+
"hour": "小时",
288+
"day": "",
289+
"time": "时间",
290+
"log_number": "日志数",
291+
"close": "关闭",
292+
"normal_filter": "普通筛选",
293+
"advanced_filter": "高级筛选",
294+
"json_mode": "JSON模式",
295+
"only_stderr": "只看 Stderr",
296+
"keyword": "关键词",
297+
"search": "查询",
298+
"field_name": "字段名",
299+
"equal": "等于",
300+
"value": "",
301+
"logNumber": "日志数量",
302+
"overview": "概览",
303+
"monitor": "监控",
304+
"logs": "日志",
305+
"application_source": "来源",
306+
"contains": "包含",
307+
"not_contains": "不包含",
308+
"visible": "可见",
309+
"hidden": "隐藏",
310+
"piece": "",
311+
"export_log": "导出日志",
312+
"no_data_available": "暂无数据",
313+
"all": "全部",
314+
"hour-singular": "小时",
315+
"not_equal": "不等于",
316+
"field_settings": "字段设置",
317+
"selected": "已选中",
318+
"please_select": "请选择",
319+
"refetching_success": "刷新成功",
320+
"refresh": "刷新"
282321
}

frontend/providers/applaunchpad/src/api/app.ts

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
} from '@/utils/adapt';
1010
import type { AppPatchPropsType, PodDetailType } from '@/types/app';
1111
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor';
12+
import { LogQueryPayload } from '@/pages/api/log/queryLogs';
13+
import { PodListQueryPayload } from '@/pages/api/log/queryPodList';
1214

1315
export const postDeployApp = (yamlList: string[]) => POST('/api/applyApp', { yamlList });
1416

@@ -58,4 +60,11 @@ export const getAppMonitorData = (payload: {
5860
queryName: string;
5961
queryKey: keyof MonitorQueryKey;
6062
step: string;
63+
start?: number;
64+
end?: number;
6165
}) => GET<MonitorDataResult[]>(`/api/monitor/getMonitorData`, payload);
66+
67+
export const getAppLogs = (payload: LogQueryPayload) => POST<string>('/api/log/queryLogs', payload);
68+
69+
export const getLogPodList = (payload: PodListQueryPayload) =>
70+
POST<string[]>('/api/log/queryPodList', payload);

0 commit comments

Comments
 (0)