File

ecosystem/shared/application-card.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(applicationService: ApplicationService, ecosystemService: EcosystemService, alertService: AlertService, router: Router, wizardModalService: WizardModalService, alert: AlertService, pluginService: PluginsService, gainsightService: GainsightService)
Parameters :
Name Type Optional
applicationService ApplicationService No
ecosystemService EcosystemService No
alertService AlertService No
router Router No
wizardModalService WizardModalService No
alert AlertService No
pluginService PluginsService No
gainsightService GainsightService No

Inputs

app
Type : IApplication
canEdit
Type : boolean
Default value : true

Outputs

onAppCloned
Type : EventEmitter<void>
onAppDeleted
Type : EventEmitter<void>

Methods

Async clone
clone()
Returns : any
Async delete
delete()
Returns : any
detail
detail()
Returns : void
Async ngOnInit
ngOnInit()
Returns : any
openApp
openApp()
Returns : void
shouldShowVersion
shouldShowVersion()
Returns : boolean

Properties

appState
Type : ApplicationState
blueprintApplicationVersion
Type : IApplicationVersion[]
canClone
Type : boolean
canDelete
Type : boolean
Readonly CANNOT_DELETE_HINT
Default value : gettext( `Subscribed or current applications can't be deleted. Delete the application on the parent tenant or unsubscribe it from the current.` )
canOpenInBrowser
Type : boolean
CURRENT_LOCATION
Default value : location.href
disableOpenInBrowser
Type : boolean
isExternal
Type : boolean
isFeature
Type : boolean
isMicroservice
Type : boolean
isOwnedByManagementTenant
Type : boolean
isPackage
Type : boolean
isPlugin
Type : boolean
isShowVersion
Type : boolean
isUnpacked
Type : boolean
latestApplicationVersion
Type : IApplicationVersion
Readonly PACKAGE_CONTENT_UNDETERMINED_LABEL
Default value : gettext( 'Package contents could not be determined.' )
Readonly PACKAGE_TYPE
Default value : PackageType
packageContentState
Type : ApplicationState
packageType
Type : PackageType
Readonly packageTypeLabels
Default value : PACKAGE_TYPE_LABELS
shouldUpgradePackage
Type : boolean
Readonly UNPACKED_LABEL
Default value : APP_STATE.UNPACKED.label

Accessors

openButtonTitle
getopenButtonTitle()
<div
  class="card pointer card--d-col notFeature"
  data-cy="application-card--extensions-list"
  *ngIf="!isFeature"
