commodel

package
v1.0.7-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

README

Common Model

This package contains all common models for standard components.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID    string `json:"id,omitempty"`
	Title string `json:"title,omitempty"`

	cptype.Extra
}

Card .

func (Card) ModelType

func (c Card) ModelType() string

ModelType .

type DropDownMenu struct {
	Menus []DropDownMenuItem `json:"menus,omitempty"`

	Operations map[cptype.OperationKey]cptype.Operation `json:"operations,omitempty"`
}

DropDownMenu .

func (m DropDownMenu) ModelType() string

ModelType .

type DropDownMenuItem struct {
	ID   string `json:"id,omitempty"`
	Text string `json:"text,omitempty"`

	Icon          *Icon         `json:"icon,omitempty"`
	UnifiedStatus UnifiedStatus `json:"unifiedStatus,omitempty"`

	Selected bool   `json:"selected,omitempty"`
	Disabled bool   `json:"disabled,omitempty"`
	Hidden   bool   `json:"hidden,omitempty"`
	Tip      string `json:"tip,omitempty"`
}

DropDownMenuItem .

type Duration

type Duration struct {
	Value int64  `json:"value,omitempty"`
	Tip   string `json:"tip,omitempty"` // Hover on the text, use '\n' for newlines
}

Duration A Duration represents the elapsed time between two instants Such as 10s 360s, if the value is -1 means not started

func (Duration) ModelType

func (d Duration) ModelType() string

ModelType .

type IModel

type IModel interface {
	ModelType() string
}

IModel .

type IUnifiedColor

type IUnifiedColor interface {
	fmt.Stringer
}

IUnifiedColor .

type IUnifiedStatus

type IUnifiedStatus interface {
	fmt.Stringer
}

IUnifiedStatus .

type Icon

type Icon struct {
	URL  string `json:"url,omitempty"`
	Type string `json:"type,omitempty"`
}

Icon .

func NewTypedIcon

func NewTypedIcon(_type string) *Icon

NewTypedIcon from type, such as: ISSUE_ICON.issue.TASK

func NewURLIcon

func NewURLIcon(url string) *Icon

NewURLIcon from url, such as: /api/files/{uuid}

func (Icon) ModelType

func (i Icon) ModelType() string

ModelType .

type KV

type KV struct {
	K string `json:"k,omitempty"`
	V string `json:"v,omitempty"`
}

KV .

func (KV) ModelType

func (kv KV) ModelType() string

ModelType .

type Label

type Label struct {
	ID    string       `json:"id,omitempty"`
	Title string       `json:"title,omitempty"`
	Color UnifiedColor `json:"color,omitempty"`

	Operations map[cptype.OperationKey]cptype.Operation `json:"operations,omitempty"`
}

Label .

func (Label) ModelType

func (l Label) ModelType() string

ModelType .

type Labels

type Labels struct {
	Labels []Label `json:"labels,omitempty"`

	Operations map[cptype.OperationKey]cptype.Operation `json:"operations,omitempty"`
}

Labels .

func (Labels) ModelType

func (l Labels) ModelType() string

ModelType .

type MoreOpItem

type MoreOpItem struct {
	ID   string `json:"id,omitempty"`
	Text string `json:"text,omitempty"`
	Icon *Icon  `json:"icon,omitempty"`

	Operations map[cptype.OperationKey]cptype.Operation `json:"operations"`
}

MoreOpItem more operation item info

type MoreOperations

type MoreOperations struct {
	Ops []MoreOpItem `json:"ops,omitempty"` // use list for order
}

MoreOperations .

func (MoreOperations) ModelType

func (m MoreOperations) ModelType() string

ModelType .

type OpClick

type OpClick struct{}

OpClick is a simple click op.

func (OpClick) OpKey

func (o OpClick) OpKey() cptype.OperationKey

OpKey .

type OpClickGoto

type OpClickGoto struct {
}

OpClickGoto means click and goto target link.

func (OpClickGoto) OpKey

func (o OpClickGoto) OpKey() cptype.OperationKey

OpKey .

type OpClickGotoServerData

type OpClickGotoServerData struct {
	// open a new fronted page
	JumpOut bool `json:"jumpOut,omitempty"`
	// the jump out target of the new opened fronted page, e.g: projectAllIssue page
	Target string `json:"target,omitempty"`
	// params needed for jumping to the new page, e.g: projectId
	Params map[string]interface{} `json:"params,omitempty"`
	// the query condition of the new page, e.g: issueFilter__urlQuery
	Query map[string]interface{} `json:"query,omitempty"`
}

OpClickGotoServerData .

type OpDropDownMenuChange

type OpDropDownMenuChange struct {
	cptype.Operation
	ServerData OpDropDownMenuChangeServerData `json:"serverData,omitempty"`
	ClientData OpDropDownMenuChangeClientData `json:"clientData,omitempty"`
}

OpDropDownMenuChange .

func (OpDropDownMenuChange) OpKey

OpKey .

type OpDropDownMenuChangeClientData

type OpDropDownMenuChangeClientData struct {
	DataRef        *DropDownMenuItem `json:"dataRef,omitempty"`
	SelectedItemID string            `json:"selectedItemID,omitempty"`
}

