Documentation ¶
Index ¶
- Constants
- type DownloadOpts
- type Downloader
- type GitHubRelease
- type GithubAsset
- type LocalVersion
- type NoOpVersionConfig
- type NodeUIServer
- type NodeUIVersionConfig
- type RemoteVersion
- type RemoteVersionRequest
- type Status
- type VersionConfig
- type VersionManager
- func (vm *VersionManager) BundledVersion() (LocalVersion, error)
- func (vm *VersionManager) Download(versionName string) error
- func (vm *VersionManager) DownloadStatus() Status
- func (vm *VersionManager) ListLocalVersions() ([]LocalVersion, error)
- func (vm *VersionManager) ListRemoteVersions(r RemoteVersionRequest) ([]RemoteVersion, error)
- func (vm *VersionManager) SwitchTo(versionName string) error
- func (vm *VersionManager) UsedVersion() (LocalVersion, error)
Constants ¶
const (
// BundledVersionName bundled node UI version name
BundledVersionName = "bundled"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadOpts ¶
type DownloadOpts struct { URL *url.URL DistFile string Tag string Callback func(opts DownloadOpts) error }
DownloadOpts download options
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader node UI downloader
func (*Downloader) DownloadNodeUI ¶
func (d *Downloader) DownloadNodeUI(opts DownloadOpts)
DownloadNodeUI download node UI
type GitHubRelease ¶
type GitHubRelease struct { Url string `json:"url"` AssetsUrl string `json:"assets_url"` UploadUrl string `json:"upload_url"` HtmlUrl string `json:"html_url"` Id int `json:"id"` Author struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } `json:"author"` NodeId string `json:"node_id"` TagName string `json:"tag_name"` TargetCommitish string `json:"target_commitish"` Name string `json:"name"` Draft bool `json:"draft"` Prerelease bool `json:"prerelease"` CreatedAt time.Time `json:"created_at"` PublishedAt time.Time `json:"published_at"` Assets []struct { Url string `json:"url"` Id int `json:"id"` NodeId string `json:"node_id"` Name string `json:"name"` Label string `json:"label"` Uploader struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } `json:"uploader"` ContentType string `json:"content_type"` State string `json:"state"` Size int `json:"size"` DownloadCount int `json:"download_count"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` BrowserDownloadUrl string `json:"browser_download_url"` } `json:"assets"` TarballUrl string `json:"tarball_url"` ZipballUrl string `json:"zipball_url"` Body string `json:"body"` }
GitHubRelease github release resource
type GithubAsset ¶
type GithubAsset struct { Url string `json:"url"` Id int `json:"id"` NodeId string `json:"node_id"` Name string `json:"name"` Label string `json:"label"` Uploader struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } `json:"uploader"` ContentType string `json:"content_type"` State string `json:"state"` Size int `json:"size"` DownloadCount int `json:"download_count"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` BrowserDownloadUrl string `json:"browser_download_url"` }
GithubAsset github asset resource
type LocalVersion ¶
type LocalVersion struct {
Name string `json:"name"`
}
LocalVersion it's a local version with extra indicator if it is in use
type NoOpVersionConfig ¶
type NoOpVersionConfig struct { }
NoOpVersionConfig ui version config
func NewNoOpVersionConfig ¶
func NewNoOpVersionConfig() (*NoOpVersionConfig, error)
NewNoOpVersionConfig constructor for VersionConfig
func (*NoOpVersionConfig) UIBuildPath ¶
func (vm *NoOpVersionConfig) UIBuildPath(versionName string) string
UIBuildPath build path to the assets of provided versionName
func (*NoOpVersionConfig) Version ¶
func (vm *NoOpVersionConfig) Version() (string, error)
Version returns version to be used
type NodeUIServer ¶
type NodeUIServer interface {
SwitchUI(path string)
}
NodeUIServer interface with UI server
type NodeUIVersionConfig ¶
type NodeUIVersionConfig interface { Version() (string, error) UIBuildPath(versionName string) string // contains filtered or unexported methods }
NodeUIVersionConfig interface
type RemoteVersion ¶
type RemoteVersion struct { Name string `json:"name"` PublishedAt time.Time `json:"released_at"` CompatibilityURL string `json:"compatibility_url,omitempty"` IsPreRelease bool `json:"is_pre_release"` ReleaseNotes string `json:"release_notes,omitempty"` }
RemoteVersion it's a version
type RemoteVersionRequest ¶
RemoteVersionRequest for paged requests
type Status ¶
type Status struct { Status dlStatus `json:"status"` ProgressPct int `json:"progress_percent"` Tag string `json:"tag,omitempty"` Err error `json:"error,omitempty"` }
Status download status swagger:model DownloadStatus
type VersionConfig ¶
type VersionConfig struct {
// contains filtered or unexported fields
}
VersionConfig ui version config
func NewVersionConfig ¶
func NewVersionConfig(nodeUIDir string) (*VersionConfig, error)
NewVersionConfig constructor for VersionConfig
func (*VersionConfig) UIBuildPath ¶
func (vm *VersionConfig) UIBuildPath(versionName string) string
UIBuildPath build path to the assets of provided versionName
func (*VersionConfig) Version ¶
func (vm *VersionConfig) Version() (string, error)
Version returns version to be used
type VersionManager ¶
type VersionManager struct {
// contains filtered or unexported fields
}
VersionManager Node UI version manager
func NewVersionManager ¶
func NewVersionManager( uiServer NodeUIServer, http *requests.HTTPClient, versionConfig NodeUIVersionConfig, ) *VersionManager
NewVersionManager VersionManager constructor
func (*VersionManager) BundledVersion ¶
func (vm *VersionManager) BundledVersion() (LocalVersion, error)
BundledVersion bundled version
func (*VersionManager) Download ¶
func (vm *VersionManager) Download(versionName string) error
Download and untar node UI dist
func (*VersionManager) DownloadStatus ¶
func (vm *VersionManager) DownloadStatus() Status
DownloadStatus provides download status
func (*VersionManager) ListLocalVersions ¶
func (vm *VersionManager) ListLocalVersions() ([]LocalVersion, error)
ListLocalVersions list downloaded Node UI versions
func (*VersionManager) ListRemoteVersions ¶
func (vm *VersionManager) ListRemoteVersions(r RemoteVersionRequest) ([]RemoteVersion, error)
ListRemoteVersions list versions from github releases of NodeUI
func (*VersionManager) SwitchTo ¶
func (vm *VersionManager) SwitchTo(versionName string) error
SwitchTo switch to serving specific version
func (*VersionManager) UsedVersion ¶
func (vm *VersionManager) UsedVersion() (LocalVersion, error)
UsedVersion current version