Add/Edit Bookmark Dialog - #278
Conversation
c622e28 to
fbfa6e6
Compare
This reverts commit 740391c.
* Add OPA client for admin rights checking
- New OPA client module (src/lib/server/opa.ts) using plain fetch
- Separate handleOpaAdmin middleware hook (fail-closed)
- Admin status exposed to client via event.locals.isAdmin and $page.data
- Prometheus metrics: opa_request_duration_seconds + opa_request_total
- Helm chart for OPA 1.16.2 (dev/opa/)
- Sample Rego policy with admin email domain check
- Dev setup: alice is admin (alice@admin.example.com)
- Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars
* Replace custom OPA fetch client with @open-policy-agent/opa SDK
Uses OPAClient.evaluate() with fromResult callback instead of raw fetch.
Same external interface (checkAdmin), same error handling (fail-closed).
* fix YAML format
* fix YAML format
* fix YAML format
* fix: handle bare boolean responses from OPA admin check
The fromResult callback expected { admin: true } but OPA may return a
bare boolean. Now handles both formats.
* chore: remove merge artifact feature flags
Remove unused archivePreviewMaxBytes and commented-out env vars
(INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no
corresponding code.
---------
Co-authored-by: F3l1x1vo <fli@ordix.de>
286a34a to
7a7d76c
Compare
* #270 add bookmark dialog * add edit bookmarks dialog * fix cancel editing bookmark * fix darkmode for icons, cursor pointer over boxes * update product icons to use colored versions where possible * scaled icons down to 64x64 * Revert "scaled icons down to 64x64" This reverts commit 740391c. * revert image downscale, use svelte enhanced image component to downscale images * #271 overhaul dashboard layout design * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * chore: dedupe packages * #270 add admin check to pinning, add OPA tests * fix unit test * #270 show pin for all only to admins * fix unit test * pull from feat/app-bookmark-dialog * pull from feat/app-bookmark-dialog --------- Co-authored-by: dklOrdix <dkl@ordix.de>
… as tools inside the cockpit (#283) * #270 add bookmark dialog * add edit bookmarks dialog * fix cancel editing bookmark * fix darkmode for icons, cursor pointer over boxes * update product icons to use colored versions where possible * scaled icons down to 64x64 * Revert "scaled icons down to 64x64" This reverts commit 740391c. * revert image downscale, use svelte enhanced image component to downscale images * #275 allow users to pin bookmarks * #275 #280 add bookmarks to sidebar navigation, show external apps in cockpit * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * fix auth port, implement open in new tab option, fix custom link resolve * #270 add admin check to pinning, add OPA tests * fix unit test * #270 show pin for all only to admins * fix unit test * pull from feat/app-bookmark-dialog --------- Co-authored-by: dklOrdix <dkl@ordix.de>
# Conflicts: # TECH_DEBT.md # src/lib/server/auth.ts
|
|
Bohreromir
left a comment
There was a problem hiding this comment.
Unless I do miss something the whole PinForEveryone does not work as its only stored in LocalStorage. Opa could then be removed too.
I havent yet read the whole thing, but I think this is enough for the meantime.
Feel free to ask for any clarifications.
| {#if product.logo} | ||
| <enhanced:img | ||
| src={product.logo} | ||
| alt="" |
| export default defineConfig({ | ||
| plugins: [ | ||
| tailwindcss(), | ||
| enhancedImages(), |
There was a problem hiding this comment.
Should we use enhanced img for the already existing imgs too?
| # Feature flags | ||
| # STACKABLE_COCKPIT_COMPLETION_ENABLED=false # Disable SQL editor code completion (default: true) | ||
| # STACKABLE_COCKPIT_STORAGE_BROWSER_ENABLED=true # Enable S3/HDFS file browser (default: false) | ||
| # PUBLIC_STACKABLE_COCKPIT_UPLOAD_CONCURRENCY=3 # Maximum number of concurrent file uploads (default: 3) |
| # OPA (Open Policy Agent) — admin rights checking | ||
| # STACKABLE_COCKPIT_OPA_ENABLED=true # Enable OPA admin checks (default: false) |
There was a problem hiding this comment.
Small contradiciton here. i guess most users would copy the .env.example to craft there own. If they do, the default is true while comment says false
| if (typeof bookmark.id === 'string' && isValidBookmarkId(bookmark.id)) { | ||
| return bookmarkWithoutOpenIn; | ||
| } | ||
| migrated = true; |
There was a problem hiding this comment.
Whats being migrated here? Bookmarks do not exist outside of this PR as far as i know
| addModalOpen = true; | ||
| } | ||
|
|
||
| function getProduct(productId: string) { |
There was a problem hiding this comment.
this fn exists twice and could be a shared helper in products.ts
| } | ||
| } | ||
|
|
||
| function handleLogoError(e: Event) { |
| productId: selectedProduct.id, | ||
| name: name.trim(), | ||
| environment: environment.trim(), | ||
| url: url.trim(), |
There was a problem hiding this comment.
We should use zod here to verify data, as it stands everything can be inserted as an url, even javascript
| if (!section || !parent || !child) return; | ||
|
|
||
| const compute = () => { | ||
| const sectionRect = section.getBoundingClientRect(); |
There was a problem hiding this comment.
this will break the animation if the user resize his window
| } | ||
| } | ||
|
|
||
| $effect(() => { |
There was a problem hiding this comment.
i think this could be removed by directly calling initForm in handleDeleteCancel
This PR adds a bookmark modal for adding and editing bookmarks. Currently, they are saved in localStorage (not a database like we hoped. The database is a v1 feature of the S3 Storage Browser and not yet available on the parent branch). Migrating these bookmarks to the database is an issue for later (#277).
The bookmarks are currently shown in a section on the dashboard but we will change the display of these as well (#271)
Closes #270