This commit is contained in:
mozzie 2023-09-13 17:40:06 +08:00
parent 53f73d045c
commit 67b3943dc4
12 changed files with 164 additions and 66 deletions

19
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"sqltools.connections": [
{
"mysqlOptions": {
"authProtocol": "default",
"enableSsl": "Disabled"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "tavi-universe",
"group": "local",
"username": "root",
"password": "root",
"database": "rbac"
}
]
}

89
.vscode/tasks.json vendored
View File

@ -5,17 +5,17 @@
"label": "start-all-tasks",
"dependsOn": [
"build:pkg",
"cert-authorize",
"cert-authenticate",
"cert-gateway",
"cert-web",
"aorta-web",
"aorta-gateway",
"dmp-archive",
"dmp-web",
"dmp-gateway",
"logger",
"cert-authorize",
"cert-authenticate",
"dmp-archive",
"dicom",
"logger"
"dmp-gateway",
"aorta-gateway",
"cert-gateway",
]
},
{
@ -27,6 +27,14 @@
"for package in @tavi/util @tavi/oss @tavi/i18n; do (pnpm run --filter $package build); done && echo 'build:pkg completed'"
]
},
{
"label": "logger",
"type": "shell",
"command": "pnpm",
"args": [
"dev:logger",
],
},
{
"label": "aorta-web",
"type": "shell",
@ -39,33 +47,11 @@
]
},
{
"label": "aorta-gateway",
"label": "cert-web",
"type": "shell",
"command": "pnpm",
"args": [
"dev:aorta-gateway",
],
"dependsOn": [
"build:pkg"
]
},
{
"label": "dmp-archive",
"type": "shell",
"command": "pnpm",
"args": [
"dev:dmp-archive",
],
"dependsOn": [
"build:pkg"
]
},
{
"label": "dmp-gateway",
"type": "shell",
"command": "pnpm",
"args": [
"dev:dmp-gateway",
"dev:cert-web"
],
"dependsOn": [
"build:pkg"
@ -83,15 +69,13 @@
]
},
{
"label": "logger",
"label": "dmp-archive",
"type": "shell",
"command": "pnpm",
"args": [
"dev:logger",
"dev:dmp-archive",
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "dicom",
@ -100,9 +84,7 @@
"args": [
"dev:dicom",
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "cert-authorize",
@ -111,9 +93,7 @@
"args": [
"dev:authorize",
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "cert-authenticate",
@ -122,9 +102,7 @@
"args": [
"dev:authenticate"
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "cert-gateway",
@ -133,20 +111,25 @@
"args": [
"dev:cert-gateway"
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "cert-web",
"label": "dmp-gateway",
"type": "shell",
"command": "pnpm",
"args": [
"dev:cert-web"
"dev:dmp-gateway",
],
"dependsOn": [
"build:pkg"
]
"dependsOrder": "sequence",
},
{
"label": "aorta-gateway",
"type": "shell",
"command": "pnpm",
"args": [
"dev:aorta-gateway",
],
"dependsOrder": "sequence",
},
]
}

View File

@ -0,0 +1,10 @@
.label-container {
display: grid;
grid-template-columns: 1fr 4fr;
height: 100%;
aside {
padding: 20px 20px 0 20px;
border-right: 1px solid rgba(5, 5, 5, 0.06);
}
}

View File

@ -1,7 +1,59 @@
import { CSSProperties } from "react";
import "./index.less";
import { Collapse, CollapseProps, theme } from "antd";
import { CaretRightOutlined } from "@ant-design/icons";
interface LabelProps {
children?: JSX.Element;
}
const content = (
<ul>
<li></li>
<li>{"层厚>1.0mm"}</li>
</ul>
);
const getItems: (panelStyle: CSSProperties) => CollapseProps["items"] = (
panelStyle
) => [
{
key: "1",
label: "影像质量",
children: content,
style: panelStyle,
},
{
key: "2",
label: "其他",
children: <p>1</p>,
style: panelStyle,
},
];
export const Label = (props: LabelProps) => {
return <div>Label</div>
}
const { token } = theme.useToken();
const panelStyle: React.CSSProperties = {
marginBottom: 12,
background: token.colorFillAlter,
borderRadius: token.borderRadiusLG,
border: "none",
};
return (
<div className="label-container">
<aside>
<Collapse
bordered={false}
defaultActiveKey={[]}
expandIcon={({ isActive }) => (
<CaretRightOutlined rotate={isActive ? 90 : 0} />
)}
style={{ background: token.colorBgContainer }}
items={getItems(panelStyle)}
/>
</aside>
<main></main>
</div>
);
};

View File

@ -0,0 +1,7 @@
interface LoggerProps {
children?: JSX.Element;
}
export const Logger = (props: LoggerProps) => {
return <div>Logger</div>;
};

View File

@ -5,6 +5,7 @@ import {
DatabaseOutlined,
TagsOutlined,
UnorderedListOutlined,
ProfileOutlined
} from "@ant-design/icons";
import { Outlet } from "react-router";
import { MenuProps } from "antd";
@ -18,9 +19,10 @@ export type MenuItem = Required<MenuProps>["items"][number];
const adminMenuItems: MenuItem[] = [
getItem("影像", "dicom", <DatabaseOutlined />, [
getItem("上传", "/upload", <CloudUploadOutlined />),
getItem("列表", "/list", <UnorderedListOutlined />),
getItem("全部", "/list", <UnorderedListOutlined />),
]),
getItem("标签", "/label", <TagsOutlined />),
getItem("日志", "/logger", <ProfileOutlined />),
];
export const AdminDashboard = (props: AdminDashboardProps) => {

View File

@ -7,6 +7,7 @@ import { ROLE_NAME } from "@/constant";
import { AdminDashboard } from "@/modules/Admin";
import { AnnotatorDashBoard } from "@/modules/Annotator";
import { Label } from "@/modules/Admin/Label";
import { Logger } from "@/modules/Admin/Logger";
export const roleRoutes: Record<ROLE_NAME, (RouteObject & ExpandRouteProps)[]> =
{
@ -34,18 +35,12 @@ export const roleRoutes: Record<ROLE_NAME, (RouteObject & ExpandRouteProps)[]> =
path: "/label",
element: <Label />,
},
{
path: "/logger",
element: <Logger />,
},
],
},
// {
// path: "/list",
// element: <DicomList />,
// title: "管理员",
// },
// {
// path: "/upload",
// element: <DicomUpload />,
// title: "管理员",
// },
],
/**
*

22
apps/services/alg/app.py Normal file
View File

@ -0,0 +1,22 @@
from flask import Flask, request, jsonify
import nats.aio.client
import asyncio
app = Flask(__name__)
nc = nats.aio.client.Client()
@app.route('/send_to_nats', methods=['POST'])
def send_to_nats():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(send_message(request.json))
print("1")
return 111
async def send_message(message):
await nc.connect(servers=["nats://localhost:4222"])
await nc.publish(jsonify({"cmd": "alg.test"}), str(message).encode())
await nc.close()
if __name__ == "__main__":
app.run(debug=True)

View File

@ -0,0 +1,2 @@
flask
asyncio-nats-client

View File

@ -94,6 +94,7 @@ export class RbacService {
* 2. permissions
*/
async initPermission(permissions: PermissionItem[]) {
console.log('初始化permission表');
const records = permissions.map((i) => ({
...i,
name: i.name,

View File

@ -29,4 +29,9 @@ export class AppController {
async saveLogger(payload: UserSignLoggerDto) {
return 'ok';
}
@EventPattern({ cmd: 'alg.test' })
async algTest(payload) {
return 'ok';
}
}

0
architecture.drawio Normal file
View File