Image assets (2/3): Angular client — ImageAssetService + Image widget - #1081
Closed
dillan wants to merge 2 commits into
Closed
Image assets (2/3): Angular client — ImageAssetService + Image widget#1081dillan wants to merge 2 commits into
dillan wants to merge 2 commits into
Conversation
resolveKipPluginBaseUrl() extracts the <server>/plugins/kip/ resolution (mirroring kip-series-api-client) and snapImageWidth() snaps a container width (x DPR) to the server's variant allow-list so the client requests stable, cache-friendly URLs. ImageAssetService wraps the plugin endpoints: upload (multipart FormData with progress), list, delete, cacheStats, purgeCache, and urlFor(id, cssWidth, dpr) for the widget. Requests are auto-authenticated by the JWT interceptor. 9 vitest cases green.
This was referenced Jun 24, 2026
New widget-image renders a selected image (by id) via ImageAssetService, scaled to fit the widget with object-fit (contain/cover) over a configurable background that defaults to transparent so the dashboard shows through. It tracks its container width with the existing kipResizeObserver directive and requests a server variant matched to that width (x DPR) so a small widget never downloads a full-resolution image. Shows an empty state when nothing is selected. Registered in WidgetService (component map + Component-category definition); adds the `image` config block to IWidgetSvcConfig. 3 vitest cases (empty state, render+object-fit, background default/override).
dillan
force-pushed
the
feat/image-assets-client
branch
from
June 24, 2026 10:05
c4eba98 to
c5a140c
Compare
dillan
marked this pull request as ready for review
June 24, 2026 11:29
This was referenced Jun 30, 2026
dillan
marked this pull request as draft
July 2, 2026 12:39
Contributor
Author
|
Superseded by #1120, which re-points the client at the standalone |
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.
Image assets (2/3) — Angular client: ImageAssetService + Image widget
Part 2 of 3 adding user-uploaded image assets to KIP dashboards. This PR adds the client service and the Image widget that displays a server-stored image, scaled to fit its container while preserving aspect ratio.
Depends on PR 1 (server, #1080) at runtime — the widget fetches bytes from the plugin's
/plugins/kip/imagesendpoints. The code compiles and unit-tests on its own; it just won't display anything until the server side is present. The widget config UI (upload + gallery + settings cache card) is PR 3.What it does
ImageAssetService(providedIn: 'root') — resolves the plugin base URL from the SK connection endpoint and exposesupload()(FormData + progress events),list(),delete(),cacheStats(),purgeCache(), andurlFor(id, cssWidth, dpr)which snaps the requested width to the server's allow-list so a small widget never downloads a full-resolution image. All calls are auto-authenticated by the existing JWT interceptor.resolveKipPluginBaseUrl/snapImageWidthhelper (core/utils/kip-plugin-url.util.ts) — small, unit-tested URL/width logic extracted so it's testable in isolation.widget-image— zoneless/signals widget. Reads its config viaWidgetRuntimeDirective, derives the image URL fromImageAssetService.urlFor(...)using aResizeObserverto request the container-matched variant, and renders<img [style.object-fit]>(contain | cover) over a configurable solid or transparent background. Shows an empty state when no image is selected. No data streams (static widget).widget.service.tsas an Image widget (Component category) so it appears in Add Widgets.Display behavior
Scales to fit (
contain) or fill (cover) preserving aspect ratio; background defaults to transparent (the dashboard shows through the letterbox area), or a user-chosen color (set in PR 3's config UI).Tests
image-asset.service.spec.ts(URL/variant resolution, FormData upload, cache calls),kip-plugin-url.util.spec.ts(base-URL + width snapping),widget-image.component.spec.ts(empty state, URL derivation, object-fit, transparent default). Vitest/zoneless.Status / gates
npm run build:dev) clean;ng lintclean; the 3 image specs (12 tests) pass.Stacking / dependency
📚 3-PR stack (review/merge in order)
PR 2 needs PR 1 at runtime; PR 3 is stacked on PR 2. Together they add the full image-assets feature.
You are viewing PR 2 of 3.