aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src
diff options
context:
space:
mode:
authorChris Donley <christopher.donley@huawei.com>2018-04-18 13:21:31 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-18 13:21:31 +0000
commitc5279dee315d9834307015a0700125c4e40014f0 (patch)
tree3e7f1998f3a76559961c4fd088eb44f9689ef9ff /vnfmarket/src
parent8ac9aaa90490e17d754819bd46282235208cf4e0 (diff)
parentbee3e9d43fba11fb37bd8ba590c76203e585505d (diff)
Merge "validation for file type selection"
Diffstat (limited to 'vnfmarket/src')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js10
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json2
2 files changed, 10 insertions, 2 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js b/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js
index 3f64841d..43137a5a 100644
--- a/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js
+++ b/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js
@@ -43,7 +43,15 @@
function link(scope, element, attrs) {
element.bind("change", function (changeEvent) {
scope.$apply(function () {
- scope.fileUpload = changeEvent.target.files[0];
+ var fileType = changeEvent.target.accept;
+ var ext = "." + changeEvent.target.value.match(/\.(.+)$/)[1];
+ scope.fileUpload = null;
+ if (typeof fileType == undefined || fileType == "") {
+ scope.fileUpload = changeEvent.target.files[0];
+ }
+ else if ((Array.isArray(fileType) && fileType.indexOf(ext) > -1) || (fileType == ext)) {
+ scope.fileUpload = changeEvent.target.files[0];
+ }
});
});
}
diff --git a/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json b/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json
index d086b9ac..f82b567e 100644
--- a/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json
+++ b/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json
@@ -57,7 +57,7 @@
"fields": {
"fileUpload": {
"label": "Select File",
- "noFileSelected": "No file selected"
+ "noFileSelected": "No file selected (Select .csar file)"
},
"shortDescription": {
"placeholder": "Short Description"