xref: /openbmc/phosphor-webui/app/configuration/controllers/firmware-controller.js (revision 43366db73718c935665c1546ba93c09557949f2c)
1/**
2 * Controller for firmware
3 *
4 * @module app/configuration
5 * @exports firmwareController
6 * @name firmwareController
7 * @version 0.1.0
8 */
9
10window.angular && (function (angular) {
11    'use strict';
12
13    angular
14        .module('app.configuration')
15        .controller('firmwareController', [
16                '$scope',
17                '$window',
18                'APIUtils',
19                'dataService',
20                '$location',
21                '$anchorScroll',
22                function ($scope, $window, APIUtils, dataService, $location, $anchorScroll) {
23                    $scope.dataService = dataService;
24
25                    //Check if window has scroll
26                    $scope.hasVScroll = document.body.scrollHeight > document.body.clientHeight;
27                    $scope.link = document.getElementsByClassName("btn-upload");
28                    $scope.appWindow = angular.element($window);
29
30                    //Hide/Show anchor link if window has scroll
31                    if ($scope.hasVScroll == true) {
32                        $scope.link[0].style.display = 'block';
33                    } else {
34                        $scope.link[0].style.display = 'none';
35                    }
36
37                    //Scroll to target anchor
38                    $scope.gotoAnchor = function () {
39                        $location.hash('upload');
40                        $anchorScroll();
41                    };
42                }
43            ]
44        );
45
46})(angular);
47