demo page :) for command is done.

This commit is contained in:
David Lebee 2021-08-18 16:57:32 -04:00
parent 222e0be33b
commit e31d99a17b
3 changed files with 42 additions and 17 deletions

View File

@ -2,26 +2,25 @@
<ng-container *ngIf="hasContent" [ngTemplateOutlet]="contentTemplate" <ng-container *ngIf="hasContent" [ngTemplateOutlet]="contentTemplate"
[ngTemplateOutletContext]="{ $implicit: command, loading: isLoading }"> [ngTemplateOutletContext]="{ $implicit: command, loading: isLoading }">
</ng-container> </ng-container>
</ng-container>
<ng-container *ngIf="lastValidationResult"> <ng-container *ngIf="lastValidationResult">
<ng-container *ngIf="hasValidationTemplate" [ngTemplateOutlet]="validationTemplate" <ng-container *ngIf="hasValidationTemplate" [ngTemplateOutlet]="validationTemplate"
[ngTemplateOutletContext]="{ $implicit: lastValidationResult }"> [ngTemplateOutletContext]="{ $implicit: lastValidationResult }">
</ng-container> </ng-container>
</ng-container> </ng-container>
<ng-container *ngIf="lastErrorMessage && errorContent && errorContent.template"> <ng-container *ngIf="lastErrorMessage && errorContent && errorContent.template">
<ng-container [ngTemplateOutlet]="errorContent.template" <ng-container [ngTemplateOutlet]="errorContent.template"
[ngTemplateOutletContext]="{ $implicit: lastErrorMessage }"> [ngTemplateOutletContext]="{ $implicit: lastErrorMessage }">
</ng-container> </ng-container>
</ng-container> </ng-container>
<ng-container *ngIf="hasFooterTemplate" [ngTemplateOutlet]="footerTemplate" <ng-container *ngIf="hasFooterTemplate" [ngTemplateOutlet]="footerTemplate"
[ngTemplateOutletContext]="{ $implicit: command, loading: isLoading }"> [ngTemplateOutletContext]="{ $implicit: command, loading: isLoading }">
</ng-container>
</ng-container> </ng-container>
<ng-template #noCommand> <ng-template #noCommand>
<ng-container *ngIf="noCommandContent && noCommandContent.template"> <ng-container *ngIf="noCommandContent && noCommandContent.template">
<ng-container [ngTemplateOutlet]="noCommandContent.template"> <ng-container [ngTemplateOutlet]="noCommandContent.template">

View File

@ -1,3 +1,4 @@
<ps-view [dataSource]="dataSource"> <ps-view [dataSource]="dataSource">
<ng-container *psViewContent="let model"> <ng-container *psViewContent="let model">
<div class="card"> <div class="card">
@ -18,6 +19,7 @@
</div> </div>
<div class="card mt-2" *ngIf="formActivated"> <div class="card mt-2" *ngIf="formActivated">
<div class="card-body"> <div class="card-body">
<ps-ds-command [dataSource]="dataSource" name="changePhone" (success)="onSuccess($event)" <ps-ds-command [dataSource]="dataSource" name="changePhone" (success)="onSuccess($event)"
[model]="model"> [model]="model">
@ -45,6 +47,16 @@
</ng-container> </ng-container>
</div> </div>
<ng-container *psDsCommandNoCommand>
NO COMMAND
</ng-container>
<ng-container *psDsCommandError="let error;">
<div class="alert alert-danger">
{{error}}
</div>
</ng-container>
<ng-container *psDsCommandFooter="let command; let loading=loading"> <ng-container *psDsCommandFooter="let command; let loading=loading">
<button class="btn btn-info" [disabled]="loading" <button class="btn btn-info" [disabled]="loading"
(click)="formActivated = false">Cancel</button> (click)="formActivated = false">Cancel</button>

View File

@ -36,6 +36,12 @@ export class DsCommandDemoPageComponent implements OnInit {
number: "514 448 8444" number: "514 448 8444"
}; };
myCommand: ChangeContactPhone = {
contactId: 1,
number: null,
extension: null
}
formActivated: boolean = false; formActivated: boolean = false;
dataSource: IDataSource<Contact>; dataSource: IDataSource<Contact>;
@ -56,6 +62,14 @@ export class DsCommandDemoPageComponent implements OnInit {
}) })
} }
if (command.extension == "hello")
return throwError({
status: 500,
error: {
message: "Error from server..."
}
})
return of(command); return of(command);
}, e => { }, e => {
return of(<ChangeContactPhone>{ return of(<ChangeContactPhone>{