Currently, Kimchi uses different ways of displaying error messages.
Use the standard message (kimchi.message) to display HTML errors.
This is one step towards the solution of issue #215.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
ui/css/theme-default/guest-cdrom-edit.css | 5 -----
ui/css/theme-default/guest-storage-add.css | 5 -----
ui/css/theme-default/login-window.css | 9 ---------
ui/css/theme-default/report-add.css | 4 ----
ui/js/src/kimchi.guest_cdrom_edit_main.js | 4 +---
ui/js/src/kimchi.guest_storage_add.main.js | 4 +---
ui/js/src/kimchi.login_window.js | 2 +-
ui/js/src/kimchi.report_add_main.js | 6 ++----
ui/pages/guest-cdrom-edit.html.tmpl | 3 ---
ui/pages/guest-storage-add.html.tmpl | 3 ---
ui/pages/login-window.html.tmpl | 1 -
ui/pages/report-add.html.tmpl | 1 -
12 files changed, 5 insertions(+), 42 deletions(-)
diff --git a/ui/css/theme-default/guest-cdrom-edit.css
b/ui/css/theme-default/guest-cdrom-edit.css
index 7008d73..9c539c9 100644
--- a/ui/css/theme-default/guest-cdrom-edit.css
+++ b/ui/css/theme-default/guest-cdrom-edit.css
@@ -44,11 +44,6 @@
cursor: not-allowed;
}
-#cdrom-error-message {
- color: red;
- padding: 5px;
-}
-
#vm-cdrom-button-edit[disabled] {
background: #c0c0c0;
color: #ddd;
diff --git a/ui/css/theme-default/guest-storage-add.css
b/ui/css/theme-default/guest-storage-add.css
index c8c31a2..4da8389 100644
--- a/ui/css/theme-default/guest-storage-add.css
+++ b/ui/css/theme-default/guest-storage-add.css
@@ -52,11 +52,6 @@
cursor: not-allowed;
}
-#storage-error-message {
- color: red;
- padding: 5px;
-}
-
#vm-storage-button-add[disabled] {
background: #c0c0c0;
color: #ddd;
diff --git a/ui/css/theme-default/login-window.css
b/ui/css/theme-default/login-window.css
index fe83de0..27f8502 100644
--- a/ui/css/theme-default/login-window.css
+++ b/ui/css/theme-default/login-window.css
@@ -78,15 +78,6 @@
color: #DDD;
}
-#login-window .login-panel .error-message {
- color: red;
- font-size: 15px;
- line-height: 22px;
- width: 306px;
- height: 22px;
- margin-top: -10px;
-}
-
.language {
display:inline-block;
float:right;
diff --git a/ui/css/theme-default/report-add.css b/ui/css/theme-default/report-add.css
index 753f100..236029a 100644
--- a/ui/css/theme-default/report-add.css
+++ b/ui/css/theme-default/report-add.css
@@ -14,10 +14,6 @@
width: 100%;
}
-#report-error-message {
- color: red;
-}
-
#button-report-add[disabled] {
background: #c0c0c0 url(../../images/theme-default/loading.gif) 7px
center no-repeat;
diff --git a/ui/js/src/kimchi.guest_cdrom_edit_main.js
b/ui/js/src/kimchi.guest_cdrom_edit_main.js
index 45fc80c..abce9a5 100644
--- a/ui/js/src/kimchi.guest_cdrom_edit_main.js
+++ b/ui/js/src/kimchi.guest_cdrom_edit_main.js
@@ -21,7 +21,6 @@ kimchi.guest_cdrom_edit_main = function() {
var nameTextbox = $('input[name="dev"]', cdromEditForm);
var typeTextbox = $('input[name="type"]', cdromEditForm);
var pathTextbox = $('input[name="path"]', cdromEditForm);
- var errorMessage = $('#cdrom-error-message');
var originalPath = null;
kimchi.retrieveVMStorage({
@@ -49,7 +48,6 @@ kimchi.guest_cdrom_edit_main = function() {
$(c).prop('disabled', true);
});
$(submitButton).addClass('loading').text(i18n['KCHVMCD6005M']);
- $(errorMessage).text('');
var settings = {
vm: kimchi.selectedGuest,
@@ -65,7 +63,7 @@ kimchi.guest_cdrom_edit_main = function() {
}, function(result) {
var errText = result['reason'] ||
result['responseJSON']['reason'];
- $(errorMessage).text(errText);
+ kimchi.message.error(errText);
$.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
$(c).prop('disabled', false);
diff --git a/ui/js/src/kimchi.guest_storage_add.main.js
b/ui/js/src/kimchi.guest_storage_add.main.js
index 7c96e3a..9e232d7 100644
--- a/ui/js/src/kimchi.guest_storage_add.main.js
+++ b/ui/js/src/kimchi.guest_storage_add.main.js
@@ -27,7 +27,6 @@ kimchi.guest_storage_add_main = function() {
var nameTextbox = $('input[name="dev"]', storageAddForm);
var typeTextbox = $('input[name="type"]', storageAddForm);
var pathTextbox = $('input[name="path"]', storageAddForm);
- var errorMessage = $('#storage-error-message');
var submitForm = function(event) {
if(submitButton.prop('disabled')) {
@@ -46,7 +45,6 @@ kimchi.guest_storage_add_main = function() {
$(c).prop('disabled', true);
});
$(submitButton).addClass('loading').text(i18n['KCHVMCD6003M']);
- $(errorMessage).text('');
var settings = {
vm: kimchi.selectedGuest,
@@ -66,7 +64,7 @@ kimchi.guest_storage_add_main = function() {
}, function(result) {
var errText = result['reason'] ||
result['responseJSON']['reason'];
- $(errorMessage).text(errText);
+ kimchi.message.error(errText);
$.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
$(c).prop('disabled', false);
diff --git a/ui/js/src/kimchi.login_window.js b/ui/js/src/kimchi.login_window.js
index e9af18f..4933a79 100644
--- a/ui/js/src/kimchi.login_window.js
+++ b/ui/js/src/kimchi.login_window.js
@@ -94,7 +94,7 @@ kimchi.login_main = function() {
kimchi.user.showUser(true);
kimchi.window.close();
}, function() {
- $('#message-container').text(i18n['KCHAUTH6001E']);
+ kimchi.message.error(i18n['KCHAUTH6001E']);
$('#btn-login').prop('disabled',
false).text(i18n['KCHAUTH6001M']);
placeCursor('user-id');
});
diff --git a/ui/js/src/kimchi.report_add_main.js b/ui/js/src/kimchi.report_add_main.js
index 757ee21..50807f0 100644
--- a/ui/js/src/kimchi.report_add_main.js
+++ b/ui/js/src/kimchi.report_add_main.js
@@ -2,7 +2,6 @@ kimchi.report_add_main = function() {
var addReportForm = $('#form-report-add');
var submitButton = $('#button-report-add');
var nameTextbox = $('input[name="name"]', addReportForm);
- var errorMessage = $('#report-error-message');
var submitForm = function(event) {
if(submitButton.prop('disabled')) {
return false;
@@ -10,11 +9,10 @@ kimchi.report_add_main = function() {
var reportName = nameTextbox.val();
var validator = RegExp("^[A-Za-z0-9-]*$");
if (!validator.test(reportName)) {
- errorMessage.text(i18n['KCHDR6011M']);
+ kimchi.message.error(i18n['KCHDR6011M']);
return false;
}
var formData = addReportForm.serializeObject();
- errorMessage.text('');
submitButton
.text(i18n['KCHDR6007M'])
.prop('disabled', true);
@@ -31,7 +29,7 @@ kimchi.report_add_main = function() {
else {
var errText = result['responseJSON']['reason'];
}
- result && $('#report-error-message').text(errText);
+ result && kimchi.message.error(errText)
submitButton
.text(i18n['KCHDR6006M'])
.prop('disabled', false);
diff --git a/ui/pages/guest-cdrom-edit.html.tmpl b/ui/pages/guest-cdrom-edit.html.tmpl
index 9f07d9f..b95119f 100644
--- a/ui/pages/guest-cdrom-edit.html.tmpl
+++ b/ui/pages/guest-cdrom-edit.html.tmpl
@@ -55,9 +55,6 @@
<input type="text" class="text"
name="path" />
</div>
</section>
- <section class="form-section">
- <div id="cdrom-error-message"></div>
- </section>
</form>
</div>
<footer>
diff --git a/ui/pages/guest-storage-add.html.tmpl b/ui/pages/guest-storage-add.html.tmpl
index c190d0e..71e0610 100644
--- a/ui/pages/guest-storage-add.html.tmpl
+++ b/ui/pages/guest-storage-add.html.tmpl
@@ -62,9 +62,6 @@
<input type="text" class="text"
name="path" />
</div>
</section>
- <section class="form-section">
- <div id="storage-error-message"></div>
- </section>
</form>
</div>
<footer>
diff --git a/ui/pages/login-window.html.tmpl b/ui/pages/login-window.html.tmpl
index dfcb6b0..b7850e5 100644
--- a/ui/pages/login-window.html.tmpl
+++ b/ui/pages/login-window.html.tmpl
@@ -33,7 +33,6 @@
</header>
<div class="content login-panel">
<form id="form-login" action="/login"
method="POST">
- <div id="message-container" class="row
error-message"></div>
<div class="row">
<input type="text" id="user-id" name="userid"
required="required" placeholder="$_("User Name")" />
<div id="user-id-msg"
class="msg-required"></div>
diff --git a/ui/pages/report-add.html.tmpl b/ui/pages/report-add.html.tmpl
index 18216ce..b7209fe 100644
--- a/ui/pages/report-add.html.tmpl
+++ b/ui/pages/report-add.html.tmpl
@@ -38,7 +38,6 @@
$_("The name used to identify the report. If omitted, a name
will be chosen based on current time. Name can contain: letters, digits and hyphen
(\"-\").")
</span>
<input type="text" class="text"
id="report-name-textbox" name="name" />
- <span id="report-error-message"></span>
</div>
</section>
</form>
--
1.8.5.3