update editor

This commit is contained in:
Владимир Фёдоров 2025-12-07 04:59:43 +07:00
parent 49c415d4b9
commit 383e12b718
10 changed files with 82 additions and 190 deletions

View File

@ -205,6 +205,7 @@ message GetGraphRsp {
int32 from = 1;
int32 to = 2;
string arrows = 3;
string type = 4;
}
}

View File

@ -5,8 +5,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ВД Админка</title>
<script type="module" crossorigin src="/assets/index-DY0mDz-m.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-1rBZ50JZ.css">
<script type="module" crossorigin src="/assets/index-D6zn6NYW.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CtwEz1js.css">
</head>
<body>
<div id="app"></div>

File diff suppressed because one or more lines are too long

View File

@ -250,6 +250,7 @@ func (s *Services) GetGraph(ctx context.Context, req *proto.GetGraphReq) (*proto
From: edge.From,
To: edge.To,
Arrows: "to",
Type: edge.Type,
})
}
return &proto.GetGraphRsp{

View File

@ -16,6 +16,7 @@ type GraphNode struct {
type GraphEdge struct {
From int32
To int32
Type string
}
type GraphApplication struct {

View File

@ -69,12 +69,22 @@ func (s *StoryService) GetPlace(code string) *Place {
for _, place := range s.story.Places {
if clearCode(place.Code) == code {
re := regexp.MustCompile(`\(\[[a-zA-Zа-яА-Я\d-]+\]\)`)
applications := make([]*Application, 0, len(place.Applications))
for _, application := range place.Applications {
name := re.ReplaceAllString(application.Name, "")
applications = append(
applications,
&Application{
Name: name,
},
)
}
text := re.ReplaceAllString(place.Text, "")
return &Place{
Code: place.Code,
Name: place.Name,
Text: text,
Applications: place.Applications,
Applications: applications,
}
}
}
@ -88,11 +98,20 @@ func (s *StoryService) GetPlace(code string) *Place {
func (s *StoryService) UpdatePlace(node *GraphNode) error {
for i := range s.story.Places {
if s.story.Places[i].Code == node.Label {
applications := make([]*Application, 0, len(node.Applications))
for _, application := range node.Applications {
applications = append(
applications,
&Application{
Name: application.Name,
},
)
}
s.story.Places[i] = &Place{
Code: s.story.Places[i].Code,
Name: node.Name,
Text: node.Text,
Applications: s.story.Places[i].Applications,
Applications: applications,
}
break
}
@ -137,9 +156,24 @@ func (s *StoryService) GetGraph(ctx context.Context) *Graph {
&GraphEdge{
From: m[clearCode(place.Code)],
To: m[clearMatch(match)],
Type: "node",
},
)
}
for _, application := range place.Applications {
re := regexp.MustCompile(`\(\[[a-zA-Zа-яА-Я\d-]+\]\)`)
matches := re.FindAllString(application.Name, -1)
for _, match := range matches {
edges = append(
edges,
&GraphEdge{
From: m[clearCode(place.Code)],
To: m[clearMatch(match)],
Type: "application",
},
)
}
}
}
return &Graph{

View File

@ -1559,6 +1559,7 @@ type GetGraphRsp_Edge struct {
From int32 `protobuf:"varint,1,opt,name=from,proto3" json:"from,omitempty"`
To int32 `protobuf:"varint,2,opt,name=to,proto3" json:"to,omitempty"`
Arrows string `protobuf:"bytes,3,opt,name=arrows,proto3" json:"arrows,omitempty"`
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@ -1614,6 +1615,13 @@ func (x *GetGraphRsp_Edge) GetArrows() string {
return ""
}
func (x *GetGraphRsp_Edge) GetType() string {
if x != nil {
return x.Type
}
return ""
}
var File_main_proto protoreflect.FileDescriptor
const file_main_proto_rawDesc = "" +
@ -1683,7 +1691,7 @@ const file_main_proto_rawDesc = "" +
"\x1bDownloadTeamsQrCodesFileReq\"5\n" +
"\x1bDownloadTeamsQrCodesFileRsp\x12\x16\n" +
"\x06result\x18\x01 \x01(\fR\x06result\"\r\n" +
"\vGetGraphReq\"\x8c\x02\n" +
"\vGetGraphReq\"\xa0\x02\n" +
"\vGetGraphRsp\x128\n" +
"\x05nodes\x18\x01 \x03(\v2\".crabs.evening_detective.GraphNodeR\x05nodes\x12?\n" +
"\x05edges\x18\x02 \x03(\v2).crabs.evening_detective.GetGraphRsp.EdgeR\x05edges\x12\x1e\n" +
@ -1692,11 +1700,12 @@ const file_main_proto_rawDesc = "" +
"countNodes\x12\x1e\n" +
"\n" +
"countEdges\x18\x04 \x01(\x05R\n" +
"countEdges\x1aB\n" +
"countEdges\x1aV\n" +
"\x04Edge\x12\x12\n" +
"\x04from\x18\x01 \x01(\x05R\x04from\x12\x0e\n" +
"\x02to\x18\x02 \x01(\x05R\x02to\x12\x16\n" +
"\x06arrows\x18\x03 \x01(\tR\x06arrows\"G\n" +
"\x06arrows\x18\x03 \x01(\tR\x06arrows\x12\x12\n" +
"\x04type\x18\x04 \x01(\tR\x04type\"G\n" +
"\rUpdateNodeReq\x126\n" +
"\x04node\x18\x01 \x01(\v2\".crabs.evening_detective.GraphNodeR\x04node\"\x0f\n" +
"\rUpdateNodeRsp\"\xa8\x01\n" +

View File

@ -377,6 +377,9 @@
},
"arrows": {
"type": "string"
},
"type": {
"type": "string"
}
}
},