[PATCH 0/3] Fix UI code errors and messages

Ramon Medeiros (3): Remove unused messages in Kimchi UI Fix WOK UI error messages Add checking for UI codes when running make check-local Makefile.am | 1 + check_ui_code_errors.sh | 11 ++ src/wok/plugins/kimchi/Makefile.am | 2 +- src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 ++ src/wok/plugins/kimchi/model/vms.py | 6 +- src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl | 81 ------------ ui/js/src/wok.confirm.js | 4 +- ui/js/src/wok.grid.js | 10 +- ui/js/src/wok.line-chart.js | 2 +- ui/js/src/wok.list.js | 10 +- ui/js/src/wok.main.js | 2 +- ui/js/widgets/filter-select.js | 4 +- ui/pages/i18n.json.tmpl | 168 ++----------------------- 13 files changed, 52 insertions(+), 260 deletions(-) create mode 100755 check_ui_code_errors.sh create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh -- 2.1.0

Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl | 81 -------------------------- 1 file changed, 81 deletions(-) diff --git a/src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl b/src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl index 64045a9..d356437 100644 --- a/src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl +++ b/src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl @@ -22,12 +22,6 @@ #silent _ = t.gettext #silent _t = t.gettext { - "KCHAUTH6001E": "$_("The username or password you entered is incorrect. Please try again.")", - "KCHAUTH6002E": "$_("This field is required.")", - - "KCHAUTH6001M": "$_("Log in")", - "KCHAUTH6002M": "$_("Logging in...")", - "Host": "$_("Host")", "Guests": "$_("Guests")", "Templates": "$_("Templates")", @@ -37,8 +31,6 @@ "KCHAPI6002E": "$_("Failed to get application configuration")", "KCHAPI6003E": "$_("This is not a valid Linux path")", "KCHAPI6004E": "$_("This is not a valid URL.")", - "KCHAPI6005E": "$_("No such data available.")", - "KCHAPI6007E": "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")", "KCHAPI6008E": "$_("Unable to read file.")", "KCHAPI6009E": "$_("Error while uploading file.")", @@ -52,73 +44,12 @@ "KCHAPI6008M": "$_("Creating...")", "KCHAPI6009M": "$_("Cloning...")", - "KCHGRD6001M": "$_("Loading...")", - "KCHGRD6002M": "$_("An error occurred while retrieving system information.")", - "KCHGRD6003M": "$_("Retry")", - "KCHGRD6004M": "$_("Detailed message:")", - "KCHTMPL6001W": "$_("No ISO found")", - "KCHTMPL6002E": "$_("This is not a valid ISO file.")", "KCHTMPL6002M": "$_("This may take a long time. Do you want to continue?")", "KCHTMPL6003M": "$_("This will permanently delete the template. Would you like to continue?")", - "KCHHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")", - - "KCHHOST6001M": "$_("Max:")", - "KCHHOST6002M": "$_("Utilization")", - "KCHHOST6003M": "$_("Available")", - "KCHHOST6004M": "$_("Read Rate")", - "KCHHOST6005M": "$_("Write Rate")", - "KCHHOST6006M": "$_("Received")", - "KCHHOST6007M": "$_("Sent")", - "KCHHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")", - - - "KCHREPO6001M": "$_("Confirm")", - "KCHREPO6002M": "$_("Repository will be removed permanently and can't be recovered. Do you want to continue?")", - "KCHREPO6003M": "$_("Repositories")", - "KCHREPO6004M": "$_("ID")", - "KCHREPO6005M": "$_("Name")", - "KCHREPO6006M": "$_("Base URL")", - "KCHREPO6007M": "$_("Is Mirror")", - "KCHREPO6008M": "$_("URL Args")", - "KCHREPO6009M": "$_("Enabled")", - "KCHREPO6010M": "$_("GPG Check")", - "KCHREPO6011M": "$_("GPG Key")", - "KCHREPO6012M": "$_("Add")", - "KCHREPO6013M": "$_("Edit")", - "KCHREPO6014M": "$_("Remove")", - "KCHREPO6016M": "$_("Enable")", - "KCHREPO6017M": "$_("Disable")", - - - "KCHUPD6001M": "$_("Software Updates")", - "KCHUPD6002M": "$_("Package Name")", - "KCHUPD6003M": "$_("Version")", - "KCHUPD6004M": "$_("Architecture")", - "KCHUPD6005M": "$_("Repository")", - "KCHUPD6006M": "$_("Update All")", - "KCHUPD6007M": "$_("Updating...")", - "KCHUPD6008M": "$_("Failed to retrieve packages update information.")", - "KCHUPD6009M": "$_("Failed to update package(s).")", - "KCHUPD6010M": "$_("The package manager job is done.")", - "KCHUPD6011M": "$_("Failed to read the package manager logfile.")", - - - "KCHDR6001M": "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")", - "KCHDR6002M": "$_("Debug Reports")", - "KCHDR6003M": "$_("Name")", - "KCHDR6005M": "$_("Generated Time")", - "KCHDR6006M": "$_("Generate")", - "KCHDR6007M": "$_("Generating...")", - "KCHDR6008M": "$_("Rename")", - "KCHDR6009M": "$_("Remove")", - "KCHDR6010M": "$_("Download")", - "KCHDR6011M": "$_("Report name should contain only letters, digits, underscore ('_') and/or hyphen ('-').")", - "KCHDR6012M": "$_("Pending...")", - "KCHDR6013M": "$_("Report name is the same as the original one.")", "KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")", "KCHVM6002M": "$_("Power off Confirmation")", @@ -137,11 +68,6 @@ "KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")", "KCHVMCD6002M": "$_("Attach")", "KCHVMCD6003M": "$_("Attaching...")", - "KCHVMCD6004M": "$_("Replace")", - "KCHVMCD6005M": "$_("Replacing...")", - "KCHVMCD6006M": "$_("Successfully attached!")", - "KCHVMCD6007M": "$_("Successfully replaced!")", - "KCHVMCD6008M": "$_("Successfully detached!")", "KCHVMCD6009M": "$_("This disk will be detached permanently and you can re-attach it. Continue to detach it?")", "KCHVMED6001M": "$_("interface:")", @@ -156,7 +82,6 @@ "KCHNET6001M": "$_("unavailable")", "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", - "KCHNET6003M": "$_("Create a network")", "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")", @@ -169,15 +94,9 @@ "KCHPOOL6007M": "$_("No iSCSI found. Please input one.")", "KCHPOOL6008M": "$_("Failed to load iSCSI targets.")", - "KCHPOOL6001E": "$_("The storage pool name can not be blank.")", - "KCHPOOL6002E": "$_("The storage pool path can not be blank.")", - "KCHPOOL6003E": "$_("NFS server mount path can not be blank.")", "KCHPOOL6005E": "$_("Invalid NFS mount path.")", "KCHPOOL6006E": "$_("No logical device selected.")", - "KCHPOOL6007E": "$_("The iSCSI target can not be blank.")", - "KCHPOOL6008E": "$_("Server name can not be blank.")", "KCHPOOL6009E": "$_("This is not a valid Server Name or IP. Please, modify it.")", - "KCHPOOL6010M": "$_("Looking for available partitions ...")", "KCHPOOL6011M": "$_("No available partitions found.")", "KCHPOOL6012M": "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")", "KCHPOOL6013M": "$_("Unable to retrieve partitions information.")", -- 2.1.0

