跳到主要内容

Data Asset Detail Page Feature

Overview

The Data Asset Detail Page is a comprehensive frontend interface that provides detailed information about data assets stored in the DatomsDB system. This feature enhances the existing admin interface with rich metadata display, inline editing capabilities, and proper permission-based access control.

Key Features

1. Enhanced Asset List Display

  • Asset Type Icons: Visual indicators for different data asset types (database, file, CSV, JSON, Excel, API, etc.)
  • Asset Status: Color-coded status badges (active, inactive, processing, unknown)
  • Encryption Indicators: Lock icons for encrypted assets
  • Backward Compatibility: Seamless fallback to legacy database list if new API is unavailable

2. Comprehensive Asset Details

  • Basic Information: Name, description, type, status, version, source ID, creation/update timestamps, creator
  • DatomsDB Metadata: Structured display of DatomsDB-specific metadata with proper formatting
  • Additional Metadata: JSON-formatted display of custom metadata
  • Tags: Visual tag display for asset categorization

3. Inline Editing Capabilities

  • Editable Fields: Asset name and description can be edited inline
  • Real-time Updates: Changes are saved immediately via API calls
  • User-friendly Interface: Click-to-edit with save/cancel buttons
  • Error Handling: Graceful error handling with user feedback

4. Permission-Based Access Control

  • RBAC Integration: Full integration with the Role-Based Access Control system
  • Permission Checks: Different operations require specific permissions:
    • view_data_asset_details: View asset details
    • edit_data_asset_metadata: Edit asset metadata
    • delete_data_asset: Delete assets
    • manage_data_sources: Create new assets
  • Graceful Error Handling: User-friendly messages for permission denials

5. Asset Management Operations

  • Delete Assets: Comprehensive deletion with confirmation dialog
  • Physical File Cleanup: Automatic cleanup of associated physical files
  • Export/Backup: Placeholder for future export functionality
  • Refresh Capabilities: Real-time list updates after operations

Technical Implementation

Frontend Architecture

  • Vanilla JavaScript: No additional frameworks, maintains consistency with existing codebase
  • Panel-based UI: Integrates seamlessly with existing admin interface
  • Responsive Design: Mobile-friendly layout with CSS Grid and Flexbox
  • Error Handling: Centralized error handling with toast notifications

API Integration

  • Primary Endpoint: /api/data-assets for asset listing
  • Details Endpoint: /api/data-assets/:id/details for detailed information
  • Update Endpoint: /api/data-assets/:id/metadata for metadata updates
  • Delete Endpoint: /api/data-assets/:id for asset deletion
  • Fallback Support: Automatic fallback to legacy /api/db/list endpoint

CSS Styling

  • Modern Design: Clean, professional interface with consistent styling
  • Status Indicators: Color-coded status badges and icons
  • Interactive Elements: Hover effects and smooth transitions
  • Responsive Layout: Adapts to different screen sizes
  • Toast Notifications: Slide-in notifications for user feedback

User Interface Components

Asset List

<div class="list-item">
<span class="asset-icon">🗃️</span>
<span class="asset-name">Asset Name</span>
<span class="encrypted-badge"></span>
</div>

Asset Details Header

<div class="asset-details-header">
<h3>🗃️ Asset Name</h3>
<span class="asset-status status-active">ACTIVE</span>
</div>

Editable Fields

<div class="info-item">
<label>Asset Name:</label>
<span id="edit-asset-name">Current Name</span>
<button class="btn-icon edit-btn" onclick="editAssetField('name', 'Current Name')">✏️</button>
</div>

Metadata Display

<div class="asset-datoms-metadata">
<h4>DatomsDB Metadata</h4>
<div class="metadata-grid">
<div class="metadata-item">
<label>Field Name:</label>
<span>Field Value</span>
</div>
</div>
</div>

Permission Requirements

View Access

  • Permission: view_data_asset_details
  • Description: Required to view asset details and metadata

Edit Access

  • Permission: edit_data_asset_metadata
  • Description: Required to modify asset metadata (name, description)

Delete Access

  • Permission: delete_data_asset
  • Description: Required to delete assets and associated files

Create Access

  • Permission: manage_data_sources
  • Description: Required to create new data assets

Error Handling

HTTP Status Codes

  • 401 Unauthorized: Session expired, redirects to login
  • 403 Forbidden: Insufficient permissions, shows permission error
  • 404 Not Found: Asset not found, shows not found error
  • 500 Internal Server Error: Server error, shows retry option

User Feedback

  • Success Messages: Green toast notifications for successful operations
  • Error Messages: Red toast notifications for failures
  • Info Messages: Blue toast notifications for informational updates
  • Warning Messages: Yellow toast notifications for warnings

Browser Compatibility

  • Modern Browsers: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
  • Mobile Support: Responsive design works on mobile devices
  • JavaScript: ES6+ features with fallbacks for older browsers

Future Enhancements

  • Advanced Search: Filter and search capabilities for asset lists
  • Bulk Operations: Select multiple assets for batch operations
  • Asset Relationships: Display relationships between assets
  • Version History: Track and display asset version changes
  • Export Formats: Multiple export formats (JSON, CSV, XML)
  • Asset Templates: Predefined templates for common asset types

Security Considerations

  • Input Validation: All user inputs are validated on both client and server
  • XSS Prevention: Proper escaping of user-generated content
  • CSRF Protection: Token-based protection for state-changing operations
  • Permission Enforcement: Server-side permission checks for all operations
  • Audit Logging: All operations are logged for security auditing