xref: /openbmc/phosphor-webui/app/common/directives/firmware-list.js (revision 84e7a936db2addc3c10be97c3b348b9ffdb3601b)
1c016139fSIftekharul Islamwindow.angular && (function(angular) {
2c016139fSIftekharul Islam  'use strict';
3c016139fSIftekharul Islam
4d27bb135SAndrew Geissler  angular.module('app.common.directives').directive('firmwareList', [
5d27bb135SAndrew Geissler    'APIUtils',
6d27bb135SAndrew Geissler    function(APIUtils) {
7c016139fSIftekharul Islam      return {
8c016139fSIftekharul Islam        'restrict': 'E',
9bbcf670aSEd Tanous        'template': require('./firmware-list.html'),
10d27bb135SAndrew Geissler        'scope':
11d27bb135SAndrew Geissler            {'title': '@', 'firmwares': '=', 'filterBy': '=', 'version': '='},
12d27bb135SAndrew Geissler        'controller': [
13d27bb135SAndrew Geissler          '$rootScope', '$scope', 'dataService', '$location', '$timeout',
14d27bb135SAndrew Geissler          function($rootScope, $scope, dataService, $location, $timeout) {
15c016139fSIftekharul Islam            $scope.dataService = dataService;
16ee6efd85SGunnar Mills            $scope.activate = function(imageId, imageVersion, imageType) {
17ee6efd85SGunnar Mills              $scope.$parent.activateImage(imageId, imageVersion, imageType);
18ba5e3f34SAndrew Geissler            };
19c016139fSIftekharul Islam
20607a120aSGunnar Mills            $scope.delete = function(imageId, imageVersion) {
21607a120aSGunnar Mills              $scope.$parent.deleteImage(imageId, imageVersion);
22ba5e3f34SAndrew Geissler            };
231acb412dSIftekharul Islam
246473a41dSGunnar Mills            $scope.changePriority = function(imageId, imageVersion, from, to) {
256473a41dSGunnar Mills              $scope.$parent.changePriority(imageId, imageVersion, from, to);
26ba5e3f34SAndrew Geissler            };
27*84e7a936SRyan Arnell
28*84e7a936SRyan Arnell            $scope.toggleMoreDropdown = function(event, firmware) {
29*84e7a936SRyan Arnell              firmware.extended.show = !firmware.extended.show;
30*84e7a936SRyan Arnell              event.stopPropagation();
31*84e7a936SRyan Arnell            };
32d27bb135SAndrew Geissler          }
33d27bb135SAndrew Geissler        ]
34c016139fSIftekharul Islam      };
35d27bb135SAndrew Geissler    }
36d27bb135SAndrew Geissler  ]);
37c016139fSIftekharul Islam})(window.angular);
38