>
  <div
    class="card-block text-center card-column-40"
    data-cy="application-card--package-name"
    (click)="detail()"
  >
    <button
      class="card__ribbon btn-clean"
      [attr.aria-label]="
        (app.label || app.manifest?.label | translatePackageLabel) +
        ': ' +
        (packageTypeLabels[packageType].tooltip | translate)
      "
      tooltip="{{ packageTypeLabels[packageType].tooltip | translate }}"
      placement="right"
      type="button"
      *ngIf="packageType !== PACKAGE_TYPE.CUSTOM"
      [delay]="500"
    >
      <span
        [ngClass]="{
          'bg-info': packageType === PACKAGE_TYPE.COMMUNITY,
          'bg-primary': packageType === PACKAGE_TYPE.OFFICIAL
        }"
      >
        {{ app.label || app.manifest?.label | translatePackageLabel }}
      </span>
    </button>
    <div class="card-appicon">
      <c8y-app-icon
        *ngIf="!isPackage && !isFeature && !isMicroservice && !isExternal"
        [app]="app"
        [contextPath]="app.contextPath"
        [name]="app.name"
      ></c8y-app-icon>
      <i
        c8yIcon="big-parcel"
        *ngIf="isPackage"
      ></i>
      <i
        c8yIcon="microchip"
        *ngIf="isMicroservice"
      ></i>
      <i
        c8yIcon="globe1"
        *ngIf="isExternal"
      ></i>
    </div>
    <div style="line-height: 1.3">
      <p class="e2e-appCardName text-medium text-break-word">
        {{ app | humanizeAppName | async }}
      </p>
      <ng-container *ngIf="isShowVersion">
        <p class="small text-muted">
          <em>{{ app.manifest.version }}</em>
          <button
            class="btn-clean m-l-4"
            [attr.aria-label]="'Update available' | translate"
            [tooltip]="'Update available' | translate"
            *ngIf="shouldUpgradePackage && isUnpacked"
          >
            <i
              class="text-warning icon-16"
              c8yIcon="exclamation-triangle"
            ></i>
          </button>
        </p>
      </ng-container>
      <p
        class="small text-break-word"
        *ngIf="app.manifest?.author"
      >
        {{ app.manifest.author }}
      </p>
    </div>
  </div>
  <div
    class="card-block p-0 no-min-height card--d-col card-column-80 flex-grow"
    (click)="detail()"
  >
    <div class="card-block no-min-height p-t-0 p-b-0 card-column-80">
      <div class="text-center-grid">
        <div class="p-b-8 card-hidden-grid"></div>
        <p
          class="small l-h-tight p-b-8 p-l-0 p-r-0 text-break-word"
          *ngIf="app.description || app.manifest?.description"
        >
          {{ app.description || app.manifest?.description | translate }}
        </p>
        <p
          class="small l-h-tight p-b-8 p-l-0 p-r-0"
          *ngIf="!app.description && !app.manifest?.description"
        >
          <em class="text-muted">{{ 'No description available.' | translate }}</em>
        </p>
      </div>
    </div>
    <div
      class="card-block no-min-height p-t-0 p-b-0 d-flex card-column-20 text-center-grid flex-wrap gap-8"
    >
      <button
        class="btn-clean"
        [attr.aria-label]="
          ((isUnpacked ? UNPACKED_LABEL : appState?.label) | translate) +
          ': ' +
          (appState?.tooltip | translate)
        "
        [tooltip]="appState?.tooltip | translate"
        placement="top"
        [delay]="500"
      >
        <span
          class="label"
          [ngClass]="appState?.class"
        >
          {{ appState?.label | translate }}
        </span>
      </button>
      <button
        class="btn-clean"
        [attr.aria-label]="
          (packageContentState?.label | translate) +
            ': ' +
            (packageContentState?.tooltip
              ? packageContentState?.tooltip
              : PACKAGE_CONTENT_UNDETERMINED_LABEL) | translate
        "
        [tooltip]="
          (packageContentState?.tooltip
            ? packageContentState?.tooltip
            : PACKAGE_CONTENT_UNDETERMINED_LABEL
          ) | translate
        "
        placement="top"
        *ngIf="isPackage"
      >
        <span
          class="label"
          [ngClass]="packageContentState?.class ? packageContentState?.class : 'label-danger'"
        >
          {{
            packageContentState?.label || packageTypeLabels[PACKAGE_TYPE.UNKNOWN].label | translate
          }}
        </span>
      </button>
    </div>
    <div class="card-footer no-min-height p-t-0 p-b-0 card-column-20 text-center-grid">
      <div class="p-b-16 card-hidden-list"></div>
      <button
        class="btn btn-sm btn-default"
        [title]="openButtonTitle | translate"
        type="button"
        (click)="openApp(); $event.stopPropagation()"
        *ngIf="canOpenInBrowser"
        [disabled]="disableOpenInBrowser"
      >
        <i
          class="m-r-4"
          c8yIcon="external-link"
        ></i>
        {{ 'Open' | translate }}
      </button>
      <div class="p-b-32 card-hidden-list"></div>
    </div>
  </div>
  <div class="p-r-40 card-hidden-grid"></div>
  <div
    class="card-actions m-t-0"
    *ngIf="canEdit || canOpenInBrowser || canDelete"
  >
    <div
      class="dropdown"
      #appCardDropdown="bs-dropdown"
      dropdown
      [cdkTrapFocus]="appCardDropdown.isOpen"
    >
      <button
        class="dropdown-toggle c8y-dropdown"
        title="{{ 'Settings' | translate }}"
        data-cy="application-card--settings-button"
        type="button"
        dropdownToggle
      >
        <i c8yIcon="ellipsis-v"></i>
      </button>
      <ul
        class="dropdown-menu dropdown-menu-right"
        *dropdownMenu
      >
        <li *ngIf="canEdit">
          <button
            title="{{ 'Edit' | translate }}"
            data-cy="application-card--edit-button"
            (click)="detail()"
          >
            <i
              class="m-r-4"
              c8yIcon="pencil"
            ></i>
            {{ 'Edit' | translate }}
          </button>
        </li>
        <ng-container *c8yIfAllowed="['ROLE_APPLICATION_MANAGEMENT_ADMIN']">
          <li>
            <button
              [title]="canDelete ? ('Delete' | translate) : (CANNOT_DELETE_HINT | translate)"
              type="button"
              data-cy="application-card--delete-button"
              [disabled]="!canDelete"
              (click)="delete()"
            >
              <i
                class="m-r-4"
                c8yIcon="delete"
              ></i>
              {{ 'Delete' | translate }}
            </button>
          </li>
          <li *ngIf="canClone">
            <button
              [title]="'Clone`package,verb`' | translate"
              type="button"
              *ngIf="isPackage"
              (click)="clone()"
            >
              <i
                class="m-r-4"
                c8yIcon="copy"
              ></i>
              {{ 'Clone`package,verb`' | translate }}
            </button>
            <button
              [title]="'Clone`application,verb`' | translate"
              type="button"
              *ngIf="!isPackage"
              (click)="clone()"
            >
              <i
                class="m-r-4"
                c8yIcon="copy"
              ></i>
              {{ 'Clone`application,verb`' | translate }}
            </button>
          </li>
        </ng-container>
      </ul>
    </div>
  </div>
