File

src/app/runtime/components/runtime-app-state/runtime-app-state.component.ts

Description

Runtime application status.

Implements

OnChanges

Example

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector app-runtime-state
styleUrls styles.scss

Index

Properties
Methods
Inputs

Constructor

constructor()

Inputs

runtimeApp

Runtime Application

Methods

ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional Description
changes SimpleChanges
Returns : void

Properties

className
className:
Default value : default

CSS class

state
state:

Current status

import { Component, ChangeDetectionStrategy, Input, OnChanges, SimpleChanges } from '@angular/core';

/**
 * Runtime application status.
 *
 * @author Vitrac Damien
 */
@Component({
  selector: 'app-runtime-state',
  styleUrls: ['./styles.scss'],
  template: `<span *ngIf="state" class="label label-{{ className }}">{{ state | uppercase }}</span>`,
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class RuntimeAppStateComponent implements OnChanges {

  /**
   * Runtime Application
   */
  @Input() runtimeApp;

  /**
   * Current status
   */
  state = '';

  /**
   * CSS class
   */
  className = 'default';

  /**
   * Constructor
   */
  constructor() {
  }

  ngOnChanges(changes: SimpleChanges) {
    if (changes.runtimeApp.currentValue.state) {
      this.state = changes.runtimeApp.currentValue.state;
      switch (this.state) {
        case 'failed':
          this.className = 'danger';
          break;
        case 'deploying':
          this.className = 'info';
          break;
        case 'deployed':
          this.className = 'success';
          break;
      }
    }
  }


}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""