summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeccabroek <beccabroek@gmail.com>2019-04-10 14:08:49 -0500
committerGunnar Mills <gmills@us.ibm.com>2019-04-11 14:40:14 +0000
commit4733a11b42fca6013e3957bf0e345d0cea086d96 (patch)
treebbb37811876e1fbb05edc0bd4430f75df7686cdf
parent1ffa209e99da608e225df0a3a3caf47036b3a793 (diff)
downloadphosphor-webui-4733a11b42fca6013e3957bf0e345d0cea086d96.tar.gz
phosphor-webui-4733a11b42fca6013e3957bf0e345d0cea086d96.zip
Firmware page upload not working in some cases
Upload was not working in some cases because of two separate issues. Inline onchange is no longer executed in Chrome. This removes the inline onchange event since it was updating a variable not being used anyway. This also updates the click-outside directive as it was missing [ ] brackets that were necessary and throwing an error in the console when loaded onto a witherspoon. see https://developer.chrome.com/extensions/contentSecurityPolicy and https://stackoverflow.com/questions/35126898/error-after-minifica tion-of-angular-js-error-injectorunpr-unknown-provider Resolves openbmc/phosphor-webui#77 Tested: Able to upload image onto Witherspoon. Click-outside directive worked when GUI was mounted on a Witherspoon Change-Id: I7b1c385751e114b2d31f516e391dd0737117ab42 Signed-off-by: beccabroek <beccabroek@gmail.com>
-rw-r--r--app/common/directives/click-outside.js38
-rw-r--r--app/configuration/controllers/firmware-controller.html2
-rw-r--r--app/configuration/controllers/firmware-controller.js3
3 files changed, 21 insertions, 22 deletions
diff --git a/app/common/directives/click-outside.js b/app/common/directives/click-outside.js
index ffe1464..35248ee 100644
--- a/app/common/directives/click-outside.js
+++ b/app/common/directives/click-outside.js
@@ -1,24 +1,26 @@
window.angular && (function(angular) {
'use strict';
- angular.module('app.common.directives')
- .directive('clickOutside', function($document) {
- return {
- restrict: 'A', scope: {clickOutside: '&'},
- link: function(scope, el, attr) {
- function clickEvent(e) {
- if (el !== e.target && !el[0].contains(e.target)) {
- scope.$apply(function() {
- scope.$eval(scope.clickOutside);
- });
- }
+ angular.module('app.common.directives').directive('clickOutside', [
+ '$document',
+ function($document) {
+ return {
+ restrict: 'A', scope: {clickOutside: '&'},
+ link: function(scope, el, attr) {
+ function clickEvent(e) {
+ if (el !== e.target && !el[0].contains(e.target)) {
+ scope.$apply(function() {
+ scope.$eval(scope.clickOutside);
+ });
}
- $document.bind('click', clickEvent);
-
- scope.$on('$destroy', function() {
- $document.unbind('click', clickEvent);
- });
}
- }
- });
+ $document.bind('click', clickEvent);
+
+ scope.$on('$destroy', function() {
+ $document.unbind('click', clickEvent);
+ });
+ }
+ }
+ }
+ ]);
})(window.angular); \ No newline at end of file
diff --git a/app/configuration/controllers/firmware-controller.html b/app/configuration/controllers/firmware-controller.html
index 1ec79fd..6863ae5 100644
--- a/app/configuration/controllers/firmware-controller.html
+++ b/app/configuration/controllers/firmware-controller.html
@@ -21,7 +21,7 @@
<h3>Upload image file from workstation</h3>
<p>Select the image file saved on the workstation storage medium to upload to the server BMC.</p>
<label for="file-upload" class="inline firmware__upload-chooser">
- <input id="file-upload" type="file" file="file" class="hide" onchange="angular.element(this).scope().fileNameChanged()"/>
+ <input id="file-upload" type="file" file="file" class="hide"/>
<span class="button btn-secondary inline">Choose a file</span>
<span class="inline firmware__upload-file-name"><span ng-if="!file">No file chosen</span><span ng-if="file.name !== undefined">{{file.name}}</span></span>
</label>
diff --git a/app/configuration/controllers/firmware-controller.js b/app/configuration/controllers/firmware-controller.js
index 9a811c3..da4dc1c 100644
--- a/app/configuration/controllers/firmware-controller.js
+++ b/app/configuration/controllers/firmware-controller.js
@@ -312,9 +312,6 @@ window.angular && (function(angular) {
});
$scope.confirm_delete = false;
};
- $scope.fileNameChanged = function() {
- $scope.file_empty = false;
- };
$scope.filters = {bmc: {imageType: 'BMC'}, host: {imageType: 'Host'}};
OpenPOWER on IntegriCloud