ecosystem/applications/add-external-applicaiton/add-external-application.component.ts
OnInit
selector | c8y-add-external-application |
templateUrl | ./add-external-application.component.html |
Properties |
Methods |
constructor(applicationService: ApplicationService, formBuilder: FormBuilder, alertService: AlertService, wizardComponent: WizardComponent)
|
|||||||||||||||
Parameters :
|
back |
back()
|
Returns :
void
|
cancel |
cancel()
|
Returns :
void
|
done |
done()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Async save | ||||||
save(app: IApplication)
|
||||||
Parameters :
Returns :
any
|
createdApp |
Type : IApplication
|
formGroup |
Type : FormGroup
|
<form *ngIf="!createdApp; else appCreated" [formGroup]="formGroup" novalidate>
<c8y-wizard-header>
<i [c8yIcon]="'cloud-link'"></i>
<h4 translate id="modal-title">Add external application</h4>
</c8y-wizard-header>
<c8y-wizard-body>
<p class="p-16 text-medium text-center bg-level-0 separator-bottom sticky-top">
{{ 'Provide external application details' | translate }}
</p>
<div class="modal-body p-t-8" id="modal-body">
<c8y-form-group>
<label style="text-align: left">{{ 'Name' | translate }}</label>
<input
class="form-control"
formControlName="name"
name="name"
placeholder="{{ 'e.g. My application' | translate }}"
required
type="text"
/>
</c8y-form-group>
<c8y-form-group>
<label style="text-align: left">{{ 'Application key' | translate }}</label>
<input
class="form-control"
formControlName="key"
name="key"
placeholder="{{ 'e.g. my-external-application-key' | translate }}"
required
type="text"
/>
</c8y-form-group>
<c8y-form-group>
<label style="text-align: left">{{ 'External URL' | translate }}</label>
<input
[pattern]="'^(?!javascript:).+'"
class="form-control"
formControlName="externalUrl"
name="externalUrl"
placeholder="{{ 'e.g.' | translate }} https://www.example.com"
required
type="url"
/>
</c8y-form-group>
</div>
</c8y-wizard-body>
<c8y-wizard-footer>
<button
(click)="back()"
class="btn btn-default"
title="{{ 'Back' | translate }}"
translate
type="button"
>
Back
</button>
<button (click)="cancel()" class="btn btn-default" title="{{ 'Cancel' | translate }}" translate>
Cancel
</button>
<button
(click)="save(formGroup.value)"
[disabled]="formGroup.invalid || formGroup.pristine"
class="btn btn-primary btn-form"
title="{{ 'Add application' | translate }}"
type="button"
>
{{ 'Add application' | translate }}
</button>
</c8y-wizard-footer>
</form>
<ng-template #appCreated>
<c8y-wizard-body>
<div class="d-flex d-col j-c-center a-i-center" style="min-height: 324px">
<c8y-operation-result
text="{{ 'Application created' | translate }}"
[size]="84"
[vertical]="true"
type="success"
class="lead"
></c8y-operation-result>
</div>
</c8y-wizard-body>
<c8y-wizard-footer>
<button (click)="done()" class="btn btn-default" title="{{ 'Done' | translate }}" translate>
Done
</button>
<a
(click)="$event.stopPropagation()"
[href]="formGroup.value.externalUrl"
target="_blank"
rel="noopener noreferrer"
class="btn btn-primary"
title="{{ 'Open' | translate }}"
>
<i c8yIcon="external-link" class="m-r-4"></i>
{{ 'Open' | translate }}
</a>
</c8y-wizard-footer>
</ng-template>