Documentation
¶
Overview ¶
Package render contains HTML template models and parsing.
Index ¶
- Constants
- func CoderLabel(id string) string
- func DockerIconClass(name string) string
- func DockerRunStatus(run docker.RunView) string
- func HTMLTemplate(assetPath func(string) string, version, assetBuild string, ...) *template.Template
- func HostBarClass(percent int) string
- func HostBarHeight(percent int) template.HTMLAttr
- func HostBarStyle(percent int) template.HTMLAttr
- func HostLevelClass(level string) string
- func HostRingClass(percent int) string
- type AgentsFormData
- type AgentsListData
- type AssistantAttachmentView
- type AssistantCard
- type AssistantCoderOption
- type AssistantData
- type AssistantHistoryData
- type AssistantJobView
- type AssistantMemoryData
- type AssistantMemoryEntry
- type AssistantMessageData
- type AssistantMessageView
- type AssistantWakeView
- type BackupGroup
- type BackupImport
- type BackupImportSection
- type BackupListData
- type BackupMergeData
- type BackupReviewRow
- type BackupRow
- type BackupSection
- type CoderAttachData
- type CoderChoice
- type CoderFilesData
- type CoderNewData
- type DockerActionRow
- type DockerButton
- type DockerContainer
- type DockerIcon
- type DockerLinkRuleRow
- type DockerRunData
- type DockerStack
- type DocsCap
- type DocsData
- type DocsItem
- type DocsKeys
- type DocsTopic
- type EditorData
- type EditorInactiveCoder
- type EditorLSPProfile
- type EditorProject
- type EditorProjectsData
- type EditorTerminal
- type EditorTerminalsData
- type ErrorPage
- type Flash
- type InstructionsData
- type JingleOption
- type LoginData
- type Page
- type ProjectDelete
- type ProjectDocker
- type ProjectNav
- type ProjectNavItem
- type ProjectOption
- type ProjectsListData
- type PushDevice
- type PushWebhook
- type QuickNav
- type SettingsBackupData
- type SettingsBackupNewData
- type SettingsCoder
- type SettingsDockerData
- type SettingsEditorData
- type SettingsGeneralData
- type SettingsNav
- type SettingsNotificationsData
- type SettingsVoiceData
- type ShellAttachData
- type ShellNewData
- type SkillRow
- type SkillsFormData
- type SkillsListData
- type SplitAttachData
- type SplitMember
- type StripTab
- type TerminalTab
- type VoiceEngine
- type VoiceOption
Constants ¶
const DocsLead = "" /* 289-byte string literal not displayed */
DocsLead is the note above the topics.
Variables ¶
This section is empty.
Functions ¶
func CoderLabel ¶
CoderLabel capitalizes a coder id for display. One implementation for the templates and the handlers, so a label never differs by surface.
func DockerIconClass ¶
DockerIconClass answers the class one icon name renders as. A name nobody knows and no name at all both end at the neutral command icon: an empty box in a menu reads as a broken page.
func DockerRunStatus ¶
DockerRunStatus is the one line that says where a run stands: that it is going, the exit code it ended with, or what went wrong instead.
func HTMLTemplate ¶
func HTMLTemplate(assetPath func(string) string, version, assetBuild string, plugins []*pluginhost.Serve) *template.Template
HTMLTemplate returns the parsed template set used by Gin's HTML renderer. plugins feeds the two plugin funcs: pluginElements binds every final element name to its plugin's starter module in the import map, which is how the lazy element loader finds plugin code; pluginSlot is the markup the plugins added for a named slot.
func HostBarClass ¶
HostBarClass colors one bar by its own reading.
func HostBarHeight ¶
HostBarHeight is HostBarStyle for the standing mini bars of the float card.
func HostBarStyle ¶
HostBarStyle writes the width of a bar. It is built here rather than interpolated in the template so the value never lands in a CSS context the template escaper has to guess at.
func HostLevelClass ¶
HostLevelClass colors the status icon by the worst of the readings.
func HostRingClass ¶
HostRingClass colors a ring gauge. Unlike a bare number a ring is always visible, so the quiet state is an explicit green rather than no class.
Types ¶
type AgentsFormData ¶
type AgentsFormData struct {
Page
Base string // canonical coder URL prefix, "/settings/coders/<id>"
IsEdit bool
OriginalID string
ID string
Description string
Instructions string
FormAction string
SubmitLabel string
Heading string
}
AgentsFormData is the model for create/edit forms.
type AgentsListData ¶
type AgentsListData struct {
Page
Base string // canonical coder URL prefix, "/settings/coders/<id>"
Agents []coder.Agent
}
AgentsListData is the model for the agents list.
type AssistantAttachmentView ¶
AssistantAttachmentView is one file a message carries, ready to embed.
type AssistantCard ¶
type AssistantCard struct {
ID string
Title string
Preview string
CoderLabel string
URL string
Messages int
Unfinished bool
Current bool
// Updated is a machine stamp (RFC3339), the dc-time element renders it in
// the browser locale.
Updated string
}
AssistantCard is one row on the assistant history. The title names the conversation, the same way `dev-cockpit assistant conversation-list` prints it, and the preview of the last answer sits under it.
type AssistantCoderOption ¶
AssistantCoderOption is one selectable coder on the new conversation control.
type AssistantData ¶
type AssistantData struct {
Page
ID string
// Panel says the surface renders inside the overlay: it gets its own
// compact head row and scrolls internally instead of with the page.
Panel bool
// View is which of the overlay's own sections renders: "chat", "jobs",
// "memory" or "history". The overlay is its own world, nothing in it
// opens a modal or navigates the page behind it.
View string
// MemoryData and HistoryData feed the overlay's memory and history views,
// set only when that view renders.
MemoryData *AssistantMemoryData
HistoryData *AssistantHistoryData
CoderID string
CoderLabel string
// Coders is only used when more than one is installed: the new
// conversation control then asks which one answers.
Coders []AssistantCoderOption
Messages []AssistantMessageView
Running bool
// Blocked carries the reason the composer is off. Empty means the
// assistant accepts messages.
Blocked string
// NewCoderID is the coder a new conversation started from a blocked one
// runs on. It is empty when this conversation's coder is gone, then the
// new one picks whichever coder is installed.
NewCoderID string
// CurrentURL points at the conversation that still takes messages, set
// only while looking at a different one. An earlier conversation then
// sends the reader on instead of offering to start another one.
CurrentURL string
// Jobs are the coders the assistant steers. Empty when nothing is
// steered, which is the normal state.
Jobs []AssistantJobView
// JobsOpen is how many of them still wake the assistant. It is what the
// button that opens the list shows without being opened: the icon carries
// it the way every other status in the cockpit does, through its colour.
JobsOpen int
// JobsOlder is how many closed jobs the list holds back, so nothing is
// dropped silently. The open jobs always all render.
JobsOlder int
// JobsURL is the jobs path: it serves the list on its own, so the page can
// pull it when a check changed something, and it takes the two actions on a
// job. One path, so the forms post where the fragment came from.
JobsURL string
// EarlierCount is how many messages are held back above the rendered
// window, and AllURL renders the whole transcript, anchored at the oldest
// message that was already on the page.
EarlierCount int
AllURL string
StreamURL string
PostURL string
MessageURL string
UploadURL string
// SttURL takes a recorded clip and answers its transcript. Empty while
// speech to text is off, which is what takes the talk button away.
SttURL string
// TTS says the spoken answers are on: the messages carry their audio
// routes and the composer offers the voice mode toggle.
TTS bool
MaxPromptBytes int
MaxUploadBytes int64
// MemoryCount is what the assistant knows about the user, shown as a
// badge so the memory never grows unnoticed.
MemoryCount int
HistoryCount int
// Draft is the unsent message this conversation holds, rendered straight
// into the message box, and DraftFiles are the files that were uploaded
// for it, as the JSON the composer rebuilds its chips from. Both come from
// the conversation, so the draft is there on the next device too.
Draft string
DraftFiles string
// DraftURL serves the stored draft on its own, which is how a second device
// catches up after a save somewhere else and after a reconnect.
DraftURL string
// ContextPercent is how full the coder's context window stood at the end of
// the last turn, drawn as the ring around the new conversation button. Zero
// means there is nothing to show, either because no turn reported a reading
// yet or because that model's window is unknown, and the ring then stays
// empty: a wrong percentage is worse than none. It is rendered here as well
// as pushed with the end frame, so opening the panel shows the number
// without waiting for a turn.
ContextPercent int
}
AssistantData is the model for the assistant conversation surface, rendered as the full page and as the interior of the docked panel.
type AssistantHistoryData ¶
type AssistantHistoryData struct {
Page
Conversations []AssistantCard
Available bool
// CurrentURL is the conversation that still takes messages. While there is
// one, the page sends the reader there instead of offering to start
// another one next to it.
CurrentURL string
}
AssistantHistoryData is the model for the earlier conversations.
type AssistantJobView ¶
type AssistantJobView struct {
Terminal string
Name string
Project string
Task string
DoneWhen string
State string
Open bool
// Checking says a check is running on this job right now, so the page can
// show it instead of leaving the user to read a counter.
Checking bool
Note string
Wakes int
MaxWakes int
// Expires is a machine stamp (RFC3339); the dc-time element renders it in
// the browser locale like the conversation timestamps.
Expires string
// URL opens the coder the job steers.
URL string
}
AssistantJobView is one steered job on the conversation page: what the assistant keeps an eye on, what it costs, and where it stands.
type AssistantMemoryData ¶
type AssistantMemoryData struct {
Page
Entries []AssistantMemoryEntry
}
AssistantMemoryData is the model for the memory page. Editing happens in place, each row carries its own prefilled form.
type AssistantMemoryEntry ¶
type AssistantMemoryEntry struct {
Slug string
Title string
Body string
// Updated is a machine stamp (RFC3339), the dc-time element renders it in
// the browser locale.
Updated string
}
AssistantMemoryEntry is one thing the assistant knows about the user.
type AssistantMessageData ¶
type AssistantMessageData struct {
Message AssistantMessageView
}
AssistantMessageData is the model for the single-message fragment the browser pulls when a streamed answer finished.
type AssistantMessageView ¶
type AssistantMessageView struct {
ID string
RunID string
User bool
// Wake is set on a message a check wrote: which coder it was about and what
// it concluded. It never renders as something the user said.
Wake *AssistantWakeView
Author string
Text string
HTML template.HTML
Attachments []AssistantAttachmentView
State string
Error string
Streaming bool
Failed bool
CanRetry bool
// Queued marks a message still waiting for the running turn to end, and
// CanDiscard says the page may still take it back. A waiting entry in a
// read-only conversation renders as never sent instead.
Queued bool
CanDiscard bool
Time string
// AudioURL serves this answer spoken, set only while text to speech is on
// and the answer is complete; the speaker button renders from it.
AudioURL string
}
AssistantMessageView is one rendered message. User text stays plain, assistant answers are rendered from Markdown server-side with raw HTML disabled.
type AssistantWakeView ¶
type AssistantWakeView struct {
Terminal string
Name string
Verdict string
Done bool
Blocked bool
// Expired marks the one message a job writes when it ran out of checks or
// out of time, so the reader knows nobody is looking any more.
Expired bool
URL string
}
AssistantWakeView describes the check a message came from.
type BackupGroup ¶
type BackupGroup struct {
Label string
Sections []BackupSection
}
BackupGroup groups the export sections on the backup page.
type BackupImport ¶
type BackupImport struct {
Token string
Created string
Host string
Version string
Sections []BackupImportSection
}
BackupImport describes an uploaded archive waiting for the import selection, the adaptive part of the import flow.
type BackupImportSection ¶
type BackupImportSection struct {
ID string
Label string
Description string
Files int
Size string
Supported bool
Requires string
RequiresLabels string
}
BackupImportSection is one section found in an uploaded backup archive. Requires and RequiresLabels drive the same dependency enforcement and hint as the export form, limited to the sections the archive contains.
type BackupListData ¶
BackupListData feeds the standalone backup list fragment, pulled live by dc-backup-list. It carries no flash, so a live refresh never eats the redirect flash of a create or delete.
type BackupMergeData ¶
type BackupMergeData struct {
Page
ID string
FilePath string
Text bool
Content string
Previous string
Restart bool
}
BackupMergeData feeds the merge page for one overwritten file. Restart marks cockpit files, saving a merge or restoring restarts the server.
type BackupReviewRow ¶
BackupReviewRow is one overwritten file awaiting a keep, restore, or merge decision. It carries the CSRF token so the shared row template can render its action forms without extra template helpers. Restart marks cockpit files, restoring or merging one restarts the server.
type BackupRow ¶
type BackupRow struct {
ID string
Name string
Created string
Size string
Sections int
Running bool
Done bool
Error string
}
BackupRow is one stored backup in the export tab list.
type BackupSection ¶
type BackupSection struct {
ID string
Label string
Description string
Detail string
Available bool
Requires string
RequiresLabels string
}
BackupSection is one selectable export section on the backup form. Requires carries the space joined section ids this one depends on, for the dc-backup-sections dependency enforcement; RequiresLabels the same dependencies as human labels, rendered under the checkbox so the relationship is visible before anything toggles. Detail carries an extra enumeration line under the checkbox, the dotfiles section lists the files it discovered there.
type CoderAttachData ¶
type CoderAttachData struct {
Page
Running coder.Running
Identifier string
Coder string // owning coder id
ProjectName string // owning project, empty when CWD is outside the projects root
Files []filesystem.File
MaxUploadSizeMB string
Error string
Message string
StreamURL string
ResizeURL string
InputURL string
}
CoderAttachData is the model for the attach page.
type CoderChoice ¶
type CoderChoice struct {
ID string
Agents []coder.AgentOption
DefaultAgent string
}
CoderChoice is one selectable coder in the new-coder form together with its agent choices.
type CoderFilesData ¶
type CoderFilesData struct {
Page
Identifier string
Files []filesystem.File
MaxUploadSizeMB string
Error string
Message string
}
CoderFilesData is the model for the coder files HTML fragment.
type CoderNewData ¶
type CoderNewData struct {
Page
Projects []ProjectOption
DefaultPath string
Coders []CoderChoice
SelectedCoder string
AutomaticApproval bool
Return string // where Cancel goes back to (the page you came from)
// Panel marks a create opened from the editor terminal panel's + menu, the
// one caller whose create goes back to the editor instead of the coder's
// page. It rides the query into the form and back out through the POST,
// like Return does; Return alone cannot carry this, every quick nav link
// on an editor page sends the same editor return for its Cancel.
Panel bool
// SplitGroup and SplitColumn carry a split view the new coder joins right
// after it starts: the group id, and a member of the column it stacks into
// (empty for a column of its own at the right edge). They ride the query
// into the form and back out through the POST, like Return does.
SplitGroup string
SplitColumn string
}
CoderNewData is the model for the new-coder form. Project is chosen from a select that stands in the order the projects page is in; DefaultPath holds the project the form was opened from and is empty without one, then the first project of that order is the preselection.
type DockerActionRow ¶
DockerActionRow is one configured compose command on the settings form, together with the argv it splits into, so what a line really becomes is visible under the field it is typed in. Error carries what makes the line unusable, an unclosed quote for example.
func DockerActionRows ¶
func DockerActionRows(actions []docker.Action) []DockerActionRow
DockerActionRows pairs every configured command with the argv it splits into. The split is the same function the run uses, so the preview cannot drift away from what actually starts.
func (DockerActionRow) IconClass ¶
func (r DockerActionRow) IconClass() string
IconClass is the picture the row's icon name stands for.
func (DockerActionRow) TimeoutLabel ¶
func (r DockerActionRow) TimeoutLabel() string
TimeoutLabel is how long the entry may run, the value as it is stored when it can be read at all.
type DockerButton ¶
DockerButton is one configured command as a surface offers it: the icon resolved to a class, everything else as it is stored.
func DockerButtons ¶
func DockerButtons(actions []docker.Action) []DockerButton
DockerButtons resolves the configured commands for the surfaces that render them, the projects page and the editor's docker view.
type DockerContainer ¶
DockerContainer is one container as the row renders it: what the daemon says, plus the addresses it answers on. Those are resolved here and not in the template, because which label carries an address is configuration and applying it is the matcher's job, not a template's.
type DockerIcon ¶
DockerIcon is one entry of the icon vocabulary as the settings form offers it, the name that is stored next to the picture it stands for.
func DockerIcons ¶
func DockerIcons() []DockerIcon
DockerIcons is the vocabulary in the order it is offered.
type DockerLinkRuleRow ¶
type DockerLinkRuleRow struct {
docker.LinkRule
Error string
// Sample are the first few addresses the rule currently yields, Found how
// many there are in total.
Sample []string
Found int
}
DockerLinkRuleRow is one configured link rule on the settings form, together with what makes it unusable and what it finds in the containers that run right now. A regular expression nobody can try is a field nobody can fill in, so the row answers both questions where the pattern is typed.
func DockerLinkRuleRows ¶
func DockerLinkRuleRows(rules []docker.LinkRule, containers []docker.Container) []DockerLinkRuleRow
DockerLinkRuleRows pairs every rule with its verdict and its preview. The preview runs through the same matcher the pages build their links with, on the same cached container list they read, so what a row promises cannot drift away from what the menus offer.
func (DockerLinkRuleRow) More ¶
func (r DockerLinkRuleRow) More() int
More is how many findings the row does not show.
type DockerRunData ¶
type DockerRunData struct {
Page
Project string
// Stack is the project relative directory the command ran in, empty for
// the project root.
Stack string
Run docker.RunView
Status string
Output string
// OutputURL is what the page repaints from, StopURL what calls the run
// off while it is still going.
OutputURL string
StopURL string
}
DockerRunData feeds the output page of one compose run. The page is not watching a process: it reads the file the detached run writes into, which is why it answers the same way while the run goes and long after it ended.
func (DockerRunData) Failed ¶
func (d DockerRunData) Failed() bool
Failed reports whether the run has something to complain about, the one thing that colors the status line.
type DockerStack ¶
DockerStack is one compose control point rendered as a chip. Busy marks a compose run in flight, the menu then disables the actions. Run names the newest run of that stack, the one whose output the menu leads to, whether it is still going or over.
type DocsCap ¶
DocsCap is one rendered key cap. Caps named after a Tabler icon render as that glyph, so a pair like the arrow keys shares one font.
type DocsData ¶
DocsData feeds the documentation page: one intro line plus the topics, each rendered as a collapsible panel of title/description rows.
type DocsItem ¶
type DocsItem struct {
Title string
// Tag marks the context a control belongs to (Touch, Desktop, Coder).
Tag string
TagClass string
// Keys holds the keyboard alternatives, each a sequence of key caps.
Keys []DocsKeys
Desc template.HTML
}
DocsItem is one documented control, gesture, or shortcut.
type DocsKeys ¶
type DocsKeys struct {
Caps []string
}
DocsKeys is one key combination, rendered as kbd caps joined by a plus.
type DocsTopic ¶
type DocsTopic struct {
Key string
Title string
Icon string
Lead string
// Intro is an optional paragraph rendered above the items.
Intro template.HTML
// LinkURL and LinkText render an optional action next to the title.
LinkURL string
LinkText string
Items []DocsItem
}
DocsTopic groups the documented behavior of one area of the app.
type EditorData ¶
type EditorData struct {
Page
Project project.Project
MaxEditKiB int64
// MaxEditSize is the same limit as the file tree writes its sizes, so the
// sentence in the empty editor reads like the rows next to it rather than
// as a five digit KiB number.
MaxEditSize string
// Return is the safe in-app URL the header back button leads to, passed by
// the linking page as ?return like the create forms' Cancel.
Return string
// Projects feeds the project switcher in the file tree header, one entry
// per selectable project linking to its editor page.
Projects []EditorProject
// The diff's limits ride along as page data: the diff itself is computed in
// the browser, so this is where the values have to be. How it looks, the
// view and the folding, is not here, that is per device in the editor's own
// settings.
DiffMaxLines int
DiffMaxKiB int
// LSPExts is the code navigation surface as comma joined `ext:Label`
// pairs of the enabled language server profiles, so the client never
// mirrors the registry and a disabled profile leaves no surface.
LSPExts string
// Terminal is the session id a panel-marked coder create handed back via
// ?terminal=, rendered into the page because the client must not read it
// from the URL: a boosted navigation swaps the body before it pushes the
// URL, so the editor's init still sees the previous address. The terminal
// panel activates that session's tab.
Terminal string
}
EditorData is the model for the per-project code editor page.
type EditorInactiveCoder ¶
EditorInactiveCoder is one resumable coder in the panel's + menu.
type EditorLSPProfile ¶
type EditorLSPProfile struct {
ID string
Label string
Command string
Server string
Selected string
DockerOK bool
}
EditorLSPProfile is one language on the LSP tab: its select offers Automatic, Server over Docker, and Off, with Selected carrying the stored pick, "auto" while nothing explicit is stored. Command is the full line the description names, DockerOK whether the local daemon answers right now.
type EditorProject ¶
EditorProject is one project switcher entry in the editor's tree header. The entries render with the data-project-* attributes @dc/project-sort reads, so the client orders the menu like every other project listing.
type EditorProjectsData ¶
type EditorProjectsData struct {
Projects []EditorProject
}
EditorProjectsData feeds the switcher fragment, the very rows the editor page renders inside its dropdown. The client pulls it when the project set changes instead of building the markup a second time in the browser.
type EditorTerminal ¶
type EditorTerminal struct {
ID string
Name string
Kind string // "coder" or "shell"
Coder string
URL string
StreamURL string
ResizeURL string
InputURL string
ScrollHistory bool
HasNews bool
Steered bool
SteerPrefill string
// FilesData feeds a coder's files modal, the same one the attach pages
// carry; nil for shells and for coders whose files cannot be listed.
FilesData *CoderFilesData
}
EditorTerminal is one session in the editor's terminal panel: the tab entry and the pane the client mounts a terminal island into.
type EditorTerminalsData ¶
type EditorTerminalsData struct {
Sessions []EditorTerminal
Inactive []EditorInactiveCoder
CSRFToken string
}
EditorTerminalsData feeds the editor's terminal panel fragment: the live coders and shells of one project in tab strip order, plus the project's inactive coders for the panel's + menu.
type ErrorPage ¶
type ErrorPage struct {
Title string // document <title>, consumed by html_head.gohtml
Status int
Heading string
Message string
// CSRFToken and Jingle stay empty. html_head.gohtml evaluates both on
// every page, a model without the fields fails the whole error render.
// TestErrorPageRenders guards this contract.
CSRFToken string
Jingle string
}
ErrorPage is the model for the standalone HTTP error page. It deliberately avoids the shared Page model so it can be rendered from anywhere (including a panic recovery) without touching the session, CSRF token, or flash store.
type InstructionsData ¶
type InstructionsData struct {
Page
Base string // canonical coder URL prefix, "/settings/coders/<id>"
Instructions string
}
InstructionsData is the model for the global instructions editor.
type JingleOption ¶
JingleOption is one selectable notification jingle. The IDs must match the tune keys in the client's @dc/jingle module.
type Page ¶
type Page struct {
Title string
ActiveTab string
Flash Flash
// FlashProject, when set, anchors the flash to a project card on the projects
// page (rendered there instead of at the top of the page).
FlashProject string
CSRFToken string
User string
// MultiCoder is true when more than one coder is active, switching on the
// coder badges and selectors across the UI.
MultiCoder bool
// Jingle is the cross-device notification jingle selection, rendered into
// a meta tag so the client picks the right tune.
Jingle string
// HasTabStrip marks the attach pages, which render the terminal tab strip
// inline. Every other page gets a hidden switcher-only terminal-tabs
// instance from the layout, so the double Ctrl/Meta switcher works app wide.
HasTabStrip bool
// AssistantID is the conversation the assistant entry points open, and
// AssistantNews whether it has unread news. The three entry points carry
// the id as a notification target, so dc-notifications marks them live the
// way it marks a terminal row.
AssistantID string
AssistantNews bool
// BackupReviewCount is the number of open backup overwrite reviews,
// rendered as a badge on the Settings nav so the pending resolution is
// visible app wide. Fresh on every navigation (whole body boost).
BackupReviewCount int
// Steered marks the coders an open job holds, keyed by terminal id: the
// assistant owns those and may write into them, and every surface shows
// it as the purple steered mark. SteerPrefill carries the stored
// criterion of a closed job, which is what the steer dialog offers when
// such a terminal is steered again. Surfaces read both by id
// (`{{index $.Steered .ID}}`) instead of carrying the values through
// their own view structs; the fragments refresh on the terminals event,
// so the marks stay current without client logic.
Steered map[string]bool
SteerPrefill map[string]string
// Host is the machine's load, memory and disk at render time, so the status
// in the header is right before the first event arrives. It refreshes over
// the event stream from there.
Host hostinfo.Stats
}
Page carries request-scoped metadata shared by all templates.
type ProjectDelete ¶
ProjectDelete is what a row says about its own deletion: one that brings compose stacks down runs longer than its request, and a failure has nobody left to flash it, so both live on the row.
type ProjectDocker ¶
type ProjectDocker struct {
Stacks []DockerStack
Containers []DockerContainer
}
ProjectDocker is one project's docker presence: the compose stacks it can drive and the containers that exist. Either list may be empty, a project with only a compose file still gets its compose button on the row.
func (ProjectDocker) AnyRunning ¶
func (d ProjectDocker) AnyRunning() bool
AnyRunning reports whether one of the project's containers runs, the state the row button's icon colors on.
func (ProjectDocker) Working ¶
func (d ProjectDocker) Working() bool
Working reports whether a compose command of this project is in flight, which is what the row's docker icon rides the wave for. Both halves count: a run this process started holds the stack busy, and a run adopted after a restart is going without anybody holding anything.
type ProjectNav ¶
type ProjectNav struct {
// Active mirrors the projects page: a project counts as active when it has a
// running session or shell. LastUsedUnix is its last-opened timestamp. Both
// feed the project browser's client-side sort (same modes as the list page).
}
ProjectNav is the per-project quick-access model shared by the subpages (editor, session, shell). It lists the project's editor plus its live terminals and inactive sessions, so a subpage can offer one-click navigation to every sibling resource of the same project. Terminals holds the running coders and shells merged in tab strip order, the same order the projects page shows its chips.
type ProjectNavItem ¶
type ProjectNavItem struct {
}
ProjectNavItem is one navigable resource. URL points at the attach page for active sessions and shells, and at the resume action for inactive sessions.
type ProjectOption ¶ added in v1.55.0
ProjectOption is one project in the project select of a create form. The select is server rendered alphabetically and put into the user's order in the browser, so an option carries everything @dc/project-sort compares: the name, whether the project runs something, and when it was last opened.
func ProjectOptions ¶ added in v1.55.0
func ProjectOptions(nav []ProjectNav) []ProjectOption
ProjectOptions turns the quick nav's project browser into that select. Both list every project with the same marks, and the quick nav is built for every page render anyway, so a create form takes its projects from there instead of scanning the coders and shells a second time.
type ProjectsListData ¶
type ProjectsListData struct {
Page
Projects []project.Project
// Docker holds each project's docker presence, keyed by project name,
// joined through the compose working directory. Nil while no daemon
// answers, the chip row then simply has no docker chips.
Docker map[string]ProjectDocker
// DockerActions is the configured compose commands, the same list for
// every project because it describes the install and not one stack, with
// their icons already resolved. Empty is a real answer: the menu then says
// so and offers the defaults back.
DockerActions []DockerButton
// Deleting holds the rows whose project is being deleted or whose
// deletion failed, keyed by project name. Nil while none is.
Deleting map[string]ProjectDelete
}
ProjectsListData is the model for the projects list page.
type PushDevice ¶
type PushDevice struct {
ID string
Label string
Endpoint string
Added string
Icon string
Stale bool
}
PushDevice is one registered Web Push subscription shown on the settings page. Endpoint lets the dc-push-settings element recognize the row that belongs to the current device. Stale marks devices bound to older VAPID keys that can no longer receive pushes.
type PushWebhook ¶
PushWebhook is one registered notification webhook.
type QuickNav ¶
type QuickNav struct {
// attach page tab strip (same @dc_tab_pos sort), so the quick nav and the tab
// strip agree and a drag in either persists through POST /terminal-tabs/order.
Active []TerminalTab
// entry with their members, so the quick nav renders groups as blocks.
Strip []StripTab
// UnreadCount is the number of targets with unread news, rendered into
// the toggle badge server-side so the badge survives a boosted body swap
// (the app-wide event stream sends its snapshot on connect, not per
// navigation); the client keeps it live from there.
// the group block can mark that member row and the project context can
// follow it even when the group's members span several projects.
Focus string
// to preselect it in the new-session / new-shell forms. Empty when there is
// no project context.
CurrentProject string
// "new shell in current project" form (which posts a path, not a name).
CurrentProjectPath string
// forms as their Cancel return target.
CurrentPath string
// sorted, like the projects page) with its editor, sessions and shells.
AllProjects []ProjectNav
}
QuickNav feeds the quick nav floating button: the live sessions and shells you can jump to, plus the identifier of the one you are currently attached to.
func (QuickNav) HasInactiveCoders ¶
HasInactiveCoders reports whether any project carries a resumable session. It switches on the resume section in the tab strip's plus menu.
type SettingsBackupData ¶
type SettingsBackupData struct {
Page
Tab string
Backups []BackupRow
Import *BackupImport
ImportError string
Review []BackupReviewRow
ReviewMoreCount int
}
SettingsBackupData feeds the backup settings page. Tab picks the visible pane, "export" or "import", resolved server side so every redirect flow lands on the right one.
type SettingsBackupNewData ¶
type SettingsBackupNewData struct {
Page
Groups []BackupGroup
}
SettingsBackupNewData feeds the create backup form page.
type SettingsCoder ¶
SettingsCoder is one coder row in the settings sidebar. URL keeps the section the page is on, so switching the coder stays in the same section.
type SettingsDockerData ¶
type SettingsDockerData struct {
Page
// DockerHost is the stored docker-host setting, empty means resolve
// automatically. DockerStatus is the current connection line under the
// field, DockerConnected colors it.
DockerHost string
DockerStatus string
DockerConnected bool
// Actions is the configured compose commands, each with the argv it
// splits into, so the form shows what a line really becomes. Empty means
// no buttons anywhere, and the page then offers the defaults back.
Actions []DockerActionRow
// Icons is the icon vocabulary an entry picks from, name and picture.
Icons []DockerIcon
// LinkRules is where a container's own address comes from, each rule with
// what it finds in what runs right now. Empty means the menus offer the
// published ports and nothing else.
LinkRules []DockerLinkRuleRow
// LinkSchemes is what a rule may pin its links to, the empty one being
// the page's own scheme.
LinkSchemes []string
}
SettingsDockerData feeds the docker settings page: which daemon the cockpit talks to, and the compose commands its menus offer.
type SettingsEditorData ¶
type SettingsEditorData struct {
Page
Section string
GitPollSeconds int
DiffMaxLines int
DiffMaxKiB int
// Exclusions is the newline joined folder list the search tab edits.
Exclusions string
// LSPProfiles are the code navigation's language server profiles the
// LSP tab offers a server select for.
LSPProfiles []EditorLSPProfile
}
SettingsEditorData feeds the editor settings pages, one per tab. The values are the effective ones, so a form always shows what applies, not what happens to be stored. Section marks the open tab the way the coder pages mark theirs, so the page can grow more of them.
type SettingsGeneralData ¶
SettingsGeneralData feeds the general settings page.
type SettingsNav ¶
type SettingsNav struct {
}
SettingsNav feeds the settings sidebar, the one navigation every settings page shares (`settings_nav.gohtml`). Active names the entry to mark ("general", "editor", "docker", "notifications", "assistant", "coder", "backup"). The coder pages are settings of one coder, so the sidebar picks the coder first and the page then shows that coder's sections: with several coders active the entry becomes one row per coder (Selected marks it), a single coder host keeps one plain Coder row pointing at Home.
func (SettingsNav) Multi ¶
func (n SettingsNav) Multi() bool
Multi reports whether the coder entry splits into one row per coder. Single coder hosts keep the plain Coder row, like every other adaptive surface.
type SettingsNotificationsData ¶
type SettingsNotificationsData struct {
Page
Jingles []JingleOption
Selected string
VAPIDPublicKey string
Devices []PushDevice
StaleDevices bool
Webhooks []PushWebhook
BaseURL string
}
SettingsNotificationsData feeds the notifications settings page.
type SettingsVoiceData ¶ added in v1.55.0
type SettingsVoiceData struct {
Page
Section string
// Engines are the speech engines, each with its select. Selected carries
// the stored pick, "auto" while nothing explicit is stored.
Engines []VoiceEngine
// DockerOK is whether the local daemon answers right now, named in the
// description under each select.
DockerOK bool
}
SettingsVoiceData feeds the assistant settings page's voice tab: one select per speech engine, the same three way choice the editor LSP page offers. Section marks the open tab the way the editor pages mark theirs, so the page can grow more of them.
type ShellAttachData ¶
type ShellAttachData struct {
Page
Shell shell.Shell
ProjectName string // owning project, empty for home/ungrouped shells
StreamURL string
ResizeURL string
InputURL string
RenameURL string
}
ShellAttachData is the model for the shell attach page.
type ShellNewData ¶
type ShellNewData struct {
Page
Projects []ProjectOption
DefaultPath string
Return string // where Cancel goes back to (the page you came from)
// SplitGroup and SplitColumn carry a split view the new shell joins right
// after it starts: the group id, and a member of the column it stacks into
// (empty for a column of its own at the right edge). They ride the query
// into the form and back out through the POST, like Return does.
SplitGroup string
SplitColumn string
}
ShellNewData is the model for the new-shell form. Project is chosen from a select that stands in the order the projects page is in; DefaultPath holds the project the form was opened from and is empty without one, then the first project of that order is the preselection.
type SkillRow ¶
SkillRow is one skill of the list plus what the cockpit knows about it: a managed skill is the cockpit's own, written at start and kept current, so the page renders it locked instead of editable.
type SkillsFormData ¶
type SkillsFormData struct {
Page
Base string // canonical coder URL prefix, "/settings/coders/<id>"
IsEdit bool
OriginalID string
ID string
Description string
Instructions string
FormAction string
SubmitLabel string
Heading string
}
SkillsFormData is the model for create/edit skill forms.
type SkillsListData ¶
type SkillsListData struct {
Page
Base string // canonical coder URL prefix, "/settings/coders/<id>"
Skills []SkillRow
}
SkillsListData is the model for the skills list.
type SplitAttachData ¶
type SplitAttachData struct {
Page
GroupID string
GroupName string
ProjectName string // the members' shared project, empty when they differ
// Focus is the member whose pane starts active (a member link redirects
// here carrying ?focus); defaults to the first member. FocusExplicit
// tells the client a ?focus was requested, so it must not restore the
// remembered pane over it.
Focus string
FocusExplicit bool
Members []SplitMember
// Cols and Rows are the grid tracks the panes are placed on: one column
// per rendered column, and enough equal rows that every column divides
// them evenly (a column of two panes and one of three share six rows).
Cols int
Rows int
}
SplitAttachData is the model for the split view attach page.
type SplitMember ¶
type SplitMember struct {
ID string
Name string
Kind string // "coder" or "shell"
Coder string // owning coder id, empty for shells
Project string
URL string // the member's own attach page
StreamURL string
ResizeURL string
InputURL string
ScrollHistory bool // shells scroll the tmux history
// Col is the rendered column, 1 based and left to right, and Row/RowSpan
// place the pane inside that column's stack. The three are the pane's
// place in the page's one grid: the panes stay flat siblings so a layout
// change is a style change and never a DOM move, which is what keeps the
// streams connected. Order is the visual reading of that grid, columns
// left to right and top to bottom, rendered as the pane's `order` style:
// the keyboard stepping walks it, and it can differ from the flat member
// order the strip surfaces render. Computed by splitLayout, mirrored by
// terminal-split.
Col int
Row int
RowSpan int
Order int
// FilesData feeds the member's own files modal; nil for shells. The
// active pane's contextual footer opens it through a per-member modal id.
FilesData *CoderFilesData
}
SplitMember is one terminal pane on the split view page.
type StripTab ¶
type StripTab struct {
TerminalTab
Members []TerminalTab
}
StripTab is one rendered entry of the tab strip: a single session, or a split view group folding several sessions into one tab. Group entries fill the embedded TerminalTab with the group's values (ID is the group id, URL the split page, Kind "split", HasNews the aggregate) and carry the member sessions in group order.
func (StripTab) IsActive ¶
IsActive reports whether this strip entry represents the current page: the entry itself, or for a group one of its members, so a member's own page keeps its group tab highlighted.
func (StripTab) MemberCols ¶
MemberCols returns the space separated column indices matching MemberIDs (0 for a member that renders as a column of its own). The strip is the split page's live mirror, so a column change made anywhere travels to an open split through this attribute, the way the member order does.
func (StripTab) MemberIDs ¶
MemberIDs returns the space separated session ids behind this strip entry, the members for a group, the session itself otherwise. The strip client posts these expanded ids when it persists the tab order.
func (StripTab) MemberKinds ¶
MemberKinds returns the space separated kinds matching MemberIDs, so the strip client knows each member's stop/delete endpoint.
type TerminalTab ¶
type TerminalTab struct {
ID string
Name string
URL string
Project string // owning project name, shown under the tab name
Coder string // owning coder id, empty for shells
Kind string // "coder" or "shell"
HasNews bool
StartedAt time.Time
TabPos int // strip position from @dc_tab_pos, 0 when unset
Group string // split view group id from @dc_tab_group, empty when ungrouped
GroupPos int // position inside the group from @dc_tab_gpos, 0 when unset
GroupName string // group display name from @dc_tab_gname, may be empty
GroupCol int // column inside the group from @dc_tab_gcol, 0 for a column of its own
}
TerminalTab is one entry in the attach page tab strip: a live coder or shell.
type VoiceEngine ¶ added in v1.55.0
type VoiceEngine struct {
// Key is the form field and settings suffix ("stt", "tts").
Key string
// Label names what the engine does, Detail what runs behind it.
Label string
Detail string
// Server is the engine's short name, the value scheme's Docker option.
Server string
Selected string
// OptionKey is the form field of the engine's second select, empty for an
// engine with nothing to pick; OptionLabel names it, OptionDetail stands
// under it, Options are the fixed choices and OptionSelected the one in
// force, which is the engine's own default while nothing is stored.
OptionKey string
OptionLabel string
OptionDetail string
Options []VoiceOption
OptionSelected string
}
VoiceEngine is one engine on the voice page.
type VoiceOption ¶ added in v1.55.0
VoiceOption is one choice of an engine's second select: the stored id and what the page calls it.