[Kimchi-devel] [PATCH 2/2] Fix debug report naming problem (UI)

Aline Manera alinefm at linux.vnet.ibm.com
Fri Feb 21 17:29:27 UTC 2014


On 02/21/2014 12:29 PM, Rodrigo Trujillo wrote:
> The tool sosreport only accepts letters, digits and hyphen in the name
> of the report, non alphanumeric characteres are removed from the file
> name and then Kimchi is not able to find the file.
>
> This patch modifies the UI html and js in order to show the right
> information and catch the right return error message.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.report_add_main.js | 9 +++++++--
>   ui/pages/report-add.html.tmpl       | 2 +-
>   2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/ui/js/src/kimchi.report_add_main.js b/ui/js/src/kimchi.report_add_main.js
> index f893d85..96d9625 100644
> --- a/ui/js/src/kimchi.report_add_main.js
> +++ b/ui/js/src/kimchi.report_add_main.js
> @@ -25,8 +25,13 @@ kimchi.report_add_main = function() {
>                   result: result
>               });
>           }, function(result) {
> -            result && result['reason'] &&
> -                $('#report-error-message').text(result['reason']);
> +            if (result['reason']) {
> +                var errText = result['reason'];
> +            }
> +            else {
> +                var errText = result['responseJSON']['reason'];
> +            }
> +            result && $('#report-error-message').text(errText);
>               submitButton

We should not send a request to server with invalid data.
So verify the debug report name in UI too and only request server if it 
is a valid one

>                   .text(i18n['KCHDR6006M'])
>                   .prop('disabled', false);
> diff --git a/ui/pages/report-add.html.tmpl b/ui/pages/report-add.html.tmpl
> index 2a962d4..383175f 100644
> --- a/ui/pages/report-add.html.tmpl
> +++ b/ui/pages/report-add.html.tmpl
> @@ -38,7 +38,7 @@
>                   </h2>
>                   <div class="field">
>                       <span>
> -                        $_("The name used to identify the report. If omitted, a name will be chosen based on current time. Name can contain: letters, digits, \"-\", \"_\", or \".\".")
> +                        $_("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>




More information about the Kimchi-devel mailing list