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

View File

@ -1,3 +1,4 @@
<ps-view [dataSource]="dataSource">
<ng-container *psViewContent="let model">
<div class="card">
@ -16,8 +17,9 @@
</div>
</div>
<div class="card mt-2" *ngIf="formActivated">
<div class="card-body">
<ps-ds-command [dataSource]="dataSource" name="changePhone" (success)="onSuccess($event)"
[model]="model">
@ -45,6 +47,16 @@
</ng-container>
</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">
<button class="btn btn-info" [disabled]="loading"
(click)="formActivated = false">Cancel</button>

View File

@ -36,6 +36,12 @@ export class DsCommandDemoPageComponent implements OnInit {
number: "514 448 8444"
};
myCommand: ChangeContactPhone = {
contactId: 1,
number: null,
extension: null
}
formActivated: boolean = false;
dataSource: IDataSource<Contact>;
@ -49,13 +55,21 @@ export class DsCommandDemoPageComponent implements OnInit {
return throwError({
status: 400,
error: {
errors: {
errors: {
number: ['number is required']
}
}
})
}
if (command.extension == "hello")
return throwError({
status: 500,
error: {
message: "Error from server..."
}
})
return of(command);
}, e => {
return of(<ChangeContactPhone>{