A full-screen diagram management interface with integrated file explorer and diagram viewer/editor. This component combines qds-tree-view and qds-diagram-host in a split-panel layout for managing and editing diagram files stored in Azure Blob Storage.
ITreeDataProvider for storage-agnostic data operationsThe component is included in the Quantum Design System and automatically registered when you import the component library:
<script type="module" src="https://cdn.q360.ai/assets/components/index.js"></script>
Or import the specific component:
<script type="module" src="https://cdn.q360.ai/assets/components/diagram-manager/qds-diagram-manager.js"></script>
The diagram manager requires these components:
qds-tree-view - File tree displayqds-diagram-host - Diagram viewer/editorAzureStorageTreeProvider - Azure Storage data providerThese are automatically loaded when you use the component.
<qds-diagram-manager
storage-account="mystorageaccount"
container="diagrams"
auth-method="quantum-auth">
</qds-diagram-manager>
<qds-diagram-manager
storage-account="mystorageaccount"
container="diagrams"
auth-method="sas-token"
sas-token="your-sas-token-here">
</qds-diagram-manager>
<qds-diagram-manager
storage-account="mystorageaccount"
container="diagrams"
base-path="engineering/schematics"
tree-width="400px">
</qds-diagram-manager>
<qds-diagram-manager
storage-account="mystorageaccount"
container="diagrams"
initial-path="engineering/schematics/system-architecture.drawio.svg">
</qds-diagram-manager>
This will automatically navigate to and open the specified diagram when the component loads.
| Attribute | Type | Default | Description |
|---|---|---|---|
storage-account |
string | - | Required. Azure storage account name |
container |
string | - | Required. Azure storage container name |
base-path |
string | - | Optional base path to filter files (e.g., “folder/subfolder”) |
initial-path |
string | - | Optional path to a specific file to automatically open on load (e.g., “folder/diagram.drawio.svg”) |
tree-width |
string | 300px |
Initial width of the tree panel |
auth-method |
string | quantum-auth |
Authentication method: quantum-auth or sas-token |
sas-token |
string | - | SAS token (required if auth-method is sas-token) |
dataProviderGet or set the data provider instance.
const manager = document.querySelector('qds-diagram-manager');
// Get current provider
const provider = manager.dataProvider;
// Set custom provider
import { AzureStorageTreeProvider } from './providers/AzureStorageTreeProvider.js';
manager.dataProvider = new AzureStorageTreeProvider({
storageAccount: 'myaccount',
container: 'mycontainer',
authMethod: 'quantum-auth'
});
selectedNodeGet the currently selected node (read-only).
const manager = document.querySelector('qds-diagram-manager');
const selected = manager.selectedNode;
if (selected) {
console.log(`Selected: ${selected.name} (${selected.type})`);
}
file-selectedFired when a file is selected in the tree view.
manager.addEventListener('file-selected', (event) => {
const { node } = event.detail;
console.log('File selected:', node.name, node.path);
});
Event Detail:
{
node: TreeNode // The selected tree node
}
diagram-loadedFired when a diagram is loaded into the diagram-host.
manager.addEventListener('diagram-loaded', (event) => {
const { path, name } = event.detail;
console.log('Diagram loaded:', name, 'from', path);
});
Event Detail:
{
path: string // Storage URL path
name: string // Diagram filename
}
errorFired when an error occurs (provider initialization, file loading, etc.).
manager.addEventListener('error', (event) => {
const { error } = event.detail;
console.error('Error:', error.message);
});
Event Detail:
{
error: Error // The error object
}
Style internal elements using CSS ::part() selector:
| Part | Description |
|---|---|
container |
The main container element |
tree-panel |
The left panel containing the tree view |
diagram-panel |
The right panel containing the diagram host |
resize-handle |
The drag handle between panels |
qds-diagram-manager::part(tree-panel) {
background: #f5f5f5;
}
qds-diagram-manager::part(resize-handle) {
background: #007bff;
}
qds-diagram-manager::part(diagram-panel) {
background: #ffffff;
}
const manager = document.createElement('qds-diagram-manager');
// Set attributes
manager.setAttribute('storage-account', 'myaccount');
manager.setAttribute('container', 'diagrams');
manager.setAttribute('base-path', 'engineering');
manager.setAttribute('tree-width', '400px');
// Listen for events
manager.addEventListener('file-selected', (event) => {
console.log('Selected:', event.detail.node.name);
});
manager.addEventListener('error', (event) => {
alert(`Error: ${event.detail.error.message}`);
});
// Add to page
document.body.appendChild(manager);
import { ITreeDataProvider } from './providers/ITreeDataProvider.js';
import { QdsDiagramManager } from './diagram-manager/qds-diagram-manager.js';
// Create custom provider (e.g., for local files or database)
class CustomTreeProvider implements ITreeDataProvider {
// Implement all ITreeDataProvider methods
async getRootNodes() { /* ... */ }
async getChildren(nodeId) { /* ... */ }
// ... other methods
}
// Use custom provider
const manager = document.querySelector('qds-diagram-manager');
manager.dataProvider = new CustomTreeProvider();
const manager = document.querySelector('qds-diagram-manager');
manager.addEventListener('file-selected', (event) => {
const { node } = event.detail;
// Check file type
if (node.metadata?.extension === 'drawio') {
console.log('Draw.io diagram selected');
}
// Update external UI
document.querySelector('#filename-display').textContent = node.name;
document.querySelector('#file-path').textContent = node.path;
});
const manager = document.querySelector('qds-diagram-manager');
// Change storage account
function switchAccount(accountName, containerName) {
manager.setAttribute('storage-account', accountName);
manager.setAttribute('container', containerName);
// Provider will reinitialize automatically
}
// Change tree width
function setTreeWidth(width) {
manager.setAttribute('tree-width', `${width}px`);
}
// Navigate to a specific diagram
function openDiagram(filePath) {
manager.setAttribute('initial-path', filePath);
// Note: This will only work once per page load
// For dynamic navigation, you'll need to reinitialize the component
}
// Example usage
switchAccount('production-storage', 'prod-diagrams');
setTreeWidth(500);
openDiagram('engineering/network-diagram.drawio.svg');
You can create direct links to specific diagrams using the URL query string. The component automatically checks for a qds-diagram-manager-path parameter:
<!-- No JavaScript needed! Just add the component -->
<qds-diagram-manager
storage-account="mystorageaccount"
container="diagrams">
</qds-diagram-manager>
Example URL: https://yourapp.com/?qds-diagram-manager-path=engineering/system-architecture.drawio.svg
The component will automatically detect the query parameter and open the specified diagram. This works alongside the initial-path attribute - if both are present, the attribute takes precedence.
The component is designed to fill the entire viewport (100vw x 100vh). For proper full-screen display:
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<qds-diagram-manager
storage-account="myaccount"
container="diagrams">
</qds-diagram-manager>
</body>
</html>
The component integrates seamlessly with the Quantum Authentication system:
<!-- Load quantum-auth first -->
<script src="https://cdn.q360.ai/auth/quantum-auth.js"></script>
<!-- Then load the diagram manager -->
<script type="module" src="https://cdn.q360.ai/assets/components/index.js"></script>
<qds-diagram-manager
storage-account="myaccount"
container="diagrams"
auth-method="quantum-auth">
</qds-diagram-manager>
The component will automatically:
quantum-auth-initialized eventRequires ES6 modules and Shadow DOM support.
The component is built with accessibility in mind:
Cause: Missing storage-account or container attributes, or authentication failed
Solution:
// Check configuration
const manager = document.querySelector('qds-diagram-manager');
console.log('Storage account:', manager.getAttribute('storage-account'));
console.log('Container:', manager.getAttribute('container'));
// Listen for errors
manager.addEventListener('error', (event) => {
console.error('Error details:', event.detail.error);
});
Cause: File might not be a valid Draw.io diagram, or path construction failed
Solution:
manager.addEventListener('diagram-loaded', (event) => {
console.log('Loaded from:', event.detail.path);
console.log('File name:', event.detail.name);
});
manager.addEventListener('error', (event) => {
console.error('Load error:', event.detail.error.message);
});
Cause: Quantum auth not initialized or token request failed
Solution:
// Check auth status
document.addEventListener('quantum-auth-initialized', () => {
console.log('Auth initialized');
});
// Or use SAS token as fallback
manager.setAttribute('auth-method', 'sas-token');
manager.setAttribute('sas-token', 'your-token');
Part of the Quantum Design System. Internal use only.