Skip to content

优化用户体验修改前端页面 #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5ab17e7
文档保存
HappyLadySauce May 4, 2025
c724070
更新概览页面
May 5, 2025
7449489
更新多云策略编辑器和新工作负载编辑器,添加模板选择功能,优化内容初始化逻辑
May 6, 2025
a2b045d
修复多云策略编辑器中的未定义变量问题,暂时注释掉相关代码。同时更新Karmada子项目状态为脏状态。
May 6, 2025
2ca293e
更新多云策略编辑器,添加注释以解释代码逻辑,同时将Karmada子项目状态更新为脏状态。
May 6, 2025
cc7b79a
更新Karmada子项目状态为脏状态,并在多云策略编辑器中添加注释以解释代码逻辑。
May 7, 2025
3f1a4e5
更新Karmada子项目状态为脏状态,并在多个文件中添加中文注释以解释代码逻辑和功能。
May 7, 2025
8a5928c
更新概览页面,添加节点和Pod汇总接口,完善相关类型定义,并在多个文件中添加中文注释以解释代码逻辑和功能。同时更新Karmada子项目状态…
May 7, 2025
1fb374d
更新概览页面,添加集群调度预览接口,完善相关类型定义,并在多个文件中添加中文注释以解释代码逻辑和功能。同时更新Karmada子项目状态为脏状态。
May 7, 2025
46e81fc
更新概览页面,完善集群调度预览功能,添加图表渲染错误处理,优化状态管理,并在多个文件中添加中文注释以解释代码逻辑。同时更新Karmada子…
May 7, 2025
432d9dc
更新概览页面,优化调度预览组件,添加锁定功能和图表渲染错误处理,调整样式以提升用户体验。同时更新Karmada子项目状态为脏状态。
May 7, 2025
4b02bc9
更新调度预览组件和集群概览页面,调整部分文本为更准确的描述,同时更新Karmada子项目状态为脏状态。
May 7, 2025
c43869d
更新概览页面,修正内存使用和容量的计算方式,确保显示更准确的内存信息。同时更新Karmada子项目状态为脏状态。
May 7, 2025
dc04834
更新调度预览组件,优化垂直图例的实现,添加占位符动画以提升用户体验,同时更新Karmada子项目状态为脏状态。
May 7, 2025
da08544
更新调度预览组件,添加实际资源分布信息和一致性指标,优化状态显示逻辑,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 7, 2025
ea6bca1
更新调度预览组件,添加获取所有集群资源预览的接口,并在相关文件中添加中文注释以解释代码逻辑。同时更新Karmada子项目状态为脏状态。
May 8, 2025
8a348f2
更新调度预览组件,增加节点状态和资源数量的显示逻辑,优化样式以提升用户体验。同时更新Karmada子项目状态为脏状态。
May 8, 2025
edc67ac
更新调度预览组件,添加资源名称列表的显示逻辑,优化资源类型分布信息的处理,同时更新Karmada子项目状态为脏状态。
May 8, 2025
d05e2cf
更新调度预览组件,优化资源组节点的显示逻辑,添加资源类型和名称的展示,同时调整样式以提升用户体验。Karmada子项目状态更新为脏状态。
May 8, 2025
68b2ba4
更新调度预览组件,调整字体大小并修改文本为“调度资源数量”,以提升可读性和准确性。同时更新Karmada子项目状态为脏状态。
May 8, 2025
c46c03d
更新调度预览组件,添加集群调度参数的显示逻辑,包括权重和污点信息,优化样式以提升用户体验。同时更新Karmada子项目状态为脏状态。
May 8, 2025
843d260
更新调度预览组件,添加传播策略查找功能和详细资源信息展示,优化资源调度信息的处理逻辑,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 8, 2025
6b1a1aa
更新调度预览组件,添加中文注释以解释集群覆盖策略、传播策略和覆盖策略的相关逻辑,提升代码可读性。同时更新Karmada子项目状态为脏状态。
May 9, 2025
68066e7
更新调度预览组件,优化传播策略查找函数以返回集群权重映射,提升资源调度信息的准确性。同时更新Karmada子项目状态为脏状态。
May 9, 2025
977b969
更新调度预览组件,添加详细资源信息和集群权重的展示逻辑,优化资源分布统计功能,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 9, 2025
5473162
更新调度预览组件,优化样式和布局,调整资源名称、传播策略的展示逻辑,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 9, 2025
96071f5
更新调度预览组件,优化标签选择器逻辑以准确获取Pod数量,增强调试信息输出,提升资源调度信息的准确性。同时更新Karmada子项目状态为脏状态。
May 9, 2025
29081e0
更新调度预览组件,添加Pod副本数量、当前副本数量、运行中副本数量和总可用副本数量的展示逻辑,优化样式和布局以提升用户体验。同时更新Kar…
May 9, 2025
8660394
更新调度预览组件,添加集群数量卡片及相关展示逻辑,优化样式以提升用户体验。同时更新Karmada子项目状态为脏状态。
May 9, 2025
bf4e1ff
更新调度预览组件,修改标题文本为“集群资源调度统计”,优化资源分布统计功能,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 9, 2025
e32996f
更新调度预览组件,添加节点的Pod数量、CPU和内存使用情况的获取逻辑,优化资源调度信息的准确性。同时更新Karmada子项目状态为脏状态。
May 9, 2025
3bd9497
更新调度预览组件,优化卡片布局和样式,调整集群、节点、Pod、CPU和内存的展示逻辑,提升用户体验。同时更新Karmada子项目状态为脏状态。
May 9, 2025
4ce9cc7
更新调度预览组件,调整TypeScript配置以禁用未使用变量的检查,优化代码结构,提升可读性。同时更新Karmada子项目状态为脏状态。
May 9, 2025
ab3ef11
修正local-build.sh脚本中REPO_ROOT的计算方式,以支持从任何目录调用脚本,并在构建过程中输出项目根目录信息。同时更新K…
May 9, 2025
0b1cd67
更新Karmada子项目状态为脏状态,修改karmada-dashboard-api和karmada-dashboard-web的镜像地址…
May 10, 2025
4cef8df
更改镜像
May 10, 2025
ff4dc6c
删除Karmada Dashboard相关文档和README文件,同时更新Karmada子项目状态为脏状态。
May 10, 2025
a38154c
删除Karmada Dashboard相关的中文文档和README文件,更新Karmada子项目状态为脏状态。
May 10, 2025
16cf265
删除中文开发文档,并在英文文档中添加后端和前端构建项目脚本命令,更新Karmada子项目状态为脏状态。
May 10, 2025
ecf36e2
在工作负载页面中添加快速创建和yaml创建按钮,集成新工作负载向导模态框,优化用户交互体验。
May 11, 2025
288d09f
在服务管理页面中新增服务向导模态框,优化服务创建方式,支持选择向导或YAML创建,同时更新服务描述信息,提升用户交互体验。
May 11, 2025
7216272
在多云资源管理页面中新增配置向导模态框,优化配置创建方式,支持选择向导或YAML创建,同时更新状态管理,提升用户交互体验。
May 11, 2025
93c6396
优化工作负载创建流程,增强表单验证和错误处理,确保用户输入有效性;更新YAML生成逻辑,提升生成的资源配置准确性;改进模态框交互,防止在提…
May 12, 2025
52f4512
在多云策略管理页面中新增调度策略向导模态框,优化策略创建方式,支持选择使用向导或YAML创建,同时更新状态管理,提升用户交互体验。
May 12, 2025
d59d099
优化调度预览组件,添加加载状态和点击事件日志;增强数据获取逻辑,添加错误处理和时间戳参数,确保每次请求获取最新数据;更新手动刷新功能,确保…
May 12, 2025
30323af
优化概览页面,调整卡片样式和高度,简化数据获取逻辑,移除不必要的查询,增强用户界面交互体验。
May 12, 2025
df7a9bd
新增拓扑图相关功能,注册拓扑图路由,添加获取拓扑图数据的处理逻辑,支持集群和节点的资源展示,优化数据结构以提升用户体验。
May 12, 2025
db52e87
更新依赖项,添加G6图表库支持,修改Dashboard页面图标和标题,新增集群资源拓扑图组件,优化概览页面以展示拓扑图信息,增强用户交互体验。
May 12, 2025
99a3947
优化集群拓扑图组件,调整节点和图表样式,增加全屏支持,提升用户交互体验;更新样式文件以适应新高度和提示框样式,增强可读性和视觉效果。
May 12, 2025
3836c64
优化集群拓扑图组件,注册自定义节点类型,增强节点图形样式和状态指示器,提升可视化效果和用户交互体验。
May 13, 2025
4df8016
Update README.md
HappyLadySauce May 13, 2025
e8716c4
更新多云策略管理页面,调整资源选择器和API版本设置,优化表单验证逻辑,增强用户交互体验;删除不再使用的karmada子项目,更新开发文档…
HappyLadySauce May 14, 2025
6abe876
更新中文仪表板截图,替换为最新版本以反映当前界面状态。
HappyLadySauce May 15, 2025
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
86 changes: 85 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,102 @@ bash hack/local-up-karmada.sh
```

The minimal environment consists of one host cluster and three member cluster, the host cluster is responsible for deploying karmada control-plane, after karmada control-plane is up, member clusters will be managed by karmada control-plane, member1 and member2 cluster will be managed in `push` mode, and the member3 cluster will be managed in `pull` mode. After you see the success tips for installing, you can start `api` project. To start the `api` project locally, you should fetch kubeconfig for `karmada-apiserver` and `karmada-host` context, you can get the file under the `$HOME/.kubeconfig/karmada.config`. Executing command `make karmada-dashboard-api` to build binary for `api` project, you can start `api` by
```shell
<!-- ```shell
_output/bin/${os name}/${os arch}/karmada-dashboard-api \
--karmada-kubeconfig=${path/to/karmada.config} \
--karmada-context=karmada-apiserver \
--skip-karmada-apiserver-tls-verify \
--kubeconfig=${path/to/karmada.config} \
--context=karmada-host \
--insecure-port=8000
``` -->

