Add total RAM capacity calculation and update index view
This commit is contained in:
16
views.go
16
views.go
@@ -15,10 +15,11 @@ type App struct {
|
||||
}
|
||||
|
||||
type IndexVM struct {
|
||||
AssetCount int
|
||||
BrandCount int
|
||||
Brands []string
|
||||
Types []string
|
||||
AssetCount int
|
||||
BrandCount int
|
||||
TotalRamCapacity int
|
||||
Brands []string
|
||||
Types []string
|
||||
}
|
||||
|
||||
func (a *App) getIndex(c *gin.Context) {
|
||||
@@ -36,6 +37,12 @@ func (a *App) getIndex(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
vm.TotalRamCapacity, err = a.GetTotalRamCapacity()
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
vm.Brands, err = a.GetAllBrands()
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
@@ -236,6 +243,7 @@ func (a *App) getBrowse(c *gin.Context) {
|
||||
if len(types) > 0 {
|
||||
query += " AND assets.type IN (" + placeholders(len(types)) + ")"
|
||||
}
|
||||
query += "ORDER BY assets.type, assets.brand, assets.name, assets.qr"
|
||||
|
||||
vm := &BrowseVM{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user