Repository navigation
feat(shell): backdrop host, Sheet and view switch (phase 3) - #197
Merged
Merged
Conversation
Shell phase 3, ember-ui side. - Layout::Canvas::BackdropHost renders every registration in ember-core's backdrop.mounted once (keyed by name), shows the active one and hides the rest with visibility + inert instead of tearing them down; the dot grid shows when nothing is active or there is no backdrop service. It is now Layout::Canvas's default backdrop. Over a live backdrop the content layer passes the pointer through in its gaps (fb-canvas-passthrough for full-size page wrappers). - Sheet: floating record card, right or left, sm/md/lg (360/440/640) or any width, pointer and keyboard resizing, header/body/footer blocks, close and park. Stacked sheets show as spines (B3) with inert, still-mounted content. The new sheet-stack service gives Escape and Tab wrapping to the top sheet. - Layout::ViewSwitch: the top-centre Map/Table/Board radio pill with counts, route-aware selection and a primary action or actions block. - Layout::Resource::Panel renders through Sheet in the canvas layout and is unchanged in classic. The new shell service says which layout is on (setLayout(), or a mounted Layout::Canvas); @layout overrides it. - ResourceContextPanel in canvas: stacks overlays as sheets keyed by id, spine click brings to front, sizes map to sheet presets, sheets own Escape, no click-away backdrop. Classic is unchanged. - resource-context-panel service: park/unpark/isParked, parked list, overlay.parked/overlay.unparked events and enableParking() for the phase 4 taskbar.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/map-canvas #197 +/- ##
=====================================================
Coverage 100.00% 100.00%
=====================================================
Files 350 356 +6
Lines 9876 10142 +266
=====================================================
+ Hits 9876 10142 +266
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…nents Panels and sheets also render inside engines, whose owners have no ember-ui services, so @service shell / @service sheetStack threw there. The layout now lives in a page-wide shellState and the open sheets in a module-level sheetStack (the sheet-stack service is removed); the shell service stays for setLayout(). Sheet looks up modals-manager optionally. BackdropHost renders an engine ExtensionComponent (or its #extension-component string) through LazyEngineComponent with the backdrop values as @params. test-support gains resetShellState()/setupShellState(hooks); the dummy test helper resets before every test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shell phase 3, the ember-ui side: the backdrop host,
Sheet, the view switch, and the resource panel rendered as a sheet. It works alongside ember-core'sbackdropservice (built in parallel) and the fleetops live-map registration.The classic layout is unchanged. Everything new happens only when the canvas layout is on.
API summary
Layout::Canvas::BackdropHost(now the default backdrop ofLayout::Canvas)service:backdropthrough an optional lookup. It usesactive,mounted(falling back to[active]) andstate.{ name, component, routes, priority, keepAlive }) once, keyed byname, in.fb-canvas-backdrop-slot[data-backdrop].visibility: hidden,inertandaria-hidden; they are never removed with{{#if}}.@registration,@isActive,@stateand@backdrop(the service, forsetInstanceandonReady).ExtensionComponent, or its#extension-component:string, renders throughLazyEngineComponentand receives the same values as@params.*.pointer-eventson the backdrop layer or its slots..fb-canvas-contentstops taking the pointer and only its direct children take it, so the map stays draggable around the cards. A page wrapper that spans the whole content area should get thefb-canvas-passthroughclass.<Sheet>role="separator". Width is clamped between 320 and 960 by default.size - 1 - index. Each sheet behind the top one is pushed in 28px and shows a spine button that calls@onActivate. Its content stays mounted but isinert. Sheets more than three deep are hidden.sheetStack(utils/sheet-stack) closes only the top sheet. It is a module singleton rather than a service so that sheets rendered inside engines share the same stack. It listens onwindowin the bubble phase, and does nothing if the event was already handled or a modal is open (modals-manageris looked up optionally).<Layout::ViewSwitch>@views=[{ id, label, count?, route?, models?, query? }](defaults to Map, Table and Board),@selected,@onChange(id, view),@primaryAction={ label, icon?, onClick | action | route }or an<:actions>block, and@label.@selected, the view matching the current route is selected.--fb-view-switch-top, 12px by default). Place it in the canvas<:chrome>block.Layout::Resource::PanelandResourceContextPanelSheet. The resource header goes in the sheet header and keeps its own cancel button.onLoad,onOverlayReadyandonOpenreceive the sheet API.@layout="canvas|classic"overrides the layout on both components.ResourceContextPanel:id, so they are not re-created;overlay.widthtaking precedence;New services
shell:layout(classicorcanvas),isCanvas,setLayout(). The console should callsetLayout('canvas')when it picks the canvas branch, andLayout::Canvasmarks the layout as canvas while it is mounted.shellState. Components read it directly, without injecting a service, because engine owners don't have ember-ui's services. This means no ember-core export is needed.resetShellState()orsetupShellState(hooks)from@fleetbase/ember-ui/test-support. The dummy app resets before every test.resource-context-paneladditions for the phase 4 taskbar:park(id?),unpark(id),isParked(id), a trackedparkedlist, the eventsoverlay.parkedandoverlay.unparked(the service is now Evented), andenableParking(bool). An overlay can also opt in withparkable: trueoronPark. The park button is hidden until parking is enabled, because nothing can show a parked panel before phase 4.Tests
New tests cover every component and state, including:
ember-core's
backdropis stubbed asBackdropStubintests/helpers/shell-stubs.js.Local
COVERAGE=true ember test: 6522 of 6525 pass. The 3 failures also fail on the base branch in this environment (filter/model name path, and resource-component /resourceComponentNamedriver/pill).Every new or changed file reached 100% coverage except one branch in
sheet-stack.js. I added a test for that branch after the run; CI's coverage gate is the confirmation.