</div>

<button
  class="card pointer card--d-col"
  type="button"
  (click)="detail()"
  *ngIf="isFeature"
>
  <div class="card-block text-center card-column-40">
    <div class="card-appicon">
      <c8y-app-icon
        *ngIf="!isPackage && !isFeature && !isMicroservice && !isExternal"
        [app]="app"
        [contextPath]="app.contextPath"
        [name]="app.name"
      ></c8y-app-icon>
      <i c8yIcon="tab"></i>
    </div>
    <div>
      <p
        class="e2e-appCardName text-medium"
        title="{{ app | humanizeAppName | async }}"
      >
        {{ app | humanizeAppName | async }}
      </p>
      <ng-container *ngIf="isShowVersion">
        <p class="small text-muted">
          <em>{{ app.manifest.version }}</em>
          <i
            class="text-warning m-l-4"
            c8yIcon="exclamation-triangle"
            [tooltip]="'Update available' | translate"
            *ngIf="shouldUpgradePackage && isUnpacked"
          ></i>
        </p>
      </ng-container>
    </div>
  </div>
  <div class="card-block p-0 no-min-height card--d-col card-column-80 flex-grow">
    <div class="card-block no-min-height p-t-0 p-b-0 card-column-80">
      <div
        class="text-center-grid"
        *ngIf="app.description || app.manifest?.description"
      >
        <div class="p-b-8 card-hidden-grid"></div>
        <p class="small l-h-tight p-b-8 p-l-0 p-r-0">
          {{ app.description || app.manifest?.description | translate }}
        </p>
      </div>
    </div>
    <div class="card-block no-min-height p-t-0 p-b-0 card-column-20 text-center-grid">
      <span
        class="label"
        [ngClass]="appState.class"
      >
        {{ appState.label | translate }}
      </span>
    </div>
    <div
      class="card-block no-min-height p-t-0 p-b-0 card-column-20 text-center-grid"
      *ngIf="isPackage"
    >
      <span
        class="label"
        [ngClass]="packageContentState.class"
      >
        {{ packageContentState.label | translate }}
      </span>
    </div>
    <div class="p-b-32 card-hidden-list"></div>
  </div>
</button>

results matching ""

    No results matching ""