Yoshie Muranaka | 1ab0f7c | 2019-10-24 07:02:12 -0700 | [diff] [blame] | 1 | window.angular && (function(angular) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * |
| 6 | * firmwareCard Component |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Component template |
| 12 | */ |
| 13 | const template = ` |
| 14 | <div class="card-component"> |
| 15 | <div class="card__header" |
| 16 | ng-class="{ |
| 17 | 'card__header--success' : $ctrl.status === 'success', |
| 18 | 'card__header--error' : $ctrl.status === 'error' }"> |
| 19 | <p class="card__header__label inline">{{$ctrl.headerLabel}}</p> |
| 20 | <p class="card__header__value inline">{{$ctrl.headerValue}}</p> |
| 21 | </div> |
| 22 | <div class="card__body" |
| 23 | ng-if="$ctrl.body"> |
| 24 | <div class="row"> |
| 25 | <div class="column small-6"> |
| 26 | <label>BMC Status</label> |
| 27 | {{$ctrl.bmcStatus || 'n/a'}} |
| 28 | </div> |
| 29 | <div class="column small-6"> |
| 30 | <label>Host status</label> |
| 31 | {{$ctrl.hostStatus || 'n/a'}} |
| 32 | </div> |
| 33 | </div> |
| 34 | </div> |
| 35 | </div>` |
| 36 | |
| 37 | /** |
| 38 | * Register firmwareCard component |
| 39 | */ |
| 40 | angular.module('app.configuration').component('firmwareCard', { |
| 41 | template, |
| 42 | bindings: { |
| 43 | headerLabel: '@', |
| 44 | headerValue: '<', |
| 45 | status: '<', // optional, 'success' or 'error' |
| 46 | body: '<', // boolean true to render body content |
| 47 | hostStatus: '<', |
| 48 | bmcStatus: '<' |
| 49 | } |
| 50 | }) |
| 51 | })(window.angular); |