Skip to content

Commit 9e2ee08

Browse files
committed
refactor(37943): remove the feature flag
1 parent 7b6b9cb commit 9e2ee08

File tree

10 files changed

+52
-100
lines changed

10 files changed

+52
-100
lines changed

hivemq-edge-frontend/src/config/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ interface configType {
2020
DEV_MOCK_SERVER: boolean
2121
DATAHUB_FSM_REACT_FLOW: boolean
2222
WORKSPACE_EXPERIMENTAL: boolean
23-
WORKSPACE_AUTO_LAYOUT: boolean
2423
}
2524

2625
documentation: {
@@ -90,13 +89,6 @@ const config: configType = {
9089
DATAHUB_FSM_REACT_FLOW: import.meta.env.VITE_FLAG_DATAHUB_FSM_REACTFLOW === 'true',
9190

9291
WORKSPACE_EXPERIMENTAL: import.meta.env.VITE_FLAG_WORKSPACE_SHOW_EXPERIMENTAL === 'true',
93-
94-
/**
95-
* Enable workspace auto-layout algorithms (dagre, WebCola)
96-
* Allows users to apply professional graph layout algorithms to automatically arrange workspace nodes
97-
* @experimental Phase: Beta testing
98-
*/
99-
WORKSPACE_AUTO_LAYOUT: import.meta.env.VITE_FLAG_WORKSPACE_AUTO_LAYOUT === 'true',
10092
},
10193

10294
documentation: {

hivemq-edge-frontend/src/modules/Workspace/components/controls/CanvasToolbar.spec.cy.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import config from '@/config'
66
describe('CanvasToolbar', () => {
77
beforeEach(() => {
88
cy.viewport(800, 600)
9-
// Enable feature flag for testing layout controls
10-
config.features.WORKSPACE_AUTO_LAYOUT = true
119
})
1210

1311
const wrapper = ({ children }: { children: JSX.Element }) => (
@@ -41,7 +39,6 @@ describe('CanvasToolbar', () => {
4139
})
4240

4341
it('should show layout section when expanded and feature enabled', () => {
44-
config.features.WORKSPACE_AUTO_LAYOUT = true
4542
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
4643

4744
// Expand toolbar
@@ -54,7 +51,6 @@ describe('CanvasToolbar', () => {
5451
})
5552

5653
it('should hide layout section when feature disabled', () => {
57-
config.features.WORKSPACE_AUTO_LAYOUT = false
5854
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
5955

6056
// Expand toolbar
@@ -67,7 +63,6 @@ describe('CanvasToolbar', () => {
6763
})
6864

6965
it('should show visual divider between sections when feature enabled', () => {
70-
config.features.WORKSPACE_AUTO_LAYOUT = true
7166
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
7267

7368
// Expand toolbar
@@ -79,31 +74,27 @@ describe('CanvasToolbar', () => {
7974
})
8075

8176
it('should show layout selector', () => {
82-
config.features.WORKSPACE_AUTO_LAYOUT = true
8377
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
8478

8579
cy.getByTestId('toolbox-search-expand').click()
8680
cy.getByTestId('workspace-layout-selector').should('be.visible')
8781
})
8882

8983
it('should show apply layout button', () => {
90-
config.features.WORKSPACE_AUTO_LAYOUT = true
9184
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
9285

9386
cy.getByTestId('toolbox-search-expand').click()
9487
cy.getByTestId('workspace-apply-layout').should('be.visible')
9588
})
9689

9790
it('should show presets manager', () => {
98-
config.features.WORKSPACE_AUTO_LAYOUT = true
9991
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
10092

10193
cy.getByTestId('toolbox-search-expand').click()
10294
cy.get('button[aria-label*="preset"]').should('be.visible')
10395
})
10496

10597
it('should show settings button', () => {
106-
config.features.WORKSPACE_AUTO_LAYOUT = true
10798
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
10899

109100
cy.getByTestId('toolbox-search-expand').click()
@@ -114,7 +105,6 @@ describe('CanvasToolbar', () => {
114105
})
115106

116107
it('should open layout options drawer when settings clicked', () => {
117-
config.features.WORKSPACE_AUTO_LAYOUT = true
118108
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
119109

120110
cy.getByTestId('toolbox-search-expand').click()
@@ -128,7 +118,6 @@ describe('CanvasToolbar', () => {
128118
})
129119

130120
it('should be accessible', () => {
131-
config.features.WORKSPACE_AUTO_LAYOUT = true
132121
cy.injectAxe()
133122
cy.mountWithProviders(<CanvasToolbar />, { wrapper })
134123

hivemq-edge-frontend/src/modules/Workspace/components/controls/CanvasToolbar.tsx

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -148,53 +148,50 @@ const CanvasToolbar: FC = () => {
148148
<DrawerFilterToolbox />
149149
</Box>
150150
</VStack>
151-
{config.features.WORKSPACE_AUTO_LAYOUT && (
152-
<Divider
153-
orientation={dividerOrientation}
154-
// h={{ base: 'auto', xl: '24px' }}
155-
// w={{ base: 'auto', xl: 'auto' }}
156-
borderColor="gray.300"
157-
_dark={{ borderColor: 'gray.600' }}
158-
/>
159-
)}
160-
{config.features.WORKSPACE_AUTO_LAYOUT && (
161-
<VStack
162-
role="region"
163-
data-testid="layout-controls-panel"
164-
aria-label={t('workspace.autoLayout.controls.aria-label')}
165-
spacing={{ base: 2, xl: 0 }}
166-
align="stretch"
167-
flex={{ base: '1', xl: 'initial' }}
151+
<Divider
152+
orientation={dividerOrientation}
153+
// h={{ base: 'auto', xl: '24px' }}
154+
// w={{ base: 'auto', xl: 'auto' }}
155+
borderColor="gray.300"
156+
_dark={{ borderColor: 'gray.600' }}
157+
/>
158+
159+
<VStack
160+
role="region"
161+
data-testid="layout-controls-panel"
162+
aria-label={t('workspace.autoLayout.controls.aria-label')}
163+
spacing={{ base: 2, xl: 0 }}
164+
align="stretch"
165+
flex={{ base: '1', xl: 'initial' }}
166+
>
167+
<Box
168+
display="flex"
169+
flexDirection={{ base: 'column', md: 'row', xl: 'row' }}
170+
gap={2}
171+
sx={{
172+
'& > *': {
173+
width: { base: '100%', md: 'auto' },
174+
},
175+
}}
168176
>
169-
<Box
170-
display="flex"
171-
flexDirection={{ base: 'column', md: 'row', xl: 'row' }}
172-
gap={2}
173-
sx={{
174-
'& > *': {
175-
width: { base: '100%', md: 'auto' },
176-
},
177-
}}
178-
>
179-
<LayoutSelector />
180-
<ApplyLayoutButton />
181-
<Box display="flex" gap={2} width="fit-content">
182-
<LayoutPresetsManager />
183-
<Tooltip label={t('workspace.autoLayout.options.title')} placement={tooltipPlacement}>
184-
<ChakraIconButton
185-
data-testid="workspace-layout-options"
186-
aria-label={t('workspace.autoLayout.options.title')}
187-
icon={<Icon as={LuSettings} />}
188-
size="sm"
189-
variant="ghost"
190-
onClick={onLayoutDrawerOpen}
191-
width={{ base: '100%', md: 'auto' }}
192-
/>
193-
</Tooltip>
194-
</Box>
177+
<LayoutSelector />
178+
<ApplyLayoutButton />
179+
<Box display="flex" gap={2} width="fit-content">
180+
<LayoutPresetsManager />
181+
<Tooltip label={t('workspace.autoLayout.options.title')} placement={tooltipPlacement}>
182+
<ChakraIconButton
183+
data-testid="workspace-layout-options"
184+
aria-label={t('workspace.autoLayout.options.title')}
185+
icon={<Icon as={LuSettings} />}
186+
size="sm"
187+
variant="ghost"
188+
onClick={onLayoutDrawerOpen}
189+
width={{ base: '100%', md: 'auto' }}
190+
/>
191+
</Tooltip>
195192
</Box>
196-
</VStack>
197-
)}
193+
</Box>
194+
</VStack>
198195
<Divider
199196
orientation={dividerOrientation}
200197
// h={{ base: 'auto', xl: '24px' }}
@@ -220,14 +217,13 @@ const CanvasToolbar: FC = () => {
220217
</Panel>
221218

222219
{/* Layout Options Drawer */}
223-
{config.features.WORKSPACE_AUTO_LAYOUT && (
224-
<LayoutOptionsDrawer
225-
isOpen={isLayoutDrawerOpen}
226-
onClose={onLayoutDrawerClose}
227-
algorithmType={layoutConfig.currentAlgorithm}
228-
options={layoutConfig.options}
229-
/>
230-
)}
220+
221+
<LayoutOptionsDrawer
222+
isOpen={isLayoutDrawerOpen}
223+
onClose={onLayoutDrawerClose}
224+
algorithmType={layoutConfig.currentAlgorithm}
225+
options={layoutConfig.options}
226+
/>
231227
</>
232228
)
233229
}

hivemq-edge-frontend/src/modules/Workspace/components/layout/ApplyLayoutButton.spec.cy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ describe('ApplyLayoutButton', () => {
1212
beforeEach(() => {
1313
cy.viewport(400, 300)
1414

15-
// Enable the feature flag for testing
16-
config.features.WORKSPACE_AUTO_LAYOUT = true
17-
1815
// Reset store before each test
1916
useWorkspaceStore.getState().reset()
2017
})

hivemq-edge-frontend/src/modules/Workspace/components/layout/ApplyLayoutButton.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ const ApplyLayoutButton: FC = () => {
1717
const { applyLayout, currentAlgorithmInstance } = useLayoutEngine()
1818
const [isApplying, setIsApplying] = useState(false)
1919

20-
if (!config.features.WORKSPACE_AUTO_LAYOUT) {
21-
return null
22-
}
23-
2420
const handleApplyLayout = async () => {
2521
if (!currentAlgorithmInstance) {
2622
toast({

hivemq-edge-frontend/src/modules/Workspace/components/layout/LayoutOptionsDrawer.spec.cy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ describe('LayoutOptionsDrawer', () => {
1212
beforeEach(() => {
1313
cy.viewport(1200, 800)
1414

15-
// Enable the feature flag for testing
16-
config.features.WORKSPACE_AUTO_LAYOUT = true
17-
1815
// Reset store before each test
1916
useWorkspaceStore.getState().reset()
2017
})

hivemq-edge-frontend/src/modules/Workspace/components/layout/LayoutPresetsManager.spec.cy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ describe('LayoutPresetsManager', () => {
1313
beforeEach(() => {
1414
cy.viewport(600, 800)
1515

16-
// Enable the feature flag for testing
17-
config.features.WORKSPACE_AUTO_LAYOUT = true
18-
1916
// Reset store before each test
2017
useWorkspaceStore.getState().reset()
2118
})

hivemq-edge-frontend/src/modules/Workspace/components/layout/LayoutSelector.spec.cy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import config from '@/config'
1010
describe('LayoutSelector', () => {
1111
beforeEach(() => {
1212
cy.viewport(400, 300)
13-
14-
// Enable the feature flag for testing
15-
config.features.WORKSPACE_AUTO_LAYOUT = true
1613
})
1714

1815
it('should render with all available algorithms', () => {

hivemq-edge-frontend/src/modules/Workspace/components/layout/LayoutSelector.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const LayoutSelector: FC = () => {
1515
const { t } = useTranslation()
1616
const { currentAlgorithm, setAlgorithm, availableAlgorithms } = useLayoutEngine()
1717

18-
if (!config.features.WORKSPACE_AUTO_LAYOUT) {
19-
return null
20-
}
21-
2218
const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
2319
const newAlgorithm = event.target.value as LayoutType
2420
setAlgorithm(newAlgorithm)

hivemq-edge-frontend/src/modules/Workspace/hooks/useWorkspaceStore.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { Group, WorkspaceState, WorkspaceAction, DeviceMetadata } from '@/m
55
import { NodeTypes } from '@/modules/Workspace/types.ts'
66
import { persist, createJSONStorage } from 'zustand/middleware'
77
import type { Adapter } from '@/api/__generated__'
8-
import config from '@/config'
98
import { LayoutType, LayoutMode, type LayoutPreset, type LayoutHistoryEntry, type LayoutOptions } from '../types/layout'
109

1110
// define the initial state
@@ -222,13 +221,9 @@ const useWorkspaceStore = create<WorkspaceState & WorkspaceAction>()(
222221
edges: state.edges,
223222
}
224223

225-
// Only persist layout config if feature is enabled
226-
// This prevents breaking existing installations when flag is off
227-
if (config.features.WORKSPACE_AUTO_LAYOUT) {
228-
persisted.layoutConfig = state.layoutConfig
229-
persisted.isAutoLayoutEnabled = state.isAutoLayoutEnabled
230-
// Don't persist layoutHistory - it's ephemeral
231-
}
224+
persisted.layoutConfig = state.layoutConfig
225+
persisted.isAutoLayoutEnabled = state.isAutoLayoutEnabled
226+
// Don't persist layoutHistory - it's ephemeral
232227

233228
return persisted
234229
},

0 commit comments

Comments
 (0)