OpDropDownMenuChangeClientData .

type OpDropDownMenuChangeServerData

type OpDropDownMenuChangeServerData struct{}

OpDropDownMenuChangeServerData .

type OpMoreOperationsItemClick

type OpMoreOperationsItemClick struct {
	OpClick
	ServerData OpMoreOperationsItemClickServerData `json:"serverData,omitempty"`
	ClientData OpMoreOperationsItemClickClientData `json:"clientData,omitempty"`
}

OpMoreOperationsItemClick .

type OpMoreOperationsItemClickClientData

type OpMoreOperationsItemClickClientData struct {
	DataRef       *MoreOpItem `json:"dataRef,omitempty"`
	ParentDataRef interface{} `json:"parentDataRef,omitempty"` // optional, such like list row data, table row data
}

OpMoreOperationsItemClickClientData .

type OpMoreOperationsItemClickGoto

type OpMoreOperationsItemClickGoto struct {
	OpClickGoto
}

OpMoreOperationsItemClickGoto .

type OpMoreOperationsItemClickGotoClientData

type OpMoreOperationsItemClickGotoClientData struct {
	OpMoreOperationsItemClickClientData
}

OpMoreOperationsItemClickGotoClientData .

type OpMoreOperationsItemClickGotoServerData

type OpMoreOperationsItemClickGotoServerData struct {
	OpClickGotoServerData
}

OpMoreOperationsItemClickGotoServerData .

type OpMoreOperationsItemClickServerData

type OpMoreOperationsItemClickServerData struct {
}

OpMoreOperationsItemClickServerData .

type OpUserSelectorChange

type OpUserSelectorChange struct {
	cptype.Operation
	ServerData OpUserSelectorChangeServerData `json:"serverData,omitempty"`
	ClientData OpUserSelectorChangeClientData `json:"clientData,omitempty"`
}

OpUserSelectorChange .

func (OpUserSelectorChange) OpKey

OpKey .

type OpUserSelectorChangeClientData

type OpUserSelectorChangeClientData struct {
	DataRef         *DropDownMenuItem `json:"dataRef,omitempty"`
	SelectedUserIDs []string          `json:"selectedUserIDs,omitempty"`
}

OpUserSelectorChangeClientData .

type OpUserSelectorChangeServerData

type OpUserSelectorChangeServerData struct{}

OpUserSelectorChangeServerData .

type ProgressBar

type ProgressBar struct {
	// BarCompletedNum is Numerator.
	BarCompletedNum int64 `json:"barCompletedNum,omitempty"`
	// BarTotalNum is Denominator.
	BarTotalNum int64 `json:"barTotalNum,omitempty"`

	// BarPercent is the calculated result.
	// Optional.
	// If not present, BarCompletedNum and BarTotalNum must provide.
	// For some situations, backend only have percent value.
	BarPercent float64 `json:"barPercent,omitempty"` // optional, percent, range: [0,100], such as: 0.1, 20, 100

	Text   string        `json:"text,omitempty"`   // optional, bar detail text
	Tip    string        `json:"tip,omitempty"`    // optional, tip
	Status UnifiedStatus `json:"status,omitempty"` // optional, status
}

ProgressBar is progress bar. formula: BarPercent = BarCompletedNum / BarTotalNum * 100 example: 7/10 * 100 = 70

func (ProgressBar) ModelType

func (p ProgressBar) ModelType() string

ModelType .

type Text

type Text struct {
	Text       string        `json:"text,omitempty"`
	EnableCopy bool          `json:"enableCopy,omitempty"`
	Status     UnifiedStatus `json:"status,omitempty"`
	Tip        string        `json:"tip,omitempty"` // Hover on the text, use '\n' for newlines
}

Text .

func (Text) ModelType

func (t Text) ModelType() string

ModelType .

type UnifiedColor

type UnifiedColor int

UnifiedColor .

const (
	ColorRed UnifiedColor = iota
	ColorYellow
	ColorGreen
	ColorBlue
	ColorPurple
	ColorDefault
)

UnifiedColor .

func (UnifiedColor) String

func (c UnifiedColor) String() string

String .

type UnifiedStatus

type UnifiedStatus string

UnifiedStatus .

const (
	ErrorStatus      UnifiedStatus = "error"
	WarningStatus    UnifiedStatus = "warning"
	SuccessStatus    UnifiedStatus = "success"
	ProcessingStatus UnifiedStatus = "processing"
	DefaultStatus    UnifiedStatus = "default"
)

UnifiedStatus .

func (UnifiedStatus) String

func (g UnifiedStatus) String() string

String .

type User

type User struct {
	ID     string `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	Avatar string `json:"avatar,omitempty"`
}

User .

func (User) ModelType

func (u User) ModelType() string

ModelType .

type UserSelector

type UserSelector struct {
	Scope           string   `json:"scope,omitempty"` // org/project/app/etc
	ScopeID         string   `json:"scopeID,omitempty"`
	SelectedUserIDs []string `json:"selectedUserIDs,omitempty"`

	Operations map[cptype.OperationKey]cptype.Operation `json:"operations,omitempty"`
}

UserSelector .

func (UserSelector) ModelType

func (us UserSelector) ModelType() string

ModelType .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL