fix: policy header, create app, api short description
MODIFY
src/app/components/marketplace-api-description/marketplace-api-description.component.html
src/app/components/marketplace-api-description/marketplace-api-description.component.html
src="https://github.com/apiman/apiman/raw/master/manager/ui/war/plugins/api-manager/img/about-logo.png"
/>
</span>
- <p id="shortDescription">{{ api.api.description.substr(0, 240) }}</p>
+ <p id="shortDescription">{{ shortDescription }}</p>
</div>
<mat-grid-list cols="4" rowHeight="1:1">

MODIFY
src/app/components/marketplace-api-description/marketplace-api-description.component.ts
src/app/components/marketplace-api-description/marketplace-api-description.component.ts
import { Component, Input, OnInit } from '@angular/core';
-import {IApiVersionExt} from "../../interfaces/IApiVersionExt";
+import {IApiVersionExt} from '../../interfaces/IApiVersionExt';
@Component({
selector: 'app-marketplace-api-description',
@@ -11,8 +11,17 @@ export class MarketplaceApiDescriptionComponent implements OnInit {
@Input() isLatest!: boolean;
features: string[] = ['fast', 'free', 'fancy features'];
+ shortDescription = '';
constructor() {}
- ngOnInit(): void {}
+ ngOnInit(): void {
+ this.getShortDescription();
+ }
+
+ private getShortDescription() {
+ if (this.api.api.description) {
+ this.shortDescription = this.api.api.description.substring(0, 240);
+ }
+ }
}

MODIFY
src/app/components/marketplace-client-app/marketplace-client-app.component.html
src/app/components/marketplace-client-app/marketplace-client-app.component.html
/>
</mat-form-field>
</form>
- <button mat-raised-button color="primary" class="ml-20" [disabled]="clickedRows.size > 0 || clientName.length === 0" (click)="addClient()">
+ <button mat-raised-button color="primary" class="ml-20" [disabled]="isCreateButtonDisabled()" (click)="addClient()">
{{ "COMMON.CREATE" | translate }}
</button>
</div>

MODIFY
src/app/components/marketplace-client-app/marketplace-client-app.component.ts
src/app/components/marketplace-client-app/marketplace-client-app.component.ts
@@ -11,7 +11,7 @@ import {HttpErrorResponse} from '@angular/common/http';
import {catchError, switchMap} from 'rxjs/operators';
import {forkJoin, of} from 'rxjs';
import {TranslateService} from '@ngx-translate/core';
-import {KeycloakHelperService} from "../../services/keycloak-helper/keycloak-helper.service";
+import {KeycloakHelperService} from '../../services/keycloak-helper/keycloak-helper.service';
@Component({
selector: 'app-marketplace-client-app',
@@ -23,8 +23,9 @@ export class MarketplaceClientAppComponent implements OnInit {
dataSource = new MatTableDataSource<IClientSummary>([]);
clickedRows = new Set<IClientSummary>();
clientName = '';
- organizationId = '';
+ organizationId = this.keycloakHelper.getUsername();
organizations: IOrganizationSummary[] = [];
+ clients: IClientSummary[] = [];
@Output() selectedClients = new EventEmitter<Set<IClientSummary>>();
@@ -122,15 +123,27 @@ export class MarketplaceClientAppComponent implements OnInit {
}
private createTableView(results: [IOrganizationSummary[], IClientSummary[]]) {
- const clients = results[1];
+ this.clients = results[1];
this.organizations = results[0];
if (this.organizations.length > 1) {
this.displayedColumns = ['org-name', 'name'];
}
this.dataSource = new MatTableDataSource(results[1]);
- if (clients.length === 1) {
+ if (this.clients.length === 1) {
// if we only have one client we can select it automatically
- this.selectClient(clients[0]);
+ this.selectClient(this.clients[0]);
}
}
+
+ public isCreateButtonDisabled(): boolean {
+ return (
+ this.clickedRows.size > 0 ||
+ this.clientName.length === 0 ||
+ this.clients.some(
+ (clientSummary) =>
+ clientSummary.name === this.clientName &&
+ clientSummary.organizationId === this.organizationId
+ )
+ );
+ }
}

MODIFY
src/app/components/marketplace-signup-stepper/marketplace-signup-stepper.component.html
src/app/components/marketplace-signup-stepper/marketplace-signup-stepper.component.html
</mat-card-header>
<mat-card-content class="mat-card-header-text">
<app-my-apps-use-api></app-my-apps-use-api>
+ <ng-container *ngFor="let policy of newContractDetails.policies">
<h4>Policies</h4>
<!--In this version we will not have more than 2 policies-->
<div class="policies">
- <ng-container *ngFor="let policy of newContractDetails.policies">
<app-policy-card [policy]="policy"></app-policy-card>
- </ng-container>
</div>
+ </ng-container>
</mat-card-content>
<mat-divider></mat-divider>
<mat-card-actions class="right">
</mat-card-header>
<mat-card-content class="mat-card-header-text">
<app-my-apps-use-api [contract]="contract"></app-my-apps-use-api>
- <h3>Policies</h3>
+ <ng-container *ngFor="let policy of newContractDetails.policies">
+ <h4>Policies</h4>
<!--In this version we will not have more than 2 policies-->
- <div class="policies" *ngIf="newContractDetails.policies">
- <app-policy-card
- *ngFor="let policy of newContractDetails.policies"
- [policy]="policy"
- ></app-policy-card>
+ <div class="policies">
+ <app-policy-card [policy]="policy"></app-policy-card>
</div>
+ </ng-container>
</mat-card-content>
<mat-divider></mat-divider>
<mat-card-actions class="right">

fix: policy header, create app, api short description