Refactor video streaming feature and update dependencies
- Replaced npm ci with npm install in docker-compose for better package management. - Introduced remote component loading for the VideoStreamingPage with error handling. - Updated the title in index.html to "Experiments Dashboard" for clarity. - Added new video remote service configuration in docker-compose for improved integration. - Removed deprecated files and components related to the video streaming feature to streamline the codebase. - Updated package.json and package-lock.json to include @originjs/vite-plugin-federation for module federation support.
This commit is contained in:
26
management-dashboard-web-app/src/lib/featureFlags.ts
Normal file
26
management-dashboard-web-app/src/lib/featureFlags.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export type FeatureFlags = {
|
||||
enableShell: boolean
|
||||
enableVideoModule: boolean
|
||||
enableExperimentModule: boolean
|
||||
enableCameraModule: boolean
|
||||
}
|
||||
|
||||
const toBool = (v: unknown, fallback = false): boolean => {
|
||||
if (typeof v === 'string') {
|
||||
const s = v.trim().toLowerCase()
|
||||
return s === '1' || s === 'true' || s === 'yes' || s === 'on'
|
||||
}
|
||||
if (typeof v === 'boolean') return v
|
||||
return fallback
|
||||
}
|
||||
|
||||
export const featureFlags: FeatureFlags = {
|
||||
enableShell: toBool(import.meta.env.VITE_ENABLE_SHELL ?? false),
|
||||
enableVideoModule: toBool(import.meta.env.VITE_ENABLE_VIDEO_MODULE ?? false),
|
||||
enableExperimentModule: toBool(import.meta.env.VITE_ENABLE_EXPERIMENT_MODULE ?? false),
|
||||
enableCameraModule: toBool(import.meta.env.VITE_ENABLE_CAMERA_MODULE ?? false),
|
||||
}
|
||||
|
||||
export const isFeatureEnabled = (flag: keyof FeatureFlags): boolean => featureFlags[flag]
|
||||
|
||||
|
||||
14
management-dashboard-web-app/src/lib/loadRemote.tsx
Normal file
14
management-dashboard-web-app/src/lib/loadRemote.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import React from 'react'
|
||||
|
||||
export function loadRemoteComponent<T>(
|
||||
enabled: boolean,
|
||||
remoteImport: () => Promise<{ default: T }>,
|
||||
localComponent: T
|
||||
): T {
|
||||
if (enabled) {
|
||||
return React.lazy(remoteImport) as T
|
||||
}
|
||||
return localComponent
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user