File

ecosystem/applications/install-from-package/install-from-package.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(ecosystemService: EcosystemService, applicationService: ApplicationService, wizardComponent: WizardComponent, pluginsService: PluginsService, inventoryService: InventoryService)
Parameters :
Name Type Optional
ecosystemService EcosystemService No
applicationService ApplicationService No
wizardComponent WizardComponent No
pluginsService PluginsService No
inventoryService InventoryService No

Methods

back
back()
Returns : void
cancel
cancel()
Returns : void
clean
clean()
Returns : void
Async deployApp
deployApp()
Returns : any
Async fallbackToCloneLatest
fallbackToCloneLatest(config)
Parameters :
Name Optional
config No
Returns : any
Async ngOnInit
ngOnInit()
Returns : any
onAppVersionSelect
onAppVersionSelect(appVersion: IApplicationVersion)
Parameters :
Name Type Optional
appVersion IApplicationVersion No
Returns : void
Async selectPackage
selectPackage(selectedPackage: IApplication)
Parameters :
Name Type Optional
selectedPackage IApplication No
Returns : any

Properties

applicationPropertiesForm
Type : ApplicationPropertiesFormComponent
Decorators :
@ViewChild(ApplicationPropertiesFormComponent)
canDeploy
Type : boolean
Default value : false
deployedWithSuccess
Type : boolean
Default value : false
inProgress
Type : boolean
isDeployed
Type : boolean
Default value : false
model
Type : object
Default value : { selected: undefined, binary: { id: undefined } }
newAppConfig
Type : IApplication
onInput
Type : BehaviorSubject<string>
Default value : new BehaviorSubject<string>('')
packages
Type : IApplication[]
selectedPackage
Type : IApplication
versions$
Type : Observable<IResultList<IApplicationVersion>>
<c8y-wizard-header>
  <i [c8yIcon]="'big-parcel'"></i>
  <h4 translate>Install from package</h4>
</c8y-wizard-header>
<c8y-wizard-body>
  <ng-container *ngIf="!selectedPackage">
    <div class="modal-inner-scroll">
      <p class="p-16 text-medium text-center separator-bottom sticky-top bg-white">
        {{ 'Select from available packages' | translate }}
      </p>
      <div *ngIf="!packages?.length" class="c8y-empty-state text-center">
        <p class="text-center">{{ 'No packages to display.' | translate }}</p>
      </div>
      <div *ngIf="packages?.length" class="c8y-wizard-list-nav" style="min-height: 257px">
        <button
          class="list-group-item text-truncate"
          *ngFor="let package of packages"
          (click)="selectPackage(package)"
          title="{{ package.name }}"
          type="button"
        >
          <i c8yIcon="big-parcel" class="list-group-icon"></i>
          <span [innerText]="package.name"></span>
        </button>
      </div>
    </div>
  </ng-container>
  <ng-container *ngIf="!isDeployed && selectedPackage">
    <p class="p-16 text-center text-medium separator-bottom sticky-top bg-white">
      {{ 'Provide application details' | translate }}
    </p>
    <div class="d-flex d-col a-i-center j-c-center" style="min-height: 257px">
      <c8y-application-properties-form
        *ngIf="!inProgress"
        [application]="newAppConfig"
        class="d-block fit-w"
      ></c8y-application-properties-form>

      <ng-container *ngIf="!inProgress">
        <div [ngStyle]="{ padding: '0 16px' }" class="d-block fit-w bg-gray-white">
          <label for="packageVersion" translate>Use package version</label>
          <c8y-form-group>
            <c8y-typeahead
              [(ngModel)]="model.selected"
              name="packageVersion"
              (onSearch)="onInput.next($event)"
              placeholder="{{ 'Select or enter' | translate }}"
              [displayProperty]="'version'"
              [required]="true"
              [hideNew]="true"
              [container]="'body'"
            >
              <c8y-li
                *c8yFor="let version of versions$; loadMore: 'auto'; notFound: notFoundTemplate"
                (click)="onAppVersionSelect(version)"
                class="p-l-8 p-r-8 c8y-list__item--link"
                [active]="model.selected === version"
              >
                <c8y-li-icon icon="big-parcel"></c8y-li-icon>
                <span
                  [ngStyle]="{
                    display: 'flex',
                    'flex-direction': 'row',
                    'align-content': 'center',
                    'justify-content': 'space-between',
                    'align-items': 'center'
                  }"
                >
                  <c8y-highlight
                    [text]="version.version || '--'"
                    [pattern]="onInput | async"
                  ></c8y-highlight>

                  <span>
                    <span *ngFor="let tag of version.tags" class="label label-info m-l-4">
                      {{ tag }}
                    </span>
                  </span>
                </span>
              </c8y-li>
              <ng-template #notFoundTemplate>
                <c8y-li
                  class="bg-gray-lighter p-8"
                  *ngIf="(onInput | async)?.length > 0 && (versions$ | async)?.data?.length === 0"
                >
                  <span translate>No match found.</span>
                </c8y-li>
              </ng-template>
            </c8y-typeahead>
          </c8y-form-group>
        </div>
      </ng-container>

      <c8y-progress-bar
        [message]="'Installing…' | translate"
        class="text-center d-block"
        *ngIf="inProgress"
      ></c8y-progress-bar>
    </div>
  </ng-container>

  <ng-container *ngIf="isDeployed">
    <div
      *ngIf="deployedWithSuccess; else failedDeploy"
      class="d-flex a-i-center j-c-center"
      style="min-height: 257px"
    >
      <c8y-operation-result
        text="{{ 'Application created' | translate }}"
        [size]="84"
        [vertical]="true"
        type="success"
        class="lead"
      ></c8y-operation-result>
    </div>
    <ng-template #failedDeploy>
      <div class="d-flex a-i-center j-c-center" style="min-height: 257px">
        <c8y-operation-result
          text="{{ 'Application creation failed' | translate }}"
          [size]="84"
          [vertical]="true"
          type="error"
          class="lead"
        ></c8y-operation-result>
      </div>
    </ng-template>
  </ng-container>
</c8y-wizard-body>

<c8y-wizard-footer>
  <button
    *ngIf="!isDeployed"
    (click)="selectedPackage ? clean() : back()"
    class="btn btn-default"
    title="{{ 'Back' | translate }}"
    translate
    [disabled]="inProgress"
    type="button"
  >
    Back
  </button>
  <button
    title="{{ isDeployed && deployedWithSuccess ? ('Close' | translate) : ('Cancel' | translate) }}"
    class="btn btn-default"
    type="button"
    (click)="cancel()"
  >
    {{ isDeployed && deployedWithSuccess ? ('Close' | translate) : ('Cancel' | translate) }}
  </button>

  <button
    title="{{ 'Install' | translate }}"
    class="btn btn-primary"
    type="button"
    (click)="deployApp()"
    [disabled]="inProgress || !packages?.length"
    *ngIf="!isDeployed"
  >
    {{ 'Install' | translate }}
  </button>
</c8y-wizard-footer>

results matching ""

    No results matching ""