Skip to content

Commit 215cf5a

Browse files
V0.1
- feat(BreakdownChart) - feat(WorkflowChart) - feat(TaskConfig)
1 parent aa42fd8 commit 215cf5a

Some content is hidden

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

55 files changed

+5194
-238
lines changed

.github/workflows/ci.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Docker Image
2+
on:
3+
push:
4+
branches:
5+
- dev/*
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [ 18.x ]
17+
image-name: [ chrisgray0626/gis-agent-frontend ]
18+
image-tag: [ 0.1 ]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'yarn'
27+
- run: yarn install
28+
- run: yarn build
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
- name: Login to Docker Hub
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ matrix.image-name }}:latest, ${{ matrix.image-name }}:${{ matrix.image-tag }}
44+
cache-from: type=gha
45+
cache-to: type=gha,mode=max

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ dist-ssr
2020
*.njsproj
2121
*.sln
2222
*.sw?
23+
24+
# Nginx
25+
nginx/log

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM nginx:stable
2+
# Copy the configuration of Nginx
3+
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
4+
# COPY the source code
5+
COPY dist/ /usr/share/nginx/html/

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Vue 3 + TypeScript + Vite
1+
# Agent-Web
22

3-
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
3+
## 功能设计
44

5-
## Recommended Setup
5+
https://dde.feishu.cn/wiki/TlxpwBmUIipdZ1kmfgjcEfK6nYB
66

7-
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously Volar) and disable Vetur
7+
## 接口文档
88

9-
- Use [vue-tsc](https://github.com/vuejs/language-tools/tree/master/packages/tsc) for performing the same type checking from the command line, or for generating d.ts files for SFCs.
9+
https://app.apifox.com/project/4714372

compose.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
frontend:
3+
image: chrisgray0626/gis-agent-frontend:latest
4+
volumes:
5+
- ./nginx/log:/var/log/nginx
6+
ports:
7+
- 8888:80

index.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
65
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + Vue + TS</title>
6+
<title>Agent-Web</title>
87
</head>
98
<body>
109
<div id="app"></div>

nginx/default.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
#charset koi8-r;
5+
access_log /var/log/nginx/host.access.log main;
6+
error_log /var/log/nginx/error.log error;
7+
location / {
8+
root /usr/share/nginx/html;
9+
index index.html index.htm;
10+
}
11+
error_page 500 502 503 504 /50x.html;
12+
location = /50x.html {
13+
root /usr/share/nginx/html;
14+
}
15+
}

package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"vue": "^3.4.21"
12+
"@antv/g6": "^4.8.24",
13+
"@antv/layout": "^0.3.25",
14+
"@element-plus/icons-vue": "^2.3.1",
15+
"@logicflow/core": "^1.2.27",
16+
"@logicflow/extension": "^1.2.27",
17+
"axios": "^1.7.2",
18+
"element-plus": "^2.7.3",
19+
"pinia": "^2.1.7",
20+
"vue": "^3.4.21",
21+
"vue-router": "4"
1322
},
1423
"devDependencies": {
24+
"@types/node": "^20.12.12",
1525
"@vitejs/plugin-vue": "^5.0.4",
1626
"less": "^4.2.0",
1727
"typescript": "^5.2.2",

public/vite.svg

-1
This file was deleted.

script/build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
REGISTRY_URL=chrisgray0626
4+
IMAGE_NAME=gis-agent-frontend
5+
IMAGE_TAG=0.1
6+
# Change to the root directory
7+
cd ..
8+
# Build the image
9+
docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:latest .
10+
# Tag the image
11+
docker tag ${REGISTRY_URL}/${IMAGE_NAME}:latest ${REGISTRY_URL}/${IMAGE_NAME}:${IMAGE_TAG}

script/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run dev

src/App.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
<script lang="ts" setup>
2-
import Index from '/src/views/index/index.vue'
3-
</script>
1+
<script lang="ts" setup></script>
42

53
<template>
6-
<Index/>
4+
<RouterView />
75
</template>
8-

src/G6/behaviorConfig.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { IG6GraphEvent } from "@antv/g6-core/lib/types";
2+
import { BehaviorOption } from "@antv/g6";
3+
import { useTaskStore } from "@/store/task.ts";
4+
import pinia from "@/store";
5+
import { Task } from "@/type.ts";
6+
7+
export const activateNodeBehavior: BehaviorOption = {
8+
getEvents() {
9+
return {
10+
"node:click": "onNodeClick",
11+
};
12+
},
13+
async onNodeClick(evt: IG6GraphEvent) {
14+
const node = evt.item!;
15+
const task: Task = node.getModel().task as Task;
16+
// Update the task config
17+
const taskStore = useTaskStore(pinia);
18+
await taskStore.updateData(task);
19+
// Show the task config
20+
taskStore.show();
21+
},
22+
};

src/G6/edgeConfig.ts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import G6, { ShapeOptions } from "@antv/g6";
2+
3+
export const indentedEdge: ShapeOptions = {
4+
afterDraw(_cfg, group) {
5+
const shape = group?.get("children")[0];
6+
shape.attr("stroke", "#656565");
7+
shape.attr("radius", "16");
8+
shape.attr("lineWidth", "2");
9+
},
10+
getControlPoints: (cfg) => {
11+
const startPoint = cfg.startPoint;
12+
const endPoint = cfg.endPoint;
13+
return [
14+
startPoint!,
15+
{
16+
x: startPoint!.x,
17+
y: endPoint!.y,
18+
},
19+
endPoint!,
20+
];
21+
},
22+
};
23+
export const workflowEdge: ShapeOptions = {
24+
draw(cfg, group) {
25+
const { startPoint, endPoint } = cfg;
26+
const r = 3;
27+
const lineWidth = 2;
28+
const keyShape = group.addShape("path", {
29+
attrs: {
30+
path: [
31+
["M", startPoint!.x, startPoint!.y + (r + lineWidth / 2)],
32+
["L", endPoint!.x, endPoint!.y + (r + lineWidth / 2)],
33+
],
34+
// radius: 10,
35+
stroke: "#5A77C1",
36+
lineWidth,
37+
endArrow: {
38+
path: G6.Arrow.circle(r), // 使用内置箭头路径函数,参数为箭头的 宽度、长度、偏移量(默认为 0,与 d 对应)
39+
// d: 25,
40+
fill: "#5A77C1",
41+
},
42+
},
43+
name: "workflow-edge-path-shape",
44+
});
45+
group.toFront();
46+
return keyShape;
47+
},
48+
};

src/G6/index.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import G6 from "@antv/g6";
2+
import {
3+
breakdownNode as breakdownNodeConfig,
4+
workflowNode as workflowNodeConfig,
5+
} from "@/G6/nodeConfig.ts";
6+
import {
7+
indentedEdge as indentedEdgeConfig,
8+
workflowEdge as workflowEdgeConfig,
9+
} from "@/G6/edgeConfig.ts";
10+
import { activateNodeBehavior as activateNodeBehaviorConfig } from "@/G6/behaviorConfig.ts";
11+
12+
export function G6Register() {
13+
// node registration
14+
// G6.registerNode("rootNode", rootNodeConfig, "rect");
15+
// G6.registerNode("treeNode", treeNodeConfig);
16+
G6.registerNode("breakdownNode", breakdownNodeConfig);
17+
G6.registerNode("workflowNode", workflowNodeConfig);
18+
// edge registration
19+
G6.registerEdge("indentedEdge", indentedEdgeConfig, "polyline");
20+
G6.registerEdge("workflowEdge", workflowEdgeConfig);
21+
// behavior registration
22+
G6.registerBehavior("activate-node", activateNodeBehaviorConfig);
23+
}

0 commit comments

Comments
 (0)