summaryrefslogtreecommitdiffstats
path: root/app/common/directives/firmware-list.js
blob: ec3a30e01afb695968f89831a06a6e6023fb377d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
window.angular && (function(angular) {
  'use strict';

  angular.module('app.common.directives').directive('firmwareList', [
    'APIUtils',
    function(APIUtils) {
      return {
        'restrict': 'E',
        'template': require('./firmware-list.html'),
        'scope':
            {'title': '@', 'firmwares': '=', 'filterBy': '=', 'version': '='},
        'controller': [
          '$rootScope', '$scope', 'dataService', '$location', '$timeout',
          function($rootScope, $scope, dataService, $location, $timeout) {
            $scope.dataService = dataService;
            $scope.activate = function(imageId, imageVersion, imageType) {
              $scope.$parent.activateImage(imageId, imageVersion, imageType);
            };

            $scope.delete = function(imageId, imageVersion) {
              $scope.$parent.deleteImage(imageId, imageVersion);
            };

            $scope.changePriority = function(imageId, imageVersion, from, to) {
              $scope.$parent.changePriority(imageId, imageVersion, from, to);
            };

            $scope.toggleMoreDropdown = function(event, firmware) {
              firmware.extended.show = !firmware.extended.show;
              event.stopPropagation();
            };
          }
        ]
      };
    }
  ]);
})(window.angular);
OpenPOWER on IntegriCloud