Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:TobikoData Sqlmesh Model ModuleController

From Leeroopedia
Revision as of 16:55, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/TobikoData_Sqlmesh_Model_ModuleController.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Web_UI, Navigation, State_Management
Last Updated 2026-02-07 20:00 GMT

Overview

Module controller for managing UI navigation and visibility of SQLMesh web application features based on available modules.

Description

ModelModuleController manages the visibility and navigation logic for different modules (features) in the SQLMesh web UI, including editor, files, data-catalog, plans, tests, audits, data, lineage, and errors. The controller uses a Set to track enabled modules and provides computed properties to determine navigation display rules and default routes based on module combinations.

Key features include intelligent navigation rules that determine when to show module navigation vs history navigation, special handling for project editor (editor + files combination), module-specific queries like hasProjectEditorAndModule, and defaultNavigationRoute() method for determining landing pages.

Usage

Use this class to control the visibility of UI components and determine navigation behavior based on which SQLMesh features are available in the current project configuration.

Code Reference

Source Location

Signature

export class ModelModuleController extends ModelInitial {
  modules: Set<Modules>

  constructor(modules: Modules[] = [])

  get list(): Modules[]
  get isEmpty(): boolean
  get hasErrors(): boolean
  get hasEditor(): boolean
  get hasFiles(): boolean
  get hasProjectEditor(): boolean
  get hasOnlyProjectEditor(): boolean
  get hasOnlyDataCatalog(): boolean
  get hasProjectEditorAndModule(): boolean
  get hasDataCatalog(): boolean
  get hasPlans(): boolean
  get hasOnlyPlans(): boolean
  get hasOnlyPlansAndErrors(): boolean
  get hasTests(): boolean
  get hasAudits(): boolean
  get hasData(): boolean
  get hasLineage(): boolean
  get hasModuleAndErrors(): boolean
  get hasSingleModule(): boolean
  get showModuleNavigation(): boolean
  get showHistoryNavigation(): boolean
  get showNavigation(): boolean

  update(modules: Modules[]): void
  defaultNavigationRoute(): Routes
}

Import

import { ModelModuleController } from '@models/module-controller'
import { Modules } from '@api/client'

I/O Contract

Inputs

Name Type Required Description
modules Modules[] No Array of available module names (errors, editor, files, data-catalog, plans, tests, audits, data, lineage)

Outputs

Property Type Description
list Modules[] Array of enabled modules
hasEditor boolean True if editor module is available
hasFiles boolean True if files module is available
hasProjectEditor boolean True if both editor and files are available
hasDataCatalog boolean True if data-catalog module is available
hasPlans boolean True if plans module is available
hasErrors boolean True if errors module is available
showModuleNavigation boolean True if module navigation should be displayed
showHistoryNavigation boolean True if history navigation should be displayed
showNavigation boolean True if any navigation should be shown

Usage Examples

// Initialize with available modules
const controller = new ModelModuleController([
  Modules.editor,
  Modules.files,
  Modules.plans
])

// Check module availability
if (controller.hasProjectEditor) {
  console.log('Project editor is available')
}

// Determine navigation visibility
if (controller.showModuleNavigation) {
  // Show module tabs
}

// Get default landing page
const defaultRoute = controller.defaultNavigationRoute()
navigate(defaultRoute)
// Returns: EnumRoutes.Editor (if editor available)
// Or: EnumRoutes.Plan (if only plans available)
// Or: EnumRoutes.DataCatalog (if only data-catalog)
// Or: EnumRoutes.NotFound (if no primary modules)

// Update modules dynamically
controller.update([Modules['data-catalog'], Modules.lineage])

// Check specific combinations
if (controller.hasOnlyProjectEditor) {
  // Show only editor, no extra navigation
}

if (controller.hasProjectEditorAndModule) {
  // Has editor + files + one additional module
  console.log('Show enhanced navigation')
}

// Check if navigation should be shown
if (controller.showNavigation) {
  // Display navigation bar
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment