Tài liệu

Trang Workspace

Workspace page là một màn hình hoàn chỉnh do app sở hữu, mở từ navigation của workspace. Core resolve app execution hiện tại của lane đã cài, giữ routing và mount boundary rồi render component được export. Phần bên trong boundary là của app; Core không tự chèn artifact launcher, chip environment hay control theo use case.

YAML
contributes:
  ui:
    - id: reports-page
      kind: nativeModule
      surface: page
      slot: workspace.nav
      sectionId: reports
      label: Reports
      icon: chart
      route: /reports/*
      module:
        entry: dist/ui/app.js
        export: ReportsPage
        styles: dist/ui/app.css

Dùng workspace.nav cho entry thông thường hoặc workspace.nav.section cho placement dạng section. route bắt đầu bằng /; hậu tố /* cho phép route con. Slot có navigation phải có route hoặc sectionId. Có thể giới hạn thêm bằng roles và activation.

TSX
import { useAppContext } from '@sota/platform';

type PageProps = { route?: string; subroute?: string };

export function ReportsPage({ route, subroute }: PageProps) {
  const { workspaceId, ui } = useAppContext();
  return (
    <main>
      <h1>Reports</h1>
      <button type="button" onClick={() => ui.openArtifact('reports.viewer')}>
        Open latest report
      </button>
      <small>Workspace: {workspaceId}</small>
      <small>Route: {subroute ?? route}</small>
    </main>
  );
}

Core truyền app route đã chọn qua route và subroute; dùng nó làm input cho app-local router. Identity, locale, theme, backend access, lifecycle và host actions lấy qua platform hooks. Không suy ra exact app execution từ route.

Mục lục

Esc

Tìm theo tiêu đề và nội dung trong mọi chương.