-
-
Notifications
You must be signed in to change notification settings - Fork 670
feat(core): implement application capability model and store slice (#1672) #2097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { type NetworkToolKind, useAppStore } from "@geolibre/core"; | ||
| import { type NetworkToolKind, useAppCapability, useAppStore } from "@geolibre/core"; | ||
| import { isEarthEngineAvailable } from "@geolibre/plugins"; | ||
| import { | ||
| Button, | ||
|
|
@@ -73,6 +73,9 @@ export function ProcessingMenu({ | |
| const setAssistantOpen = useAppStore((s) => s.setAssistantOpen); | ||
| const setDashboardOpen = useAppStore((s) => s.setDashboardOpen); | ||
| const setProcessingHistoryOpen = useAppStore((s) => s.setProcessingHistoryOpen); | ||
| const processingCap = useAppCapability("processing:run"); | ||
| const sidecarCap = useAppCapability("processing:sidecar"); | ||
| const assistantCap = useAppCapability("assistant:use"); | ||
|
|
||
| // Format Conversion, Raster tools, and AI Segmentation require the Python | ||
| // sidecar, which cannot run on Android/iOS — hide them on mobile so they don't | ||
|
|
@@ -143,7 +146,10 @@ export function ProcessingMenu({ | |
| <DropdownMenuSeparator /> | ||
| {show("processing.assistant") && ( | ||
| <> | ||
| <DropdownMenuItem onSelect={() => setAssistantOpen(true)}> | ||
| <DropdownMenuItem | ||
| onSelect={() => setAssistantOpen(true)} | ||
| disabled={!assistantCap.granted} | ||
| > | ||
|
Comment on lines
+149
to
+152
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Expose capability denial reasons consistently. Both menus use
This follows the PR objective to disable controls with an explanatory reason. 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| {t("toolbar.command.assistant")} | ||
| </DropdownMenuItem> | ||
| <DropdownMenuSeparator /> | ||
|
|
@@ -157,7 +163,10 @@ export function ProcessingMenu({ | |
| does; pairs with the GeoLibre Toolbox trigger below. Reuses the | ||
| dialog's own heading string, already translated in every locale. */} | ||
| {showWhitebox && ( | ||
| <DropdownMenuItem onSelect={() => setProcessingOpen(true)}> | ||
| <DropdownMenuItem | ||
| onSelect={() => setProcessingOpen(true)} | ||
| disabled={!processingCap.granted} | ||
| > | ||
|
Comment on lines
+166
to
+169
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Apply This condition disables only the top-level Whitebox item. The Whitebox category submenus are siblings and remain enabled, so This follows the PR objective to gate processing menus by application capability. 🤖 Prompt for AI Agents |
||
| {t("processing.whitebox.toolbox")} | ||
| </DropdownMenuItem> | ||
| )} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Gate sidecar-backed actions with
sidecarCap.sidecarCapis initialized but never used. The conversion, raster, and segmentation entries remain selectable whenprocessing:sidecaris denied. Disable those actions, and expose the capability reason.This follows the PR objective to apply the application privilege model to processing actions.
🤖 Prompt for AI Agents