xref: /openbmc/phosphor-webui/app/common/directives/firmware-list.js (revision a30394b79c414a7f470bd89a333e892ccb3d2340)
1 window.angular && (function(angular) {
2   'use strict';
3 
4   angular.module('app.common.directives').directive('firmwareList', [
5     'APIUtils',
6     function(APIUtils) {
7       return {
8         'restrict': 'E',
9         'template': require('./firmware-list.html'),
10         'scope':
11             {'title': '@', 'firmwares': '=', 'filterBy': '=', 'version': '='},
12         'controller': [
13           '$rootScope', '$scope', 'dataService', '$location', '$timeout',
14           function($rootScope, $scope, dataService, $location, $timeout) {
15             $scope.dataService = dataService;
16             $scope.activate = function(imageId, imageVersion, imageType) {
17               $scope.$parent.activateImage(imageId, imageVersion, imageType);
18             };
19 
20             $scope.delete = function(imageId, imageVersion) {
21               $scope.$parent.deleteImage(imageId, imageVersion);
22             };
23 
24             $scope.changePriority = function(imageId, imageVersion, from, to) {
25               $scope.$parent.changePriority(imageId, imageVersion, from, to);
26             };
27 
28             $scope.toggleMoreDropdown = function(event, firmware) {
29               firmware.extended.show = !firmware.extended.show;
30               event.stopPropagation();
31             };
32           }
33         ]
34       };
35     }
36   ]);
37 })(window.angular);
38