Page Modules

Page customization needs to call the engine's Content method, which needs to return an object types.Panel

The following is the definition of types.Panel:

type Panel struct {
    Content     template.HTML
    Title       string       
    Description string       
    Url         string

Corresponding ui, you can see the following picture:

How to use

package datamodel

import (
    template2 ""

func GetContent() (types.Panel, error) {

    components := template2.Get(config.Get().THEME)
    colComp := components.Col()

    infobox := components.InfoBox().
        SetText("CPU TRAFFIC").

    var size = map[string]string{"md": "3", "sm": "6", "xs": "12"}
    infoboxCol1 := colComp.SetSize(size).SetContent(infobox).GetContent()
    row1 := components.Row().SetContent(infoboxCol1).GetContent()

    return types.Panel{
        Content:     row1,
        Title:       "Dashboard",
        Description: "this is a example",
    }, nil


A col is type of ColAttribute, has three methods:

type ColAttribute interface {
    SetSize(value map[string]string) ColAttribute 
    SetContent(value template.HTML) ColAttribute  
    GetContent() template.HTML                    

About the size,example is map[string]string{"md": "3", "sm": "6", "xs": "12"}


A row is type of RowAttribute, has two methods:

type RowAttribute interface {
    SetContent(value template.HTML) RowAttribute
    GetContent() template.HTML