@mintplayer/ng-spark 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/mintplayer-ng-spark-client-operations.mjs +168 -0
- package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-models.mjs +84 -1
- package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-pipes.mjs +25 -8
- package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-create.mjs +39 -13
- package/fesm2022/mintplayer-ng-spark-po-create.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs +3 -3
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-edit.mjs +47 -2
- package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-form.mjs +1 -1
- package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-query-list.mjs +33 -6
- package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +165 -14
- package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-services.mjs +51 -30
- package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
- package/package.json +6 -2
- package/types/mintplayer-ng-spark-client-operations.d.ts +159 -0
- package/types/mintplayer-ng-spark-models.d.ts +54 -10
- package/types/mintplayer-ng-spark-pipes.d.ts +8 -0
- package/types/mintplayer-ng-spark-po-create.d.ts +1 -0
- package/types/mintplayer-ng-spark-po-detail.d.ts +2 -1
- package/types/mintplayer-ng-spark-po-edit.d.ts +2 -0
- package/types/mintplayer-ng-spark-query-list.d.ts +10 -2
- package/types/mintplayer-ng-spark-retry-action-modal.d.ts +33 -4
- package/types/mintplayer-ng-spark-services.d.ts +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-spark-query-list.mjs","sources":["../../query-list/src/spark-query-list.component.ts","../../query-list/src/spark-query-list.component.html","../../query-list/mintplayer-ng-spark-query-list.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, input, output, signal, TemplateRef, Type } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subscription } from 'rxjs';\nimport { CommonModule, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, DatatableSettings } from '@mintplayer/ng-bootstrap/datatable';\nimport { BsVirtualDatatableComponent, BsVirtualRowTemplateDirective, VirtualDatatableDataSource } from '@mintplayer/ng-bootstrap/virtual-datatable';\nimport { BsFormComponent, BsFormControlDirective } from '@mintplayer/ng-bootstrap/form';\nimport { BsContainerComponent } from '@mintplayer/ng-bootstrap/container';\nimport { BsGridComponent, BsGridRowDirective, BsGridColumnDirective } from '@mintplayer/ng-bootstrap/grid';\nimport { BsInputGroupComponent } from '@mintplayer/ng-bootstrap/input-group';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { PaginationResponse, SortColumn } from '@mintplayer/pagination';\nimport { SparkService, SparkStreamingService } from '@mintplayer/ng-spark/services';\nimport {\n TranslateKeyPipe,\n ResolveTranslationPipe,\n AttributeValuePipe,\n} from '@mintplayer/ng-spark/pipes';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SPARK_ATTRIBUTE_RENDERERS } from '@mintplayer/ng-spark/renderers';\nimport {\n StreamingMessage,\n EntityType,\n EntityAttributeDefinition,\n LookupReference,\n PersistentObject,\n SparkQuery,\n ShowedOn,\n hasShowedOnFlag,\n} from '@mintplayer/ng-spark/models';\n\n@Component({\n selector: 'spark-query-list',\n imports: [CommonModule, NgTemplateOutlet, NgComponentOutlet, FormsModule, RouterModule, BsAlertComponent, BsContainerComponent, BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, BsVirtualDatatableComponent, BsVirtualRowTemplateDirective, BsFormComponent, BsFormControlDirective, BsGridComponent, BsGridRowDirective, BsGridColumnDirective, BsInputGroupComponent, BsSpinnerComponent, SparkIconComponent, ResolveTranslationPipe, TranslateKeyPipe, AttributeValuePipe],\n templateUrl: './spark-query-list.component.html',\n styleUrl: './spark-query-list.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.virtual-scrolling]': 'isVirtualScrolling()'\n }\n})\nexport class SparkQueryListComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly sparkService = inject(SparkService);\n private readonly streamingService = inject(SparkStreamingService);\n private readonly rendererRegistry = inject(SPARK_ATTRIBUTE_RENDERERS);\n private readonly destroyRef = inject(DestroyRef);\n\n extraActionsTemplate = input<TemplateRef<void> | null>(null);\n\n rowClicked = output<PersistentObject>();\n createClicked = output<void>();\n\n colors = Color;\n errorMessage = signal<string | null>(null);\n query = signal<SparkQuery | null>(null);\n entityType = signal<EntityType | null>(null);\n allEntityTypes = signal<EntityType[]>([]);\n lookupReferenceOptions = signal<Record<string, LookupReference>>({});\n paginationData = signal<PaginationResponse<PersistentObject> | undefined>(undefined);\n searchTerm: string = '';\n canRead = signal(false);\n canCreate = signal(false);\n isStreaming = signal(false);\n private streamingSub: Subscription | null = null;\n private allItems = signal<PersistentObject[]>([]);\n private filteredItems: PersistentObject[] = [];\n settings = signal(new DatatableSettings({\n perPage: { values: [10, 25, 50], selected: 10 },\n page: { values: [1], selected: 1 },\n sortColumns: []\n }));\n virtualDataSource = signal<VirtualDatatableDataSource<PersistentObject> | null>(null);\n virtualSettings = signal(new DatatableSettings({\n sortColumns: []\n }));\n\n constructor() {\n this.route.paramMap.pipe(takeUntilDestroyed()).subscribe(params => this.onParamsChange(params));\n this.destroyRef.onDestroy(() => this.disconnectStreaming());\n }\n\n private async onParamsChange(params: any): Promise<void> {\n const queryId = params.get('queryId');\n const typeParam = params.get('type');\n\n let resolvedQuery: SparkQuery | null = null;\n let resolvedEntityType: EntityType | null = null;\n let resolvedEntityTypes: EntityType[] = [];\n\n if (queryId) {\n resolvedQuery = await this.sparkService.getQuery(queryId);\n if (resolvedQuery) {\n const result = await this.resolveEntityTypeForQuery(resolvedQuery);\n resolvedEntityType = result.entityType;\n resolvedEntityTypes = result.entityTypes;\n }\n } else if (typeParam) {\n resolvedEntityTypes = await this.sparkService.getEntityTypes();\n resolvedEntityType = resolvedEntityTypes.find(t =>\n t.id === typeParam || t.alias === typeParam\n ) || null;\n\n if (resolvedEntityType) {\n const queries = await this.sparkService.getQueries();\n const singularName = resolvedEntityType.name;\n resolvedQuery = queries.find(q => {\n // Match by explicit entityType\n if (q.entityType === singularName) return true;\n // Match by source name\n const sourceName = this.extractSourceName(q.source);\n const sourceSingular = this.singularize(sourceName);\n return sourceName === singularName ||\n sourceSingular === singularName ||\n sourceName === singularName + 's';\n }) || null;\n }\n }\n\n if (resolvedQuery) this.query.set(resolvedQuery);\n\n if (resolvedEntityType) {\n this.entityType.set(resolvedEntityType);\n this.allEntityTypes.set(resolvedEntityTypes);\n\n const initialSortColumns: SortColumn[] = (resolvedQuery?.sortColumns || []).map(sc => ({\n property: sc.property,\n direction: sc.direction === 'desc' ? 'descending' as const : 'ascending' as const\n }));\n\n if (resolvedQuery?.renderMode === 'VirtualScrolling') {\n this.virtualSettings.set(new DatatableSettings({ sortColumns: initialSortColumns }));\n if (resolvedQuery?.isStreamingQuery) {\n // Streaming + VirtualScrolling: create a stable client-side data source, then connect WebSocket\n this.virtualDataSource.set(new VirtualDatatableDataSource<PersistentObject>(\n (skip, take) => Promise.resolve({\n data: this.filteredItems.slice(skip, skip + take),\n totalRecords: this.filteredItems.length\n }),\n 50\n ));\n this.connectStreaming(resolvedQuery.id);\n } else {\n this.initVirtualDataSource();\n }\n } else {\n this.settings.set(new DatatableSettings({\n perPage: { values: [10, 25, 50], selected: 10 },\n page: { values: [1], selected: 1 },\n sortColumns: initialSortColumns\n }));\n await this.loadItems();\n }\n\n this.loadLookupReferenceOptions();\n const permissions = await this.sparkService.getPermissions(resolvedEntityType.id);\n this.canRead.set(permissions.canRead);\n this.canCreate.set(permissions.canCreate);\n }\n }\n\n private async resolveEntityTypeForQuery(query: SparkQuery): Promise<{ entityType: EntityType | null; entityTypes: EntityType[] }> {\n const entityTypes = await this.sparkService.getEntityTypes();\n\n // If entityType is explicitly set on the query, use it directly\n if (query.entityType) {\n const type = entityTypes.find(t =>\n t.name === query.entityType || t.alias === query.entityType?.toLowerCase()\n );\n return { entityType: type || null, entityTypes };\n }\n\n // For Database.X sources, extract the property name and try to match\n const sourceName = this.extractSourceName(query.source);\n const singularName = this.singularize(sourceName);\n const type = entityTypes.find(t =>\n t.name === sourceName ||\n t.name === singularName ||\n t.clrType.endsWith(singularName)\n );\n return { entityType: type || null, entityTypes };\n }\n\n private extractSourceName(source: string): string {\n const dotIndex = source.indexOf('.');\n return dotIndex >= 0 ? source.substring(dotIndex + 1) : source;\n }\n\n private singularize(plural: string): string {\n const irregulars: { [key: string]: string } = {\n 'People': 'Person',\n 'Children': 'Child',\n 'Men': 'Men',\n 'Women': 'Woman'\n };\n if (irregulars[plural]) return irregulars[plural];\n\n if (plural.endsWith('ies')) {\n return plural.slice(0, -3) + 'y';\n }\n if (plural.endsWith('es')) {\n return plural.slice(0, -2);\n }\n if (plural.endsWith('s')) {\n return plural.slice(0, -1);\n }\n return plural;\n }\n\n private initVirtualDataSource(): void {\n const currentQuery = this.query();\n if (!currentQuery) return;\n this.virtualDataSource.set(new VirtualDatatableDataSource<PersistentObject>(\n (skip, take) => this.sparkService.executeQuery(currentQuery.id, {\n sortColumns: this.virtualSettings().sortColumns,\n skip, take,\n search: this.searchTerm || undefined,\n }).then(r => ({ data: r.data, totalRecords: r.totalRecords })),\n 50\n ));\n }\n\n async loadItems(): Promise<void> {\n const currentQuery = this.query();\n if (!currentQuery) return;\n\n // Streaming queries use WebSocket instead of HTTP\n if (currentQuery.isStreamingQuery) {\n this.connectStreaming(currentQuery.id);\n return;\n }\n\n // Non-streaming: disconnect any previous streaming connection\n this.disconnectStreaming();\n\n try {\n const s = this.settings();\n const result = await this.sparkService.executeQuery(currentQuery.id, {\n sortColumns: s.sortColumns,\n skip: (s.page.selected - 1) * s.perPage.selected,\n take: s.perPage.selected,\n search: this.searchTerm || undefined,\n });\n this.errorMessage.set(null);\n\n const totalPages = Math.ceil(result.totalRecords / s.perPage.selected) || 1;\n this.paginationData.set({\n data: result.data,\n totalRecords: result.totalRecords,\n totalPages: totalPages,\n perPage: s.perPage.selected,\n page: s.page.selected\n });\n s.page.values = Array.from({ length: totalPages }, (_, i) => i + 1);\n } catch (e: any) {\n this.errorMessage.set(e.error?.error || e.message || 'An unexpected error occurred');\n this.paginationData.set(undefined);\n }\n }\n\n onSettingsChange(): void {\n if (this.isStreaming()) {\n // Streaming: sort/filter is client-side only\n this.applyFilter();\n return;\n }\n\n if (this.query()?.renderMode === 'VirtualScrolling') {\n this.virtualDataSource()?.reset();\n this.initVirtualDataSource();\n } else {\n this.loadItems();\n }\n }\n\n onSearchChange(): void {\n if (this.isStreaming()) {\n this.applyFilter();\n return;\n }\n\n if (this.query()?.renderMode === 'VirtualScrolling') {\n this.virtualDataSource()?.reset();\n this.initVirtualDataSource();\n } else {\n this.settings().page.selected = 1;\n this.loadItems();\n }\n }\n\n clearSearch(): void {\n this.searchTerm = '';\n this.onSearchChange();\n }\n\n isVirtualScrolling = computed(() => this.query()?.renderMode === 'VirtualScrolling');\n\n visibleAttributes = computed(() => {\n return this.entityType()?.attributes\n .filter(a => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.Query))\n .sort((a, b) => a.order - b.order) || [];\n });\n\n getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null {\n if (!attr.renderer) return null;\n return this.rendererRegistry.find(r => r.name === attr.renderer)?.columnComponent ?? null;\n }\n\n getColumnRendererInputs(item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any> {\n const itemAttr = item.attributes.find(a => a.name === attr.name);\n return {\n value: itemAttr?.value,\n attribute: attr,\n options: attr.rendererOptions,\n };\n }\n\n private async loadLookupReferenceOptions(): Promise<void> {\n const lookupAttrs = this.visibleAttributes().filter(a => a.lookupReferenceType);\n if (lookupAttrs.length === 0) return;\n\n const lookupNames = [...new Set(lookupAttrs.map(a => a.lookupReferenceType!))];\n const entries = await Promise.all(\n lookupNames.map(async name => {\n const result = await this.sparkService.getLookupReference(name);\n return [name, result] as const;\n })\n );\n this.lookupReferenceOptions.set(entries.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {} as Record<string, LookupReference>));\n }\n\n onCreate(): void {\n this.createClicked.emit();\n const et = this.entityType();\n if (et) {\n this.router.navigate(['/po', et.alias || et.id, 'new']);\n }\n }\n\n private connectStreaming(queryId: string): void {\n this.disconnectStreaming();\n this.isStreaming.set(true);\n\n this.streamingSub = this.streamingService.connectToStreamingQuery(queryId).subscribe({\n next: (message) => this.handleStreamingMessage(message),\n error: (err) => {\n this.errorMessage.set(err?.message || 'Streaming connection failed');\n this.isStreaming.set(false);\n },\n complete: () => {\n this.isStreaming.set(false);\n }\n });\n }\n\n private disconnectStreaming(): void {\n if (this.streamingSub) {\n this.streamingSub.unsubscribe();\n this.streamingSub = null;\n }\n this.isStreaming.set(false);\n }\n\n private handleStreamingMessage(message: StreamingMessage): void {\n switch (message.type) {\n case 'snapshot':\n this.errorMessage.set(null);\n this.allItems.set(message.data);\n this.applyFilter();\n break;\n\n case 'patch':\n if (message.updated.length > 0) {\n const currentItems = this.allItems();\n const updatedItems = currentItems.map(item => {\n const patch = message.updated.find(u => u.id === item.id);\n if (!patch) return item;\n\n // Clone the item and update only changed attribute values\n const updatedAttributes = item.attributes.map(attr => {\n if (attr.name in patch.attributes) {\n return { ...attr, value: patch.attributes[attr.name] };\n }\n return attr;\n });\n\n return { ...item, attributes: updatedAttributes };\n });\n\n this.allItems.set(updatedItems);\n this.applyFilter();\n }\n break;\n\n case 'error':\n this.errorMessage.set(message.message);\n break;\n }\n }\n\n private applyFilter(): void {\n let items = this.allItems();\n\n // Apply search filter\n if (this.searchTerm) {\n const term = this.searchTerm.toLowerCase();\n items = items.filter(item =>\n item.attributes.some(a => String(a.value ?? '').toLowerCase().includes(term))\n );\n }\n\n // Apply sorting\n const isVirtual = this.query()?.renderMode === 'VirtualScrolling';\n const sortCols = isVirtual ? this.virtualSettings().sortColumns : this.settings().sortColumns;\n if (sortCols.length > 0) {\n items = [...items].sort((a, b) => {\n for (const col of sortCols) {\n const aVal = a.attributes.find(attr => attr.name === col.property)?.value ?? '';\n const bVal = b.attributes.find(attr => attr.name === col.property)?.value ?? '';\n const cmp = String(aVal).localeCompare(String(bVal));\n if (cmp !== 0) return col.direction === 'descending' ? -cmp : cmp;\n }\n return 0;\n });\n }\n\n if (isVirtual) {\n // Update the mutable filtered items array.\n // The stable data source's fetchFn closure reads from this.filteredItems,\n // so clearing its cache and emitting empty triggers the CDK viewport to re-fetch.\n this.filteredItems = items;\n this.virtualDataSource()?.reset();\n } else {\n this.paginationData.set({\n data: items,\n totalRecords: items.length,\n totalPages: 1,\n perPage: items.length,\n page: 1\n });\n }\n }\n}\n","<div class=\"d-flex flex-column h-100\">\n <!-- Title + Actions row -->\n <div class=\"d-flex justify-content-between align-items-center mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <h2>\n {{ (query()?.description | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <span class=\"badge bg-success ms-2\" style=\"font-size: 0.5em; vertical-align: middle;\">LIVE</span>\n }\n </h2>\n <div class=\"d-flex gap-2\">\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n }\n @if (canCreate()) {\n <button class=\"btn btn-primary\" (click)=\"onCreate()\">\n <spark-icon name=\"plus-lg\" /> {{ 'common.new' | t }}\n </button>\n }\n </div>\n </div>\n\n @if (entityType()) {\n <!-- Search box -->\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-form>\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"4\">\n <bs-input-group>\n <span class=\"input-group-text\">\n <spark-icon name=\"search\" />\n </span>\n <input\n type=\"text\"\n [placeholder]=\"'common.search' | t\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchChange()\">\n @if (searchTerm) {\n <button\n type=\"button\"\n class=\"btn btn-outline-secondary\"\n (click)=\"clearSearch()\">\n <spark-icon name=\"x-lg\" />\n </button>\n }\n </bs-input-group>\n </div>\n <div [md]=\"8\" class=\"text-end\">\n @if (searchTerm && paginationData()) {\n <span class=\"text-muted\">\n {{ paginationData()!.totalRecords }} {{ paginationData()!.totalRecords === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n }\n </div>\n </div>\n </bs-grid>\n </bs-form>\n\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n </div>\n\n @if (query()?.renderMode === 'VirtualScrolling') {\n @if (virtualDataSource(); as vds) {\n <bs-virtual-datatable class=\"flex-grow-1 overflow-hidden\"\n [(settings)]=\"virtualSettings\"\n [dataSource]=\"vds\"\n [isResponsive]=\"true\"\n (settingsChange)=\"onSettingsChange()\">\n @for (attr of visibleAttributes(); track attr.id) {\n <div *bsDatatableColumn=\"attr.name; sortable: true\">\n {{ (attr.label | resolveTranslation) || attr.name }}\n </div>\n }\n\n <ng-template bsVirtualRowTemplate let-item>\n @for (attr of visibleAttributes(); track attr.id; let first = $first) {\n <td>\n @if (item) {\n @if (first && canRead()) {\n <a [routerLink]=\"['/po', entityType()!.alias || entityType()!.id, item.id]\" (click)=\"rowClicked.emit(item)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n }\n } @else {\n \n }\n </td>\n }\n </ng-template>\n </bs-virtual-datatable>\n }\n } @else {\n <bs-datatable class=\"flex-grow-1\" [(settings)]=\"settings\" (settingsChange)=\"onSettingsChange()\">\n @for (attr of visibleAttributes(); track attr.id) {\n <div *bsDatatableColumn=\"attr.name; sortable: true\">\n {{ (attr.label | resolveTranslation) || attr.name }}\n </div>\n }\n\n <tr *bsRowTemplate=\"let item of paginationData()\">\n @for (attr of visibleAttributes(); track attr.id; let first = $first) {\n <td>\n @if (first && canRead()) {\n <a [routerLink]=\"['/po', entityType()!.alias || entityType()!.id, item.id]\" (click)=\"rowClicked.emit(item)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n }\n </td>\n }\n </tr>\n </bs-datatable>\n }\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n\n<ng-template #cellContent let-item let-attr=\"attr\">\n @if (getColumnRendererComponent(attr); as rendererType) {\n <ng-container *ngComponentOutlet=\"rendererType; inputs: getColumnRendererInputs(item, attr)\"></ng-container>\n } @else if (attr.dataType === 'boolean') {\n <input type=\"checkbox\"\n [checked]=\"(attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) === true\"\n [indeterminate]=\"(attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) == null\"\n disabled\n onclick=\"return false;\">\n } @else if (attr.dataType === 'color') {\n @let colorVal = (attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes());\n @if (colorVal) {\n <span class=\"d-inline-block align-middle border rounded\" [style.background-color]=\"colorVal\" style=\"width: 1.5em; height: 1.5em;\"></span>\n }\n } @else {\n {{ (attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) }}\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MA6Ca,uBAAuB,CAAA;AACjB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;AACnC,IAAA,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAChD,IAAA,gBAAgB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACpD,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhD,IAAA,oBAAoB,GAAG,KAAK,CAA2B,IAAI,gEAAC;IAE5D,UAAU,GAAG,MAAM,EAAoB;IACvC,aAAa,GAAG,MAAM,EAAQ;IAE9B,MAAM,GAAG,KAAK;AACd,IAAA,YAAY,GAAG,MAAM,CAAgB,IAAI,wDAAC;AAC1C,IAAA,KAAK,GAAG,MAAM,CAAoB,IAAI,iDAAC;AACvC,IAAA,UAAU,GAAG,MAAM,CAAoB,IAAI,sDAAC;AAC5C,IAAA,cAAc,GAAG,MAAM,CAAe,EAAE,0DAAC;AACzC,IAAA,sBAAsB,GAAG,MAAM,CAAkC,EAAE,kEAAC;AACpE,IAAA,cAAc,GAAG,MAAM,CAAmD,SAAS,0DAAC;IACpF,UAAU,GAAW,EAAE;AACvB,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,mDAAC;AACvB,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,qDAAC;AACzB,IAAA,WAAW,GAAG,M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MAAA,EAAA,IAAA,EAAE,gBAAgB,qCAAE,kBAAkB,EAAA,IAAA,EAAA,gBAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQ3d,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAVnC,SAAS;+BACE,kBAAkB,EAAA,OAAA,EACnB,CAAC,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAA,eAAA,EAGtd,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,2BAA2B,EAAE;AAC9B,qBAAA,EAAA,QAAA,EAAA,q9LAAA,EAAA,MAAA,EAAA,CAAA,qNAAA,CAAA,EAAA;;;AE3CH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-spark-query-list.mjs","sources":["../../query-list/src/spark-query-list.component.ts","../../query-list/src/spark-query-list.component.html","../../query-list/mintplayer-ng-spark-query-list.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, input, output, signal, TemplateRef, Type } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subscription } from 'rxjs';\nimport { CommonModule, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, DatatableSettings } from '@mintplayer/ng-bootstrap/datatable';\nimport { BsVirtualDatatableComponent, BsVirtualRowTemplateDirective, VirtualDatatableDataSource } from '@mintplayer/ng-bootstrap/virtual-datatable';\nimport { BsFormComponent, BsFormControlDirective } from '@mintplayer/ng-bootstrap/form';\nimport { BsContainerComponent } from '@mintplayer/ng-bootstrap/container';\nimport { BsGridComponent, BsGridRowDirective, BsGridColumnDirective } from '@mintplayer/ng-bootstrap/grid';\nimport { BsInputGroupComponent } from '@mintplayer/ng-bootstrap/input-group';\nimport { BsPriorityNavComponent, BsPriorityNavItemDirective } from '@mintplayer/ng-bootstrap/priority-nav';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { PaginationResponse, SortColumn } from '@mintplayer/pagination';\nimport { SparkService, SparkStreamingService, SparkLanguageService } from '@mintplayer/ng-spark/services';\nimport {\n TranslateKeyPipe,\n ResolveTranslationPipe,\n AttributeValuePipe,\n} from '@mintplayer/ng-spark/pipes';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SPARK_ATTRIBUTE_RENDERERS } from '@mintplayer/ng-spark/renderers';\nimport {\n CustomActionDefinition,\n StreamingMessage,\n EntityType,\n EntityAttributeDefinition,\n LookupReference,\n PersistentObject,\n SparkQuery,\n ShowedOn,\n hasShowedOnFlag,\n} from '@mintplayer/ng-spark/models';\n\n@Component({\n selector: 'spark-query-list',\n imports: [CommonModule, NgTemplateOutlet, NgComponentOutlet, FormsModule, RouterModule, BsAlertComponent, BsContainerComponent, BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, BsVirtualDatatableComponent, BsVirtualRowTemplateDirective, BsFormComponent, BsFormControlDirective, BsGridComponent, BsGridRowDirective, BsGridColumnDirective, BsInputGroupComponent, BsPriorityNavComponent, BsPriorityNavItemDirective, BsSpinnerComponent, SparkIconComponent, ResolveTranslationPipe, TranslateKeyPipe, AttributeValuePipe],\n templateUrl: './spark-query-list.component.html',\n styleUrl: './spark-query-list.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.virtual-scrolling]': 'isVirtualScrolling()'\n }\n})\nexport class SparkQueryListComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly sparkService = inject(SparkService);\n private readonly streamingService = inject(SparkStreamingService);\n protected readonly lang = inject(SparkLanguageService);\n private readonly rendererRegistry = inject(SPARK_ATTRIBUTE_RENDERERS);\n private readonly destroyRef = inject(DestroyRef);\n\n extraActionsTemplate = input<TemplateRef<void> | null>(null);\n showCustomActions = input(true);\n\n rowClicked = output<PersistentObject>();\n createClicked = output<void>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n errorMessage = signal<string | null>(null);\n query = signal<SparkQuery | null>(null);\n entityType = signal<EntityType | null>(null);\n allEntityTypes = signal<EntityType[]>([]);\n lookupReferenceOptions = signal<Record<string, LookupReference>>({});\n paginationData = signal<PaginationResponse<PersistentObject> | undefined>(undefined);\n searchTerm: string = '';\n canRead = signal(false);\n canCreate = signal(false);\n customActions = signal<CustomActionDefinition[]>([]);\n isStreaming = signal(false);\n private streamingSub: Subscription | null = null;\n private allItems = signal<PersistentObject[]>([]);\n private filteredItems: PersistentObject[] = [];\n settings = signal(new DatatableSettings({\n perPage: { values: [10, 25, 50], selected: 10 },\n page: { values: [1], selected: 1 },\n sortColumns: []\n }));\n virtualDataSource = signal<VirtualDatatableDataSource<PersistentObject> | null>(null);\n virtualSettings = signal(new DatatableSettings({\n sortColumns: []\n }));\n\n constructor() {\n this.route.paramMap.pipe(takeUntilDestroyed()).subscribe(params => this.onParamsChange(params));\n this.destroyRef.onDestroy(() => this.disconnectStreaming());\n }\n\n private async onParamsChange(params: any): Promise<void> {\n const queryId = params.get('queryId');\n const typeParam = params.get('type');\n\n let resolvedQuery: SparkQuery | null = null;\n let resolvedEntityType: EntityType | null = null;\n let resolvedEntityTypes: EntityType[] = [];\n\n if (queryId) {\n resolvedQuery = await this.sparkService.getQuery(queryId);\n if (resolvedQuery) {\n const result = await this.resolveEntityTypeForQuery(resolvedQuery);\n resolvedEntityType = result.entityType;\n resolvedEntityTypes = result.entityTypes;\n }\n } else if (typeParam) {\n resolvedEntityTypes = await this.sparkService.getEntityTypes();\n resolvedEntityType = resolvedEntityTypes.find(t =>\n t.id === typeParam || t.alias === typeParam\n ) || null;\n\n if (resolvedEntityType) {\n const queries = await this.sparkService.getQueries();\n const singularName = resolvedEntityType.name;\n resolvedQuery = queries.find(q => {\n // Match by explicit entityType\n if (q.entityType === singularName) return true;\n // Match by source name\n const sourceName = this.extractSourceName(q.source);\n const sourceSingular = this.singularize(sourceName);\n return sourceName === singularName ||\n sourceSingular === singularName ||\n sourceName === singularName + 's';\n }) || null;\n }\n }\n\n if (resolvedQuery) this.query.set(resolvedQuery);\n\n if (resolvedEntityType) {\n this.entityType.set(resolvedEntityType);\n this.allEntityTypes.set(resolvedEntityTypes);\n\n const initialSortColumns: SortColumn[] = (resolvedQuery?.sortColumns || []).map(sc => ({\n property: sc.property,\n direction: sc.direction === 'desc' ? 'descending' as const : 'ascending' as const\n }));\n\n if (resolvedQuery?.renderMode === 'VirtualScrolling') {\n this.virtualSettings.set(new DatatableSettings({ sortColumns: initialSortColumns }));\n if (resolvedQuery?.isStreamingQuery) {\n // Streaming + VirtualScrolling: create a stable client-side data source, then connect WebSocket\n this.virtualDataSource.set(new VirtualDatatableDataSource<PersistentObject>(\n (skip, take) => Promise.resolve({\n data: this.filteredItems.slice(skip, skip + take),\n totalRecords: this.filteredItems.length\n }),\n 50\n ));\n this.connectStreaming(resolvedQuery.id);\n } else {\n this.initVirtualDataSource();\n }\n } else {\n this.settings.set(new DatatableSettings({\n perPage: { values: [10, 25, 50], selected: 10 },\n page: { values: [1], selected: 1 },\n sortColumns: initialSortColumns\n }));\n await this.loadItems();\n }\n\n this.loadLookupReferenceOptions();\n const [permissions, actions] = await Promise.all([\n this.sparkService.getPermissions(resolvedEntityType.id),\n this.sparkService.getCustomActions(resolvedEntityType.id),\n ]);\n this.canRead.set(permissions.canRead);\n this.canCreate.set(permissions.canCreate);\n this.customActions.set(actions.filter(a => a.showedOn === 'list' || a.showedOn === 'both'));\n }\n }\n\n async onCustomAction(action: CustomActionDefinition): Promise<void> {\n if (action.confirmationMessageKey) {\n const message = this.lang.t(action.confirmationMessageKey) || 'Are you sure?';\n if (!confirm(message)) return;\n }\n try {\n await this.sparkService.executeCustomAction(this.entityType()!.id, action.name);\n this.customActionExecuted.emit({ action });\n if (action.refreshOnCompleted) {\n this.onSettingsChange();\n }\n } catch (e) {\n const err = e as HttpErrorResponse;\n this.errorMessage.set(err.error?.error || err.message || 'Action failed');\n }\n }\n\n private async resolveEntityTypeForQuery(query: SparkQuery): Promise<{ entityType: EntityType | null; entityTypes: EntityType[] }> {\n const entityTypes = await this.sparkService.getEntityTypes();\n\n // If entityType is explicitly set on the query, use it directly\n if (query.entityType) {\n const type = entityTypes.find(t =>\n t.name === query.entityType || t.alias === query.entityType?.toLowerCase()\n );\n return { entityType: type || null, entityTypes };\n }\n\n // For Database.X sources, extract the property name and try to match\n const sourceName = this.extractSourceName(query.source);\n const singularName = this.singularize(sourceName);\n const type = entityTypes.find(t =>\n t.name === sourceName ||\n t.name === singularName ||\n t.clrType.endsWith(singularName)\n );\n return { entityType: type || null, entityTypes };\n }\n\n private extractSourceName(source: string): string {\n const dotIndex = source.indexOf('.');\n return dotIndex >= 0 ? source.substring(dotIndex + 1) : source;\n }\n\n private singularize(plural: string): string {\n const irregulars: { [key: string]: string } = {\n 'People': 'Person',\n 'Children': 'Child',\n 'Men': 'Men',\n 'Women': 'Woman'\n };\n if (irregulars[plural]) return irregulars[plural];\n\n if (plural.endsWith('ies')) {\n return plural.slice(0, -3) + 'y';\n }\n if (plural.endsWith('es')) {\n return plural.slice(0, -2);\n }\n if (plural.endsWith('s')) {\n return plural.slice(0, -1);\n }\n return plural;\n }\n\n private initVirtualDataSource(): void {\n const currentQuery = this.query();\n if (!currentQuery) return;\n this.virtualDataSource.set(new VirtualDatatableDataSource<PersistentObject>(\n (skip, take) => this.sparkService.executeQuery(currentQuery.id, {\n sortColumns: this.virtualSettings().sortColumns,\n skip, take,\n search: this.searchTerm || undefined,\n }).then(r => ({ data: r.data, totalRecords: r.totalRecords })),\n 50\n ));\n }\n\n async loadItems(): Promise<void> {\n const currentQuery = this.query();\n if (!currentQuery) return;\n\n // Streaming queries use WebSocket instead of HTTP\n if (currentQuery.isStreamingQuery) {\n this.connectStreaming(currentQuery.id);\n return;\n }\n\n // Non-streaming: disconnect any previous streaming connection\n this.disconnectStreaming();\n\n try {\n const s = this.settings();\n const result = await this.sparkService.executeQuery(currentQuery.id, {\n sortColumns: s.sortColumns,\n skip: (s.page.selected - 1) * s.perPage.selected,\n take: s.perPage.selected,\n search: this.searchTerm || undefined,\n });\n this.errorMessage.set(null);\n\n const totalPages = Math.ceil(result.totalRecords / s.perPage.selected) || 1;\n this.paginationData.set({\n data: result.data,\n totalRecords: result.totalRecords,\n totalPages: totalPages,\n perPage: s.perPage.selected,\n page: s.page.selected\n });\n s.page.values = Array.from({ length: totalPages }, (_, i) => i + 1);\n } catch (e: any) {\n this.errorMessage.set(e.error?.error || e.message || 'An unexpected error occurred');\n this.paginationData.set(undefined);\n }\n }\n\n onSettingsChange(): void {\n if (this.isStreaming()) {\n // Streaming: sort/filter is client-side only\n this.applyFilter();\n return;\n }\n\n if (this.query()?.renderMode === 'VirtualScrolling') {\n this.virtualDataSource()?.reset();\n this.initVirtualDataSource();\n } else {\n this.loadItems();\n }\n }\n\n onSearchChange(): void {\n if (this.isStreaming()) {\n this.applyFilter();\n return;\n }\n\n if (this.query()?.renderMode === 'VirtualScrolling') {\n this.virtualDataSource()?.reset();\n this.initVirtualDataSource();\n } else {\n this.settings().page.selected = 1;\n this.loadItems();\n }\n }\n\n clearSearch(): void {\n this.searchTerm = '';\n this.onSearchChange();\n }\n\n isVirtualScrolling = computed(() => this.query()?.renderMode === 'VirtualScrolling');\n\n visibleAttributes = computed(() => {\n return this.entityType()?.attributes\n .filter(a => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.Query))\n .sort((a, b) => a.order - b.order) || [];\n });\n\n getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null {\n if (!attr.renderer) return null;\n return this.rendererRegistry.find(r => r.name === attr.renderer)?.columnComponent ?? null;\n }\n\n getColumnRendererInputs(item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any> {\n const itemAttr = item.attributes.find(a => a.name === attr.name);\n return {\n value: itemAttr?.value,\n attribute: attr,\n options: attr.rendererOptions,\n };\n }\n\n private async loadLookupReferenceOptions(): Promise<void> {\n const lookupAttrs = this.visibleAttributes().filter(a => a.lookupReferenceType);\n if (lookupAttrs.length === 0) return;\n\n const lookupNames = [...new Set(lookupAttrs.map(a => a.lookupReferenceType!))];\n const entries = await Promise.all(\n lookupNames.map(async name => {\n const result = await this.sparkService.getLookupReference(name);\n return [name, result] as const;\n })\n );\n this.lookupReferenceOptions.set(entries.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {} as Record<string, LookupReference>));\n }\n\n onCreate(): void {\n this.createClicked.emit();\n const et = this.entityType();\n if (et) {\n this.router.navigate(['/po', et.alias || et.id, 'new']);\n }\n }\n\n private connectStreaming(queryId: string): void {\n this.disconnectStreaming();\n this.isStreaming.set(true);\n\n this.streamingSub = this.streamingService.connectToStreamingQuery(queryId).subscribe({\n next: (message) => this.handleStreamingMessage(message),\n error: (err) => {\n this.errorMessage.set(err?.message || 'Streaming connection failed');\n this.isStreaming.set(false);\n },\n complete: () => {\n this.isStreaming.set(false);\n }\n });\n }\n\n private disconnectStreaming(): void {\n if (this.streamingSub) {\n this.streamingSub.unsubscribe();\n this.streamingSub = null;\n }\n this.isStreaming.set(false);\n }\n\n private handleStreamingMessage(message: StreamingMessage): void {\n switch (message.type) {\n case 'snapshot':\n this.errorMessage.set(null);\n this.allItems.set(message.data);\n this.applyFilter();\n break;\n\n case 'patch':\n if (message.updated.length > 0) {\n const currentItems = this.allItems();\n const updatedItems = currentItems.map(item => {\n const patch = message.updated.find(u => u.id === item.id);\n if (!patch) return item;\n\n // Clone the item and update only changed attribute values\n const updatedAttributes = item.attributes.map(attr => {\n if (attr.name in patch.attributes) {\n return { ...attr, value: patch.attributes[attr.name] };\n }\n return attr;\n });\n\n return { ...item, attributes: updatedAttributes };\n });\n\n this.allItems.set(updatedItems);\n this.applyFilter();\n }\n break;\n\n case 'error':\n this.errorMessage.set(message.message);\n break;\n }\n }\n\n private applyFilter(): void {\n let items = this.allItems();\n\n // Apply search filter\n if (this.searchTerm) {\n const term = this.searchTerm.toLowerCase();\n items = items.filter(item =>\n item.attributes.some(a => String(a.value ?? '').toLowerCase().includes(term))\n );\n }\n\n // Apply sorting\n const isVirtual = this.query()?.renderMode === 'VirtualScrolling';\n const sortCols = isVirtual ? this.virtualSettings().sortColumns : this.settings().sortColumns;\n if (sortCols.length > 0) {\n items = [...items].sort((a, b) => {\n for (const col of sortCols) {\n const aVal = a.attributes.find(attr => attr.name === col.property)?.value ?? '';\n const bVal = b.attributes.find(attr => attr.name === col.property)?.value ?? '';\n const cmp = String(aVal).localeCompare(String(bVal));\n if (cmp !== 0) return col.direction === 'descending' ? -cmp : cmp;\n }\n return 0;\n });\n }\n\n if (isVirtual) {\n // Update the mutable filtered items array.\n // The stable data source's fetchFn closure reads from this.filteredItems,\n // so clearing its cache and emitting empty triggers the CDK viewport to re-fetch.\n this.filteredItems = items;\n this.virtualDataSource()?.reset();\n } else {\n this.paginationData.set({\n data: items,\n totalRecords: items.length,\n totalPages: 1,\n perPage: items.length,\n page: 1\n });\n }\n }\n}\n","<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\" [class.px-3]=\"!isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @if (canCreate()) {\n <button *bsPriorityNavItem=\"1\" class=\"btn btn-primary\" (click)=\"onCreate()\">\n <spark-icon name=\"plus-lg\" /> {{ 'common.new' | t }}\n </button>\n }\n @if (showCustomActions()) {\n @for (action of customActions(); track action.name) {\n <button *bsPriorityNavItem=\"10 + action.offset\" class=\"btn btn-outline-primary\" (click)=\"onCustomAction(action)\">\n {{ action.displayName | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n </bs-priority-nav>\n </div>\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.description | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <span class=\"badge bg-success ms-2\" style=\"font-size: 0.5em; vertical-align: middle;\">LIVE</span>\n }\n </h2>\n\n @if (entityType()) {\n <!-- Search box -->\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-form>\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"4\">\n <bs-input-group>\n <span class=\"input-group-text\">\n <spark-icon name=\"search\" />\n </span>\n <input\n type=\"text\"\n [placeholder]=\"'common.search' | t\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchChange()\">\n @if (searchTerm) {\n <button\n type=\"button\"\n class=\"btn btn-outline-secondary\"\n (click)=\"clearSearch()\">\n <spark-icon name=\"x-lg\" />\n </button>\n }\n </bs-input-group>\n </div>\n <div [md]=\"8\" class=\"text-end\">\n @if (searchTerm && paginationData()) {\n <span class=\"text-muted\">\n {{ paginationData()!.totalRecords }} {{ paginationData()!.totalRecords === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n }\n </div>\n </div>\n </bs-grid>\n </bs-form>\n\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n </div>\n\n @if (query()?.renderMode === 'VirtualScrolling') {\n @if (virtualDataSource(); as vds) {\n <bs-virtual-datatable class=\"flex-grow-1 overflow-hidden\"\n [(settings)]=\"virtualSettings\"\n [dataSource]=\"vds\"\n [isResponsive]=\"true\"\n (settingsChange)=\"onSettingsChange()\">\n @for (attr of visibleAttributes(); track attr.id) {\n <div *bsDatatableColumn=\"attr.name; sortable: true\">\n {{ (attr.label | resolveTranslation) || attr.name }}\n </div>\n }\n\n <ng-template bsVirtualRowTemplate let-item>\n @for (attr of visibleAttributes(); track attr.id; let first = $first) {\n <td>\n @if (item) {\n @if (first && canRead()) {\n <a [routerLink]=\"['/po', entityType()!.alias || entityType()!.id, item.id]\" (click)=\"rowClicked.emit(item)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n }\n } @else {\n \n }\n </td>\n }\n </ng-template>\n </bs-virtual-datatable>\n }\n } @else {\n <bs-datatable class=\"flex-grow-1\" [(settings)]=\"settings\" (settingsChange)=\"onSettingsChange()\">\n @for (attr of visibleAttributes(); track attr.id) {\n <div *bsDatatableColumn=\"attr.name; sortable: true\">\n {{ (attr.label | resolveTranslation) || attr.name }}\n </div>\n }\n\n <tr *bsRowTemplate=\"let item of paginationData()\">\n @for (attr of visibleAttributes(); track attr.id; let first = $first) {\n <td>\n @if (first && canRead()) {\n <a [routerLink]=\"['/po', entityType()!.alias || entityType()!.id, item.id]\" (click)=\"rowClicked.emit(item)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: item, attr: attr }\"></ng-container>\n }\n </td>\n }\n </tr>\n </bs-datatable>\n }\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n\n<ng-template #cellContent let-item let-attr=\"attr\">\n @if (getColumnRendererComponent(attr); as rendererType) {\n <ng-container *ngComponentOutlet=\"rendererType; inputs: getColumnRendererInputs(item, attr)\"></ng-container>\n } @else if (attr.dataType === 'boolean') {\n <input type=\"checkbox\"\n [checked]=\"(attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) === true\"\n [indeterminate]=\"(attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) == null\"\n disabled\n onclick=\"return false;\">\n } @else if (attr.dataType === 'color') {\n @let colorVal = (attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes());\n @if (colorVal) {\n <span class=\"d-inline-block align-middle border rounded\" [style.background-color]=\"colorVal\" style=\"width: 1.5em; height: 1.5em;\"></span>\n }\n } @else {\n {{ (attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes()) }}\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAgDa,uBAAuB,CAAA;AACjB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;AACnC,IAAA,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC9C,IAAA,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACrC,IAAA,gBAAgB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACpD,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhD,IAAA,oBAAoB,GAAG,KAAK,CAA2B,IAAI,gEAAC;AAC5D,IAAA,iBAAiB,GAAG,KAAK,CAAC,IAAI,6DAAC;IAE/B,UAAU,GAAG,MAAM,EAAoB;IACvC,aAAa,GAAG,MAAM,EAA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EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAA,eAAA,EAG1gB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,2BAA2B,EAAE;AAC9B,qBAAA,EAAA,QAAA,EAAA,69MAAA,EAAA,MAAA,EAAA,CAAA,uZAAA,CAAA,EAAA;;;AE9CH;;AAEG;;;;"}
|
|
@@ -1,25 +1,103 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { inject, computed, signal, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { Color } from '@mintplayer/ng-bootstrap';
|
|
5
5
|
import { BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective } from '@mintplayer/ng-bootstrap/modal';
|
|
6
6
|
import { BsButtonTypeDirective } from '@mintplayer/ng-bootstrap/button-type';
|
|
7
|
-
import { RetryActionService } from '@mintplayer/ng-spark/services';
|
|
7
|
+
import { RetryActionService, SparkService } from '@mintplayer/ng-spark/services';
|
|
8
|
+
import { SparkPoFormComponent } from '@mintplayer/ng-spark/po-form';
|
|
9
|
+
import { nestedPoToDict, dictToNestedPo } from '@mintplayer/ng-spark/models';
|
|
8
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Renders a retry-action popup. Before PRD §3 this component rendered title / message /
|
|
13
|
+
* option buttons only and silently forwarded the incoming <c>persistentObject</c> back to
|
|
14
|
+
* the server on submit — meaning any <c>Retry.Action(..., persistentObject)</c> flow had
|
|
15
|
+
* no UI to actually edit the PO. This component now embeds the shared PO form so every
|
|
16
|
+
* scalar / Reference / AsDetail attribute on the scaffolded Virtual PO is a real form
|
|
17
|
+
* field, and the values the user fills in flow back to the server via
|
|
18
|
+
* <c>RetryResult.PersistentObject</c>.
|
|
19
|
+
*/
|
|
9
20
|
class SparkRetryActionModalComponent {
|
|
10
21
|
retryActionService = inject(RetryActionService);
|
|
22
|
+
sparkService = inject(SparkService);
|
|
11
23
|
colors = Color;
|
|
12
24
|
isOpen = computed(() => this.retryActionService.payload() !== null, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
25
|
+
/**
|
|
26
|
+
* EntityType definition for the incoming PO — fetched lazily via SparkService so the
|
|
27
|
+
* form knows which attributes are editable, their labels, rules, renderers, etc.
|
|
28
|
+
* `null` when the payload has no persistentObject or its objectTypeId doesn't match
|
|
29
|
+
* any registered entity type (renders the modal as a simple option picker).
|
|
30
|
+
*/
|
|
31
|
+
entityType = signal(null, ...(ngDevMode ? [{ debugName: "entityType" }] : []));
|
|
32
|
+
formData = signal({}, ...(ngDevMode ? [{ debugName: "formData" }] : []));
|
|
33
|
+
allEntityTypes = [];
|
|
34
|
+
constructor() {
|
|
35
|
+
// Reseed form state every time the retry service opens/closes the modal. Effect
|
|
36
|
+
// cleanup isn't needed since `payload` is a signal and the component's own lifetime
|
|
37
|
+
// is root-scoped.
|
|
38
|
+
effect(() => {
|
|
39
|
+
const payload = this.retryActionService.payload();
|
|
40
|
+
if (!payload?.persistentObject) {
|
|
41
|
+
this.entityType.set(null);
|
|
42
|
+
this.formData.set({});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
void this.seedForm(payload.persistentObject);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async seedForm(po) {
|
|
49
|
+
// Virtual POs used for retry prompts (e.g. ConfirmDeleteCar) typically have no
|
|
50
|
+
// security.json grant — so `getEntityTypes()` filters them out for the current user
|
|
51
|
+
// and the lookup-by-id would return null, leaving the form blank. The scaffolded PO
|
|
52
|
+
// already carries full attribute metadata (label / dataType / rules / renderer / etc.),
|
|
53
|
+
// so we synthesize an EntityType from the attributes directly and skip the HTTP
|
|
54
|
+
// lookup altogether. `getEntityTypes()` is still fetched once (cached on the
|
|
55
|
+
// component) because the embedded spark-po-form needs the full list to resolve
|
|
56
|
+
// nested AsDetail / Reference types the retry PO might point at.
|
|
57
|
+
if (this.allEntityTypes.length === 0) {
|
|
58
|
+
try {
|
|
59
|
+
this.allEntityTypes = await this.sparkService.getEntityTypes();
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
this.allEntityTypes = [];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.entityType.set(entityTypeFromPo(po));
|
|
66
|
+
// Flatten the nested PO into the Record<string, any> shape the shared form uses
|
|
67
|
+
// throughout the rest of ng-spark — same transformation po-edit applies.
|
|
68
|
+
this.formData.set(nestedPoToDict(po));
|
|
69
|
+
}
|
|
13
70
|
onOption(option) {
|
|
14
71
|
const payload = this.retryActionService.payload();
|
|
15
72
|
if (!payload)
|
|
16
73
|
return;
|
|
74
|
+
const populated = this.populatedPersistentObject(payload.persistentObject);
|
|
17
75
|
this.retryActionService.respond({
|
|
18
76
|
step: payload.step,
|
|
19
77
|
option,
|
|
20
|
-
persistentObject:
|
|
78
|
+
persistentObject: populated,
|
|
21
79
|
});
|
|
22
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Builds the PO the server sees under <c>Retry.Result.PersistentObject</c>. If the
|
|
83
|
+
* form resolved an EntityType, rebuild from the schema + formData (identical to the
|
|
84
|
+
* po-edit save path — AsDetail recursion included). Otherwise forward the incoming
|
|
85
|
+
* PO unmodified so pre-§3 flows without editable attributes keep working.
|
|
86
|
+
*/
|
|
87
|
+
populatedPersistentObject(incoming) {
|
|
88
|
+
if (!incoming)
|
|
89
|
+
return undefined;
|
|
90
|
+
const type = this.entityType();
|
|
91
|
+
if (!type)
|
|
92
|
+
return incoming;
|
|
93
|
+
const resolver = (clrName) => this.allEntityTypes.find(t => t.clrType === clrName);
|
|
94
|
+
const rebuilt = dictToNestedPo(this.formData(), type, resolver);
|
|
95
|
+
const populated = {
|
|
96
|
+
...incoming,
|
|
97
|
+
attributes: mergeAttributeMetadata(incoming.attributes ?? [], rebuilt.attributes),
|
|
98
|
+
};
|
|
99
|
+
return populated;
|
|
100
|
+
}
|
|
23
101
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SparkRetryActionModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
24
102
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.6", type: SparkRetryActionModalComponent, isStandalone: true, selector: "spark-retry-action-modal", ngImport: i0, template: `
|
|
25
103
|
<bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption('Cancel')">
|
|
@@ -27,11 +105,18 @@ class SparkRetryActionModalComponent {
|
|
|
27
105
|
<div bsModalHeader>
|
|
28
106
|
<h5 class="modal-title">{{ retryActionService.payload()?.title }}</h5>
|
|
29
107
|
</div>
|
|
30
|
-
|
|
31
|
-
|
|
108
|
+
<div bsModalBody>
|
|
109
|
+
@if (retryActionService.payload()?.message; as message) {
|
|
32
110
|
<p>{{ message }}</p>
|
|
33
|
-
|
|
34
|
-
|
|
111
|
+
}
|
|
112
|
+
@if (entityType(); as et) {
|
|
113
|
+
<spark-po-form
|
|
114
|
+
[entityType]="et"
|
|
115
|
+
[(formData)]="formData"
|
|
116
|
+
[showButtons]="false">
|
|
117
|
+
</spark-po-form>
|
|
118
|
+
}
|
|
119
|
+
</div>
|
|
35
120
|
<div bsModalFooter>
|
|
36
121
|
@for (option of retryActionService.payload()?.options; track option) {
|
|
37
122
|
<button
|
|
@@ -44,24 +129,31 @@ class SparkRetryActionModalComponent {
|
|
|
44
129
|
</div>
|
|
45
130
|
</div>
|
|
46
131
|
</bs-modal>
|
|
47
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BsModalHostComponent, selector: "bs-modal", inputs: ["isOpen", "closeOnEscape"], outputs: ["isOpenChange"] }, { kind: "directive", type: BsModalDirective, selector: "[bsModal]" }, { kind: "directive", type: BsModalHeaderDirective, selector: "[bsModalHeader]" }, { kind: "directive", type: BsModalBodyDirective, selector: "[bsModalBody]" }, { kind: "directive", type: BsModalFooterDirective, selector: "[bsModalFooter]" }, { kind: "directive", type: BsButtonTypeDirective, selector: "button[color],input[type=\"button\"][color],input[type=\"submit\"][color],a[color]", inputs: ["color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
132
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BsModalHostComponent, selector: "bs-modal", inputs: ["isOpen", "closeOnEscape"], outputs: ["isOpenChange"] }, { kind: "directive", type: BsModalDirective, selector: "[bsModal]" }, { kind: "directive", type: BsModalHeaderDirective, selector: "[bsModalHeader]" }, { kind: "directive", type: BsModalBodyDirective, selector: "[bsModalBody]" }, { kind: "directive", type: BsModalFooterDirective, selector: "[bsModalFooter]" }, { kind: "directive", type: BsButtonTypeDirective, selector: "button[color],input[type=\"button\"][color],input[type=\"submit\"][color],a[color]", inputs: ["color"] }, { kind: "component", type: SparkPoFormComponent, selector: "spark-po-form", inputs: ["entityType", "formData", "validationErrors", "showButtons", "isSaving", "parentId", "parentType"], outputs: ["formDataChange", "save", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
48
133
|
}
|
|
49
134
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SparkRetryActionModalComponent, decorators: [{
|
|
50
135
|
type: Component,
|
|
51
136
|
args: [{
|
|
52
137
|
selector: 'spark-retry-action-modal',
|
|
53
|
-
imports: [CommonModule, BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective, BsButtonTypeDirective],
|
|
138
|
+
imports: [CommonModule, BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective, BsButtonTypeDirective, SparkPoFormComponent],
|
|
54
139
|
template: `
|
|
55
140
|
<bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption('Cancel')">
|
|
56
141
|
<div *bsModal>
|
|
57
142
|
<div bsModalHeader>
|
|
58
143
|
<h5 class="modal-title">{{ retryActionService.payload()?.title }}</h5>
|
|
59
144
|
</div>
|
|
60
|
-
|
|
61
|
-
|
|
145
|
+
<div bsModalBody>
|
|
146
|
+
@if (retryActionService.payload()?.message; as message) {
|
|
62
147
|
<p>{{ message }}</p>
|
|
63
|
-
|
|
64
|
-
|
|
148
|
+
}
|
|
149
|
+
@if (entityType(); as et) {
|
|
150
|
+
<spark-po-form
|
|
151
|
+
[entityType]="et"
|
|
152
|
+
[(formData)]="formData"
|
|
153
|
+
[showButtons]="false">
|
|
154
|
+
</spark-po-form>
|
|
155
|
+
}
|
|
156
|
+
</div>
|
|
65
157
|
<div bsModalFooter>
|
|
66
158
|
@for (option of retryActionService.payload()?.options; track option) {
|
|
67
159
|
<button
|
|
@@ -77,7 +169,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
77
169
|
`,
|
|
78
170
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
79
171
|
}]
|
|
80
|
-
}] });
|
|
172
|
+
}], ctorParameters: () => [] });
|
|
173
|
+
/**
|
|
174
|
+
* Builds a synthetic <see cref="EntityType"/> from the PO's own scaffolded attributes so
|
|
175
|
+
* the embedded spark-po-form can render without having to locate the matching server-side
|
|
176
|
+
* EntityType registration. Used for Virtual POs that are schema-registered but not
|
|
177
|
+
* security-granted (retry-action popups).
|
|
178
|
+
*/
|
|
179
|
+
function entityTypeFromPo(po) {
|
|
180
|
+
return {
|
|
181
|
+
id: po.objectTypeId,
|
|
182
|
+
name: po.name,
|
|
183
|
+
clrType: '', // Not needed by the form's rendering path; the PO's attributes carry the schema.
|
|
184
|
+
displayAttribute: undefined,
|
|
185
|
+
tabs: [],
|
|
186
|
+
groups: [],
|
|
187
|
+
attributes: (po.attributes ?? []).map(attrToDefinition),
|
|
188
|
+
queries: [],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function attrToDefinition(attr) {
|
|
192
|
+
return {
|
|
193
|
+
id: attr.id ?? '',
|
|
194
|
+
name: attr.name,
|
|
195
|
+
label: attr.label,
|
|
196
|
+
dataType: attr.dataType,
|
|
197
|
+
isArray: attr.isArray,
|
|
198
|
+
isRequired: attr.isRequired,
|
|
199
|
+
isVisible: attr.isVisible,
|
|
200
|
+
isReadOnly: attr.isReadOnly,
|
|
201
|
+
order: attr.order,
|
|
202
|
+
query: attr.query,
|
|
203
|
+
asDetailType: attr.asDetailType,
|
|
204
|
+
showedOn: attr.showedOn,
|
|
205
|
+
rules: attr.rules ?? [],
|
|
206
|
+
group: attr.group,
|
|
207
|
+
renderer: attr.renderer,
|
|
208
|
+
rendererOptions: attr.rendererOptions,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Keeps the server-issued id + metadata on each attribute while overlaying the user's
|
|
213
|
+
* values from the rebuilt PO. Prevents the modal from accidentally dropping server-only
|
|
214
|
+
* fields (e.g. rules, renderer options) that the form didn't need to know about.
|
|
215
|
+
*/
|
|
216
|
+
function mergeAttributeMetadata(incoming, rebuilt) {
|
|
217
|
+
const byName = new Map(rebuilt.map(a => [a.name, a]));
|
|
218
|
+
return incoming.map(source => {
|
|
219
|
+
const updated = byName.get(source.name);
|
|
220
|
+
if (!updated)
|
|
221
|
+
return source;
|
|
222
|
+
return {
|
|
223
|
+
...source,
|
|
224
|
+
value: updated.value,
|
|
225
|
+
object: updated.object,
|
|
226
|
+
objects: updated.objects,
|
|
227
|
+
asDetailType: updated.asDetailType ?? source.asDetailType,
|
|
228
|
+
isValueChanged: true,
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
}
|
|
81
232
|
|
|
82
233
|
/**
|
|
83
234
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-spark-retry-action-modal.mjs","sources":["../../retry-action-modal/src/spark-retry-action-modal.component.ts","../../retry-action-modal/mintplayer-ng-spark-retry-action-modal.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective } from '@mintplayer/ng-bootstrap/modal';\nimport { BsButtonTypeDirective } from '@mintplayer/ng-bootstrap/button-type';\nimport { RetryActionService } from '@mintplayer/ng-spark/services';\n\n@Component({\n selector: 'spark-retry-action-modal',\n imports: [CommonModule, BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective, BsButtonTypeDirective],\n template: `\n <bs-modal [isOpen]=\"isOpen()\" (isOpenChange)=\"!$event && onOption('Cancel')\">\n <div *bsModal>\n <div bsModalHeader>\n <h5 class=\"modal-title\">{{ retryActionService.payload()?.title }}</h5>\n </div>\n @if (retryActionService.payload()?.message; as message) {\n <div bsModalBody>\n <p>{{ message }}</p>\n </div>\n }\n <div bsModalFooter>\n @for (option of retryActionService.payload()?.options; track option) {\n <button\n type=\"button\"\n [color]=\"option === 'Cancel' ? colors.secondary : colors.primary\"\n (click)=\"onOption(option)\">\n {{ option }}\n </button>\n }\n </div>\n </div>\n </bs-modal>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SparkRetryActionModalComponent {\n protected readonly retryActionService = inject(RetryActionService);\n\n colors = Color;\n isOpen = computed(() => this.retryActionService.payload() !== null);\n\n onOption(option: string): void {\n const payload = this.retryActionService.payload();\n if (!payload) return;\n this.retryActionService.respond({\n step: payload.step,\n option,\n persistentObject: payload.persistentObject\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAoCa,8BAA8B,CAAA;AACtB,IAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAElE,MAAM,GAAG,KAAK;AACd,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,IAAI,kDAAC;AAEnE,IAAA,QAAQ,CAAC,MAAc,EAAA;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;AACjD,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM;YACN,gBAAgB,EAAE,OAAO,CAAC;AAC3B,SAAA,CAAC;IACJ;uGAdW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA9B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,8BAA8B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EA1B/B;;;;;;;;;;;;;;;;;;;;;;;AAuBT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAxBS,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,EAAA,QAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,sBAAsB,EAAA,QAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,eAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,sBAAsB,EAAA,QAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,EAAA,QAAA,EAAA,oFAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FA2BhJ,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBA7B1C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,0BAA0B;AACpC,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,CAAC;AAC5J,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;AAuBT,EAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC;AAC1C,iBAAA;;;ACnCD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-spark-retry-action-modal.mjs","sources":["../../retry-action-modal/src/spark-retry-action-modal.component.ts","../../retry-action-modal/mintplayer-ng-spark-retry-action-modal.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, inject, signal } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective } from '@mintplayer/ng-bootstrap/modal';\nimport { BsButtonTypeDirective } from '@mintplayer/ng-bootstrap/button-type';\nimport { RetryActionService, SparkService } from '@mintplayer/ng-spark/services';\nimport { SparkPoFormComponent } from '@mintplayer/ng-spark/po-form';\nimport {\n dictToNestedPo,\n EntityAttributeDefinition,\n EntityType,\n EntityTypeResolver,\n nestedPoToDict,\n PersistentObject,\n PersistentObjectAttribute,\n} from '@mintplayer/ng-spark/models';\n\n/**\n * Renders a retry-action popup. Before PRD §3 this component rendered title / message /\n * option buttons only and silently forwarded the incoming <c>persistentObject</c> back to\n * the server on submit — meaning any <c>Retry.Action(..., persistentObject)</c> flow had\n * no UI to actually edit the PO. This component now embeds the shared PO form so every\n * scalar / Reference / AsDetail attribute on the scaffolded Virtual PO is a real form\n * field, and the values the user fills in flow back to the server via\n * <c>RetryResult.PersistentObject</c>.\n */\n@Component({\n selector: 'spark-retry-action-modal',\n imports: [CommonModule, BsModalHostComponent, BsModalDirective, BsModalHeaderDirective, BsModalBodyDirective, BsModalFooterDirective, BsButtonTypeDirective, SparkPoFormComponent],\n template: `\n <bs-modal [isOpen]=\"isOpen()\" (isOpenChange)=\"!$event && onOption('Cancel')\">\n <div *bsModal>\n <div bsModalHeader>\n <h5 class=\"modal-title\">{{ retryActionService.payload()?.title }}</h5>\n </div>\n <div bsModalBody>\n @if (retryActionService.payload()?.message; as message) {\n <p>{{ message }}</p>\n }\n @if (entityType(); as et) {\n <spark-po-form\n [entityType]=\"et\"\n [(formData)]=\"formData\"\n [showButtons]=\"false\">\n </spark-po-form>\n }\n </div>\n <div bsModalFooter>\n @for (option of retryActionService.payload()?.options; track option) {\n <button\n type=\"button\"\n [color]=\"option === 'Cancel' ? colors.secondary : colors.primary\"\n (click)=\"onOption(option)\">\n {{ option }}\n </button>\n }\n </div>\n </div>\n </bs-modal>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SparkRetryActionModalComponent {\n protected readonly retryActionService = inject(RetryActionService);\n private readonly sparkService = inject(SparkService);\n\n colors = Color;\n isOpen = computed(() => this.retryActionService.payload() !== null);\n\n /**\n * EntityType definition for the incoming PO — fetched lazily via SparkService so the\n * form knows which attributes are editable, their labels, rules, renderers, etc.\n * `null` when the payload has no persistentObject or its objectTypeId doesn't match\n * any registered entity type (renders the modal as a simple option picker).\n */\n entityType = signal<EntityType | null>(null);\n formData = signal<Record<string, any>>({});\n private allEntityTypes: EntityType[] = [];\n\n constructor() {\n // Reseed form state every time the retry service opens/closes the modal. Effect\n // cleanup isn't needed since `payload` is a signal and the component's own lifetime\n // is root-scoped.\n effect(() => {\n const payload = this.retryActionService.payload();\n if (!payload?.persistentObject) {\n this.entityType.set(null);\n this.formData.set({});\n return;\n }\n void this.seedForm(payload.persistentObject);\n });\n }\n\n private async seedForm(po: PersistentObject): Promise<void> {\n // Virtual POs used for retry prompts (e.g. ConfirmDeleteCar) typically have no\n // security.json grant — so `getEntityTypes()` filters them out for the current user\n // and the lookup-by-id would return null, leaving the form blank. The scaffolded PO\n // already carries full attribute metadata (label / dataType / rules / renderer / etc.),\n // so we synthesize an EntityType from the attributes directly and skip the HTTP\n // lookup altogether. `getEntityTypes()` is still fetched once (cached on the\n // component) because the embedded spark-po-form needs the full list to resolve\n // nested AsDetail / Reference types the retry PO might point at.\n if (this.allEntityTypes.length === 0) {\n try { this.allEntityTypes = await this.sparkService.getEntityTypes(); }\n catch { this.allEntityTypes = []; }\n }\n this.entityType.set(entityTypeFromPo(po));\n // Flatten the nested PO into the Record<string, any> shape the shared form uses\n // throughout the rest of ng-spark — same transformation po-edit applies.\n this.formData.set(nestedPoToDict(po));\n }\n\n onOption(option: string): void {\n const payload = this.retryActionService.payload();\n if (!payload) return;\n\n const populated = this.populatedPersistentObject(payload.persistentObject);\n this.retryActionService.respond({\n step: payload.step,\n option,\n persistentObject: populated,\n });\n }\n\n /**\n * Builds the PO the server sees under <c>Retry.Result.PersistentObject</c>. If the\n * form resolved an EntityType, rebuild from the schema + formData (identical to the\n * po-edit save path — AsDetail recursion included). Otherwise forward the incoming\n * PO unmodified so pre-§3 flows without editable attributes keep working.\n */\n private populatedPersistentObject(incoming: PersistentObject | undefined): PersistentObject | undefined {\n if (!incoming) return undefined;\n const type = this.entityType();\n if (!type) return incoming;\n\n const resolver: EntityTypeResolver = (clrName) => this.allEntityTypes.find(t => t.clrType === clrName);\n const rebuilt = dictToNestedPo(this.formData(), type, resolver);\n const populated: PersistentObject = {\n ...incoming,\n attributes: mergeAttributeMetadata(incoming.attributes ?? [], rebuilt.attributes),\n };\n return populated;\n }\n}\n\n/**\n * Builds a synthetic <see cref=\"EntityType\"/> from the PO's own scaffolded attributes so\n * the embedded spark-po-form can render without having to locate the matching server-side\n * EntityType registration. Used for Virtual POs that are schema-registered but not\n * security-granted (retry-action popups).\n */\nfunction entityTypeFromPo(po: PersistentObject): EntityType {\n return {\n id: po.objectTypeId,\n name: po.name,\n clrType: '', // Not needed by the form's rendering path; the PO's attributes carry the schema.\n displayAttribute: undefined,\n tabs: [],\n groups: [],\n attributes: (po.attributes ?? []).map(attrToDefinition),\n queries: [],\n };\n}\n\nfunction attrToDefinition(attr: PersistentObjectAttribute): EntityAttributeDefinition {\n return {\n id: attr.id ?? '',\n name: attr.name,\n label: attr.label,\n dataType: attr.dataType,\n isArray: attr.isArray,\n isRequired: attr.isRequired,\n isVisible: attr.isVisible,\n isReadOnly: attr.isReadOnly,\n order: attr.order,\n query: attr.query,\n asDetailType: attr.asDetailType,\n showedOn: attr.showedOn,\n rules: attr.rules ?? [],\n group: attr.group,\n renderer: attr.renderer,\n rendererOptions: attr.rendererOptions,\n };\n}\n\n/**\n * Keeps the server-issued id + metadata on each attribute while overlaying the user's\n * values from the rebuilt PO. Prevents the modal from accidentally dropping server-only\n * fields (e.g. rules, renderer options) that the form didn't need to know about.\n */\nfunction mergeAttributeMetadata(\n incoming: PersistentObjectAttribute[],\n rebuilt: PersistentObjectAttribute[],\n): PersistentObjectAttribute[] {\n const byName = new Map(rebuilt.map(a => [a.name, a]));\n return incoming.map(source => {\n const updated = byName.get(source.name);\n if (!updated) return source;\n return {\n ...source,\n value: updated.value,\n object: updated.object,\n objects: updated.objects,\n asDetailType: updated.asDetailType ?? source.asDetailType,\n isValueChanged: true,\n };\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAiBA;;;;;;;;AAQG;MAqCU,8BAA8B,CAAA;AACtB,IAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACjD,IAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAEpD,MAAM,GAAG,KAAK;AACd,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,IAAI,kDAAC;AAEnE;;;;;AAKG;AACH,IAAA,UAAU,GAAG,MAAM,CAAoB,IAAI,sDAAC;AAC5C,IAAA,QAAQ,GAAG,MAAM,CAAsB,EAAE,oDAAC;IAClC,cAAc,GAAiB,EAAE;AAEzC,IAAA,WAAA,GAAA;;;;QAIE,MAAM,CAAC,MAAK;YACV,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;AACjD,YAAA,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE;AAC9B,gBAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;AACzB,gBAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrB;YACF;YACA,KAAK,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAC9C,QAAA,CAAC,CAAC;IACJ;IAEQ,MAAM,QAAQ,CAAC,EAAoB,EAAA;;;;;;;;;QASzC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAA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';
|
|
5
5
|
import { currentLanguage } from '@mintplayer/ng-spark/models';
|
|
6
6
|
import { SPARK_CONFIG } from '@mintplayer/ng-spark';
|
|
7
|
+
import { SparkClientOperationDispatcher } from '@mintplayer/ng-spark/client-operations';
|
|
7
8
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
8
9
|
|
|
9
10
|
class RetryActionService {
|
|
@@ -164,6 +165,7 @@ class SparkService {
|
|
|
164
165
|
baseUrl = this.config?.baseUrl ?? '/spark';
|
|
165
166
|
http = inject(HttpClient);
|
|
166
167
|
retryActionService = inject(RetryActionService);
|
|
168
|
+
dispatcher = inject(SparkClientOperationDispatcher);
|
|
167
169
|
// Entity Types
|
|
168
170
|
async getEntityTypes() {
|
|
169
171
|
return firstValueFrom(this.http.get(`${this.baseUrl}/types`));
|
|
@@ -223,13 +225,13 @@ class SparkService {
|
|
|
223
225
|
return firstValueFrom(this.http.get(`${this.baseUrl}/po/${encodeURIComponent(type)}/${encodeURIComponent(id)}`));
|
|
224
226
|
}
|
|
225
227
|
async create(type, data) {
|
|
226
|
-
return this.
|
|
228
|
+
return this.postWithEnvelope(`${this.baseUrl}/po/${encodeURIComponent(type)}`, { persistentObject: data });
|
|
227
229
|
}
|
|
228
230
|
async update(type, id, data) {
|
|
229
|
-
return this.
|
|
231
|
+
return this.putWithEnvelope(`${this.baseUrl}/po/${encodeURIComponent(type)}/${encodeURIComponent(id)}`, { persistentObject: data });
|
|
230
232
|
}
|
|
231
233
|
async delete(type, id) {
|
|
232
|
-
return this.
|
|
234
|
+
return this.deleteWithEnvelope(`${this.baseUrl}/po/${encodeURIComponent(type)}/${encodeURIComponent(id)}`, {});
|
|
233
235
|
}
|
|
234
236
|
// Custom Actions
|
|
235
237
|
async getCustomActions(objectTypeId) {
|
|
@@ -237,7 +239,7 @@ class SparkService {
|
|
|
237
239
|
}
|
|
238
240
|
async executeCustomAction(objectTypeId, actionName, parent, selectedItems) {
|
|
239
241
|
const body = { parent, selectedItems };
|
|
240
|
-
return this.
|
|
242
|
+
return this.postWithEnvelope(`${this.baseUrl}/actions/${encodeURIComponent(objectTypeId)}/${encodeURIComponent(actionName)}`, body);
|
|
241
243
|
}
|
|
242
244
|
// LookupReferences
|
|
243
245
|
async getLookupReferences() {
|
|
@@ -255,44 +257,63 @@ class SparkService {
|
|
|
255
257
|
async deleteLookupReferenceValue(name, key) {
|
|
256
258
|
return firstValueFrom(this.http.delete(`${this.baseUrl}/lookupref/${encodeURIComponent(name)}/${encodeURIComponent(key)}`));
|
|
257
259
|
}
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
260
|
+
// Envelope-aware HTTP helpers.
|
|
261
|
+
// All mutation endpoints (Create / Update / Delete / Execute custom action) emit the
|
|
262
|
+
// ClientOperationEnvelope { result, operations } shape. These helpers unwrap the envelope,
|
|
263
|
+
// dispatch any non-retry operations, and translate 449 retry-operations into the existing
|
|
264
|
+
// RetryActionService modal flow.
|
|
265
|
+
postWithEnvelope(url, body) {
|
|
266
|
+
return this.sendWithEnvelope(() => firstValueFrom(this.http.post(url, body)), body, () => this.postWithEnvelope(url, body));
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return await firstValueFrom(this.http.put(url, body));
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
return this.handleRetryError(error, () => this.putWithRetry(url, body), body);
|
|
273
|
-
}
|
|
268
|
+
putWithEnvelope(url, body) {
|
|
269
|
+
return this.sendWithEnvelope(() => firstValueFrom(this.http.put(url, body)), body, () => this.putWithEnvelope(url, body));
|
|
274
270
|
}
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
deleteWithEnvelope(url, body) {
|
|
272
|
+
return this.sendWithEnvelope(() => {
|
|
277
273
|
const hasRetry = body.retryResults && body.retryResults.length > 0;
|
|
278
|
-
return
|
|
274
|
+
return firstValueFrom(hasRetry
|
|
279
275
|
? this.http.delete(url, { body })
|
|
280
276
|
: this.http.delete(url));
|
|
277
|
+
}, body, () => this.deleteWithEnvelope(url, body));
|
|
278
|
+
}
|
|
279
|
+
async sendWithEnvelope(send, body, retryFn) {
|
|
280
|
+
try {
|
|
281
|
+
const envelope = await send();
|
|
282
|
+
if (envelope?.operations?.length) {
|
|
283
|
+
this.dispatcher.dispatch(envelope.operations);
|
|
284
|
+
}
|
|
285
|
+
return envelope?.result;
|
|
281
286
|
}
|
|
282
287
|
catch (error) {
|
|
283
|
-
return this.
|
|
288
|
+
return this.handleEnvelopeRetryError(error, retryFn, body);
|
|
284
289
|
}
|
|
285
290
|
}
|
|
286
|
-
async
|
|
287
|
-
if (error.status !== 449
|
|
291
|
+
async handleEnvelopeRetryError(error, retryFn, body) {
|
|
292
|
+
if (error.status !== 449)
|
|
288
293
|
throw error;
|
|
289
|
-
|
|
290
|
-
|
|
294
|
+
const envelope = error.error;
|
|
295
|
+
if (!envelope?.operations?.length)
|
|
296
|
+
throw error;
|
|
297
|
+
// Dispatch any non-retry operations accumulated before the retry throw
|
|
298
|
+
// so notify/refresh/etc. fire BEFORE the retry modal opens.
|
|
299
|
+
const nonRetry = envelope.operations.filter(o => o.type !== 'retry');
|
|
300
|
+
if (nonRetry.length)
|
|
301
|
+
this.dispatcher.dispatch(nonRetry);
|
|
302
|
+
const retryOp = envelope.operations.find(o => o.type === 'retry');
|
|
303
|
+
if (!retryOp)
|
|
304
|
+
throw error;
|
|
305
|
+
const payload = {
|
|
306
|
+
type: 'retry-action',
|
|
307
|
+
step: retryOp.step,
|
|
308
|
+
title: retryOp.title,
|
|
309
|
+
options: retryOp.options,
|
|
310
|
+
defaultOption: retryOp.defaultOption ?? undefined,
|
|
311
|
+
persistentObject: retryOp.persistentObject ?? undefined,
|
|
312
|
+
message: retryOp.message ?? undefined,
|
|
313
|
+
};
|
|
291
314
|
const result = await this.retryActionService.show(payload);
|
|
292
|
-
|
|
293
|
-
if (result.option === 'Cancel' && !payload.options.includes('Cancel')) {
|
|
315
|
+
if (result.option === 'Cancel' && !payload.options.includes('Cancel'))
|
|
294
316
|
throw error;
|
|
295
|
-
}
|
|
296
317
|
body.retryResults = [...(body.retryResults || []), result];
|
|
297
318
|
return retryFn();
|
|
298
319
|
}
|