appnav

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package appnav exposes the dashboard's page catalog to the API — which pages the app has, and which API object type each record detail page shows.

Agents reference app records and pages by writing `openmrp:` markdown links that the frontend resolves to real routes, so nothing here builds a URL; the catalog exists so an agent can be told what is linkable at all. The manifest is generated from the dashboard's own navigation (`dashboard/apps/frontend/scripts/generate-app-pages.ts`) and committed, which keeps a new page linkable without an edit on this side.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	// Key identifies the page in an `openmrp:page/<key>` link (e.g. `customer-prices`, `agents/runs`).
	Key string `json:"key"`
	// Title is the page's name as the navigation shows it.
	Title string `json:"title"`
	// Path is the operator-shell route. Kept for diagnostics — links carry the key, not the path.
	Path string `json:"path"`
	// Section and Subsection locate the page in the sidebar, which is how users describe where things are.
	Section    string `json:"section"`
	Subsection string `json:"subsection,omitempty"`
	// Shells lists which app shells mount the page: `user` (operator) and/or `customer` (portal).
	Shells []string `json:"shells"`
	// RecordType is the API object type this page's detail view shows, when it has one.
	RecordType string `json:"record_type,omitempty"`
}

Page is a linkable dashboard page.

func PageByKey

func PageByKey(key string) (Page, bool)

PageByKey looks up a page by its link key.

func Pages

func Pages() []Page

Pages returns every linkable page.

func Search(query string, limit int) []Page

Search ranks pages against a plain-language query, best first, capped at limit.

Matching is weighted by where a term hits: the page's own title is what someone naming a page is naming, so it outranks the section it happens to sit under — otherwise a query like "pricing" returns every page in the Pricing subsection ahead of the pricing pages themselves. An empty query returns the whole catalog in sidebar order, which is how an agent browses rather than looks up.

type RecordRoute

type RecordRoute struct {
	// Type is the object type as it appears in a resource's `object` field.
	Type       string   `json:"type"`
	PageKey    string   `json:"page_key"`
	DetailBase string   `json:"detail_base"`
	Shells     []string `json:"shells"`
}

RecordRoute records that an object type has a detail page, and which page it is.

func RecordRouteFor

func RecordRouteFor(objectType string) (RecordRoute, bool)

RecordRouteFor reports whether an object type has a detail page, and which one.

Jump to

Keyboard shortcuts

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