Remove unused messages and correct prefix (change from KCH to WOK) Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- ui/js/src/wok.confirm.js | 4 +- ui/js/src/wok.grid.js | 10 +-- ui/js/src/wok.line-chart.js | 2 +- ui/js/src/wok.list.js | 10 +-- ui/js/src/wok.main.js | 2 +- ui/js/widgets/filter-select.js | 4 +- ui/pages/i18n.json.tmpl | 168 +++-------------------------------------- 7 files changed, 25 insertions(+), 175 deletions(-) diff --git a/ui/js/src/wok.confirm.js b/ui/js/src/wok.confirm.js index 63f01c4..3e7ce54 100644 --- a/ui/js/src/wok.confirm.js +++ b/ui/js/src/wok.confirm.js @@ -56,8 +56,8 @@ wok.confirm = function(settings, confirmCallback, cancelCallback) { settings.content, '</div>', '<div class="modal-footer">', - '<button id="button-confirm" class="btn btn-default">' + (settings.confirm || i18n['KCHAPI6004M']) + '</button>', - '<button id="button-cancel" class="btn btn-default">' + (settings.cancel || i18n['KCHAPI6003M']) + '</button>', + '<button id="button-confirm" class="btn btn-default">' + (settings.confirm || i18n['WOKAPI6004M']) + '</button>', + '<button id="button-cancel" class="btn btn-default">' + (settings.cancel || i18n['WOKAPI6003M']) + '</button>', '</div>', '</div>', '</div>' diff --git a/ui/js/src/wok.grid.js b/ui/js/src/wok.grid.js index 5913a7f..48bdfad 100644 --- a/ui/js/src/wok.grid.js +++ b/ui/js/src/wok.grid.js @@ -192,10 +192,10 @@ wok.widget.Grid.prototype = (function() { var rowSelection = this['opts']['rowSelection'] || 'single'; var domNode = $(wok.substitute(htmlStr, { id: gridID, - loading: i18n['KCHGRD6001M'], - message: i18n['KCHGRD6002M'], - buttonLabel: i18n['KCHGRD6003M'], - detailedLabel: i18n['KCHGRD6004'] + loading: i18n['WOKGRD6001M'], + message: i18n['WOKGRD6002M'], + buttonLabel: i18n['WOKGRD6003M'], + detailedLabel: i18n['WOKGRD6004M'] })).appendTo(container); this.domNode = domNode; @@ -311,4 +311,4 @@ wok.widget.Grid.prototype = (function() { //destroy: destroy, showMessage: showMessage }; -})(); \ No newline at end of file +})(); diff --git a/ui/js/src/wok.line-chart.js b/ui/js/src/wok.line-chart.js index 3eb3494..d6fca9c 100644 --- a/ui/js/src/wok.line-chart.js +++ b/ui/js/src/wok.line-chart.js @@ -104,7 +104,7 @@ wok.widget.LineChart = function(params) { ]; - var maxValueLabel = i18n['KCHHOST6001M'] + ' ' + + var maxValueLabel = i18n['WOKHOST6001M'] + ' ' + (type === 'value' ? wok.formatMeasurement(maxValue, formatSettings) : '100%'); diff --git a/ui/js/src/wok.list.js b/ui/js/src/wok.list.js index 21aa9fd..a7c43d6 100644 --- a/ui/js/src/wok.list.js +++ b/ui/js/src/wok.list.js @@ -237,10 +237,10 @@ wok.widget.List.prototype = (function() { var rowSelection = this.opts.rowSelection || 'single'; var domNode = $(wok.substitute(htmlStr, { id: gridID, - loading: i18n.KCHGRD6001M, - message: i18n.KCHGRD6002M, - buttonLabel: i18n.KCHGRD6003M, - detailedLabel: i18n.KCHGRD6004 + loading: i18n.WOKGRD6001M, + message: i18n.WOKGRD6002M, + buttonLabel: i18n.WOKGRD6003M, + detailedLabel: i18n.WOKGRD6004M })).appendTo(container); this.domNode = domNode; @@ -299,4 +299,4 @@ wok.widget.List.prototype = (function() { reload: reload, showMessage: showMessage }; -})(); \ No newline at end of file +})(); diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js index 1330ac1..c0d5872 100644 --- a/ui/js/src/wok.main.js +++ b/ui/js/src/wok.main.js @@ -316,7 +316,7 @@ wok.main = function() { return; } else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText) && !wok.isLoggingOut && errorMsg == "") { - errorMsg = i18n['KCHAPI6007E'].replace("%1", jqXHR.state()); + errorMsg = i18n['WOKAPI6007E'].replace("%1", jqXHR.state()); wok.message.error(errorMsg); } if(ajaxSettings['originalError']) { diff --git a/ui/js/widgets/filter-select.js b/ui/js/widgets/filter-select.js index 8e78fc1..d884962 100644 --- a/ui/js/widgets/filter-select.js +++ b/ui/js/widgets/filter-select.js @@ -54,7 +54,7 @@ that.listControl.html(''); var items = that._dataList(options); if (items.length === 0) { - that.listControl.html(i18n['KCHAPI6005E']); + that.listControl.html(i18n['WOKAPI6005E']); } else { $.each(items, function(index, item) { that.listControl.append(item); @@ -74,7 +74,7 @@ }); if (that.listControl.html() === '') { that.target.addClass("invalid-field"); - that.listControl.html(i18n['KCHAPI6005E']); + that.listControl.html(i18n['WOKAPI6005E']); } else { that.target.removeClass("invalid-field"); } diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index 8753a6e..7188a98 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -24,166 +24,16 @@ #silent _ = t.gettext #silent _t = t.gettext { - "KCHAUTH6001E": "$_("The username or password you entered is incorrect. Please try again.")", - "KCHAUTH6002E": "$_("This field is required.")", + "WOKAPI6005E": "$_("No such data available.")", + "WOKAPI6007E": "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")", - "KCHAUTH6001M": "$_("Log in")", - "KCHAUTH6002M": "$_("Logging in...")", + "WOKAPI6003M": "$_("Cancel")", + "WOKAPI6004M": "$_("Confirm")", - "Host": "$_("Host")", - "Guests": "$_("Guests")", - "Templates": "$_("Templates")", - "Storage": "$_("Storage")", - "Network": "$_("Network")", + "WOKGRD6001M": "$_("Loading...")", + "WOKGRD6002M": "$_("An error occurred while retrieving system information.")", + "WOKGRD6003M": "$_("Retry")", + "WOKGRD6004M": "$_("Detailed message:")", - "KCHAPI6002E": "$_("Failed to get application configuration")", - "KCHAPI6003E": "$_("This is not a valid Linux path")", - "KCHAPI6004E": "$_("This is not a valid URL.")", - "KCHAPI6005E": "$_("No such data available.")", - "KCHAPI6007E": "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")", - "KCHAPI6008E": "$_("Unable to read file.")", - "KCHAPI6009E": "$_("Error while uploading file.")", - - "KCHAPI6001M": "$_("Delete Confirmation")", - "KCHAPI6002M": "$_("OK")", - "KCHAPI6003M": "$_("Cancel")", - "KCHAPI6004M": "$_("Confirm")", - "KCHAPI6005M": "$_("Create")", - "KCHAPI6006M": "$_("Warning")", - "KCHAPI6007M": "$_("Save")", - "KCHAPI6008M": "$_("Creating...")", - "KCHAPI6009M": "$_("Cloning...")", - - "KCHGRD6001M": "$_("Loading...")", - "KCHGRD6002M": "$_("An error occurred while retrieving system information.")", - "KCHGRD6003M": "$_("Retry")", - "KCHGRD6004M": "$_("Detailed message:")", - - "KCHTMPL6001W": "$_("No ISO found")", - - "KCHTMPL6002E": "$_("This is not a valid ISO file.")", - - "KCHTMPL6002M": "$_("This may take a long time. Do you want to continue?")", - "KCHTMPL6003M": "$_("This will permanently delete the template. Would you like to continue?")", - - "KCHHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")", - - "KCHHOST6001M": "$_("Max:")", - "KCHHOST6002M": "$_("Utilization")", - "KCHHOST6003M": "$_("Available")", - "KCHHOST6004M": "$_("Read Rate")", - "KCHHOST6005M": "$_("Write Rate")", - "KCHHOST6006M": "$_("Received")", - "KCHHOST6007M": "$_("Sent")", - "KCHHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")", - - - "KCHREPO6001M": "$_("Confirm")", - "KCHREPO6002M": "$_("Repository will be removed permanently and can't be recovered. Do you want to continue?")", - "KCHREPO6003M": "$_("Repositories")", - "KCHREPO6004M": "$_("ID")", - "KCHREPO6005M": "$_("Name")", - "KCHREPO6006M": "$_("Base URL")", - "KCHREPO6007M": "$_("Is Mirror")", - "KCHREPO6008M": "$_("URL Args")", - "KCHREPO6009M": "$_("Enabled")", - "KCHREPO6010M": "$_("GPG Check")", - "KCHREPO6011M": "$_("GPG Key")", - "KCHREPO6012M": "$_("Add")", - "KCHREPO6013M": "$_("Edit")", - "KCHREPO6014M": "$_("Remove")", - "KCHREPO6016M": "$_("Enable")", - "KCHREPO6017M": "$_("Disable")", - - - "KCHUPD6001M": "$_("Software Updates")", - "KCHUPD6002M": "$_("Package Name")", - "KCHUPD6003M": "$_("Version")", - "KCHUPD6004M": "$_("Architecture")", - "KCHUPD6005M": "$_("Repository")", - "KCHUPD6006M": "$_("Update All")", - "KCHUPD6007M": "$_("Updating...")", - "KCHUPD6008M": "$_("Failed to retrieve packages update information.")", - "KCHUPD6009M": "$_("Failed to update package(s).")", - - - "KCHDR6001M": "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")", - "KCHDR6002M": "$_("Debug Reports")", - "KCHDR6003M": "$_("Name")", - "KCHDR6005M": "$_("Generated Time")", - "KCHDR6006M": "$_("Generate")", - "KCHDR6007M": "$_("Generating...")", - "KCHDR6008M": "$_("Rename")", - "KCHDR6009M": "$_("Remove")", - "KCHDR6010M": "$_("Download")", - "KCHDR6011M": "$_("Report name should contain only letters, digits, underscore ('_') and/or hyphen ('-').")", - "KCHDR6012M": "$_("Pending...")", - "KCHDR6013M": "$_("Report name is the same as the original one.")", - - "KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")", - "KCHVM6002M": "$_("Power off Confirmation")", - "KCHVM6003M": "$_("This action may produce undesirable results, " - "for example unflushed disk cache in the guest. " - "Would you like to continue?")", - "KCHVM6004M": "$_("Reset Confirmation")", - "KCHVM6005M": "$_("There is a risk of data loss caused by reset without" - " the guest OS shutdown. Would you like to continue?")", - "KCHVM6006M": "$_("Shut Down Confirmation")", - "KCHVM6007M": "$_("Note the guest OS may ignore this request. Would you like to continue?")", - "KCHVM6008M": "$_("Virtual Machine delete Confirmation")", - "KCHVM6009M": "$_("This virtual machine is not persistent. Power Off will delete it. Continue?")", - "KCHVM6010M": "$_("When the target guest has SCSI or iSCSI volumes, they will be cloned on default storage pool. The same will happen when the target pool does not have enough space to clone the volumes. Do you want to continue?")", - - "KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")", - "KCHVMCD6002M": "$_("Attach")", - "KCHVMCD6003M": "$_("Attaching...")", - "KCHVMCD6004M": "$_("Replace")", - "KCHVMCD6005M": "$_("Replacing...")", - "KCHVMCD6006M": "$_("Successfully attached!")", - "KCHVMCD6007M": "$_("Successfully replaced!")", - "KCHVMCD6008M": "$_("Successfully detached!")", - "KCHVMCD6009M": "$_("This disk will be detached permanently and you can re-attach it. Continue to detach it?")", - - "KCHVMED6001M": "$_("interface:")", - "KCHVMED6002M": "$_("address:")", - "KCHVMED6003M": "$_("link_type:")", - "KCHVMED6004M": "$_("block:")", - "KCHVMED6005M": "$_("drive_type:")", - "KCHVMED6006M": "$_("model:")", - "KCHVMED6007M": "$_("Affected devices:")", - - "KCHNET6001E": "$_("The VLAN id must be between 1 and 4094.")", - - "KCHNET6001M": "$_("unavailable")", - "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", - "KCHNET6003M": "$_("Create a network")", - "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", - "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")", - - "KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")", - "KCHPOOL6002M": "$_("This storage pool is empty.")", - "KCHPOOL6003M": "$_("It will format your disk and you will loose any data in there, are you sure to continue? ")", - "KCHPOOL6004M": "$_("SCSI Fibre Channel")", - "KCHPOOL6005M": "$_("No SCSI adapters found.")", - "KCHPOOL6006M": "$_("Loading iSCSI targets...")", - "KCHPOOL6007M": "$_("No iSCSI found. Please input one.")", - "KCHPOOL6008M": "$_("Failed to load iSCSI targets.")", - - "KCHPOOL6001E": "$_("The storage pool name can not be blank.")", - "KCHPOOL6002E": "$_("The storage pool path can not be blank.")", - "KCHPOOL6003E": "$_("NFS server mount path can not be blank.")", - "KCHPOOL6005E": "$_("Invalid NFS mount path.")", - "KCHPOOL6006E": "$_("No logical device selected.")", - "KCHPOOL6007E": "$_("The iSCSI target can not be blank.")", - "KCHPOOL6008E": "$_("Server name can not be blank.")", - "KCHPOOL6009E": "$_("This is not a valid Server Name or IP. Please, modify it.")", - "KCHPOOL6010M": "$_("Looking for available partitions ...")", - "KCHPOOL6011M": "$_("No available partitions found.")", - "KCHPOOL6012M": "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")", - "KCHPOOL6013M": "$_("Unable to retrieve partitions information.")", - "KCHPOOL6014M": "$_("In progress...")", - "KCHPOOL6015M": "$_("Failed!")", - - "KCHVMSTOR0001E": "$_("CDROM path needs to be a valid local/remote path and cannot be blank.")", - "KCHVMSTOR0002E": "$_("Disk pool or volume cannot be blank.")" + "WOKHOST6001M": "$_("Max:")" } -- 2.1.0

Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- Makefile.am | 1 + check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/Makefile.am | 2 +- src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/model/vms.py | 6 +++--- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 check_ui_code_errors.sh create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh diff --git a/Makefile.am b/Makefile.am index 027344f..106a577 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ check-local: $(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" . + /bin/bash check_ui_code_errors.sh # Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/check_ui_code_errors.sh b/check_ui_code_errors.sh new file mode 100755 index 0000000..7220a75 --- /dev/null +++ b/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'WOK[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'WOK[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct" +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/Makefile.am b/src/wok/plugins/kimchi/Makefile.am index 8a55b23..250dc83 100644 --- a/src/wok/plugins/kimchi/Makefile.am +++ b/src/wok/plugins/kimchi/Makefile.am @@ -65,7 +65,7 @@ check-local: $(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" . - + ./check_ui_code_errors.sh # Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/src/wok/plugins/kimchi/check_ui_code_errors.sh b/src/wok/plugins/kimchi/check_ui_code_errors.sh new file mode 100755 index 0000000..d9f51e2 --- /dev/null +++ b/src/wok/plugins/kimchi/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'KCH[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'KCH[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct" +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py index 5623879..bdd32a1 100644 --- a/src/wok/plugins/kimchi/model/vms.py +++ b/src/wok/plugins/kimchi/model/vms.py @@ -1520,9 +1520,9 @@ class VMModel(object): def migration_pre_check(self, remote_host, user, password): self._check_if_host_not_localhost(remote_host) self._check_if_password_less_login_enabled( - remote_host, - user, - password + remote_host, + user, + password ) self._check_if_migrating_same_arch_hypervisor(remote_host, user) -- 2.1.0

On 11/24/2015 06:11 PM, Ramon Medeiros wrote:
Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- Makefile.am | 1 + check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/Makefile.am | 2 +- src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/model/vms.py | 6 +++--- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 check_ui_code_errors.sh create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh
diff --git a/Makefile.am b/Makefile.am index 027344f..106a577 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ check-local: $(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
+ /bin/bash check_ui_code_errors.sh
# Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/check_ui_code_errors.sh b/check_ui_code_errors.sh new file mode 100755 index 0000000..7220a75 --- /dev/null +++ b/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'WOK[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'WOK[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct Is it possible to print the obsoletes message codes ? This will help to fix Something like:
diff <( printf "%s\n" "${errors}" ) <( printf "%s\n" "${uiErrors}" ) | grep -e KCH -e WOK
" +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/Makefile.am b/src/wok/plugins/kimchi/Makefile.am index 8a55b23..250dc83 100644 --- a/src/wok/plugins/kimchi/Makefile.am +++ b/src/wok/plugins/kimchi/Makefile.am @@ -65,7 +65,7 @@ check-local:
$(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" . - + ./check_ui_code_errors.sh
# Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/src/wok/plugins/kimchi/check_ui_code_errors.sh b/src/wok/plugins/kimchi/check_ui_code_errors.sh new file mode 100755 index 0000000..d9f51e2 --- /dev/null +++ b/src/wok/plugins/kimchi/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'KCH[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'KCH[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct" same here +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py index 5623879..bdd32a1 100644 --- a/src/wok/plugins/kimchi/model/vms.py +++ b/src/wok/plugins/kimchi/model/vms.py @@ -1520,9 +1520,9 @@ class VMModel(object): def migration_pre_check(self, remote_host, user, password): self._check_if_host_not_localhost(remote_host) self._check_if_password_less_login_enabled( - remote_host, - user, - password + remote_host, + user, + password ) self._check_if_migrating_same_arch_hypervisor(remote_host, user)

On 24/11/2015 18:11, Ramon Medeiros wrote:
Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- Makefile.am | 1 + check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/Makefile.am | 2 +- src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 +++++++++++ src/wok/plugins/kimchi/model/vms.py | 6 +++--- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 check_ui_code_errors.sh create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh
diff --git a/Makefile.am b/Makefile.am index 027344f..106a577 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ check-local: $(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
+ /bin/bash check_ui_code_errors.sh
# Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/check_ui_code_errors.sh b/check_ui_code_errors.sh new file mode 100755 index 0000000..7220a75 --- /dev/null +++ b/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash
License header is missing.
+ +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'WOK[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'WOK[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct" +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/Makefile.am b/src/wok/plugins/kimchi/Makefile.am index 8a55b23..250dc83 100644 --- a/src/wok/plugins/kimchi/Makefile.am +++ b/src/wok/plugins/kimchi/Makefile.am @@ -65,7 +65,7 @@ check-local:
$(PEP8) --version $(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" . - + ./check_ui_code_errors.sh
# Link built mo files in the source tree to enable use of translations from # within the source tree diff --git a/src/wok/plugins/kimchi/check_ui_code_errors.sh b/src/wok/plugins/kimchi/check_ui_code_errors.sh new file mode 100755 index 0000000..d9f51e2 --- /dev/null +++ b/src/wok/plugins/kimchi/check_ui_code_errors.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'KCH[0-9A-Z]*'| sort)" +uiErrors="$(grep -Ro 'KCH[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)" + +# all errors on i18n are present in js/html files: success +if [ "$errors" == "$uiErrors" ]; then + echo "UI errors codes are correct" +else + echo "Error while checking UI errors codes." +fi diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py index 5623879..bdd32a1 100644 --- a/src/wok/plugins/kimchi/model/vms.py +++ b/src/wok/plugins/kimchi/model/vms.py @@ -1520,9 +1520,9 @@ class VMModel(object): def migration_pre_check(self, remote_host, user, password): self._check_if_host_not_localhost(remote_host) self._check_if_password_less_login_enabled( - remote_host, - user, - password + remote_host, + user, + password ) self._check_if_migrating_same_arch_hypervisor(remote_host, user)

Hi Ramon, I will apply patches 1/3 and 2/3. So you only need to resend 3/3 On 24/11/2015 18:11, Ramon Medeiros wrote:
Ramon Medeiros (3): Remove unused messages in Kimchi UI Fix WOK UI error messages Add checking for UI codes when running make check-local
Makefile.am | 1 + check_ui_code_errors.sh | 11 ++ src/wok/plugins/kimchi/Makefile.am | 2 +- src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 ++ src/wok/plugins/kimchi/model/vms.py | 6 +- src/wok/plugins/kimchi/ui/pages/i18n.json.tmpl | 81 ------------ ui/js/src/wok.confirm.js | 4 +- ui/js/src/wok.grid.js | 10 +- ui/js/src/wok.line-chart.js | 2 +- ui/js/src/wok.list.js | 10 +- ui/js/src/wok.main.js | 2 +- ui/js/widgets/filter-select.js | 4 +- ui/pages/i18n.json.tmpl | 168 ++----------------------- 13 files changed, 52 insertions(+), 260 deletions(-) create mode 100755 check_ui_code_errors.sh create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh
participants (3)
-
Aline Manera
-
Ramon Medeiros
-
Rodrigo Trujillo