1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #3748: Check if a file is selected before the upload starts

This commit is contained in:
Carlos Martín 2015-06-03 12:58:07 +02:00
parent f3dd67c5b6
commit c640b69451
2 changed files with 14 additions and 0 deletions

View File

@ -168,6 +168,7 @@ define(function(require) {
var ds_id = $('#file_datastore .resource_list_select', context).val();
if (!ds_id) {
Sunstone.hideFormPanelLoading(TAB_ID);
Notifier.notifyError(Locale.tr("Please select a datastore for this file"));
return false;
}
@ -203,6 +204,12 @@ define(function(require) {
//this is an image upload we trigger FileUploader
//to start the upload
if (upload) {
if (that.uploader.files.length == 0) {
Sunstone.hideFormPanelLoading(TAB_ID);
Notifier.notifyError(Locale.tr("Please select a file to upload"));
return false;
}
Sunstone.resetFormPanel(that.tabId, that.formPanelId);
Sunstone.hideFormPanel(that.tabId);

View File

@ -192,6 +192,7 @@ define(function(require) {
var ds_id = $('#img_datastore .resource_list_select', context).val();
if (!ds_id) {
Sunstone.hideFormPanelLoading(TAB_ID);
Notifier.notifyError(Locale.tr("Please select a datastore for this image"));
return false;
}
@ -250,6 +251,12 @@ define(function(require) {
//this is an image upload we trigger FileUploader
//to start the upload
if (upload) {
if (that.uploader.files.length == 0) {
Sunstone.hideFormPanelLoading(TAB_ID);
Notifier.notifyError(Locale.tr("Please select a file to upload"));
return false;
}
Sunstone.resetFormPanel(that.tabId, that.formPanelId);
Sunstone.hideFormPanel(that.tabId);