Compare commits
No commits in common. "e7f3e2a6d4280feafd0c63f4bc8b154729aa37bd" and "44c8729787fec2571f47e966f3890f0d2bd4997a" have entirely different histories.
e7f3e2a6d4
...
44c8729787
@ -5,7 +5,6 @@ import { Outlet, Routes, UNSAFE_LocationContext, useLocation } from 'react-route
|
|||||||
import { TableStateProvider } from '../context/TableStateContext'
|
import { TableStateProvider } from '../context/TableStateContext'
|
||||||
import {
|
import {
|
||||||
NavigationTabActiveContext,
|
NavigationTabActiveContext,
|
||||||
NavigationTabIdContext,
|
|
||||||
createNavigationTabActiveStore,
|
createNavigationTabActiveStore,
|
||||||
useNavigationTabs
|
useNavigationTabs
|
||||||
} from '../context/NavigationTabsContext'
|
} from '../context/NavigationTabsContext'
|
||||||
@ -24,7 +23,7 @@ const toTabLocation = (tabId, source) => ({
|
|||||||
pathname: source?.pathname || '/',
|
pathname: source?.pathname || '/',
|
||||||
search: source?.search ?? '',
|
search: source?.search ?? '',
|
||||||
hash: source?.hash ?? '',
|
hash: source?.hash ?? '',
|
||||||
state: source?.state ?? null,
|
state: source?.state,
|
||||||
key: `tab-${tabId}`
|
key: `tab-${tabId}`
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ const reuseTabLocation = (tabId, previous, next) => {
|
|||||||
previous &&
|
previous &&
|
||||||
locationsEqual(previous, next) &&
|
locationsEqual(previous, next) &&
|
||||||
previous.key === `tab-${tabId}` &&
|
previous.key === `tab-${tabId}` &&
|
||||||
(previous.state ?? null) === (next.state ?? null)
|
previous.state === next.state
|
||||||
) {
|
) {
|
||||||
return previous
|
return previous
|
||||||
}
|
}
|
||||||
@ -45,7 +44,7 @@ const entryToLocation = (entry, fallbackLocation, tabId) =>
|
|||||||
pathname: entry?.pathname || fallbackLocation.pathname,
|
pathname: entry?.pathname || fallbackLocation.pathname,
|
||||||
search: entry?.search ?? fallbackLocation.search ?? '',
|
search: entry?.search ?? fallbackLocation.search ?? '',
|
||||||
hash: entry?.hash ?? fallbackLocation.hash ?? '',
|
hash: entry?.hash ?? fallbackLocation.hash ?? '',
|
||||||
state: entry?.state ?? null
|
state: fallbackLocation.state
|
||||||
})
|
})
|
||||||
|
|
||||||
const getTabCurrentEntry = (tab) =>
|
const getTabCurrentEntry = (tab) =>
|
||||||
@ -57,12 +56,6 @@ const tabMatchesLocation = (tab, loc) => {
|
|||||||
return locationsEqual(entry, loc)
|
return locationsEqual(entry, loc)
|
||||||
}
|
}
|
||||||
|
|
||||||
const locationBelongsToLeavingTab = (tab, frozen, loc) => {
|
|
||||||
if (!loc) return false
|
|
||||||
if (frozen && locationsEqual(frozen, loc)) return true
|
|
||||||
return tabMatchesLocation(tab, loc)
|
|
||||||
}
|
|
||||||
|
|
||||||
const CachedTabRouteLayout = () => (
|
const CachedTabRouteLayout = () => (
|
||||||
<TableStateProvider>
|
<TableStateProvider>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
@ -73,7 +66,7 @@ const areLocationsEqual = (left, right) =>
|
|||||||
left === right ||
|
left === right ||
|
||||||
(locationsEqual(left, right) &&
|
(locationsEqual(left, right) &&
|
||||||
left?.key === right?.key &&
|
left?.key === right?.key &&
|
||||||
(left?.state ?? null) === (right?.state ?? null))
|
left?.state === right?.state)
|
||||||
|
|
||||||
const arePanePropsEqual = (prev, next) =>
|
const arePanePropsEqual = (prev, next) =>
|
||||||
prev.tabId === next.tabId &&
|
prev.tabId === next.tabId &&
|
||||||
@ -136,11 +129,9 @@ const DashboardTabPane = memo(function DashboardTabPane({
|
|||||||
aria-hidden={!isActive}
|
aria-hidden={!isActive}
|
||||||
inert={!isActive}
|
inert={!isActive}
|
||||||
>
|
>
|
||||||
<NavigationTabIdContext.Provider value={tabId}>
|
|
||||||
<NavigationTabActiveContext.Provider value={storeRef.current}>
|
<NavigationTabActiveContext.Provider value={storeRef.current}>
|
||||||
<DashboardTabPaneRoutes loc={loc} />
|
<DashboardTabPaneRoutes loc={loc} />
|
||||||
</NavigationTabActiveContext.Provider>
|
</NavigationTabActiveContext.Provider>
|
||||||
</NavigationTabIdContext.Provider>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}, arePanePropsEqual)
|
}, arePanePropsEqual)
|
||||||
@ -172,20 +163,14 @@ const DashboardTabPanes = () => {
|
|||||||
const switchedTabs = Boolean(prevActiveId && activeTabId && prevActiveId !== activeTabId)
|
const switchedTabs = Boolean(prevActiveId && activeTabId && prevActiveId !== activeTabId)
|
||||||
|
|
||||||
if (switchedTabs) {
|
if (switchedTabs) {
|
||||||
const previousTab = tabs.find((tab) => tab.id === prevActiveId)
|
|
||||||
const previousFrozen = frozenRef.current.get(prevActiveId)
|
|
||||||
const lastLoc = lastLocationRef.current
|
|
||||||
if (locationBelongsToLeavingTab(previousTab, previousFrozen, lastLoc)) {
|
|
||||||
frozenRef.current.set(
|
frozenRef.current.set(
|
||||||
prevActiveId,
|
prevActiveId,
|
||||||
reuseTabLocation(prevActiveId, previousFrozen, lastLoc)
|
reuseTabLocation(
|
||||||
)
|
|
||||||
} else if (!previousFrozen && previousTab) {
|
|
||||||
frozenRef.current.set(
|
|
||||||
prevActiveId,
|
prevActiveId,
|
||||||
entryToLocation(getTabCurrentEntry(previousTab), lastLoc, prevActiveId)
|
frozenRef.current.get(prevActiveId),
|
||||||
|
lastLocationRef.current
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
|
||||||
pendingRestoreRef.current = true
|
pendingRestoreRef.current = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1778,8 +1778,7 @@ const ObjectTable = memo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// All tab: persist personal filter/sort (session/URL, or this
|
// All tab: persist personal filter/sort to URL/session
|
||||||
// Electron tab's listState JSON when isElectron).
|
|
||||||
persistTableState(next, nextSorter)
|
persistTableState(next, nextSorter)
|
||||||
}
|
}
|
||||||
const effective = buildEffectiveFilter(next)
|
const effective = buildEffectiveFilter(next)
|
||||||
|
|||||||
@ -62,27 +62,23 @@ const ActionsProvider = ({ children }) => {
|
|||||||
const [ctrlDown, setCtrlDown] = useState(false)
|
const [ctrlDown, setCtrlDown] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isHoldKey = (key) => key === 'Meta' || key === 'Control'
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
if (isHoldKey(event.key)) {
|
const key = event.key
|
||||||
|
if (key === 'Meta') {
|
||||||
setCtrlDown(true)
|
setCtrlDown(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleKeyUp = (event) => {
|
const handleKeyUp = (event) => {
|
||||||
if (isHoldKey(event.key)) {
|
const key = event.key
|
||||||
|
if (key === 'Meta') {
|
||||||
setCtrlDown(false)
|
setCtrlDown(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const clearHold = () => setCtrlDown(false)
|
|
||||||
window.addEventListener('keydown', handleKeyDown)
|
window.addEventListener('keydown', handleKeyDown)
|
||||||
window.addEventListener('keyup', handleKeyUp)
|
window.addEventListener('keyup', handleKeyUp)
|
||||||
window.addEventListener('blur', clearHold)
|
|
||||||
document.addEventListener('visibilitychange', clearHold)
|
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('keydown', handleKeyDown)
|
window.removeEventListener('keydown', handleKeyDown)
|
||||||
window.removeEventListener('keyup', handleKeyUp)
|
window.removeEventListener('keyup', handleKeyUp)
|
||||||
window.removeEventListener('blur', clearHold)
|
|
||||||
document.removeEventListener('visibilitychange', clearHold)
|
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -246,10 +242,9 @@ const ActionsProvider = ({ children }) => {
|
|||||||
setCurrentObjectType,
|
setCurrentObjectType,
|
||||||
callAction,
|
callAction,
|
||||||
clearAction,
|
clearAction,
|
||||||
setOnModalOk,
|
setOnModalOk
|
||||||
ctrlDown
|
|
||||||
}),
|
}),
|
||||||
[callAction, clearAction, currentObject, currentObjectType, ctrlDown]
|
[callAction, clearAction, currentObject, currentObjectType]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -20,8 +20,6 @@ const NavigationTabMetaContext = createContext({
|
|||||||
setTabPage: () => {},
|
setTabPage: () => {},
|
||||||
isElectron: false
|
isElectron: false
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line react-refresh/only-export-components
|
|
||||||
export const NavigationTabIdContext = createContext(null)
|
|
||||||
const NavigationTabPreviewsContext = createContext({
|
const NavigationTabPreviewsContext = createContext({
|
||||||
tabPreviews: {},
|
tabPreviews: {},
|
||||||
tabPreviewCapturing: {}
|
tabPreviewCapturing: {}
|
||||||
@ -85,128 +83,13 @@ const entryToPath = (entry) => {
|
|||||||
|
|
||||||
const entriesEqual = (left, right) => entryToPath(left) === entryToPath(right)
|
const entriesEqual = (left, right) => entryToPath(left) === entryToPath(right)
|
||||||
|
|
||||||
const EMPTY_LIST_STATE_ENTRY = {
|
|
||||||
viewId: null,
|
|
||||||
viewName: null,
|
|
||||||
filter: {},
|
|
||||||
sort: {},
|
|
||||||
listFilter: {},
|
|
||||||
listSort: {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const parseSearchJson = (raw) => {
|
|
||||||
if (!raw) return null
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(raw)
|
|
||||||
return parsed && typeof parsed === 'object' ? parsed : null
|
|
||||||
} catch {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const normalizeSorterValue = (sorter) =>
|
|
||||||
sorter?.field && sorter?.order
|
|
||||||
? { field: sorter.field, order: sorter.order }
|
|
||||||
: {}
|
|
||||||
|
|
||||||
const normalizeListStateEntry = (value) => {
|
|
||||||
if (!value || typeof value !== 'object') {
|
|
||||||
return { ...EMPTY_LIST_STATE_ENTRY }
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
viewId: value.viewId ? String(value.viewId) : null,
|
|
||||||
viewName: value.viewName || null,
|
|
||||||
filter:
|
|
||||||
value.filter && typeof value.filter === 'object' ? value.filter : {},
|
|
||||||
sort: normalizeSorterValue(value.sort),
|
|
||||||
listFilter:
|
|
||||||
value.listFilter && typeof value.listFilter === 'object'
|
|
||||||
? value.listFilter
|
|
||||||
: {},
|
|
||||||
listSort: normalizeSorterValue(value.listSort)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const normalizeListState = (listState) => {
|
|
||||||
if (!listState || typeof listState !== 'object' || Array.isArray(listState)) {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(listState).map(([scope, value]) => [
|
|
||||||
scope,
|
|
||||||
normalizeListStateEntry(value)
|
|
||||||
])
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const cloneListState = (listState) =>
|
|
||||||
JSON.parse(JSON.stringify(normalizeListState(listState)))
|
|
||||||
|
|
||||||
const getTabListStateEntry = (tab, scope) => {
|
|
||||||
if (!scope) return { ...EMPTY_LIST_STATE_ENTRY }
|
|
||||||
return tab?.listState?.[scope]
|
|
||||||
? normalizeListStateEntry(tab.listState[scope])
|
|
||||||
: { ...EMPTY_LIST_STATE_ENTRY }
|
|
||||||
}
|
|
||||||
|
|
||||||
const listStateEntriesEqual = (left, right) =>
|
|
||||||
JSON.stringify(normalizeListStateEntry(left)) ===
|
|
||||||
JSON.stringify(normalizeListStateEntry(right))
|
|
||||||
|
|
||||||
const applyListStateToTab = (tab, scope, patch = {}) => {
|
|
||||||
if (!tab || !scope) return tab
|
|
||||||
const current = getTabListStateEntry(tab, scope)
|
|
||||||
const next = normalizeListStateEntry({
|
|
||||||
...current,
|
|
||||||
...patch,
|
|
||||||
viewId: patch.viewId !== undefined ? patch.viewId : current.viewId,
|
|
||||||
viewName: patch.viewName !== undefined ? patch.viewName : current.viewName,
|
|
||||||
filter: patch.filter !== undefined ? patch.filter : current.filter,
|
|
||||||
sort: patch.sort !== undefined ? patch.sort : current.sort,
|
|
||||||
listFilter:
|
|
||||||
patch.listFilter !== undefined ? patch.listFilter : current.listFilter,
|
|
||||||
listSort: patch.listSort !== undefined ? patch.listSort : current.listSort
|
|
||||||
})
|
|
||||||
if (listStateEntriesEqual(current, next) && tab.listState?.[scope]) {
|
|
||||||
return tab
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...tab,
|
|
||||||
listState: {
|
|
||||||
...(tab.listState || {}),
|
|
||||||
[scope]: next
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const seedListStateFromHistory = (tab) => {
|
|
||||||
if (!tab?.modelName) return normalizeListState(tab?.listState)
|
|
||||||
if (tab.listState?.[tab.modelName]) {
|
|
||||||
return normalizeListState(tab.listState)
|
|
||||||
}
|
|
||||||
const entry = getTabCurrentEntry(tab)
|
|
||||||
const params = new URLSearchParams(entry?.search || '')
|
|
||||||
const viewId = params.get('viewId')
|
|
||||||
const filter = parseSearchJson(params.get('filter'))
|
|
||||||
const sort = parseSearchJson(params.get('sort'))
|
|
||||||
if (!viewId && !filter && !sort?.field) {
|
|
||||||
return normalizeListState(tab.listState)
|
|
||||||
}
|
|
||||||
return applyListStateToTab(tab, tab.modelName, {
|
|
||||||
viewId,
|
|
||||||
filter: filter || {},
|
|
||||||
sort: sort || {}
|
|
||||||
}).listState
|
|
||||||
}
|
|
||||||
|
|
||||||
const createTabFromLocation = (location, extras = {}) => ({
|
const createTabFromLocation = (location, extras = {}) => ({
|
||||||
id: createTabId(),
|
id: createTabId(),
|
||||||
title: extras.title || 'Farm Control',
|
title: extras.title || 'Farm Control',
|
||||||
modelName: extras.modelName || null,
|
modelName: extras.modelName || null,
|
||||||
iconKey: extras.iconKey || null,
|
iconKey: extras.iconKey || null,
|
||||||
history: [locationToEntry(location)],
|
history: [locationToEntry(location)],
|
||||||
historyIndex: 0,
|
historyIndex: 0
|
||||||
listState: cloneListState(extras.listState)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const cloneCurrentPageTab = (tab, location) => ({
|
const cloneCurrentPageTab = (tab, location) => ({
|
||||||
@ -215,8 +98,7 @@ const cloneCurrentPageTab = (tab, location) => ({
|
|||||||
modelName: tab?.modelName || null,
|
modelName: tab?.modelName || null,
|
||||||
iconKey: tab?.iconKey || null,
|
iconKey: tab?.iconKey || null,
|
||||||
history: [locationToEntry(location)],
|
history: [locationToEntry(location)],
|
||||||
historyIndex: 0,
|
historyIndex: 0
|
||||||
listState: cloneListState(tab?.listState)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const getTabCurrentEntry = (tab) =>
|
const getTabCurrentEntry = (tab) =>
|
||||||
@ -235,18 +117,13 @@ const normalizeTab = (tab, fallbackLocation) => {
|
|||||||
const rawIndex = Number.isInteger(tab?.historyIndex)
|
const rawIndex = Number.isInteger(tab?.historyIndex)
|
||||||
? tab.historyIndex
|
? tab.historyIndex
|
||||||
: history.length - 1
|
: history.length - 1
|
||||||
const normalized = {
|
return {
|
||||||
id: tab?.id || createTabId(),
|
id: tab?.id || createTabId(),
|
||||||
title: tab?.title || 'Farm Control',
|
title: tab?.title || 'Farm Control',
|
||||||
modelName: tab?.modelName || null,
|
modelName: tab?.modelName || null,
|
||||||
iconKey: tab?.iconKey || null,
|
iconKey: tab?.iconKey || null,
|
||||||
history,
|
history,
|
||||||
historyIndex: Math.min(Math.max(rawIndex, 0), history.length - 1),
|
historyIndex: Math.min(Math.max(rawIndex, 0), history.length - 1)
|
||||||
listState: normalizeListState(tab?.listState)
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...normalized,
|
|
||||||
listState: seedListStateFromHistory(normalized)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,13 +134,6 @@ const applyLocationToTab = (tab, entry) => {
|
|||||||
if (!tab.history?.length) {
|
if (!tab.history?.length) {
|
||||||
return { ...tab, history: [entry], historyIndex: 0 }
|
return { ...tab, history: [entry], historyIndex: 0 }
|
||||||
}
|
}
|
||||||
const currentPath = currentEntry?.pathname || '/'
|
|
||||||
const nextPath = entry.pathname || '/'
|
|
||||||
if (currentPath === nextPath) {
|
|
||||||
const history = [...tab.history]
|
|
||||||
history[tab.historyIndex] = entry
|
|
||||||
return { ...tab, history }
|
|
||||||
}
|
|
||||||
const truncated = tab.history.slice(0, tab.historyIndex + 1)
|
const truncated = tab.history.slice(0, tab.historyIndex + 1)
|
||||||
return {
|
return {
|
||||||
...tab,
|
...tab,
|
||||||
@ -335,38 +205,19 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
const previewThemeRef = useRef(isDarkMode ? 'dark' : 'light')
|
const previewThemeRef = useRef(isDarkMode ? 'dark' : 'light')
|
||||||
const tabStripRootRef = useRef(null)
|
const tabStripRootRef = useRef(null)
|
||||||
const scrollTabStripToEndIntervalRef = useRef(null)
|
const scrollTabStripToEndIntervalRef = useRef(null)
|
||||||
// Late URL writes from the tab we just left (e.g. persistView) must not
|
|
||||||
// attach to the newly selected tab.
|
|
||||||
const foreignLocationRef = useRef(null)
|
|
||||||
tabsRef.current = tabs
|
tabsRef.current = tabs
|
||||||
activeTabIdRef.current = activeTabId
|
activeTabIdRef.current = activeTabId
|
||||||
locationRef.current = location
|
locationRef.current = location
|
||||||
previewThemeRef.current = isDarkMode ? 'dark' : 'light'
|
previewThemeRef.current = isDarkMode ? 'dark' : 'light'
|
||||||
|
|
||||||
const markForeignLocation = useCallback((previousTabId) => {
|
const isRestoreLocation = useCallback((entry) => {
|
||||||
if (!previousTabId) {
|
const restoring = isRestoringRef.current
|
||||||
foreignLocationRef.current = null
|
if (!restoring) return false
|
||||||
return
|
if (restoring === true) return true
|
||||||
}
|
return (
|
||||||
foreignLocationRef.current = {
|
entriesEqual(restoring.target, entry) ||
|
||||||
tabId: previousTabId,
|
entriesEqual(restoring.from, entry)
|
||||||
entry: locationToEntry(locationRef.current),
|
)
|
||||||
expiresAt: Date.now() + 250
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const applyEntryToTabId = useCallback((tabId, entry) => {
|
|
||||||
if (!tabId || !entry) return
|
|
||||||
setTabs((current) => {
|
|
||||||
let changed = false
|
|
||||||
const next = current.map((tab) => {
|
|
||||||
if (tab.id !== tabId) return tab
|
|
||||||
const updated = applyLocationToTab(tab, entry)
|
|
||||||
if (updated !== tab) changed = true
|
|
||||||
return updated
|
|
||||||
})
|
|
||||||
return changed ? next : current
|
|
||||||
})
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const shouldIgnoreRestoredLocation = useCallback((entry) => {
|
const shouldIgnoreRestoredLocation = useCallback((entry) => {
|
||||||
@ -388,15 +239,11 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const restoreToEntry = useCallback(
|
const restoreToEntry = useCallback(
|
||||||
(entry, { previousTabId } = {}) => {
|
(entry) => {
|
||||||
if (!entry) return
|
if (!entry) return
|
||||||
isRestoringRef.current = {
|
isRestoringRef.current = {
|
||||||
target: locationToEntry(entry),
|
target: locationToEntry(entry),
|
||||||
from: locationToEntry(locationRef.current),
|
from: locationToEntry(locationRef.current)
|
||||||
previousTabId:
|
|
||||||
previousTabId === undefined
|
|
||||||
? activeTabIdRef.current
|
|
||||||
: previousTabId
|
|
||||||
}
|
}
|
||||||
navigate(entryToPath(entry), { replace: true })
|
navigate(entryToPath(entry), { replace: true })
|
||||||
},
|
},
|
||||||
@ -409,19 +256,16 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
const nextTab = tabsRef.current.find((tab) => tab.id === tabId)
|
const nextTab = tabsRef.current.find((tab) => tab.id === tabId)
|
||||||
if (!nextTab) return
|
if (!nextTab) return
|
||||||
|
|
||||||
const previousTabId = activeTabIdRef.current
|
|
||||||
const nextEntry = getTabCurrentEntry(nextTab)
|
const nextEntry = getTabCurrentEntry(nextTab)
|
||||||
markForeignLocation(previousTabId)
|
|
||||||
setActiveTabId(tabId)
|
setActiveTabId(tabId)
|
||||||
activeTabIdRef.current = tabId
|
|
||||||
|
|
||||||
if (entriesEqual(nextEntry, locationRef.current)) {
|
if (entriesEqual(nextEntry, locationRef.current)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreToEntry(nextEntry, { previousTabId })
|
restoreToEntry(nextEntry)
|
||||||
},
|
},
|
||||||
[markForeignLocation, restoreToEntry]
|
[restoreToEntry]
|
||||||
)
|
)
|
||||||
|
|
||||||
const registerTabStripRoot = useCallback((element) => {
|
const registerTabStripRoot = useCallback((element) => {
|
||||||
@ -481,19 +325,17 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
? createTabFromLocation(entry)
|
? createTabFromLocation(entry)
|
||||||
: cloneCurrentPageTab(currentTab, location)
|
: cloneCurrentPageTab(currentTab, location)
|
||||||
|
|
||||||
const previousTabId = activeTabIdRef.current
|
|
||||||
setTabs((current) => [...current, nextTab])
|
setTabs((current) => [...current, nextTab])
|
||||||
markForeignLocation(previousTabId)
|
|
||||||
setActiveTabId(nextTab.id)
|
setActiveTabId(nextTab.id)
|
||||||
activeTabIdRef.current = nextTab.id
|
activeTabIdRef.current = nextTab.id
|
||||||
|
|
||||||
if (targetUrl && !entriesEqual(entry, locationRef.current)) {
|
if (targetUrl && !entriesEqual(entry, locationRef.current)) {
|
||||||
restoreToEntry(entry, { previousTabId })
|
restoreToEntry(entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollTabStripToEnd()
|
scrollTabStripToEnd()
|
||||||
},
|
},
|
||||||
[location, markForeignLocation, restoreToEntry, scrollTabStripToEnd]
|
[location, restoreToEntry, scrollTabStripToEnd]
|
||||||
)
|
)
|
||||||
|
|
||||||
const removeTab = useCallback(
|
const removeTab = useCallback(
|
||||||
@ -529,18 +371,15 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
return nextCapturing
|
return nextCapturing
|
||||||
})
|
})
|
||||||
if (nextActive) {
|
if (nextActive) {
|
||||||
const previousTabId = activeTabIdRef.current
|
|
||||||
markForeignLocation(previousTabId)
|
|
||||||
setActiveTabId(nextActive.id)
|
setActiveTabId(nextActive.id)
|
||||||
activeTabIdRef.current = nextActive.id
|
|
||||||
const nextEntry = getTabCurrentEntry(nextActive)
|
const nextEntry = getTabCurrentEntry(nextActive)
|
||||||
if (!entriesEqual(nextEntry, locationRef.current)) {
|
if (!entriesEqual(nextEntry, locationRef.current)) {
|
||||||
restoreToEntry(nextEntry, { previousTabId })
|
restoreToEntry(nextEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
[handleWindowControl, markForeignLocation, restoreToEntry]
|
[handleWindowControl, restoreToEntry]
|
||||||
)
|
)
|
||||||
|
|
||||||
const closeTab = useCallback(
|
const closeTab = useCallback(
|
||||||
@ -570,16 +409,13 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
next.splice(insertBefore ? targetIndex : targetIndex + 1, 0, tab)
|
next.splice(insertBefore ? targetIndex : targetIndex + 1, 0, tab)
|
||||||
return next
|
return next
|
||||||
})
|
})
|
||||||
const previousTabId = activeTabIdRef.current
|
|
||||||
markForeignLocation(previousTabId)
|
|
||||||
setActiveTabId(tab.id)
|
setActiveTabId(tab.id)
|
||||||
activeTabIdRef.current = tab.id
|
|
||||||
const nextEntry = getTabCurrentEntry(tab)
|
const nextEntry = getTabCurrentEntry(tab)
|
||||||
if (!entriesEqual(nextEntry, locationRef.current)) {
|
if (!entriesEqual(nextEntry, locationRef.current)) {
|
||||||
restoreToEntry(nextEntry, { previousTabId })
|
restoreToEntry(nextEntry)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[markForeignLocation, restoreToEntry]
|
[restoreToEntry]
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleTabDragStart = useCallback(
|
const handleTabDragStart = useCallback(
|
||||||
@ -713,45 +549,31 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const setTabPage = useCallback(
|
const setTabPage = useCallback(
|
||||||
({ title, modelName, iconKey } = {}) => {
|
({ title, modelName, iconKey, location: pageLocation } = {}) => {
|
||||||
const activeId = activeTabIdRef.current
|
const activeId = activeTabIdRef.current
|
||||||
if (!activeId) return
|
if (!activeId) return
|
||||||
|
|
||||||
|
const pageEntry = pageLocation ? locationToEntry(pageLocation) : null
|
||||||
|
|
||||||
setTabs((current) => {
|
setTabs((current) => {
|
||||||
if (current.length === 0) return current
|
if (current.length === 0) return current
|
||||||
|
|
||||||
let changed = false
|
let changed = false
|
||||||
const next = current.map((tab) => {
|
const next = current.map((tab) => {
|
||||||
if (tab.id !== activeId) return tab
|
if (tab.id !== activeId) return tab
|
||||||
const updated = applyPageMetaToTab(tab, { title, modelName, iconKey })
|
let updated = applyPageMetaToTab(tab, { title, modelName, iconKey })
|
||||||
|
if (pageEntry && !isRestoreLocation(pageEntry)) {
|
||||||
|
updated = applyLocationToTab(updated, pageEntry)
|
||||||
|
}
|
||||||
if (updated !== tab) changed = true
|
if (updated !== tab) changed = true
|
||||||
return updated
|
return updated
|
||||||
})
|
})
|
||||||
return changed ? next : current
|
return changed ? next : current
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[]
|
[isRestoreLocation]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getTabListState = useCallback((tabId, scope) => {
|
|
||||||
const tab = tabsRef.current.find((item) => item.id === tabId)
|
|
||||||
return getTabListStateEntry(tab, scope)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const setTabListState = useCallback((tabId, scope, patch) => {
|
|
||||||
if (!tabId || !scope) return
|
|
||||||
setTabs((current) => {
|
|
||||||
let changed = false
|
|
||||||
const next = current.map((tab) => {
|
|
||||||
if (tab.id !== tabId) return tab
|
|
||||||
const updated = applyListStateToTab(tab, scope, patch)
|
|
||||||
if (updated !== tab) changed = true
|
|
||||||
return updated
|
|
||||||
})
|
|
||||||
return changed ? next : current
|
|
||||||
})
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const goBack = useCallback(() => {
|
const goBack = useCallback(() => {
|
||||||
const currentTab = tabsRef.current.find(
|
const currentTab = tabsRef.current.find(
|
||||||
(tab) => tab.id === activeTabIdRef.current
|
(tab) => tab.id === activeTabIdRef.current
|
||||||
@ -854,58 +676,8 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
if (!isElectron || !hydrated) return
|
if (!isElectron || !hydrated) return
|
||||||
|
|
||||||
const entry = locationToEntry(location)
|
const entry = locationToEntry(location)
|
||||||
const restoring = isRestoringRef.current
|
|
||||||
const foreign = foreignLocationRef.current
|
|
||||||
|
|
||||||
if (restoring && restoring !== true) {
|
|
||||||
if (entriesEqual(restoring.target, entry)) {
|
|
||||||
isRestoringRef.current = null
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (entriesEqual(restoring.from, entry)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Same-path query cleanup on the tab we just opened (action params, etc.)
|
|
||||||
if (entry.pathname === restoring.target?.pathname) {
|
|
||||||
isRestoringRef.current = null
|
|
||||||
} else if (restoring.previousTabId) {
|
|
||||||
// A delayed write from the previous tab (viewId, filters, etc.)
|
|
||||||
applyEntryToTabId(restoring.previousTabId, entry)
|
|
||||||
if (foreign) foreign.entry = entry
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldIgnoreRestoredLocation(entry)) return
|
if (shouldIgnoreRestoredLocation(entry)) return
|
||||||
|
|
||||||
if (
|
|
||||||
foreign &&
|
|
||||||
foreign.tabId &&
|
|
||||||
foreign.tabId !== activeTabIdRef.current &&
|
|
||||||
Date.now() < foreign.expiresAt
|
|
||||||
) {
|
|
||||||
if (entriesEqual(entry, foreign.entry)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const activeEntry = getTabCurrentEntry(
|
|
||||||
tabsRef.current.find((tab) => tab.id === activeTabIdRef.current)
|
|
||||||
)
|
|
||||||
if (
|
|
||||||
entry.pathname === foreign.entry.pathname &&
|
|
||||||
entry.pathname !== activeEntry?.pathname
|
|
||||||
) {
|
|
||||||
applyEntryToTabId(foreign.tabId, entry)
|
|
||||||
foreign.entry = entry
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foreign && Date.now() >= foreign.expiresAt) {
|
|
||||||
foreignLocationRef.current = null
|
|
||||||
}
|
|
||||||
|
|
||||||
setTabs((current) => {
|
setTabs((current) => {
|
||||||
if (current.length === 0) {
|
if (current.length === 0) {
|
||||||
const initialTab = createTabFromLocation(location)
|
const initialTab = createTabFromLocation(location)
|
||||||
@ -922,13 +694,7 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
})
|
})
|
||||||
return changed ? next : current
|
return changed ? next : current
|
||||||
})
|
})
|
||||||
}, [
|
}, [hydrated, isElectron, location, shouldIgnoreRestoredLocation])
|
||||||
applyEntryToTabId,
|
|
||||||
hydrated,
|
|
||||||
isElectron,
|
|
||||||
location,
|
|
||||||
shouldIgnoreRestoredLocation
|
|
||||||
])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isElectron || !hydrated || !syncWindowTabs) return undefined
|
if (!isElectron || !hydrated || !syncWindowTabs) return undefined
|
||||||
@ -971,59 +737,6 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
})
|
})
|
||||||
}, [isElectron, onTabMovedAway, removeTab])
|
}, [isElectron, onTabMovedAway, removeTab])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isElectron) return undefined
|
|
||||||
|
|
||||||
const digitIndexFromEvent = (event) => {
|
|
||||||
const code = event.code || ''
|
|
||||||
if (code.startsWith('Digit')) {
|
|
||||||
const digit = Number(code.slice(5))
|
|
||||||
if (digit >= 1 && digit <= 9) return digit - 1
|
|
||||||
if (digit === 0) return 9
|
|
||||||
}
|
|
||||||
const key = event.key
|
|
||||||
if (key >= '1' && key <= '9') return Number(key) - 1
|
|
||||||
if (key === '0') return 9
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectTabAtIndex = (index) => {
|
|
||||||
const nextTab = tabsRef.current[index]
|
|
||||||
if (!nextTab) return
|
|
||||||
selectTab(nextTab.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
const cycleTab = (delta) => {
|
|
||||||
const current = tabsRef.current
|
|
||||||
if (current.length < 2) return
|
|
||||||
const activeIndex = current.findIndex(
|
|
||||||
(tab) => tab.id === activeTabIdRef.current
|
|
||||||
)
|
|
||||||
const fromIndex = activeIndex === -1 ? 0 : activeIndex
|
|
||||||
const nextIndex = (fromIndex + delta + current.length) % current.length
|
|
||||||
selectTab(current[nextIndex].id)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
|
||||||
if (event.ctrlKey && event.key === 'Tab') {
|
|
||||||
event.preventDefault()
|
|
||||||
cycleTab(event.shiftKey ? -1 : 1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(event.metaKey || event.ctrlKey) || event.repeat) return
|
|
||||||
const index = digitIndexFromEvent(event)
|
|
||||||
if (index == null) return
|
|
||||||
event.preventDefault()
|
|
||||||
selectTabAtIndex(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('keydown', handleKeyDown, true)
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener('keydown', handleKeyDown, true)
|
|
||||||
}
|
|
||||||
}, [isElectron, selectTab])
|
|
||||||
|
|
||||||
const activeTab = useMemo(
|
const activeTab = useMemo(
|
||||||
() => tabs.find((tab) => tab.id === activeTabId) || null,
|
() => tabs.find((tab) => tab.id === activeTabId) || null,
|
||||||
[activeTabId, tabs]
|
[activeTabId, tabs]
|
||||||
@ -1055,9 +768,7 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
createNewWindow,
|
createNewWindow,
|
||||||
registerTabPane,
|
registerTabPane,
|
||||||
registerTabStripRoot,
|
registerTabStripRoot,
|
||||||
captureTabPreview,
|
captureTabPreview
|
||||||
getTabListState,
|
|
||||||
setTabListState
|
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
activeTab,
|
activeTab,
|
||||||
@ -1081,8 +792,6 @@ export const NavigationTabsProvider = ({ children }) => {
|
|||||||
reorderTabs,
|
reorderTabs,
|
||||||
selectTab,
|
selectTab,
|
||||||
setTabPage,
|
setTabPage,
|
||||||
getTabListState,
|
|
||||||
setTabListState,
|
|
||||||
tabs
|
tabs
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -1141,18 +850,19 @@ export const useTabPreview = (tabId) => {
|
|||||||
export const useNavigationTabPage = ({ title, modelName, iconKey } = {}) => {
|
export const useNavigationTabPage = ({ title, modelName, iconKey } = {}) => {
|
||||||
const { setTabPage, isElectron } = useContext(NavigationTabMetaContext)
|
const { setTabPage, isElectron } = useContext(NavigationTabMetaContext)
|
||||||
const store = useContext(NavigationTabActiveContext)
|
const store = useContext(NavigationTabActiveContext)
|
||||||
|
const pageLocation = useLocation()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isElectron || !title) return undefined
|
if (!isElectron || !title) return undefined
|
||||||
|
|
||||||
const sync = () => {
|
const sync = () => {
|
||||||
if (!store.getSnapshot()) return
|
if (!store.getSnapshot()) return
|
||||||
setTabPage({ title, modelName, iconKey })
|
setTabPage({ title, modelName, iconKey, location: pageLocation })
|
||||||
}
|
}
|
||||||
|
|
||||||
sync()
|
sync()
|
||||||
return store.subscribe(sync)
|
return store.subscribe(sync)
|
||||||
}, [iconKey, isElectron, modelName, setTabPage, store, title])
|
}, [iconKey, isElectron, modelName, pageLocation, setTabPage, store, title])
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react-refresh/only-export-components
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
|
|||||||
@ -15,10 +15,7 @@ import { useTableState } from './TableStateContext'
|
|||||||
import useViewMode from '../hooks/useViewMode'
|
import useViewMode from '../hooks/useViewMode'
|
||||||
import { DEFAULT_VIEW_MODE, normalizeViewMode } from '../common/viewModeUtils'
|
import { DEFAULT_VIEW_MODE, normalizeViewMode } from '../common/viewModeUtils'
|
||||||
import { getModelByName } from '../../../database/ObjectModels'
|
import { getModelByName } from '../../../database/ObjectModels'
|
||||||
import {
|
import { useNavigationTabPage } from './NavigationTabsContext'
|
||||||
useNavigationTabPage,
|
|
||||||
useNavigationTabs
|
|
||||||
} from './NavigationTabsContext'
|
|
||||||
|
|
||||||
const ObjectListViewContext = createContext()
|
const ObjectListViewContext = createContext()
|
||||||
|
|
||||||
@ -131,10 +128,14 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
subscribeToObjectUpdates
|
subscribeToObjectUpdates
|
||||||
} = useContext(ApiServerContext)
|
} = useContext(ApiServerContext)
|
||||||
const { token, authInitialized } = useContext(AuthContext)
|
const { token, authInitialized } = useContext(AuthContext)
|
||||||
const { getViewFromUrl, getPersistedView, persistView, setObjectListView } =
|
const { getViewFromUrl, persistView, setObjectListView } = useTableState()
|
||||||
useTableState()
|
|
||||||
const { isElectron } = useNavigationTabs()
|
|
||||||
const listModel = getModelByName(objectType)
|
const listModel = getModelByName(objectType)
|
||||||
|
useNavigationTabPage({
|
||||||
|
title: listModel?.labelPlural
|
||||||
|
? `List - ${listModel.labelPlural}`
|
||||||
|
: 'List',
|
||||||
|
modelName: objectType
|
||||||
|
})
|
||||||
|
|
||||||
const [views, setViews] = useState(() => readCachedViews(objectType) || [])
|
const [views, setViews] = useState(() => readCachedViews(objectType) || [])
|
||||||
const [draftViews, setDraftViews] = useState(() => {
|
const [draftViews, setDraftViews] = useState(() => {
|
||||||
@ -202,13 +203,6 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
return view
|
return view
|
||||||
}, [activeTabKey, displayedViews])
|
}, [activeTabKey, displayedViews])
|
||||||
|
|
||||||
const listLabel = listModel?.labelPlural || 'List'
|
|
||||||
const viewName = activeView?.name
|
|
||||||
useNavigationTabPage({
|
|
||||||
title: viewName ? `${listLabel} - ${viewName}` : listLabel,
|
|
||||||
modelName: objectType
|
|
||||||
})
|
|
||||||
|
|
||||||
viewsStateRef.current = { views, draftViews, isEditing }
|
viewsStateRef.current = { views, draftViews, isEditing }
|
||||||
activeViewRef.current = activeView
|
activeViewRef.current = activeView
|
||||||
|
|
||||||
@ -303,13 +297,11 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
const name =
|
const name =
|
||||||
key && view && typeof view === 'object' ? view.name || null : null
|
key && view && typeof view === 'object' ? view.name || null : null
|
||||||
|
|
||||||
persistView(key, { scope: objectType, name })
|
persistView(key)
|
||||||
if (!isElectron) {
|
|
||||||
writeLastViewId(objectType, key)
|
writeLastViewId(objectType, key)
|
||||||
}
|
|
||||||
setObjectListView(objectType, key ? { id: key, name } : null)
|
setObjectListView(objectType, key ? { id: key, name } : null)
|
||||||
},
|
},
|
||||||
[isElectron, objectType, persistView, setObjectListView]
|
[objectType, persistView, setObjectListView]
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -361,10 +353,9 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
// Allow early restore from cache; only block when we have nothing to match against yet
|
// Allow early restore from cache; only block when we have nothing to match against yet
|
||||||
if (initialLoading && views.length === 0) return
|
if (initialLoading && views.length === 0) return
|
||||||
|
|
||||||
const persistedViewId = getPersistedView(objectType)?.id || null
|
const urlViewId = getViewFromUrl()
|
||||||
const urlViewId = isElectron ? null : getViewFromUrl()
|
const rememberedViewId = readLastViewId(objectType)
|
||||||
const rememberedViewId = isElectron ? null : readLastViewId(objectType)
|
const candidateViewId = urlViewId || rememberedViewId
|
||||||
const candidateViewId = persistedViewId || urlViewId || rememberedViewId
|
|
||||||
|
|
||||||
if (!candidateViewId) {
|
if (!candidateViewId) {
|
||||||
urlSyncedRef.current = true
|
urlSyncedRef.current = true
|
||||||
@ -379,18 +370,14 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
if (matched) {
|
if (matched) {
|
||||||
const matchedId = String(matched._id)
|
const matchedId = String(matched._id)
|
||||||
setActiveTabKey(matchedId)
|
setActiveTabKey(matchedId)
|
||||||
if (!isElectron) {
|
|
||||||
writeLastViewId(objectType, matchedId)
|
writeLastViewId(objectType, matchedId)
|
||||||
}
|
|
||||||
setObjectListView(objectType, {
|
setObjectListView(objectType, {
|
||||||
id: matchedId,
|
id: matchedId,
|
||||||
name: matched.name || null
|
name: matched.name || null
|
||||||
})
|
})
|
||||||
if (!matched._isDraft) {
|
if (!matched._isDraft) {
|
||||||
persistView(matchedId, {
|
// Keep viewId in the URL and strip any leftover filter/sort params
|
||||||
scope: objectType,
|
persistView(matchedId)
|
||||||
name: matched.name || null
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
urlSyncedRef.current = true
|
urlSyncedRef.current = true
|
||||||
setViewSyncReady(true)
|
setViewSyncReady(true)
|
||||||
@ -413,8 +400,6 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
draftViews,
|
draftViews,
|
||||||
isEditing,
|
isEditing,
|
||||||
objectType,
|
objectType,
|
||||||
isElectron,
|
|
||||||
getPersistedView,
|
|
||||||
getViewFromUrl,
|
getViewFromUrl,
|
||||||
persistView,
|
persistView,
|
||||||
rememberActiveView,
|
rememberActiveView,
|
||||||
@ -918,7 +903,8 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
// route filter/sort changes into the draft instead of URL/session persistence.
|
// route filter/sort changes into the draft instead of URL/session persistence.
|
||||||
const activeObjectView = isEditing ? activeView : null
|
const activeObjectView = isEditing ? activeView : null
|
||||||
|
|
||||||
const handleViewModeChange = useCallback(async (viewMode) => {
|
const handleViewModeChange = useCallback(
|
||||||
|
async (viewMode) => {
|
||||||
const view = activeViewRef.current
|
const view = activeViewRef.current
|
||||||
if (!view || activeTabKeyRef.current === ALL_TAB_KEY) return
|
if (!view || activeTabKeyRef.current === ALL_TAB_KEY) return
|
||||||
|
|
||||||
@ -944,7 +930,9 @@ export const ObjectListViewProvider = ({ children, objectType, tableRef }) => {
|
|||||||
...(userOverridesRef.current || {}),
|
...(userOverridesRef.current || {}),
|
||||||
viewMode
|
viewMode
|
||||||
}
|
}
|
||||||
}, [])
|
},
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
const isCustomView = activeTabKey !== ALL_TAB_KEY
|
const isCustomView = activeTabKey !== ALL_TAB_KEY
|
||||||
|
|
||||||
|
|||||||
@ -9,10 +9,6 @@ import {
|
|||||||
} from 'react'
|
} from 'react'
|
||||||
import { useSearchParams } from 'react-router-dom'
|
import { useSearchParams } from 'react-router-dom'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {
|
|
||||||
NavigationTabIdContext,
|
|
||||||
useNavigationTabs
|
|
||||||
} from './NavigationTabsContext'
|
|
||||||
|
|
||||||
const TableStateContext = createContext(null)
|
const TableStateContext = createContext(null)
|
||||||
|
|
||||||
@ -170,9 +166,6 @@ const normalizeSorter = (sorter) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const TableStateProvider = ({ children }) => {
|
export const TableStateProvider = ({ children }) => {
|
||||||
const tabId = useContext(NavigationTabIdContext)
|
|
||||||
const { isElectron, getTabListState, setTabListState, activeTab } =
|
|
||||||
useNavigationTabs()
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams()
|
const [searchParams, setSearchParams] = useSearchParams()
|
||||||
const [pageFilters, setPageFilters] = useState({})
|
const [pageFilters, setPageFilters] = useState({})
|
||||||
const [pageSorters, setPageSorters] = useState({})
|
const [pageSorters, setPageSorters] = useState({})
|
||||||
@ -221,17 +214,8 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
[setSearchParams]
|
[setSearchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const resolveScopedTabId = useCallback(
|
|
||||||
() => tabId || (isElectron ? activeTab?.id : null),
|
|
||||||
[activeTab?.id, isElectron, tabId]
|
|
||||||
)
|
|
||||||
|
|
||||||
const getPersistedFilter = useCallback(
|
const getPersistedFilter = useCallback(
|
||||||
(scope, { useFilterInUrl = false, useFilterInSession = false } = {}) => {
|
(scope, { useFilterInUrl = false, useFilterInSession = false } = {}) => {
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
return getTabListState(scopedTabId, scope).filter || {}
|
|
||||||
}
|
|
||||||
if (useFilterInUrl) {
|
if (useFilterInUrl) {
|
||||||
const fromUrl = readFilterFromUrl(searchParams)
|
const fromUrl = readFilterFromUrl(searchParams)
|
||||||
if (fromUrl) return fromUrl
|
if (fromUrl) return fromUrl
|
||||||
@ -242,15 +226,11 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
[getTabListState, isElectron, resolveScopedTabId, searchParams]
|
[searchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getPersistedSorter = useCallback(
|
const getPersistedSorter = useCallback(
|
||||||
(scope, { useSortInUrl = false, useSortInSession = false } = {}) => {
|
(scope, { useSortInUrl = false, useSortInSession = false } = {}) => {
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
return getTabListState(scopedTabId, scope).sort || {}
|
|
||||||
}
|
|
||||||
if (useSortInUrl) {
|
if (useSortInUrl) {
|
||||||
const fromUrl = readSortFromUrl(searchParams)
|
const fromUrl = readSortFromUrl(searchParams)
|
||||||
if (fromUrl) return fromUrl
|
if (fromUrl) return fromUrl
|
||||||
@ -261,7 +241,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
[getTabListState, isElectron, resolveScopedTabId, searchParams]
|
[searchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getViewFromUrl = useCallback(
|
const getViewFromUrl = useCallback(
|
||||||
@ -269,36 +249,8 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
[searchParams]
|
[searchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getPersistedView = useCallback(
|
|
||||||
(scope) => {
|
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
const entry = getTabListState(scopedTabId, scope)
|
|
||||||
return entry.viewId
|
|
||||||
? { id: String(entry.viewId), name: entry.viewName || null }
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
const fromUrl = readViewFromUrl(searchParams)
|
|
||||||
if (fromUrl) return { id: String(fromUrl), name: null }
|
|
||||||
return readListViewFromSession(scope)
|
|
||||||
},
|
|
||||||
[getTabListState, isElectron, resolveScopedTabId, searchParams]
|
|
||||||
)
|
|
||||||
|
|
||||||
const persistView = useCallback(
|
const persistView = useCallback(
|
||||||
(
|
(viewId, { clearFilterSort = Boolean(viewId) } = {}) => {
|
||||||
viewId,
|
|
||||||
{ clearFilterSort = Boolean(viewId), scope, name } = {}
|
|
||||||
) => {
|
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId && scope) {
|
|
||||||
setTabListState(scopedTabId, scope, {
|
|
||||||
viewId: viewId ? String(viewId) : null,
|
|
||||||
viewName: viewId ? name || null : null
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSearchParams((next) => {
|
updateSearchParams((next) => {
|
||||||
// Drop legacy `view` param that previously stored `_reference`
|
// Drop legacy `view` param that previously stored `_reference`
|
||||||
next.delete('view')
|
next.delete('view')
|
||||||
@ -314,7 +266,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[isElectron, resolveScopedTabId, setTabListState, updateSearchParams]
|
[updateSearchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const persistFilter = useCallback(
|
const persistFilter = useCallback(
|
||||||
@ -324,13 +276,6 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
{ saveFilterInSession = false, saveFilterInUrl = false } = {}
|
{ saveFilterInSession = false, saveFilterInUrl = false } = {}
|
||||||
) => {
|
) => {
|
||||||
const active = getActiveFilterValues(filterState)
|
const active = getActiveFilterValues(filterState)
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
if (saveFilterInSession || saveFilterInUrl) {
|
|
||||||
setTabListState(scopedTabId, scope, { filter: active })
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (saveFilterInSession) {
|
if (saveFilterInSession) {
|
||||||
writeFilterToSession(scope, active)
|
writeFilterToSession(scope, active)
|
||||||
}
|
}
|
||||||
@ -344,7 +289,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isElectron, resolveScopedTabId, setTabListState, updateSearchParams]
|
[updateSearchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const persistSort = useCallback(
|
const persistSort = useCallback(
|
||||||
@ -354,13 +299,6 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
{ saveSortInSession = false, saveSortInUrl = false } = {}
|
{ saveSortInSession = false, saveSortInUrl = false } = {}
|
||||||
) => {
|
) => {
|
||||||
const nextSorter = normalizeSorter(sorter)
|
const nextSorter = normalizeSorter(sorter)
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
if (saveSortInSession || saveSortInUrl) {
|
|
||||||
setTabListState(scopedTabId, scope, { sort: nextSorter })
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (saveSortInSession) {
|
if (saveSortInSession) {
|
||||||
writeSortToSession(scope, nextSorter)
|
writeSortToSession(scope, nextSorter)
|
||||||
}
|
}
|
||||||
@ -374,7 +312,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isElectron, resolveScopedTabId, setTabListState, updateSearchParams]
|
[updateSearchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const persistTableState = useCallback(
|
const persistTableState = useCallback(
|
||||||
@ -391,21 +329,6 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
) => {
|
) => {
|
||||||
const active = getActiveFilterValues(filterState)
|
const active = getActiveFilterValues(filterState)
|
||||||
const nextSorter = normalizeSorter(sorter)
|
const nextSorter = normalizeSorter(sorter)
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
const patch = {}
|
|
||||||
if (saveFilterInSession || saveFilterInUrl) {
|
|
||||||
patch.filter = active
|
|
||||||
}
|
|
||||||
if (saveSortInSession || saveSortInUrl) {
|
|
||||||
patch.sort = nextSorter
|
|
||||||
}
|
|
||||||
if (Object.keys(patch).length > 0) {
|
|
||||||
setTabListState(scopedTabId, scope, patch)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (saveFilterInSession) {
|
if (saveFilterInSession) {
|
||||||
writeFilterToSession(scope, active)
|
writeFilterToSession(scope, active)
|
||||||
@ -433,7 +356,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isElectron, resolveScopedTabId, setTabListState, updateSearchParams]
|
[updateSearchParams]
|
||||||
)
|
)
|
||||||
|
|
||||||
const setPageFilter = useCallback((path, filter) => {
|
const setPageFilter = useCallback((path, filter) => {
|
||||||
@ -466,12 +389,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
const setObjectListFilter = useCallback((objectType, filter) => {
|
const setObjectListFilter = useCallback((objectType, filter) => {
|
||||||
if (!objectType) return
|
if (!objectType) return
|
||||||
const active = getActiveFilterValues(filter)
|
const active = getActiveFilterValues(filter)
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
setTabListState(scopedTabId, objectType, { listFilter: active })
|
|
||||||
} else {
|
|
||||||
writeListFilterToSession(objectType, active)
|
writeListFilterToSession(objectType, active)
|
||||||
}
|
|
||||||
setObjectListFilters((prev) => {
|
setObjectListFilters((prev) => {
|
||||||
const hasActive = Object.keys(active).length > 0
|
const hasActive = Object.keys(active).length > 0
|
||||||
if (!hasActive) {
|
if (!hasActive) {
|
||||||
@ -482,17 +400,12 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
return { ...prev, [objectType]: active }
|
return { ...prev, [objectType]: active }
|
||||||
})
|
})
|
||||||
}, [isElectron, resolveScopedTabId, setTabListState])
|
}, [])
|
||||||
|
|
||||||
const setObjectListSorter = useCallback((objectType, sorter) => {
|
const setObjectListSorter = useCallback((objectType, sorter) => {
|
||||||
if (!objectType) return
|
if (!objectType) return
|
||||||
const nextSorter = normalizeSorter(sorter)
|
const nextSorter = normalizeSorter(sorter)
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
setTabListState(scopedTabId, objectType, { listSort: nextSorter })
|
|
||||||
} else {
|
|
||||||
writeListSortToSession(objectType, nextSorter)
|
writeListSortToSession(objectType, nextSorter)
|
||||||
}
|
|
||||||
setObjectListSorters((prev) => {
|
setObjectListSorters((prev) => {
|
||||||
const hasSort = nextSorter?.field && nextSorter?.order
|
const hasSort = nextSorter?.field && nextSorter?.order
|
||||||
if (!hasSort) {
|
if (!hasSort) {
|
||||||
@ -503,7 +416,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
return { ...prev, [objectType]: nextSorter }
|
return { ...prev, [objectType]: nextSorter }
|
||||||
})
|
})
|
||||||
}, [isElectron, resolveScopedTabId, setTabListState])
|
}, [])
|
||||||
|
|
||||||
const setObjectListView = useCallback((objectType, view) => {
|
const setObjectListView = useCallback((objectType, view) => {
|
||||||
if (!objectType) return
|
if (!objectType) return
|
||||||
@ -511,15 +424,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
view?.id != null
|
view?.id != null
|
||||||
? { id: String(view.id), name: view.name || null }
|
? { id: String(view.id), name: view.name || null }
|
||||||
: null
|
: null
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
setTabListState(scopedTabId, objectType, {
|
|
||||||
viewId: nextView?.id || null,
|
|
||||||
viewName: nextView?.name || null
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
writeListViewToSession(objectType, nextView)
|
writeListViewToSession(objectType, nextView)
|
||||||
}
|
|
||||||
setObjectListViews((prev) => {
|
setObjectListViews((prev) => {
|
||||||
if (!nextView) {
|
if (!nextView) {
|
||||||
if (!(objectType in prev)) return prev
|
if (!(objectType in prev)) return prev
|
||||||
@ -537,7 +442,7 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
return { ...prev, [objectType]: nextView }
|
return { ...prev, [objectType]: nextView }
|
||||||
})
|
})
|
||||||
}, [isElectron, resolveScopedTabId, setTabListState])
|
}, [])
|
||||||
|
|
||||||
const getObjectListFilter = useCallback(
|
const getObjectListFilter = useCallback(
|
||||||
(objectType) => {
|
(objectType) => {
|
||||||
@ -545,15 +450,9 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
if (objectListFilters[objectType]) {
|
if (objectListFilters[objectType]) {
|
||||||
return objectListFilters[objectType]
|
return objectListFilters[objectType]
|
||||||
}
|
}
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
return getActiveFilterValues(
|
|
||||||
getTabListState(scopedTabId, objectType).listFilter || {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return getActiveFilterValues(readListFilterFromSession(objectType) || {})
|
return getActiveFilterValues(readListFilterFromSession(objectType) || {})
|
||||||
},
|
},
|
||||||
[getTabListState, isElectron, objectListFilters, resolveScopedTabId]
|
[objectListFilters]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getObjectListSorter = useCallback(
|
const getObjectListSorter = useCallback(
|
||||||
@ -562,13 +461,9 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
if (objectListSorters[objectType]) {
|
if (objectListSorters[objectType]) {
|
||||||
return objectListSorters[objectType]
|
return objectListSorters[objectType]
|
||||||
}
|
}
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
return getTabListState(scopedTabId, objectType).listSort || {}
|
|
||||||
}
|
|
||||||
return readListSortFromSession(objectType) || {}
|
return readListSortFromSession(objectType) || {}
|
||||||
},
|
},
|
||||||
[getTabListState, isElectron, objectListSorters, resolveScopedTabId]
|
[objectListSorters]
|
||||||
)
|
)
|
||||||
|
|
||||||
const getObjectListView = useCallback(
|
const getObjectListView = useCallback(
|
||||||
@ -577,16 +472,9 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
if (objectListViews[objectType]) {
|
if (objectListViews[objectType]) {
|
||||||
return objectListViews[objectType]
|
return objectListViews[objectType]
|
||||||
}
|
}
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
const entry = getTabListState(scopedTabId, objectType)
|
|
||||||
return entry.viewId
|
|
||||||
? { id: String(entry.viewId), name: entry.viewName || null }
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
return readListViewFromSession(objectType)
|
return readListViewFromSession(objectType)
|
||||||
},
|
},
|
||||||
[getTabListState, isElectron, objectListViews, resolveScopedTabId]
|
[objectListViews]
|
||||||
)
|
)
|
||||||
|
|
||||||
const hasPageFilter = useCallback(
|
const hasPageFilter = useCallback(
|
||||||
@ -596,17 +484,6 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
|
|
||||||
const hasStoredFilter = useCallback((scope) => {
|
const hasStoredFilter = useCallback((scope) => {
|
||||||
if (!scope) return false
|
if (!scope) return false
|
||||||
const scopedTabId = resolveScopedTabId()
|
|
||||||
if (isElectron && scopedTabId) {
|
|
||||||
const entry = getTabListState(scopedTabId, scope)
|
|
||||||
if (entry.viewId) {
|
|
||||||
return Object.keys(entry.listFilter || {}).length > 0
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
Object.keys(entry.filter || {}).length > 0 ||
|
|
||||||
Object.keys(entry.listFilter || {}).length > 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// When a view is active, only report the effective list filter (which
|
// When a view is active, only report the effective list filter (which
|
||||||
// already accounts for the view). Don't fall back to the All-tab session
|
// already accounts for the view). Don't fall back to the All-tab session
|
||||||
// filter — that belongs to a different context.
|
// filter — that belongs to a different context.
|
||||||
@ -616,19 +493,12 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
if (hasStoredSessionFilter(scope)) return true
|
if (hasStoredSessionFilter(scope)) return true
|
||||||
if (Object.keys(objectListFilters[scope] || {}).length > 0) return true
|
if (Object.keys(objectListFilters[scope] || {}).length > 0) return true
|
||||||
return Object.keys(getActiveFilterValues(readListFilterFromSession(scope) || {})).length > 0
|
return Object.keys(getActiveFilterValues(readListFilterFromSession(scope) || {})).length > 0
|
||||||
}, [
|
}, [objectListFilters, objectListViews])
|
||||||
getTabListState,
|
|
||||||
isElectron,
|
|
||||||
objectListFilters,
|
|
||||||
objectListViews,
|
|
||||||
resolveScopedTabId
|
|
||||||
])
|
|
||||||
|
|
||||||
const value = useMemo(
|
const value = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
getPersistedFilter,
|
getPersistedFilter,
|
||||||
getPersistedSorter,
|
getPersistedSorter,
|
||||||
getPersistedView,
|
|
||||||
getViewFromUrl,
|
getViewFromUrl,
|
||||||
persistView,
|
persistView,
|
||||||
persistFilter,
|
persistFilter,
|
||||||
@ -653,7 +523,6 @@ export const TableStateProvider = ({ children }) => {
|
|||||||
[
|
[
|
||||||
getPersistedFilter,
|
getPersistedFilter,
|
||||||
getPersistedSorter,
|
getPersistedSorter,
|
||||||
getPersistedView,
|
|
||||||
getViewFromUrl,
|
getViewFromUrl,
|
||||||
persistView,
|
persistView,
|
||||||
persistFilter,
|
persistFilter,
|
||||||
|
|||||||
@ -5,7 +5,9 @@ import { AuthContext } from '../context/AuthContext'
|
|||||||
import { useNavigationTabPage } from '../context/NavigationTabsContext'
|
import { useNavigationTabPage } from '../context/NavigationTabsContext'
|
||||||
|
|
||||||
const formatPageLabel = (pageName) =>
|
const formatPageLabel = (pageName) =>
|
||||||
pageName ? `${pageName.charAt(0).toUpperCase()}${pageName.slice(1)}` : 'Page'
|
pageName
|
||||||
|
? `${pageName.charAt(0).toUpperCase()}${pageName.slice(1)}`
|
||||||
|
: 'Page'
|
||||||
|
|
||||||
const getObjectDisplayName = (objectData, model) => {
|
const getObjectDisplayName = (objectData, model) => {
|
||||||
if (objectData?.name) return objectData.name
|
if (objectData?.name) return objectData.name
|
||||||
@ -15,9 +17,18 @@ const getObjectDisplayName = (objectData, model) => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatObjectPageTabTitle = ({ pageName, objectName } = {}) => {
|
export const formatObjectPageTabTitle = ({
|
||||||
|
pageName,
|
||||||
|
model,
|
||||||
|
objectName
|
||||||
|
} = {}) => {
|
||||||
const pageLabel = formatPageLabel(pageName)
|
const pageLabel = formatPageLabel(pageName)
|
||||||
if (objectName) return `${objectName} - ${pageLabel}`
|
const collectionLabel = model?.labelPlural
|
||||||
|
if (objectName && collectionLabel) {
|
||||||
|
return `${pageLabel} (${objectName}) - ${collectionLabel}`
|
||||||
|
}
|
||||||
|
if (objectName) return `${pageLabel} (${objectName})`
|
||||||
|
if (collectionLabel) return `${pageLabel} - ${collectionLabel}`
|
||||||
return pageLabel
|
return pageLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +74,7 @@ export const useObjectNavigationTabPage = ({
|
|||||||
}, [connected, model, modelName, objectId, subscribeToObjectUpdates])
|
}, [connected, model, modelName, objectId, subscribeToObjectUpdates])
|
||||||
|
|
||||||
useNavigationTabPage({
|
useNavigationTabPage({
|
||||||
title: formatObjectPageTabTitle({ pageName, objectName }),
|
title: formatObjectPageTabTitle({ pageName, model, objectName }),
|
||||||
modelName
|
modelName
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user