Horizon Framework

Architecture

Overview

The Platform framework provides a framework-agnostic component registry, an event bus for the components to communicate, an API client to access Platform back-end APIs, and a UI component library.

The framework has been built with the following 3 layers in mind:

LayerExamplesDescription
Host ApplicationPhoenix, Vax, Platform Admin ConsoleProvides application functionality such as authentication, routing, and toast messages to Platform
Platform ComponentsData Table, Global Navigation, Bulk Action ButtonsConfigurable building blocks that can be combined to build new application pages
UI ComponentsButton, Dropdown, NavigationA reusable UI component library that can be used by Platform Component developers to ensure consistent UI experiences

Using Horizon Framework

API & Data

  • API Client - ApiClientV1 wrapper around the GRPC client for Platform APIs
  • GraphQL - GraphQL client for accessing Skedulo's GraphQL API

Components and Templates

  • Component Registry - Platform Components bundled into packages
  • Event Bus - Communication system between Platform Components
  • Templates - Template system for rendering dynamic UI components

User Experience

Object names

Admins can rename standard objects for their tenant, for example Jobs to "Visit" and "Visits". Horizon Core keeps these labels in one module store, so React code, plain functions and templates all read the same values instead of a hard-coded English word.

  • Source - HorizonRootProvider posts query { objects { name label labelPlural } } to the Data Model API (dataaccess/graphql/datamodel) and reads the Skedulo overrides from GET custom/standard_schemas, in the same refresh. It stores both in memory.
  • Refresh - labels load once per page. Window focus and the tab becoming visible refresh them at most once every 60 seconds, and refreshObjectNames() refreshes them on demand.
  • Tenants - labels load for Salesforce tenants as well as Skedulo tenants. Until the first request succeeds, readers get the English defaults. A failed refresh keeps the last good labels.
  • Renamed - one rule decides it for every standard object. Each form is tested against its own default, and only a real Skedulo override counts, one form at a time. With no override every text is unchanged. A Salesforce vendor label never counts. readObjectLabelState, readObjectLabel, useObjectLabel and _.host.objectLabel read the resulting state.

See Object Names for the hook, the plain functions, templates and test helpers. Mortar and Breeze code in breeze-ui should use the object-label helpers in @skedulo/breeze-blocks, which build on this store.