generated from VLADIMIR/template
add crud for node
This commit is contained in:
parent
3b182d7380
commit
6b18709e61
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
115
cmd/evening_detective/static/admin/assets/index-WLMuUXZt.js
Normal file
115
cmd/evening_detective/static/admin/assets/index-WLMuUXZt.js
Normal file
File diff suppressed because one or more lines are too long
@ -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-DTvRzGpy.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BkyopZAN.css">
|
||||
<script type="module" crossorigin src="/assets/index-WLMuUXZt.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-D8kPNaZP.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@ -97,18 +97,44 @@ func (s *StoryService) GetPlace(code string) *Place {
|
||||
}
|
||||
|
||||
func (s *StoryService) UpdatePlace(code string, node *GraphNode) error {
|
||||
if code != "" && node.Code == "" {
|
||||
for i := range s.story.Places {
|
||||
if s.story.Places[i].Code == code {
|
||||
s.story.Places = append(s.story.Places[:i], s.story.Places[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
s.Update()
|
||||
return nil
|
||||
}
|
||||
nodeApplications := make([]*Application, 0, len(node.Applications))
|
||||
for _, application := range node.Applications {
|
||||
nodeApplications = append(
|
||||
nodeApplications,
|
||||
&Application{
|
||||
Name: application.Name,
|
||||
},
|
||||
)
|
||||
}
|
||||
if code == "" && node.Code != "" {
|
||||
s.story.Places = append(
|
||||
s.story.Places,
|
||||
&Place{
|
||||
Code: node.Code,
|
||||
Name: node.Name,
|
||||
Text: formatText(node.Text),
|
||||
Applications: nodeApplications,
|
||||
},
|
||||
)
|
||||
s.Update()
|
||||
return nil
|
||||
}
|
||||
if code == "" || node.Code == "" {
|
||||
return nil
|
||||
}
|
||||
update := false
|
||||
for i := range s.story.Places {
|
||||
if s.story.Places[i].Code == code {
|
||||
nodeApplications := make([]*Application, 0, len(node.Applications))
|
||||
for _, application := range node.Applications {
|
||||
nodeApplications = append(
|
||||
nodeApplications,
|
||||
&Application{
|
||||
Name: application.Name,
|
||||
},
|
||||
)
|
||||
}
|
||||
s.story.Places[i] = &Place{
|
||||
Code: node.Code,
|
||||
Name: node.Name,
|
||||
@ -122,15 +148,6 @@ func (s *StoryService) UpdatePlace(code string, node *GraphNode) error {
|
||||
if !update {
|
||||
for i := range s.story.Places {
|
||||
if s.story.Places[i].Code == node.Code {
|
||||
nodeApplications := make([]*Application, 0, len(node.Applications))
|
||||
for _, application := range node.Applications {
|
||||
nodeApplications = append(
|
||||
nodeApplications,
|
||||
&Application{
|
||||
Name: application.Name,
|
||||
},
|
||||
)
|
||||
}
|
||||
s.story.Places[i] = &Place{
|
||||
Code: code,
|
||||
Name: node.Name,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user