@@ -156,9 +156,10 @@ const dashboardDebugLog = (...args) => {
156156 console . log ( ...args ) ;
157157 }
158158} ;
159- const DASHBOARD_LAYOUT_MODES = [ 'classic' , 'fullwidth' , 'accordion' , 'inset' , 'compactmatrix' ] ;
159+ const DASHBOARD_LAYOUT_MODES = [ 'classic' , 'legacy' , ' fullwidth', 'accordion' , 'inset' , 'compactmatrix' ] ;
160160const DASHBOARD_LAYOUT_LABELS = Object . freeze ( {
161161 classic : 'Classic' ,
162+ legacy : 'Legacy' ,
162163 fullwidth : 'Full Width' ,
163164 accordion : 'Accordion' ,
164165 inset : 'Inset' ,
@@ -280,6 +281,7 @@ const writeDashboardCompactDensityStateForType = (type, enabled) => {
280281 }
281282} ;
282283const getDashboardStartedOnlySelectorForType = ( type ) => ( type === 'vm' ? 'input#vms' : 'input#apps' ) ;
284+ const isDashboardLegacyLayoutForType = ( type ) => normalizeDashboardPrefsForType ( type ) . layout === 'legacy' ;
283285const isDashboardStartedOnlyEnabledForType = ( type ) => {
284286 const selector = getDashboardStartedOnlySelectorForType ( type ) ;
285287 const $toggle = $ ( selector ) . first ( ) ;
@@ -464,7 +466,7 @@ const syncDashboardWidgetQuickRailVisibilityForType = (type) => {
464466 const shouldShow = ! ! parentNode
465467 && isDashboardNodeVisible ( parentNode )
466468 && isDashboardWidgetCollapsedForType ( resolvedType ) !== true
467- && hasVisibleDashboardFolderCardsForType ( resolvedType ) ;
469+ && ( hasVisibleDashboardFolderCardsForType ( resolvedType ) || isDashboardLegacyLayoutForType ( resolvedType ) ) ;
468470 $host . toggleClass ( 'is-hidden' , ! shouldShow ) ;
469471 if ( shouldShow ) {
470472 syncDashboardWidgetQuickRailAlignmentForType ( resolvedType ) ;
@@ -623,6 +625,7 @@ const handleDashboardWidgetLayoutQuickSwitch = async (type, value) => {
623625 const nextLayout = normalizeDashboardLayoutMode ( value ) ;
624626 const previousPrefs = utils . normalizePrefs ( folderTypePrefs ?. [ resolvedType ] || { } ) ;
625627 const previousDashboard = normalizeDashboardPrefsForType ( resolvedType ) ;
628+ const requiresStructureReload = previousDashboard . layout === 'legacy' || nextLayout === 'legacy' ;
626629 if ( previousDashboard . layout === nextLayout ) {
627630 syncDashboardWidgetLayoutQuickControlForType ( resolvedType ) ;
628631 return ;
@@ -650,6 +653,11 @@ const handleDashboardWidgetLayoutQuickSwitch = async (type, value) => {
650653 throw new Error ( response ?. error || 'Failed to save dashboard preferences.' ) ;
651654 }
652655 folderTypePrefs [ resolvedType ] = utils . normalizePrefs ( response . prefs || nextPrefs ) ;
656+ if ( requiresStructureReload && typeof window . loadlist === 'function' ) {
657+ loadedFolder = false ;
658+ window . loadlist ( ) ;
659+ return ;
660+ }
653661 scheduleDashboardLayoutApplyForType ( resolvedType ) ;
654662 syncDashboardWidgetLayoutQuickControlForType ( resolvedType ) ;
655663 } catch ( _error ) {
@@ -905,13 +913,13 @@ const applyDashboardLayoutStateForType = (type) => {
905913 }
906914 const dashboardPrefs = normalizeDashboardPrefsForType ( meta . type ) ;
907915 const layout = normalizeDashboardLayoutMode ( dashboardPrefs . layout ) ;
908- const nonClassicLayout = layout !== 'classic' ;
916+ const folderCardLayout = ! [ 'classic' , 'legacy' ] . includes ( layout ) ;
909917 $tbody . attr ( 'data-fv-dashboard-layout' , layout ) ;
910- $tbody . removeClass ( 'fv-dashboard-layout-classic fv-dashboard-layout-fullwidth fv-dashboard-layout-accordion fv-dashboard-layout-inset fv-dashboard-layout-compactmatrix' ) ;
918+ $tbody . removeClass ( 'fv-dashboard-layout-classic fv-dashboard-layout-legacy fv-dashboard-layout- fullwidth fv-dashboard-layout-accordion fv-dashboard-layout-inset fv-dashboard-layout-compactmatrix' ) ;
911919 $tbody . addClass ( `fv-dashboard-layout-${ layout } ` ) ;
912- $tbody . toggleClass ( 'fv-dashboard-show-expand-toggle' , nonClassicLayout && dashboardPrefs . expandToggle === true ) ;
913- $tbody . toggleClass ( 'fv-dashboard-greyscale-enabled' , nonClassicLayout && dashboardPrefs . greyscale === true ) ;
914- $tbody . toggleClass ( 'fv-dashboard-hide-folder-label' , nonClassicLayout && dashboardPrefs . folderLabel === false ) ;
920+ $tbody . toggleClass ( 'fv-dashboard-show-expand-toggle' , folderCardLayout && dashboardPrefs . expandToggle === true ) ;
921+ $tbody . toggleClass ( 'fv-dashboard-greyscale-enabled' , folderCardLayout && dashboardPrefs . greyscale === true ) ;
922+ $tbody . toggleClass ( 'fv-dashboard-hide-folder-label' , folderCardLayout && dashboardPrefs . folderLabel === false ) ;
915923 $tbody . toggleClass ( 'fv-dashboard-health-emphasis-enabled' , readDashboardHealthEmphasisStateForType ( meta . type ) ) ;
916924 $tbody . toggleClass ( 'fv-dashboard-density-compact' , readDashboardCompactDensityStateForType ( meta . type ) ) ;
917925 ensureDashboardWidgetLayoutQuickSwitchForType ( meta . type ) ;
@@ -1390,6 +1398,12 @@ const createFolders = async () => {
13901398 unraidOrder = reorderFolderSlotsInBaseOrder ( unraidOrder , folders , folderTypePrefs . docker ) ;
13911399 applyDashboardRuntimePrefs ( ) ;
13921400 lastDashboardStateSignatures . docker = buildDockerStateSignature ( containersInfo , false ) ;
1401+ if ( isDashboardLegacyLayoutForType ( 'docker' ) ) {
1402+ globalFolders . docker = { } ;
1403+ scheduleDashboardLayoutApplyForType ( 'docker' ) ;
1404+ syncDashboardWidgetLayoutQuickControlForType ( 'docker' ) ;
1405+ return ;
1406+ }
13931407
13941408 // Filter the order to get the container that aren't in the order, this happen when a new container is created
13951409 let newOnes = order . filter ( x => ! unraidOrder . includes ( x ) ) ;
@@ -1590,6 +1604,12 @@ const createFolders = async () => {
15901604 unraidOrder = reorderFolderSlotsInBaseOrder ( unraidOrder , folders , folderTypePrefs . vm ) ;
15911605 applyDashboardRuntimePrefs ( ) ;
15921606 lastDashboardStateSignatures . vm = buildVmStateSignature ( vmInfo , false ) ;
1607+ if ( isDashboardLegacyLayoutForType ( 'vm' ) ) {
1608+ globalFolders . vms = { } ;
1609+ scheduleDashboardLayoutApplyForType ( 'vm' ) ;
1610+ syncDashboardWidgetLayoutQuickControlForType ( 'vm' ) ;
1611+ return ;
1612+ }
15931613
15941614 // Filter the webui order to get the container that aren't in the order, this happen when a new container is created
15951615 let newOnes = order . filter ( x => ! unraidOrder . includes ( x ) ) ;
0 commit comments