```shell
./root/dashboard/_output/bin/linux/amd64/karmada-dashboard-api \
--karmada-kubeconfig=/root/.kube/karmada.config \
--karmada-context=karmada-apiserver \
--kubeconfig=/root/.kube/karmada.config \
--context=karmada-host \
--insecure-port=8000
```

After that, you can start the dashboard fronted project, install frontend dependencies with `cd ui && pnpm install` firstly. And then start the dashboard fronted project by executing:
```shell
cd ui
pnpm run dashboard:dev
```
then open your browser with `http://localhost:5173/`, if you can see the overview page of dashboard, it means everything is ok, start developing now.

---

# 开发

## 架构
Karmada dashboard项目由**后端**和**前端**部分组成。后端部分包含两个项目,`api`项目和`web`项目。`web`项目主要负责提供静态资源服务(包括页面静态文件和i18n翻译资源)以及转发前端的API请求。`api`项目主要负责通过使用`client-go` SDK与`karmada-host`和`karmada-apiserver`的apiserver服务交互来管理Kubernetes资源(CRUD操作),这部分的实现位于pkg目录中。

前端部分是基于`pnpm`的monorepo项目。所有与前端项目相关的工程都位于`ui`目录中。`packages`目录主要存储可重用的前端组件,如`navigations`、`editors`,甚至`translation tools`。`apps`目录包含可以从外部直接访问的项目,如`dashboard`项目。在生产环境中,apps目录中的项目构建后,会通过Dockerfile中的`cp`命令将压缩的静态资源复制到容器中供外部访问。

