Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame] | 1 | window.angular && (function(angular) { |
| 2 | 'use strict'; |
Iftekharul Islam | c016139 | 2017-06-14 15:46:15 -0500 | [diff] [blame] | 3 | |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 4 | angular.module('app.common.directives').directive('firmwareList', [ |
| 5 | 'APIUtils', |
| 6 | function(APIUtils) { |
Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame] | 7 | return { |
| 8 | 'restrict': 'E', |
| 9 | 'template': require('./firmware-list.html'), |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 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 | }; |
Iftekharul Islam | c016139 | 2017-06-14 15:46:15 -0500 | [diff] [blame] | 19 | |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 20 | $scope.delete = function(imageId, imageVersion) { |
| 21 | $scope.$parent.deleteImage(imageId, imageVersion); |
| 22 | }; |
Iftekharul Islam | 1acb412 | 2017-11-02 13:20:32 -0500 | [diff] [blame] | 23 | |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 24 | $scope.changePriority = function(imageId, imageVersion, from, to) { |
| 25 | $scope.$parent.changePriority(imageId, imageVersion, from, to); |
| 26 | }; |
Ryan Arnell | 84e7a93 | 2018-12-13 10:50:17 -0600 | [diff] [blame] | 27 | |
| 28 | $scope.toggleMoreDropdown = function(event, firmware) { |
| 29 | firmware.extended.show = !firmware.extended.show; |
| 30 | event.stopPropagation(); |
| 31 | }; |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 32 | } |
| 33 | ] |
Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame] | 34 | }; |
Andrew Geissler | d27bb13 | 2018-05-24 11:07:27 -0700 | [diff] [blame] | 35 | } |
| 36 | ]); |
Gunnar Mills | 6473a41 | 2018-03-01 16:19:37 -0600 | [diff] [blame] | 37 | })(window.angular); |