Add environment infrastructure drill-down

This commit is contained in:
2026-11-05 22:59:37 +00:00
parent 4318454a7a
commit 163f99be54
5 changed files with 40 additions and 5 deletions
+1
View File
@@ -20,6 +20,7 @@ The initial landscape contains Website, API, ERP, CRM and Email Platform plus tw
- Drag and rearrange systems on the dark LiteGraph canvas. - Drag and rearrange systems on the dark LiteGraph canvas.
- Edit or add systems, connections, scenario steps and parallel branches. - Edit or add systems, connections, scenario steps and parallel branches.
- Group systems in explicit nested environment containers such as Azure → Subscription → Resource Group. Containers can be resized, moved with their contents, collapsed to summary nodes, and persisted independently of provider metadata. - Group systems in explicit nested environment containers such as Azure → Subscription → Resource Group. Containers can be resized, moved with their contents, collapsed to summary nodes, and persisted independently of provider metadata.
- Drill into logical system environments such as Dev, QA, UAT and Prod. Environments have editable components, instances, safe example configuration placeholders and internal topology; Sitecore Prod is included as a fictional CM/CD/MSSQL/Solr example.
- Classify systems with Application, SaaS Service, Cloud Service, Development Tool and Data Store categories, plus independent tags such as Production, Test and Customer Data. - Classify systems with Application, SaaS Service, Cloud Service, Development Tool and Data Store categories, plus independent tags such as Production, Test and Customer Data.
- Use typed Data Flow, Deployment, Dependency and Source Repository relationships. Development playback includes the simulated Bitbucket commit → Azure DevOps build → website deployment journey. - Use typed Data Flow, Deployment, Dependency and Source Repository relationships. Development playback includes the simulated Bitbucket commit → Azure DevOps build → website deployment journey.
- Place reusable Website, CRM, ERP, Email Platform, Analytics and API presets, selecting only the capabilities needed for each instance. - Place reusable Website, CRM, ERP, Email Platform, Analytics and API presets, selecting only the capabilities needed for each instance.
+11 -2
View File
@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue' import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { LGraph, LGraphCanvas, LiteGraph } from 'litegraph.js' import { LGraph, LGraphCanvas, LiteGraph } from 'litegraph.js'
import { cloneCapabilities, demoLandscape, SYSTEM_PRESETS, systemFromPreset, type CapabilityModel, type ConnectionModel, type DefinitionActionModel, type EndpointModel, type EndpointResponseModel, type EnvironmentContainerModel, type LandscapeModel, type ScenarioModel, type ScenarioStep, type SystemDefinition, type SystemModel, type SystemPreset, uid, validateLandscape } from './model' import { cloneCapabilities, demoLandscape, SYSTEM_PRESETS, systemFromPreset, type CapabilityModel, type ComponentRole, type ConnectionModel, type DefinitionActionModel, type EndpointModel, type EndpointResponseModel, type EnvironmentContainerModel, type EnvironmentModel, type InfrastructureComponent, type LandscapeModel, type ScenarioModel, type ScenarioStep, type SystemDefinition, type SystemModel, type SystemPreset, uid, validateLandscape } from './model'
const STORAGE_KEY = 'dumas-system-landscape-v1' const STORAGE_KEY = 'dumas-system-landscape-v1'
const PRESET_STORAGE_KEY = 'dumas-system-presets-v1' const PRESET_STORAGE_KEY = 'dumas-system-presets-v1'
@@ -45,6 +45,8 @@ const transferHistory = ref<TransferRecord[]>([])
const dataTab = ref<TransferKind>('received') const dataTab = ref<TransferKind>('received')
const selectedContainerId = ref('') const selectedContainerId = ref('')
const selectedContainer = computed(() => landscape.value.containers.find((item) => item.id === selectedContainerId.value)) const selectedContainer = computed(() => landscape.value.containers.find((item) => item.id === selectedContainerId.value))
const selectedEnvironmentId = ref('')
const selectedEnvironment = computed(() => { const system = selectedSystem.value; return system?.environments?.find((item) => item.id === selectedEnvironmentId.value) || system?.environments?.[0] })
const allTags = computed(() => [...new Set(landscape.value.systems.flatMap((system) => system.tags || []))].sort()) const allTags = computed(() => [...new Set(landscape.value.systems.flatMap((system) => system.tags || []))].sort())
function loadLandscape(): LandscapeModel { function loadLandscape(): LandscapeModel {
@@ -60,13 +62,18 @@ const isRunning = computed(() => playing.value || stepIndex.value >= 0)
function persist() { localStorage.setItem(STORAGE_KEY, JSON.stringify(landscape.value)) } function persist() { localStorage.setItem(STORAGE_KEY, JSON.stringify(landscape.value)) }
function persistPresets() { localStorage.setItem(PRESET_STORAGE_KEY, JSON.stringify(customPresets.value)) } function persistPresets() { localStorage.setItem(PRESET_STORAGE_KEY, JSON.stringify(customPresets.value)) }
function selectSystem(id: string) { selectedSystemId.value = id; selectedConnectionId.value = '' } function selectSystem(id: string) { selectedSystemId.value = id; selectedConnectionId.value = ''; selectedEnvironmentId.value = landscape.value.systems.find((item) => item.id === id)?.environments?.[0]?.id || '' }
function selectContainer(id: string) { selectedContainerId.value = id; selectedSystemId.value = ''; selectedConnectionId.value = '' } function selectContainer(id: string) { selectedContainerId.value = id; selectedSystemId.value = ''; selectedConnectionId.value = '' }
function selectConnection(id: string) { selectedConnectionId.value = id; selectedSystemId.value = ''; const connection = landscape.value.connections.find((item) => item.id === id); if (connection) { connection.transformation ||= { incoming: connection.payload, outgoing: connection.payload, note: '' }; connection.protocol ||= 'HTTPS'; connection.dataType ||= 'JSON'; connection.deliveryMethod ||= 'immediate'; connection.exchangeType ||= 'event-transfer'; connection.responsePayload ||= '{}'; connection.responseStatus ||= 200; connection.showCableLabel ??= true } } function selectConnection(id: string) { selectedConnectionId.value = id; selectedSystemId.value = ''; const connection = landscape.value.connections.find((item) => item.id === id); if (connection) { connection.transformation ||= { incoming: connection.payload, outgoing: connection.payload, note: '' }; connection.protocol ||= 'HTTPS'; connection.dataType ||= 'JSON'; connection.deliveryMethod ||= 'immediate'; connection.exchangeType ||= 'event-transfer'; connection.responsePayload ||= '{}'; connection.responseStatus ||= 200; connection.showCableLabel ??= true } }
function addSystem() { function addSystem() {
const id = uid('system'); landscape.value.systems.push({ id, name: 'New system', description: 'Describe this system.', category: 'service', color: '#6d7cff', position: [160, 160], containerId: landscape.value.containers[0]?.id, tags: ['Test'], capabilities: [] }); selectSystem(id); persist(); rebuildGraph() const id = uid('system'); landscape.value.systems.push({ id, name: 'New system', description: 'Describe this system.', category: 'service', color: '#6d7cff', position: [160, 160], containerId: landscape.value.containers[0]?.id, tags: ['Test'], capabilities: [] }); selectSystem(id); persist(); rebuildGraph()
} }
function addContainer() { const id = uid('container'); landscape.value.containers.push({ id, name: 'New environment', color: '#2879d0', position: [80, 80], size: [500, 320] }); selectContainer(id); persist(); rebuildGraph() } function addContainer() { const id = uid('container'); landscape.value.containers.push({ id, name: 'New environment', color: '#2879d0', position: [80, 80], size: [500, 320] }); selectContainer(id); persist(); rebuildGraph() }
function selectEnvironment(id: string) { selectedEnvironmentId.value = id }
function cloneEnvironment(environment: EnvironmentModel) { if (!selectedSystem.value) return; const clone = structuredClone(environment); clone.id = uid('environment'); clone.name = `${environment.name} copy`; selectedSystem.value.environments ||= []; selectedSystem.value.environments.push(clone); selectedEnvironmentId.value = clone.id; persist() }
function addEnvironment() { if (!selectedSystem.value) return; const environment: EnvironmentModel = { id: uid('environment'), name: 'New environment', systemId: selectedSystem.value.id, configuration: { properties: { example: 'true', secret: '<SECRET_PLACEHOLDER>' } }, components: [], connections: [] }; selectedSystem.value.environments ||= []; selectedSystem.value.environments.push(environment); selectedEnvironmentId.value = environment.id; persist() }
function addComponent() { const environment = selectedEnvironment.value; if (!environment) return; const component: InfrastructureComponent = { id: uid('component'), name: 'New component', role: 'web-application', instanceName: 'Instance-01', configuration: { properties: { example: 'true', secret: '<SECRET_PLACEHOLDER>' } }, exampleConfiguration: true, position: [80, 100 + environment.components.length * 90] }; environment.components.push(component); persist() }
function deleteComponent(componentId: string) { const environment = selectedEnvironment.value; if (!environment) return; environment.components = environment.components.filter((item) => item.id !== componentId); environment.connections = environment.connections.filter((item) => item.sourceComponentId !== componentId && item.targetComponentId !== componentId); persist() }
function moveContainer(container: EnvironmentContainerModel, dx: number, dy: number) { container.position = [container.position[0] + dx, container.position[1] + dy]; for (const system of landscape.value.systems.filter((item) => item.containerId === container.id)) system.position = [system.position[0] + dx, system.position[1] + dy]; for (const child of landscape.value.containers.filter((item) => item.parentId === container.id)) child.position = [child.position[0] + dx, child.position[1] + dy]; persist(); rebuildGraph() } function moveContainer(container: EnvironmentContainerModel, dx: number, dy: number) { container.position = [container.position[0] + dx, container.position[1] + dy]; for (const system of landscape.value.systems.filter((item) => item.containerId === container.id)) system.position = [system.position[0] + dx, system.position[1] + dy]; for (const child of landscape.value.containers.filter((item) => item.parentId === container.id)) child.position = [child.position[0] + dx, child.position[1] + dy]; persist(); rebuildGraph() }
function deleteContainer(id: string) { landscape.value.systems.forEach((system) => { if (system.containerId === id) delete system.containerId }); landscape.value.containers = landscape.value.containers.filter((item) => item.id !== id && item.parentId !== id); selectedContainerId.value = ''; persist(); rebuildGraph() } function deleteContainer(id: string) { landscape.value.systems.forEach((system) => { if (system.containerId === id) delete system.containerId }); landscape.value.containers = landscape.value.containers.filter((item) => item.id !== id && item.parentId !== id); selectedContainerId.value = ''; persist(); rebuildGraph() }
function openPreset(preset: SystemPreset) { placingPreset.value = preset; selectedCapabilityIds.value = preset.capabilities.map((capability) => capability.id) } function openPreset(preset: SystemPreset) { placingPreset.value = preset; selectedCapabilityIds.value = preset.capabilities.map((capability) => capability.id) }
@@ -275,5 +282,7 @@ onUnmounted(stopAnimation)
<section v-if="activeTab === 'containers'" class="container-editor panel"><div class="section-heading"><span>Environment containers</span><button class="primary" @click="addContainer">Add container</button></div><div class="container-list"><button v-for="container in landscape.containers" :key="container.id" class="list-item" :class="{selected: selectedContainerId === container.id}" @click="selectContainer(container.id)"><span class="system-dot" :style="{background: container.color}"></span><span><strong>{{ container.name }}</strong><small>{{ container.collapsed ? 'Collapsed' : 'Expanded' }} · {{ landscape.systems.filter((system) => system.containerId === container.id).length }} systems</small></span></button></div><div v-if="selectedContainer" class="container-form"><label>Name<input v-model="selectedContainer.name" @change="rebuildGraph" /></label><label>Colour<input v-model="selectedContainer.color" type="color" @change="rebuildGraph" /></label><label>Parent<select v-model="selectedContainer.parentId" @change="rebuildGraph"><option value="">No parent</option><option v-for="parent in landscape.containers.filter((item) => item.id !== selectedContainer.id)" :key="parent.id" :value="parent.id">{{ parent.name }}</option></select></label><label>Position X<input v-model.number="selectedContainer.position[0]" type="number" @change="rebuildGraph" /></label><label>Position Y<input v-model.number="selectedContainer.position[1]" type="number" @change="rebuildGraph" /></label><label>Width<input v-model.number="selectedContainer.size[0]" type="number" min="180" @change="rebuildGraph" /></label><label>Height<input v-model.number="selectedContainer.size[1]" type="number" min="120" @change="rebuildGraph" /></label><label class="checkbox-label"><input v-model="selectedContainer.collapsed" type="checkbox" @change="rebuildGraph" /> Collapse to summary</label><div class="container-move"><button class="ghost" @click="moveContainer(selectedContainer, -20, 0)">← Move</button><button class="ghost" @click="moveContainer(selectedContainer, 20, 0)">Move →</button><button class="ghost" @click="moveContainer(selectedContainer, 0, -20)">↑ Move</button><button class="ghost" @click="moveContainer(selectedContainer, 0, 20)">↓ Move</button></div><button class="text-danger" @click="deleteContainer(selectedContainer.id)">Delete container</button></div></section> <section v-if="activeTab === 'containers'" class="container-editor panel"><div class="section-heading"><span>Environment containers</span><button class="primary" @click="addContainer">Add container</button></div><div class="container-list"><button v-for="container in landscape.containers" :key="container.id" class="list-item" :class="{selected: selectedContainerId === container.id}" @click="selectContainer(container.id)"><span class="system-dot" :style="{background: container.color}"></span><span><strong>{{ container.name }}</strong><small>{{ container.collapsed ? 'Collapsed' : 'Expanded' }} · {{ landscape.systems.filter((system) => system.containerId === container.id).length }} systems</small></span></button></div><div v-if="selectedContainer" class="container-form"><label>Name<input v-model="selectedContainer.name" @change="rebuildGraph" /></label><label>Colour<input v-model="selectedContainer.color" type="color" @change="rebuildGraph" /></label><label>Parent<select v-model="selectedContainer.parentId" @change="rebuildGraph"><option value="">No parent</option><option v-for="parent in landscape.containers.filter((item) => item.id !== selectedContainer.id)" :key="parent.id" :value="parent.id">{{ parent.name }}</option></select></label><label>Position X<input v-model.number="selectedContainer.position[0]" type="number" @change="rebuildGraph" /></label><label>Position Y<input v-model.number="selectedContainer.position[1]" type="number" @change="rebuildGraph" /></label><label>Width<input v-model.number="selectedContainer.size[0]" type="number" min="180" @change="rebuildGraph" /></label><label>Height<input v-model.number="selectedContainer.size[1]" type="number" min="120" @change="rebuildGraph" /></label><label class="checkbox-label"><input v-model="selectedContainer.collapsed" type="checkbox" @change="rebuildGraph" /> Collapse to summary</label><div class="container-move"><button class="ghost" @click="moveContainer(selectedContainer, -20, 0)">← Move</button><button class="ghost" @click="moveContainer(selectedContainer, 20, 0)">Move →</button><button class="ghost" @click="moveContainer(selectedContainer, 0, -20)">↑ Move</button><button class="ghost" @click="moveContainer(selectedContainer, 0, 20)">↓ Move</button></div><button class="text-danger" @click="deleteContainer(selectedContainer.id)">Delete container</button></div></section>
<section class="tag-panel panel"><label>Filter by system tag<select v-model="tagFilter"><option value="all">All tags</option><option v-for="tag in allTags" :key="tag">{{ tag }}</option></select></label><label v-if="selectedSystem">Selected system tags<input :value="(selectedSystem.tags || []).join(', ')" @change="selectedSystem.tags = $event.target.value.split(',').map((tag) => tag.trim()).filter(Boolean); persist()" /></label></section> <section class="tag-panel panel"><label>Filter by system tag<select v-model="tagFilter"><option value="all">All tags</option><option v-for="tag in allTags" :key="tag">{{ tag }}</option></select></label><label v-if="selectedSystem">Selected system tags<input :value="(selectedSystem.tags || []).join(', ')" @change="selectedSystem.tags = $event.target.value.split(',').map((tag) => tag.trim()).filter(Boolean); persist()" /></label></section>
<section class="category-panel panel"><label>Filter by category<select v-model="categoryFilter"><option value="all">All categories</option><option value="application">Application</option><option value="saas-service">SaaS Service</option><option value="cloud-service">Cloud Service</option><option value="development-tool">Development Tool</option><option value="data-store">Data Store</option><option value="service">Service</option><option value="data">Data</option><option value="human">Human</option><option value="external">External</option></select></label><label>Filter connections<select v-model="connectionTypeFilter" @change="rebuildGraph"><option value="all">All relationship types</option><option value="data-flow">Data Flow</option><option value="deployment">Deployment</option><option value="dependency">Dependency</option><option value="source-repository">Source Repository</option></select></label><label v-if="selectedConnection">Selected relationship type<select v-model="selectedConnection.connectionType"><option value="data-flow">Data Flow</option><option value="deployment">Deployment</option><option value="dependency">Dependency</option><option value="source-repository">Source Repository</option></select></label></section> <section class="category-panel panel"><label>Filter by category<select v-model="categoryFilter"><option value="all">All categories</option><option value="application">Application</option><option value="saas-service">SaaS Service</option><option value="cloud-service">Cloud Service</option><option value="development-tool">Development Tool</option><option value="data-store">Data Store</option><option value="service">Service</option><option value="data">Data</option><option value="human">Human</option><option value="external">External</option></select></label><label>Filter connections<select v-model="connectionTypeFilter" @change="rebuildGraph"><option value="all">All relationship types</option><option value="data-flow">Data Flow</option><option value="deployment">Deployment</option><option value="dependency">Dependency</option><option value="source-repository">Source Repository</option></select></label><label v-if="selectedConnection">Selected relationship type<select v-model="selectedConnection.connectionType"><option value="data-flow">Data Flow</option><option value="deployment">Deployment</option><option value="dependency">Dependency</option><option value="source-repository">Source Repository</option></select></label></section>
<section v-if="selectedSystem && (selectedSystem.environments?.length || activeTab === 'systems')" class="environment-panel panel"><div class="environment-header"><div><span class="eyebrow">INFRASTRUCTURE DRILL-DOWN</span><strong>{{ selectedSystem.name }} environments</strong></div><div class="environment-actions"><button class="ghost" @click="addEnvironment">+ Environment</button><button v-if="selectedEnvironment" class="ghost" @click="cloneEnvironment(selectedEnvironment)">Clone environment</button></div></div><div class="environment-tabs"><button v-for="environment in (selectedSystem.environments || [])" :key="environment.id" :class="{active: selectedEnvironment?.id === environment.id}" @click="selectEnvironment(environment.id)">{{ environment.name }}</button><span v-if="!selectedSystem.environments?.length" class="muted">No environments yet. Add Dev, QA, UAT or Prod.</span></div><div v-if="selectedEnvironment" class="environment-detail"><div class="environment-config"><label>Name<input v-model="selectedEnvironment.name" /></label><label>Hosting location<input v-model="selectedEnvironment.configuration.hostingLocation" placeholder="Azure, on-prem, etc." /></label><label>Software/version<input v-model="selectedEnvironment.configuration.softwareVersion" /></label><label>Example configuration<input :value="selectedEnvironment.exampleConfiguration ? 'Yes — fictional values' : 'No'" readonly /></label><label>Properties JSON<textarea :value="JSON.stringify(selectedEnvironment.configuration.properties, null, 2)" @change="(event) => { try { selectedEnvironment.configuration.properties = JSON.parse(event.target.value); persist() } catch { importError = 'Environment properties must be valid JSON.' } }" rows="3" class="code"></textarea></label></div><div class="environment-components"><div class="steps-head"><span>Components and instances</span><button class="icon-button" @click="addComponent">+</button></div><article v-for="component in selectedEnvironment.components" :key="component.id" class="component-card"><div class="component-head"><strong>{{ component.name }}</strong><small>{{ component.role }} · {{ component.instanceName }}</small><button class="text-danger" @click="deleteComponent(component.id)">Remove</button></div><div class="definition-grid"><label>Name<input v-model="component.name" /></label><label>Instance<input v-model="component.instanceName" /></label><label>Role<select v-model="component.role"><option value="web-application">Web Application</option><option value="content-management">Content Management</option><option value="content-delivery">Content Delivery</option><option value="database-server">Database Server</option><option value="database">Database</option><option value="search-service">Search Service</option></select></label><label>Hosting location<input v-model="component.configuration.hostingLocation" /></label><label>Hostname<input v-model="component.configuration.hostname" /></label><label>URL<input v-model="component.configuration.url" /></label><label>Software/version<input v-model="component.configuration.softwareVersion" /></label><label>Properties JSON<textarea :value="JSON.stringify(component.configuration.properties, null, 2)" @change="(event) => { try { component.configuration.properties = JSON.parse(event.target.value); persist() } catch { importError = 'Component properties must be valid JSON.' } }" rows="2" class="code"></textarea></label></div></article></div><div class="environment-topology"><div class="steps-head"><span>Internal topology</span><small>Editable example connections</small></div><div v-for="link in selectedEnvironment.connections" :key="link.id" class="topology-row"><select v-model="link.sourceComponentId"><option v-for="component in selectedEnvironment.components" :key="component.id" :value="component.id">{{ component.name }}</option></select><input v-model="link.label" /><select v-model="link.targetComponentId"><option v-for="component in selectedEnvironment.components" :key="component.id" :value="component.id">{{ component.name }}</option></select></div></div></div></section>
<section v-if="selectedScenario" class="scenario-environment panel"><span class="eyebrow">SCENARIO ENVIRONMENT</span><label>Environment<select v-model="selectedScenario.environmentId"><option value="">Logical system view</option><option v-for="system in landscape.systems" :key="system.id" :value="system.environments?.[0]?.id" :disabled="!system.environments?.length">{{ system.name }} · {{ system.environments?.[0]?.name || 'No environment' }}</option></select></label><label class="checkbox-label"><input v-model="selectedScenario.traceInternal" type="checkbox" /> Trace internal component connections when available</label></section>
</main> </main>
</template> </template>
+2 -1
View File
@@ -4,11 +4,12 @@ import { definitionFromCapabilities, demoLandscape, getPreset, systemFromPreset,
describe('landscape model', () => { describe('landscape model', () => {
it('provides the editable demo landscape', () => { it('provides the editable demo landscape', () => {
const landscape = demoLandscape() const landscape = demoLandscape()
expect(landscape.systems).toHaveLength(8) expect(landscape.systems).toHaveLength(9)
expect(landscape.scenarios.map((scenario) => scenario.name)).toEqual(expect.arrayContaining(['Place order', 'Register customer', 'Contact enquiry', 'Sample request', 'Commercial order', 'Order retry and recovery', 'Commit, build and deploy'])) expect(landscape.scenarios.map((scenario) => scenario.name)).toEqual(expect.arrayContaining(['Place order', 'Register customer', 'Contact enquiry', 'Sample request', 'Commercial order', 'Order retry and recovery', 'Commit, build and deploy']))
expect(landscape.scenarios[0].steps[2].connectionIds).toHaveLength(2) expect(landscape.scenarios[0].steps[2].connectionIds).toHaveLength(2)
expect(getPreset('bitbucket')?.category).toBe('development-tool') expect(getPreset('bitbucket')?.category).toBe('development-tool')
expect(landscape.connections.find((connection) => connection.id === 'azure-devops-website')?.connectionType).toBe('deployment') expect(landscape.connections.find((connection) => connection.id === 'azure-devops-website')?.connectionType).toBe('deployment')
expect(landscape.systems.find((system) => system.id === 'sitecore')?.environments?.[0].components.map((component) => component.role)).toEqual(expect.arrayContaining(['content-management', 'content-delivery', 'database-server', 'database', 'search-service']))
}) })
it('round-trips a valid landscape and preserves positions', () => { it('round-trips a valid landscape and preserves positions', () => {
const source = demoLandscape(); const imported = validateLandscape(JSON.parse(JSON.stringify(source))) const source = demoLandscape(); const imported = validateLandscape(JSON.parse(JSON.stringify(source)))
+25 -2
View File
@@ -27,6 +27,7 @@ export interface SystemModel {
containerId?: string containerId?: string
tags?: string[] tags?: string[]
providerMetadata?: { provider: string; service?: string; region?: string } providerMetadata?: { provider: string; service?: string; region?: string }
environments?: EnvironmentModel[]
} }
export interface EnvironmentContainerModel { export interface EnvironmentContainerModel {
@@ -38,6 +39,11 @@ export interface EnvironmentContainerModel {
parentId?: string parentId?: string
collapsed?: boolean collapsed?: boolean
} }
export type ComponentRole = 'web-application' | 'content-management' | 'content-delivery' | 'database-server' | 'database' | 'search-service'
export interface ComponentConfiguration { hostname?: string; url?: string; softwareVersion?: string; hostingLocation?: string; properties: Record<string, string> }
export interface InfrastructureComponent { id: string; name: string; role: ComponentRole; instanceName?: string; configuration: ComponentConfiguration; exampleConfiguration?: boolean; position: [number, number] }
export interface EnvironmentTopologyConnection { id: string; sourceComponentId: string; targetComponentId: string; label: string }
export interface EnvironmentModel { id: string; name: string; systemId: string; configuration: ComponentConfiguration; components: InfrastructureComponent[]; connections: EnvironmentTopologyConnection[]; exampleConfiguration?: boolean }
export interface ConnectionModel { export interface ConnectionModel {
id: string id: string
@@ -77,6 +83,8 @@ export interface ScenarioModel {
description: string description: string
startSystemId: string startSystemId: string
startActionId?: string startActionId?: string
environmentId?: string
traceInternal?: boolean
steps: ScenarioStep[] steps: ScenarioStep[]
} }
@@ -123,6 +131,19 @@ export function definitionFromCapabilities(capabilities: CapabilityModel[]): Sys
export function definitionForPreset(preset: SystemPreset) { return structuredClone(preset.definition || definitionFromCapabilities(preset.capabilities)) } export function definitionForPreset(preset: SystemPreset) { return structuredClone(preset.definition || definitionFromCapabilities(preset.capabilities)) }
export function systemFromPreset(preset: SystemPreset, selectedCapabilityIds: string[], position: [number, number]): SystemModel { return { id: uid('system'), presetId: preset.id, name: preset.name, description: preset.description, category: preset.category, color: preset.color, position, capabilities: cloneCapabilities(preset.capabilities, selectedCapabilityIds), definition: definitionForPreset(preset) } } export function systemFromPreset(preset: SystemPreset, selectedCapabilityIds: string[], position: [number, number]): SystemModel { return { id: uid('system'), presetId: preset.id, name: preset.name, description: preset.description, category: preset.category, color: preset.color, position, capabilities: cloneCapabilities(preset.capabilities, selectedCapabilityIds), definition: definitionForPreset(preset) } }
const exampleConfig = (hostingLocation: string, softwareVersion: string, hostname?: string, url?: string): ComponentConfiguration => ({ ...(hostname ? { hostname } : {}), ...(url ? { url } : {}), hostingLocation, softwareVersion, properties: { example: 'true', secret: '<SECRET_PLACEHOLDER>' } })
export const sitecoreProdEnvironment = (): EnvironmentModel => ({ id: 'sitecore-prod', name: 'Prod', systemId: 'sitecore', configuration: { hostingLocation: 'Azure', softwareVersion: 'Sitecore 10.4', properties: { example: 'true', subscription: '<AZURE_SUBSCRIPTION>' } }, exampleConfiguration: true, components: [
{ id: 'sitecore-cm', name: 'Content Management', role: 'content-management', instanceName: 'CM-01', configuration: exampleConfig('Azure App Service', 'Sitecore 10.4', 'cm.example.test', 'https://cm.example.test'), exampleConfiguration: true, position: [80, 120] },
{ id: 'sitecore-cd-1', name: 'Content Delivery', role: 'content-delivery', instanceName: 'CD-01', configuration: exampleConfig('Azure App Service', 'Sitecore 10.4', 'cd-01.example.test', 'https://www.example.test'), exampleConfiguration: true, position: [360, 80] },
{ id: 'sitecore-cd-2', name: 'Content Delivery', role: 'content-delivery', instanceName: 'CD-02', configuration: exampleConfig('Azure App Service', 'Sitecore 10.4', 'cd-02.example.test', 'https://www.example.test'), exampleConfiguration: true, position: [360, 200] },
{ id: 'sitecore-sql-server', name: 'MSSQL Server', role: 'database-server', instanceName: 'SQL-01', configuration: exampleConfig('Azure VM', 'MSSQL 2022', 'sql-01.example.test'), exampleConfiguration: true, position: [650, 100] },
{ id: 'sitecore-core-db', name: 'Core Database', role: 'database', instanceName: 'Core', configuration: exampleConfig('MSSQL Server', 'Sitecore schema', 'core-db.example.test'), exampleConfiguration: true, position: [650, 210] },
{ id: 'sitecore-master-db', name: 'Master Database', role: 'database', instanceName: 'Master', configuration: exampleConfig('MSSQL Server', 'Sitecore schema', 'master-db.example.test'), exampleConfiguration: true, position: [650, 320] },
{ id: 'sitecore-solr', name: 'Solr', role: 'search-service', instanceName: 'Solr-01', configuration: exampleConfig('Azure VM', 'Solr 8.11', 'solr.example.test', 'https://solr.example.test'), exampleConfiguration: true, position: [900, 180] }
], connections: [
{ id: 'cm-cd-1', sourceComponentId: 'sitecore-cm', targetComponentId: 'sitecore-cd-1', label: 'Publish content' }, { id: 'cm-cd-2', sourceComponentId: 'sitecore-cm', targetComponentId: 'sitecore-cd-2', label: 'Publish content' }, { id: 'cm-sql', sourceComponentId: 'sitecore-cm', targetComponentId: 'sitecore-sql-server', label: 'Read/write data' }, { id: 'cd-sql', sourceComponentId: 'sitecore-cd-1', targetComponentId: 'sitecore-sql-server', label: 'Read content' }, { id: 'cm-solr', sourceComponentId: 'sitecore-cm', targetComponentId: 'sitecore-solr', label: 'Index content' }, { id: 'cd-solr', sourceComponentId: 'sitecore-cd-1', targetComponentId: 'sitecore-solr', label: 'Search content' }
] })
export const demoLandscape = (): LandscapeModel => ({ export const demoLandscape = (): LandscapeModel => ({
version: 1, version: 1,
containers: [ containers: [
@@ -138,7 +159,8 @@ export const demoLandscape = (): LandscapeModel => ({
{ id: 'email', name: 'Email Platform', description: 'Transactional and lifecycle messaging.', category: 'external', color: '#4aa3df', position: [930, 290], containerId: 'azure-resource-group', tags: ['Test', 'Business Function'], capabilities: cloneCapabilities(getPreset('email')!.capabilities) }, { id: 'email', name: 'Email Platform', description: 'Transactional and lifecycle messaging.', category: 'external', color: '#4aa3df', position: [930, 290], containerId: 'azure-resource-group', tags: ['Test', 'Business Function'], capabilities: cloneCapabilities(getPreset('email')!.capabilities) },
{ id: 'sales-review', name: 'Sales review', description: 'Sales team role that reviews sample requests.', category: 'human', color: '#f06ca9', position: [650, 480], containerId: 'azure-resource-group', tags: ['Production', 'Business Function'], presetId: 'sales-review-role', capabilities: cloneCapabilities(getPreset('sales-review-role')!.capabilities) }, { id: 'sales-review', name: 'Sales review', description: 'Sales team role that reviews sample requests.', category: 'human', color: '#f06ca9', position: [650, 480], containerId: 'azure-resource-group', tags: ['Production', 'Business Function'], presetId: 'sales-review-role', capabilities: cloneCapabilities(getPreset('sales-review-role')!.capabilities) },
{ id: 'bitbucket', name: 'Bitbucket', description: 'Source repository for application code.', category: 'development-tool', color: '#2684ff', position: [80, 700], tags: ['Test', 'Source Control'], providerMetadata: { provider: 'Atlassian', service: 'Bitbucket' }, presetId: 'bitbucket', capabilities: cloneCapabilities(getPreset('bitbucket')!.capabilities) }, { id: 'bitbucket', name: 'Bitbucket', description: 'Source repository for application code.', category: 'development-tool', color: '#2684ff', position: [80, 700], tags: ['Test', 'Source Control'], providerMetadata: { provider: 'Atlassian', service: 'Bitbucket' }, presetId: 'bitbucket', capabilities: cloneCapabilities(getPreset('bitbucket')!.capabilities) },
{ id: 'azure-devops', name: 'Azure DevOps', description: 'Build and release orchestration.', category: 'development-tool', color: '#0078d4', position: [360, 700], tags: ['Test', 'Deployment'], providerMetadata: { provider: 'Microsoft', service: 'Azure DevOps' }, presetId: 'azure-devops', capabilities: cloneCapabilities(getPreset('azure-devops')!.capabilities) } { id: 'azure-devops', name: 'Azure DevOps', description: 'Build and release orchestration.', category: 'development-tool', color: '#0078d4', position: [360, 700], tags: ['Test', 'Deployment'], providerMetadata: { provider: 'Microsoft', service: 'Azure DevOps' }, presetId: 'azure-devops', capabilities: cloneCapabilities(getPreset('azure-devops')!.capabilities) },
{ id: 'sitecore', name: 'Sitecore', description: 'Logical Sitecore content and commerce platform.', category: 'saas-service', color: '#f06ca9', position: [650, 700], tags: ['Production', 'Customer Data'], providerMetadata: { provider: 'Microsoft', service: 'Azure' }, presetId: 'sitecore-ordercloud', capabilities: cloneCapabilities(getPreset('sitecore-ordercloud')!.capabilities), environments: [sitecoreProdEnvironment()] }
], ],
connections: [ connections: [
{ id: 'website-api', sourceId: 'website', targetId: 'api', label: 'Order request', description: 'Website submits a new order to the API.', payload: '{"orderId":"ord_1042","total":129.5}' }, { id: 'website-api', sourceId: 'website', targetId: 'api', label: 'Order request', description: 'Website submits a new order to the API.', payload: '{"orderId":"ord_1042","total":129.5}' },
@@ -233,8 +255,9 @@ export function validateLandscape(value: unknown): LandscapeModel {
const containers = Array.isArray(landscape.containers) ? landscape.containers : [] const containers = Array.isArray(landscape.containers) ? landscape.containers : []
const containerIds = new Set(containers.map((item) => item.id)) const containerIds = new Set(containers.map((item) => item.id))
for (const container of containers) if (container.parentId && !containerIds.has(container.parentId)) throw new Error(`Container “${container.name}” references a missing parent container.`) for (const container of containers) if (container.parentId && !containerIds.has(container.parentId)) throw new Error(`Container “${container.name}” references a missing parent container.`)
const systems = landscape.systems.map((item) => ({ ...item, capabilities: Array.isArray(item.capabilities) ? item.capabilities : [], tags: Array.isArray(item.tags) ? item.tags : [] })) const systems = landscape.systems.map((item) => ({ ...item, capabilities: Array.isArray(item.capabilities) ? item.capabilities : [], tags: Array.isArray(item.tags) ? item.tags : [], ...(Array.isArray(item.environments) ? { environments: item.environments } : {}) }))
for (const system of systems) if (system.containerId && !containerIds.has(system.containerId)) throw new Error(`System “${system.name}” references a missing container.`) for (const system of systems) if (system.containerId && !containerIds.has(system.containerId)) throw new Error(`System “${system.name}” references a missing container.`)
for (const system of systems) for (const environment of system.environments || []) { const componentIds = new Set(environment.components.map((component) => component.id)); for (const connection of environment.connections) if (!componentIds.has(connection.sourceComponentId) || !componentIds.has(connection.targetComponentId)) throw new Error(`Environment “${environment.name}” references a missing component.`) }
const systemIds = new Set(systems.map((item) => item.id)) const systemIds = new Set(systems.map((item) => item.id))
for (const connection of landscape.connections) { for (const connection of landscape.connections) {
if (!systemIds.has(connection.sourceId) || !systemIds.has(connection.targetId)) throw new Error(`Connection “${connection.label}” references a missing system.`) if (!systemIds.has(connection.sourceId) || !systemIds.has(connection.targetId)) throw new Error(`Connection “${connection.label}” references a missing system.`)
+1
View File
@@ -1,3 +1,4 @@
.navigation-panel{display:flex;justify-content:space-between;gap:18px;padding:12px 16px}.nav-fields{display:flex;align-items:end;gap:10px;flex:1}.nav-fields label{color:#8996af;font-size:10px;font-weight:700;flex:1}.nav-fields input,.nav-fields select{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:7px;font-size:11px}.nav-fields button{height:31px;white-space:nowrap}.minimap-wrap{flex:0 0 220px}.minimap-wrap canvas{display:block;width:220px;height:120px;border:1px solid #303d58;border-radius:4px;margin-top:5px}@media(max-width:800px){.navigation-panel{display:block}.nav-fields{display:grid;grid-template-columns:1fr 1fr}.minimap-wrap{margin-top:12px}.minimap-wrap canvas{width:100%}} .navigation-panel{display:flex;justify-content:space-between;gap:18px;padding:12px 16px}.nav-fields{display:flex;align-items:end;gap:10px;flex:1}.nav-fields label{color:#8996af;font-size:10px;font-weight:700;flex:1}.nav-fields input,.nav-fields select{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:7px;font-size:11px}.nav-fields button{height:31px;white-space:nowrap}.minimap-wrap{flex:0 0 220px}.minimap-wrap canvas{display:block;width:220px;height:120px;border:1px solid #303d58;border-radius:4px;margin-top:5px}@media(max-width:800px){.navigation-panel{display:block}.nav-fields{display:grid;grid-template-columns:1fr 1fr}.minimap-wrap{margin-top:12px}.minimap-wrap canvas{width:100%}}
.container-editor,.tag-panel{padding:16px;margin-top:14px}.container-list{display:flex;gap:8px;flex-wrap:wrap}.container-list .list-item{width:auto;min-width:180px}.container-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px;padding-top:14px;border-top:1px solid #263149}.container-form label,.tag-panel label{color:#8996af;font-size:11px;font-weight:700}.container-form input,.container-form select,.tag-panel select,.tag-panel input{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:8px}.container-move{display:flex;gap:5px;align-items:end;flex-wrap:wrap}.tag-panel{display:flex;gap:14px;align-items:end}.tag-panel label{min-width:220px}.tag-panel label+label{flex:1}@media(max-width:700px){.container-form{grid-template-columns:1fr 1fr}.tag-panel{display:block}.tag-panel label{display:block;margin-bottom:10px}} .container-editor,.tag-panel{padding:16px;margin-top:14px}.container-list{display:flex;gap:8px;flex-wrap:wrap}.container-list .list-item{width:auto;min-width:180px}.container-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px;padding-top:14px;border-top:1px solid #263149}.container-form label,.tag-panel label{color:#8996af;font-size:11px;font-weight:700}.container-form input,.container-form select,.tag-panel select,.tag-panel input{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:8px}.container-move{display:flex;gap:5px;align-items:end;flex-wrap:wrap}.tag-panel{display:flex;gap:14px;align-items:end}.tag-panel label{min-width:220px}.tag-panel label+label{flex:1}@media(max-width:700px){.container-form{grid-template-columns:1fr 1fr}.tag-panel{display:block}.tag-panel label{display:block;margin-bottom:10px}}
.category-panel{display:flex;gap:12px;align-items:end;padding:12px 16px;margin-top:14px}.category-panel label{color:#8996af;font-size:11px;font-weight:700;min-width:190px}.category-panel select{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:8px}@media(max-width:700px){.category-panel{display:block}.category-panel label{display:block;margin-bottom:10px}} .category-panel{display:flex;gap:12px;align-items:end;padding:12px 16px;margin-top:14px}.category-panel label{color:#8996af;font-size:11px;font-weight:700;min-width:190px}.category-panel select{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:8px}@media(max-width:700px){.category-panel{display:block}.category-panel label{display:block;margin-bottom:10px}}
.scenario-environment,.environment-panel{padding:16px;margin-top:14px}.scenario-environment{display:flex;gap:14px;align-items:center}.scenario-environment label{color:#8996af;font-size:11px;font-weight:700}.scenario-environment select{display:block;min-width:240px;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:8px}.environment-header{display:flex;justify-content:space-between;align-items:center;gap:12px}.environment-header strong{display:block;margin-top:4px}.environment-actions{display:flex;gap:7px}.environment-tabs{display:flex;gap:7px;flex-wrap:wrap;border-bottom:1px solid #263149;padding:12px 0}.environment-tabs button{border:1px solid #33405a;background:#151d2d;color:#bdc8dc;border-radius:5px;padding:7px 11px}.environment-tabs button.active{background:#8795ff;color:#08101f}.environment-detail{display:grid;grid-template-columns:260px 1fr;gap:16px;padding-top:14px}.environment-config{display:flex;flex-direction:column;gap:5px}.environment-config label,.component-card label{color:#8996af;font-size:10px;font-weight:700}.environment-config input,.environment-config textarea,.component-card input,.component-card select,.component-card textarea{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:7px}.component-card{border:1px solid #303d58;background:#0d1320;border-radius:6px;padding:10px;margin:8px 0}.component-head{display:flex;gap:10px;align-items:center;margin-bottom:10px}.component-head strong{color:#dce4f4}.component-head small{color:#8996af;flex:1}.environment-topology{grid-column:1/-1;border-top:1px solid #263149;padding-top:12px}.topology-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px;margin:7px 0}.topology-row input,.topology-row select{background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:7px}@media(max-width:800px){.environment-detail{grid-template-columns:1fr}.scenario-environment{display:block}.scenario-environment label{display:block;margin-top:8px}.environment-header{align-items:flex-start;flex-direction:column}}