Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added UI endpoint information for modules in product detail #383

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 30 additions & 36 deletions src/app/workspace/workspace-product/products.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@
<div class="col-3 md:col-4 hidden md:block">
<p-panel *ngIf="displayDetails" [showHeader]="true" styleClass="hidden sm:block">
<ng-template pTemplate="header">
<div
class="h-3rem lg:h-4rem flex flex-row flex-wrap row-gap-2 justify-content-between align-items-start w-full"
>
<div class="h-3rem mb-1 flex flex-row flex-wrap row-gap-2 justify-content-between align-items-start w-full">
<div class="flex flex-column text-primary">
<div class="font-semibold text-xl mb-1">{{ 'DIALOG.PRODUCTS.DETAILS' | translate }}</div>
<div class="text-sm">{{ 'DIALOG.PRODUCTS.ORIGIN.' + displayedDetailItem?.bucket | translate }}</div>
Expand Down Expand Up @@ -258,7 +256,7 @@
</ng-template>

<form [formGroup]="formGroup">
<div class="flex flex-column row-gap-4">
<div class="flex flex-column row-gap-3">
<div class="p-inputgroup">
<span class="p-float-label">
<input
Expand Down Expand Up @@ -298,28 +296,26 @@
>
</a>
</div>
<div>
<span class="p-float-label" controlErrorAnchor>
<input
pInputText
type="text"
class="w-full text-responsive"
id="ws_product_item_baseurl"
formControlName="baseUrl"
[pTooltip]="'PRODUCT.BASE_URL.TOOLTIP' | translate"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label class="ocx-required-label" for="ws_product_item_baseurl">
{{ 'PRODUCT.BASE_URL' | translate }}</label
>
</span>
</div>
<span class="mt-1 p-float-label" controlErrorAnchor>
<input
pInputText
type="text"
class="w-full text-responsive"
id="ws_product_item_baseurl"
formControlName="baseUrl"
[pTooltip]="'PRODUCT.BASE_URL.TOOLTIP' | translate"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label class="ocx-required-label" for="ws_product_item_baseurl">
{{ 'PRODUCT.BASE_URL' | translate }}</label
>
</span>

<div *ngFor="let app of displayedDetailItem?.apps | keyvalue; let i = index">
<p-divider align="center" styleClass="mt-0 mb-1">
<div class="px-3 font-bold text-primary text-responsive">{{ app.key }}</div>
<div class="px-3 text-xs">Microfrontend</div>
<p-divider align="center" styleClass="m-0 p-0">
<div class="font-bold text-primary text-responsive">{{ app.key }}</div>
<div class="text-xs">Microfrontend</div>
</p-divider>

<div *ngIf="app.value.modules" class="ml-2 text-sm">
Expand All @@ -329,7 +325,7 @@
<div
[formGroupName]="i"
[class.mb-4]="i < moduleControls.controls.length - 2"
class="ml-2 flex flex-column"
class="ml-2 flex flex-column row-gap-0"
>
<div class="mb-1 flex flex-row column-gap-2">
<span [id]="'ws_product_item_mfe_' + i + '_exposed_module'" class="mr-2">
Expand Down Expand Up @@ -369,11 +365,15 @@
{{ 'PRODUCT.MFE.BASE_PATH' | translate }}</label
>
</span>
</div>
<div *ngIf="mfe.endpoints && mfe.endpoints.length > 0">
<div class="mb-1 font-bold">Endpoints</div>
<div *ngFor="let end of mfe.endpoints; let j = index" class="ml-2">
<div [id]="'ws_product_item_mfe_' + i + '_endpoint_' + j">{{ end.name }}: {{ end.path }}</div>
<div *ngIf="mfe.controls['endpoints'] && mfe.controls['endpoints'].value.length > 0">
<div class="mt-2 font-bold">UI Endpoints</div>
<div
*ngFor="let ep of mfe.controls['endpoints'].value; let j = index"
[id]="'ws_product_item_mfe_' + i + '_endpoint_' + j"
class="ml-2 text-responsive"
>
{{ ep.name }} => {{ ep.path }}
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -404,12 +404,6 @@
>
</span>
</div>
<div *ngIf="smfe.endpoints && smfe.endpoints.length > 0">
<div class="mb-1 font-bold">Endpoints {{ smfe.endpoints.length }}</div>
<div *ngFor="let send of smfe.endpoints; let j = index" class="ml-2">
<div [id]="'ws_product_item_mfe_' + i + '_endpoint_' + j">{{ send.name }}: {{ send.path }}</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
12 changes: 9 additions & 3 deletions src/app/workspace/workspace-product/products.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import {
SlotPS,
SlotAPIService,
Workspace,
WorkspaceProductAPIService
WorkspaceProductAPIService,
UIEndpoint
} from 'src/app/shared/generated'

import { environment } from 'src/environments/environment'
Expand Down Expand Up @@ -399,7 +400,8 @@ export class ProductComponent implements OnChanges, OnDestroy, AfterViewInit {
basePath: new FormControl(null, [Validators.required, Validators.maxLength(255)]),
deprecated: new FormControl(null),
undeployed: new FormControl(null),
exposedModule: new FormControl(null)
exposedModule: new FormControl(null),
endpoints: new FormControl(null)
})
)
modules.at(i).patchValue({
Expand All @@ -408,10 +410,14 @@ export class ProductComponent implements OnChanges, OnDestroy, AfterViewInit {
basePath: mfe.basePath,
deprecated: psMfeModule?.deprecated,
undeployed: psMfeModule?.undeployed,
exposedModule: psMfeModule?.exposedModule
exposedModule: psMfeModule?.exposedModule,
endpoints: mfe.endpoints?.sort(this.sortEndpointsByName)
})
})
}
private sortEndpointsByName(a: UIEndpoint, b: UIEndpoint): number {
return (a.name ? a.name.toUpperCase() : '').localeCompare(b.name ? b.name.toUpperCase() : '')
}
private getProductStoreMfeData(item: ExtendedProduct, appId: string): ExtendedMicrofrontend | undefined {
let module: ExtendedMicrofrontend | undefined
if (item.apps.has(appId)) {
Expand Down
Loading