## 开发环境

确保安装了以下软件并添加到您的路径中:

- [Docker](https://docs.docker.com/engine/install/)
- [Go](https://golang.org/dl/)(在[`go.mod`](go.mod)中检查所需版本)
- [Node.js](https://nodejs.org/en/download)(在[`ui/package.json`](ui/package.json)中检查所需版本)
- [Pnpm](https://pnpm.io/installation)

## 入门指南

克隆仓库后,首先您应该在本地机器上准备所有需要的镜像。
您可以通过执行以下命令在线加载所有需要的镜像:
```shell
cp hack/images/image.list.load.online.example hack/images/image.list
bash hack/ops/load-images.sh hack/images/image.list
```
如果您有私有注册表,您也可以通过在`image.list`中用私有注册表地址包装镜像来更改镜像。

同时,您也可以在离线模式下加载镜像。在加载镜像之前,您需要预先在`hack/images/`文件夹中下载所有离线镜像文件,然后执行以下命令:
```shell
cp hack/images/image.list.load.offline.example hack/images/image.list
bash hack/ops/load-images.sh hack/images/image.list
```

在您的机器上加载所有需要的镜像后,您可以执行代码来启动由kind提供支持的用于开发目的的最小环境。
```shell
bash hack/local-up-karmada.sh
```

最小环境由一个主集群和三个成员集群组成,主集群负责部署karmada控制平面,karmada控制平面启动后,成员集群将由karmada控制平面管理,member1和member2集群将以`push`模式管理,member3集群将以`pull`模式管理。当您看到安装成功提示后,您可以启动`api`项目。要在本地启动`api`项目,您应该获取`karmada-apiserver`和`karmada-host`上下文的kubeconfig,您可以在`$HOME/.kubeconfig/karmada.config`下获取文件。执行命令`make karmada-dashboard-api`构建`api`项目的二进制文件,您可以通过以下方式启动`api`:
```shell
./_output/bin/linux/amd64/karmada-dashboard-api \
--karmada-kubeconfig=/root/.kube/karmada.config \
--karmada-context=karmada-apiserver \
--skip-karmada-apiserver-tls-verify \
--kubeconfig=/root/.kube/karmada.config \
--context=karmada-host \
--insecure-port=8000
```
之后,您可以启动dashboard前端项目,首先通过`cd ui && pnpm install`安装前端依赖。然后通过执行以下命令启动dashboard前端项目:
```shell
cd ui
pnpm run dashboard:dev
```
然后用浏览器打开`http://localhost:5173/`,如果您能看到dashboard的概览页面,说明一切正常,现在开始开发吧。

## 开发构建项目脚本命令

后端构建命令

```bash
cd /root/dashboard && make karmada-dashboard-api && ./_output/bin/linux/amd64/karmada-dashboard-api --karmada-kubeconfig=/root/.kube/karmada.config --karmada-context=karmada-apiserver --kubeconfig=/root/.kube/karmada.config --context=karmada-host
```

```bash
make karmada-dashboard-api && ./_output/bin/linux/amd64/karmada-dashboard-api --karmada-kubeconfig=/root/.kube/karmada.config --karmada-context=karmada-apiserver --kubeconfig=/root/.kube/config --context=default
```

前端构建命令

```bash
cd ui && pnpm run dashboard:dev
```
139 changes: 139 additions & 0 deletions README-en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Karmada-dashboard
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/kubernetes/dashboard/blob/master/LICENSE)

Karmada Dashboard is a general-purpose, web-based control panel for Karmada which is a multi-cluster management project.
![image](docs/images/readme-dashboard-en.png)

## 🚀QuickStart

### Prerequisites
You need to have a Karmada installed on Kubernetes(aka. `host cluster`) and the [karmadactl](https://karmada.io/docs/installation/install-cli-tools#install-karmadactl) or
kubectl command-line tool must be configured to communicate with your host cluster and Karmada control plane.

If you don't already have the Karmada, you can launch one by following this [tutorial](https://karmada.io/docs/installation/#install-karmada-for-development-environment).


---
### Install Karmada-dashboard
In the following steps, we are going to install Karmada Dashboard on the `host cluster` where running the Karmada
control plane components. We assume that Karmada was installed in namespace `karmada-system` and Karmada config is
located at `$HOME/.kube/karmada.config`, if this differs from your environment, please modify the following commands
accordingly.

1. Switch user-context of your Karmada config to `karmada-host`.

```bash
export KUBECONFIG="$HOME/.kube/karmada.config"
kubectl config use-context karmada-host
```

Now, you should be able to see Karmada control plane components by following command:
```
kubectl get deployments.apps -n karmada-system
```

If everything works fine, you will get similar messages as following:
```
NAME READY UP-TO-DATE AVAILABLE AGE
karmada-aggregated-apiserver 2/2 2 2 3d
karmada-apiserver 1/1 1 1 3d
karmada-controller-manager 1/1 1 1 3d
karmada-kube-controller-manager 1/1 1 1 3d
karmada-scheduler 2/2 2 2 3d
karmada-webhook 2/2 2 2 3d
```

2. Deploy Karmada Dashboard

Clone this repo to your machine:
```
git clone https://github.com/karmada-io/dashboard.git
```

Change to the dashboard directory:
```
cd dashboard
```

Create the secret based on your Karmada config, the Karmada Dashboard will use this config to talk to the Karmada API server.
```
kubectl create secret generic kubeconfig --from-file=kubeconfig=$HOME/.kube/karmada.config -n karmada-system
```

Deploy Karmada Dashboard:
```
kubectl apply -k artifacts/overlays/nodeport-mode
```

This will deploy two components in `karmada-system` namespace:

```
kubectl get deployments.apps -n karmada-system karmada-dev-linux-renhongcai: Fri Jan 10 16:08:38 2025

NAME READY UP-TO-DATE AVAILABLE AGE
karmada-dashboard-api 1/1 1 1 2m
karmada-dashboard-web 1/1 1 1 2m
...
```

Then you will be able to access the Karmada Dashboard by `http://your-karmada-host:32000`.
Note that, the Karmada Dashboard service type is `NodePort`, this exposes the dashboard on a specific port on each node
of your `host cluster`, allowing you to access it via any node's IP address and that port.

You also can use `kubectl port-forward` to forward a local port to the Dashboard's backend pod:
```
kubectl port-forward -n karmada-system services/karmada-dashboard-web --address 0.0.0.0 8000:8000
```
Then you can access it via `http://localhost:8000`.

You still need the jwt token to login to the dashboard.

3. Create Service Account

switch user-context to karmada-apiserver:
```bash
kubectl config use-context karmada-apiserver
```
Create Service Account:
```bash
kubectl apply -f artifacts/dashboard/karmada-dashboard-sa.yaml
```

4. Get jwt token

Execute the following code to get the jwt token:
```bash
kubectl -n karmada-system get secret/karmada-dashboard-secret -o go-template="{{.data.token | base64decode}}"
```

it should print results like this:
```bash
eyJhbGciOiJSUzI1NiIsImtpZCI6InZLdkRNclVZSFB6SUVXczBIRm8zMDBxOHFOanQxbWU4WUk1VVVpUzZwMG8ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrYXJtYWRhLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrYXJtYWRhLWRhc2hib2FyZC10b2tlbi14NnhzcCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrYXJtYWRhLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImE5Y2RkZDc3LTkyOWYtNGM0MS1iZDY4LWIzYWVhY2E0NGJiYiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprYXJtYWRhLXN5c3RlbTprYXJtYWRhLWRhc2hib2FyZCJ9.F0BqSxl0GVGvJZ_WNwcEFtChE7joMdIPGhv8--eN22AFTX34IzJ_2akjZcWQ63mbgr1mVY4WjYdl7KRS6w4fEQpqWkWx2Dfp3pylIcMslYRrUPirHE2YN13JDxvjtYyhBVPlbYHSj7y0rvxtfTr7iFaVRMFFiUbC3kVKNhuZtgk_tBHg4UDCQQKFALGc8xndU5nz-BF1gHgzEfLcf9Zyvxj1xLy9mEkLotZjIcnZhwiHKFYtjvCnGXxGyrTvQ5rgilAxBKv0TcmjQep_TG_Q5M9r0u8wmxhDnYd2a7wsJ3P3OnDw7smk6ikY8UzMxVoEPG7XoRcmNqhhAEutvcJoyw
```

### Login Dashboard
Now open Karmada-dashboard with url [http://your-karmada-host:32000 ]()

copy the token you just generated and paste it into the Enter token field on the login page.
![image](docs/images/readme-login-en.png)
Once the process of authentication passed, you can use karmada dashboard freely. You can follow the Usage of karmada-dashboard to have a quick experience of karmada dashboard.

## Meeting

Regular Meeting For dashboard:
* Wednesday at 14:30 UTC+8 (Chinese)(biweekly). [Convert to your timezone](https://www.thetimezoneconverter.com/?t=14%3A30&tz=GMT%2B8&).
* There isn't a dedicated English meeting yet. If you have any topics to discuss, please join [the community meeting](https://github.com/karmada-io/karmada?tab=readme-ov-file#meeting).

Resources:
- [Meeting Notes and Agenda](https://docs.google.com/document/d/1dX3skCE-QRBWzABq3O9cG7yhIDUWLYWmg7kGq8UHU6s/edit)
- [Meeting Calendar](https://calendar.google.com/calendar/embed?src=a71aae8a75e3558a90683596c71382b8195bf7c84cb50e6e75d1a3e64e08480b%40group.calendar.google.com&ctz=Asia%2FShanghai) | [Subscribe](https://calendar.google.com/calendar/u/1?cid=YTcxYWFlOGE3NWUzNTU4YTkwNjgzNTk2YzcxMzgyYjgxOTViZjdjODRjYjUwZTZlNzVkMWEzZTY0ZTA4NDgwYkBncm91cC5jYWxlbmRhci5nb29nbGUuY29t)
- [Meeting Link](https://zoom.us/j/97070047574?pwd=lXha0Sqngw4mwtmArP1sjsLMMXk34z.1)

## 💻Contributing
Karmada dashboard is still catching up with the features of Karmada, we have only implemented the basic functionalities currently.
If you want to contribute to the development of the Karmada dashboard, you can refer to the document of development, we are happy to see more contributors join us.
Please feel free to submit issues or pull requests to our repository.

## License

Karmada-dashboard is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.
Loading