fix(navigation): expose permitted inbound and delivery order lists
This commit is contained in:
@@ -52,7 +52,7 @@ test('keeps standalone business pages at the client sidebar root', () => {
|
||||
{ title: '首页', children: undefined },
|
||||
{
|
||||
title: '订单中心',
|
||||
children: ['头程订单', '海外采购', '美国本土卡', '美本土散板'],
|
||||
children: ['头程订单', '入库订单', '派送订单', '海外采购', '美国本土卡', '美本土散板'],
|
||||
},
|
||||
{ title: '报关资料', children: undefined },
|
||||
{ title: '船期价格', children: undefined },
|
||||
@@ -88,6 +88,8 @@ test('flattens visible leaves with unique paths', () => {
|
||||
assert.deepEqual(paths, [
|
||||
'/',
|
||||
'/orders/first-leg',
|
||||
'/orders/inbound',
|
||||
'/orders/delivery',
|
||||
'/cross-border/procurement',
|
||||
'/cross-border/domestic-trucking',
|
||||
'/cross-border/pallet-shipping',
|
||||
@@ -119,6 +121,24 @@ test('filters inaccessible leaves and empty navigation groups', () => {
|
||||
assert.equal(getFirstAccessiblePath([]), '/forbidden')
|
||||
})
|
||||
|
||||
test('exposes active inbound and delivery queries only with their existing read permissions', () => {
|
||||
const deliveryOnly = ['merchant:warehouse:delivery:list']
|
||||
const inboundOnly = ['merchant:warehouse:inbound:list']
|
||||
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation, deliveryOnly))
|
||||
.map(({ title, path }) => ({ title, path })), [{ title: '派送订单', path: '/orders/delivery' }])
|
||||
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation, inboundOnly))
|
||||
.map(({ title, path }) => ({ title, path })), [{ title: '入库订单', path: '/orders/inbound' }])
|
||||
assert.equal(getFirstAccessiblePath(deliveryOnly), '/orders/delivery')
|
||||
assert.equal(getFirstAccessiblePath(inboundOnly), '/orders/inbound')
|
||||
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation,
|
||||
['merchant:warehouse:delivery:create'])), [])
|
||||
assert.deepEqual(getRouteBreadcrumbs('/orders/delivery/DL-1', '派送单详情'), [
|
||||
{ title: '首页', path: '/' }, { title: '订单中心' },
|
||||
{ title: '派送订单', path: '/orders/delivery' }, { title: '派送单详情' },
|
||||
])
|
||||
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/orders/delivery'), ['order-center'])
|
||||
})
|
||||
|
||||
test('excludes entries marked for manual hiding without affecting other visible items', () => {
|
||||
const visible = filterNavigationByPermissions([
|
||||
{ key: 'shown', title: '显示入口', icon: LayoutGrid, path: '/shown', permission: 'shown:view' },
|
||||
@@ -339,7 +359,7 @@ test('keeps the dashboard route permission synchronized with navigation', () =>
|
||||
assert.match(dashboardRoute, /permission: 'dashboard:view'/)
|
||||
})
|
||||
|
||||
test('keeps internal operational pages routable without exposing them in customer navigation', () => {
|
||||
test('exposes customer business lists and keeps utility routes outside navigation', () => {
|
||||
const routerSource = [
|
||||
'first-leg',
|
||||
'cross-border',
|
||||
@@ -364,8 +384,6 @@ test('keeps internal operational pages routable without exposing them in custome
|
||||
|
||||
const hiddenActivePaths = new Set([
|
||||
'first-leg/quick-order',
|
||||
'orders/inbound',
|
||||
'orders/delivery',
|
||||
'overseas-warehouse/return-inventory',
|
||||
'overseas-warehouse/return-cartons',
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user