ui

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHiddenUserType

func IsHiddenUserType(userType string) bool

IsHiddenUserType tells if user of a given type should be hidden from UI.

func NewGithubAuthProvider

func NewGithubAuthProvider(name string, displayName string) teleui.WebConfigAuthProvider

NewGithubAuthProvider creates AuthProvider of Github type

func NewOIDCAuthProvider

func NewOIDCAuthProvider(name string, displayName string) teleui.WebConfigAuthProvider

NewOIDCAuthProvider creates AuthProvider of OIDC type

func NewSAMLAuthProvider

func NewSAMLAuthProvider(name string, displayName string) teleui.WebConfigAuthProvider

NewSAMLAuthProvider creates AuthProvider of SAML type

Types

type ConfigCollection

type ConfigCollection struct {
	// Items is a slice of ConfigItems
	Items []ConfigItem `json:"items"`
}

ConfigCollection is a collection of ConfigItems

type ConfigItem

type ConfigItem struct {
	// ID is a resource ID which is a composed value based on kind and name
	ID string `json:"id"`
	// Kind is a resource kind
	Kind string `json:"kind"`
	// Name is a resource name
	Name string `json:"name"`
	// DisplayName is a resource display name
	DisplayName string `json:"displayName"`
	// Content is resource yaml content
	Content string `json:"content"`
}

ConfigItem is UI representation of the resource

func ConvertGithubConnectors

func ConvertGithubConnectors(connectors []teleservices.GithubConnector) ([]ConfigItem, error)

ConvertGithubConnectors creates UI Github connector objects

func ConvertLogForwarders

func ConvertLogForwarders(logForwarders []storage.LogForwarder) ([]ConfigItem, error)

ConvertLogForwarders creates UI objects for Log Forwarders

func ConvertOIDCConnectors

func ConvertOIDCConnectors(connectors []teleservices.OIDCConnector) ([]ConfigItem, error)

ConvertOIDCConnectors creates UI objects for OIDC connectors

func ConvertRoles

func ConvertRoles(roles []teleservices.Role) ([]ConfigItem, error)

ConvertRoles creates UI objects for Roles

func ConvertSAMLConnectors

func ConvertSAMLConnectors(connectors []teleservices.SAMLConnector) ([]ConfigItem, error)

ConvertSAMLConnectors creates UI objects for SAML connectors

func ConvertTrustedClusters

func ConvertTrustedClusters(clusters []teleservices.TrustedCluster) ([]ConfigItem, error)

ConvertTrustedClusters creates UI objects for Cluster

func NewConfigItem

func NewConfigItem(kind string, name string, resource interface{}) (*ConfigItem, error)

NewConfigItem creates UI objects for resource

type Converter

type Converter interface {
	// ToConfigItems converts the provided resources to their UI representations
	ToConfigItems([]teleservices.UnknownResource) ([]ConfigItem, error)
}

Converter provides methods for converting objects between backend and UI representation

func NewConverter

func NewConverter() Converter

NewConverter returns a new converter instance

type UninstallStatus

type UninstallStatus struct {
	// ClusterName is cluster name
	ClusterName string `json:"siteDomain"`
	// State is a state of uninstall operation
	State string `json:"state"`
	// Step is a step of uninstall operation
	Step int `json:"step"`
	// Message is a message of uninstall operation
	Message string `json:"message"`
	// OperationID is ID of uninstall operation
	OperationID string `json:"operationId"`
}

UninstallStatus describes the status of uninstall operation

func GetUninstallStatus

func GetUninstallStatus(accountID string, clusterName string, operator ops.Operator) (*UninstallStatus, error)

GetUninstallStatus returns a status of uninstall operation. Since 'not-found' cluster indicates that a cluster has been successfully deleted, it's to be treated as such.

type User

type User struct {
	// AuthType is auth type of this user
	AuthType authType `json:"authType"`
	// AccountID is a user name
	AccountID string `json:"accountId"`
	// Name is a user name
	Name string `json:"name"`
	// Email is a user email
	Email string `json:"email"`
	// Roles is a list of user roles
	Roles []string `json:"roles"`
	// Created is user creation time
	Created time.Time `json:"created"`
	// Status is a user status
	Status string `json:"status"`
	// Owner is a flag indicating the account owner
	Owner bool `json:"owner"`
}

User describes user role consumed by web ui

func NewUserByInvite

func NewUserByInvite(invite storage.UserInvite) User

NewUserByInvite creates an instance of UIUser using invite

func NewUserByStorageUser

func NewUserByStorageUser(storageUser storage.User) User

NewUserByStorageUser creates an instance of UI User using Storage User

type WebConfig

type WebConfig struct {
	// SystemInfo contains system information
	SystemInfo struct {
		// Wizard indicates whether gravity has been launched in the wizard (aka standalone installer) mode
		Wizard bool `json:"wizard"`
		// ClusterName is the name of the local cluster (if running inside k8s)
		ClusterName string `json:"clusterName,omitempty"`
	} `json:"systemInfo"`
	// Auth customizes login screen
	Auth teleui.WebConfigAuthSettings `json:"auth"`
	// User specifies which user features are enabled
	User struct {
		// Login is configuration for the login screen
		Login struct {
			// HeaderText is the title above login form
			HeaderText string `json:"headerText,omitempty"`
		} `json:"login"`
		// Logo is the logo to display on the login screen
		Logo string `json:"logo,omitempty"`
	} `json:"user"`
	// Routes defines web app routes
	Routes struct {
		// DefaultEntry is the default web app entry point
		DefaultEntry string `json:"defaultEntry,omitempty"`
	} `json:"routes"`
	Modules struct {
		OpsCenter struct {
			Features struct {
				LicenseGenerator struct {
					Enabled bool `json:"enabled"`
				} `json:"licenseGenerator"`
			} `json:"features"`
		} `json:"opsCenter"`
	} `json:"modules"`
}

WebConfig contains various UI customizations (served as config.js)

type WebContext

type WebContext struct {
	// User describes user fields
	User User `json:"user"`
	// UserACL describes user access control list
	UserACL userACL `json:"userAcl"`
	// ServerVersion represents gravity server version
	ServerVersion version.Info `json:"serverVersion"`
}

WebContext is the context of SPA application

func NewWebContext

func NewWebContext(storageUser storage.User, identity users.Identity, cluster ops.Site) (*WebContext, error)

NewWebContext creates a context for web client

Jump to

Keyboard shortcuts

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