Add provider and development relationship modeling
This commit is contained in:
+7
-4
@@ -27,6 +27,7 @@ const searchQuery = ref('')
|
||||
const categoryFilter = ref('all')
|
||||
const dataTypeFilter = ref('all')
|
||||
const tagFilter = ref('all')
|
||||
const connectionTypeFilter = ref('all')
|
||||
const placingPreset = ref<SystemPreset | null>(null)
|
||||
const selectedCapabilityIds = ref<string[]>([])
|
||||
const presentationMode = ref(false)
|
||||
@@ -157,6 +158,7 @@ function recordsForSelectedSystem(kind: TransferKind) { if (!selectedSystem.valu
|
||||
function systemName(id: string) { return landscape.value.systems.find((system) => system.id === id)?.name || id }
|
||||
const latestSelectedRecord = computed(() => selectedSystem.value ? transferHistory.value.filter((record) => record.destinationId === selectedSystem.value?.id).slice(-1)[0] : undefined)
|
||||
const matchesSystem = (system: SystemModel) => { const query = searchQuery.value.trim().toLowerCase(); const queryMatch = !query || `${system.name} ${system.description}`.toLowerCase().includes(query); const categoryMatch = categoryFilter.value === 'all' || system.category === categoryFilter.value; const dataMatch = dataTypeFilter.value === 'all' || landscape.value.connections.some((connection) => connection.dataType === dataTypeFilter.value && (connection.sourceId === system.id || connection.targetId === system.id)); const tagMatch = tagFilter.value === 'all' || (system.tags || []).includes(tagFilter.value); return queryMatch && categoryMatch && dataMatch && tagMatch }
|
||||
function connectionVisible(connection: ConnectionModel) { return connectionTypeFilter.value === 'all' || (connection.connectionType || 'data-flow') === connectionTypeFilter.value }
|
||||
function isSystemDimmed(system: SystemModel) { if (!matchesSystem(system)) return true; if (!playing.value || !currentConnections.value.length) return false; return !currentConnections.value.some((connection) => connection.sourceId === system.id || connection.targetId === system.id) }
|
||||
function animatePacket(duration: number) {
|
||||
stopAnimation(); const started = performance.now()
|
||||
@@ -195,7 +197,7 @@ function rebuildGraph() {
|
||||
landscape.value.systems.forEach(buildNode)
|
||||
for (const connection of landscape.value.connections) {
|
||||
const source = graph.getNodeById(visualNodeId(connection.sourceId)); const target = graph.getNodeById(visualNodeId(connection.targetId))
|
||||
if (source && target) source.connect(0, target, 0)
|
||||
if (source && target && connectionVisible(connection)) source.connect(0, target, 0)
|
||||
}
|
||||
nextTick(() => { graphCanvas?.draw(true, true); drawPackets() })
|
||||
}
|
||||
@@ -207,13 +209,13 @@ function drawPackets() {
|
||||
graphCanvas.onDrawForeground = original
|
||||
if (!currentConnections.value.length || stepIndex.value < 0) return
|
||||
const ctx = graphCanvas.ctx as CanvasRenderingContext2D
|
||||
for (const connection of landscape.value.connections) {
|
||||
for (const connection of landscape.value.connections.filter(connectionVisible)) {
|
||||
if (!connection.showCableLabel) continue
|
||||
const from = graph.getNodeById(visualNodeId(connection.sourceId)); const to = graph.getNodeById(visualNodeId(connection.targetId))
|
||||
if (!from || !to) continue
|
||||
ctx.save(); ctx.fillStyle = '#7887a2'; ctx.font = '10px Inter, sans-serif'; ctx.fillText(connectionLabel(connection), (from.pos[0] + to.pos[0]) / 2, (from.pos[1] + to.pos[1]) / 2 - 8); ctx.restore()
|
||||
ctx.save(); const typeColors: Record<string, string> = { 'data-flow': '#8795ff', deployment: '#f2a65a', dependency: '#9b76e9', 'source-repository': '#26c6a6' }; ctx.strokeStyle = typeColors[connection.connectionType || 'data-flow']; ctx.lineWidth = 2; ctx.setLineDash(connection.connectionType === 'dependency' ? [5, 5] : connection.connectionType === 'source-repository' ? [2, 5] : []); ctx.beginPath(); ctx.moveTo(from.pos[0] + from.size[0] / 2, from.pos[1] + 50); ctx.lineTo(to.pos[0] + to.size[0] / 2, to.pos[1] + 50); ctx.stroke(); ctx.fillStyle = '#7887a2'; ctx.font = '10px Inter, sans-serif'; ctx.fillText(connectionLabel(connection), (from.pos[0] + to.pos[0]) / 2, (from.pos[1] + to.pos[1]) / 2 - 8); ctx.restore()
|
||||
}
|
||||
for (const connection of currentConnections.value) {
|
||||
for (const connection of currentConnections.value.filter(connectionVisible)) {
|
||||
const from = graph.getNodeById(visualNodeId(connection.sourceId)); const to = graph.getNodeById(visualNodeId(connection.targetId))
|
||||
if (!from || !to) continue
|
||||
const x = from.pos[0] + from.size[0] + (to.pos[0] - from.pos[0] - from.size[0]) * packetProgress.value
|
||||
@@ -272,5 +274,6 @@ onUnmounted(stopAnimation)
|
||||
<div v-if="customBuilderOpen" class="modal-backdrop" @click.self="customBuilderOpen = false"><section class="custom-builder panel"><div class="inspector-header"><div><span class="eyebrow">CUSTOM SYSTEM BUILDER</span><h2>Reusable system definition</h2><p class="muted">Definitions are saved to the local preset library. Placed instances remain independent.</p></div><button class="danger-icon" @click="customBuilderOpen = false">×</button></div><div class="builder-meta"><label>Name<input v-model="customDraft.name" /></label><label>Category<select v-model="customDraft.category"><option value="application">Application</option><option value="service">Service</option><option value="data">Data</option><option value="human">Human / role</option><option value="external">External</option></select></label><label>Colour<input v-model="customDraft.color" type="color" /></label><label>Description<textarea v-model="customDraft.description" rows="2"></textarea></label></div><div class="builder-section"><div class="steps-head"><span>Actions</span><button class="icon-button" @click="addCustomAction">+</button></div><article v-for="action in customDraft.definition.actions" :key="action.id" class="definition-card"><div class="definition-grid"><label>Name<input v-model="action.name" /></label><label>Trigger<select v-model="action.trigger"><option value="button">Button</option><option value="incoming">Incoming request / event</option><option value="schedule">Simulated schedule</option></select></label></div><label>Description<input v-model="action.description" /></label><label>Example input JSON<textarea v-model="action.input" rows="2" class="code"></textarea></label><div class="steps-head"><span>Outputs</span><button class="icon-button" @click="addCustomOutput(action)">+</button></div><div v-for="output in action.outputs" :key="output.id" class="nested-row"><input v-model="output.name" placeholder="Output name" /><textarea v-model="output.payload" rows="2" class="code" placeholder="Example JSON"></textarea><input v-model="output.condition" placeholder="Outcome condition (optional)" /><label class="checkbox-label"><input v-model="output.parallel" type="checkbox" /> Parallel output</label></div></article></div><div class="builder-section"><div class="steps-head"><span>Endpoints</span><button class="icon-button" @click="addCustomEndpoint">+</button></div><article v-for="endpoint in customDraft.definition.endpoints" :key="endpoint.id" class="definition-card"><div class="definition-grid"><label>Name<input v-model="endpoint.name" /></label><label>Protocol<select v-model="endpoint.protocol"><option>HTTPS</option><option>HTTP</option><option>GraphQL</option><option>Webhook</option><option>Message queue</option></select></label><label>Method<input v-model="endpoint.method" /></label><label>Path<input v-model="endpoint.path" /></label></div><label>Example request JSON<textarea v-model="endpoint.request" rows="2" class="code"></textarea></label><label>Triggers action<select v-model="endpoint.triggersActionId"><option value="">No action</option><option v-for="action in customDraft.definition.actions" :key="action.id" :value="action.id">{{ action.name }}</option></select></label><div class="steps-head"><span>Responses</span><button class="icon-button" @click="addCustomResponse(endpoint)">+</button></div><div v-for="response in endpoint.responses" :key="response.id" class="nested-row response-row"><label>Status<input v-model.number="response.status" type="number" /></label><label>Delay ms<input v-model.number="response.delayMs" type="number" min="0" /></label><textarea v-model="response.body" rows="2" class="code" placeholder="Response body JSON"></textarea></div></article></div><div class="modal-actions"><button class="ghost" @click="customBuilderOpen = false">Cancel</button><button class="primary" @click="saveCustomBuilder">Save reusable preset</button></div></section></div>
|
||||
<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="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>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user