Skip to content

Commit e6f1601

Browse files
committed
enhance: improve AdminWeb UI/UX and features
1 parent 44839a7 commit e6f1601

17 files changed

+372
-27
lines changed

api-runtime/rest-runtime/admin-web/AdminWeb-Cluster.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,9 @@ func ClusterManagement(c echo.Context) error {
9090
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
9191
}
9292

93-
return tmpl.Execute(c.Response().Writer, data)
93+
c.Response().WriteHeader(http.StatusOK)
94+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
95+
return fmt.Errorf("failed to execute template: %w", err)
96+
}
97+
return nil
9498
}

api-runtime/rest-runtime/admin-web/AdminWeb-Connection.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,5 +688,9 @@ func ConnectionManagement(c echo.Context) error {
688688
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
689689
}
690690

691-
return tmpl.Execute(c.Response().Writer, data)
691+
c.Response().WriteHeader(http.StatusOK)
692+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
693+
return fmt.Errorf("failed to execute template: %w", err)
694+
}
695+
return nil
692696
}

api-runtime/rest-runtime/admin-web/AdminWeb-Credential.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,9 @@ func CredentialManagement(c echo.Context) error {
9898
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
9999
}
100100

101-
return tmpl.Execute(c.Response().Writer, data)
101+
c.Response().WriteHeader(http.StatusOK)
102+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
103+
return fmt.Errorf("failed to execute template: %w", err)
104+
}
105+
return nil
102106
}

api-runtime/rest-runtime/admin-web/AdminWeb-Dashboard.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,9 @@ func Dashboard(c echo.Context) error {
219219
ShowEmpty: showEmpty,
220220
}
221221

222-
return tmplCache.Execute(c.Response().Writer, data)
222+
c.Response().WriteHeader(http.StatusOK)
223+
if err := tmplCache.Execute(c.Response().Writer, data); err != nil {
224+
return fmt.Errorf("failed to execute template: %w", err)
225+
}
226+
return nil
223227
}

api-runtime/rest-runtime/admin-web/AdminWeb-Disk.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,9 @@ func DiskManagement(c echo.Context) error {
118118
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
119119
}
120120

121-
return tmpl.Execute(c.Response().Writer, data)
121+
c.Response().WriteHeader(http.StatusOK)
122+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
123+
return fmt.Errorf("failed to execute template: %w", err)
124+
}
125+
return nil
122126
}

api-runtime/rest-runtime/admin-web/AdminWeb-Driver.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,9 @@ func DriverManagement(c echo.Context) error {
210210
}
211211

212212
// Execute template
213-
return tmpl.Execute(c.Response().Writer, data)
213+
c.Response().WriteHeader(http.StatusOK)
214+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
215+
return fmt.Errorf("failed to execute template: %w", err)
216+
}
217+
return nil
214218
}

api-runtime/rest-runtime/admin-web/AdminWeb-KeyPair.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,9 @@ func KeyPairManagement(c echo.Context) error {
102102
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
103103
}
104104

105-
return tmpl.Execute(c.Response().Writer, data)
105+
c.Response().WriteHeader(http.StatusOK)
106+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
107+
return fmt.Errorf("failed to execute template: %w", err)
108+
}
109+
return nil
106110
}

api-runtime/rest-runtime/admin-web/AdminWeb-MyImage.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,9 @@ func MyImageManagement(c echo.Context) error {
102102
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
103103
}
104104

105-
return tmpl.Execute(c.Response().Writer, data)
105+
c.Response().WriteHeader(http.StatusOK)
106+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
107+
return fmt.Errorf("failed to execute template: %w", err)
108+
}
109+
return nil
106110
}

api-runtime/rest-runtime/admin-web/AdminWeb-NLB.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,9 @@ func NLBManagement(c echo.Context) error {
118118
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
119119
}
120120

121-
return tmpl.Execute(c.Response().Writer, data)
121+
c.Response().WriteHeader(http.StatusOK)
122+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
123+
return fmt.Errorf("failed to execute template: %w", err)
124+
}
125+
return nil
122126
}

api-runtime/rest-runtime/admin-web/AdminWeb-Region.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,9 @@ func RegionManagement(c echo.Context) error {
8585
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "Error loading template: " + err.Error()})
8686
}
8787

88-
return tmpl.Execute(c.Response().Writer, data)
88+
c.Response().WriteHeader(http.StatusOK)
89+
if err := tmpl.Execute(c.Response().Writer, data); err != nil {
90+
return fmt.Errorf("failed to execute template: %w", err)
91+
}
92+
return nil
8993
}

0 commit comments

Comments
 (0)