Revision 038383b1 ui/templates/home.html

b/ui/templates/home.html
64 64
        };
65 65
        
66 66
        // ajax error checking  
67
        function ajax_error(status, serverID) {
67
        function ajax_error(status, serverID, action, responseText) {
68
            var serverName = '';
69
            
70
            if (serverID != undefined) {
71
                serverName = $("#"+serverID).parent().parent().find("span.name").text();
72
            }
73
            
68 74
            // prepare the error message
69 75
            $("#error-success h3").text(ERRORS['HEADER']);
70
            
71
            if (ERRORS[status] != undefined) {
76
            if (responseText != undefined){
77
                var errors = parse_error(responseText);
78
                if (serverName){
79
                    serverName="<p><strong>Server:</strong> " + serverName + "</p>";
80
                }
81
                $("#error-success div").html("<p>"+(errors[0].message || ERRORS[errors[0].code]) +"</p>"+serverName +"<p><strong>Action:</strong> " + action + "</p><p><strong>Code</strong>: " + errors[0].code + "</p><p><strong>Details:</strong> " + errors[0].details +"</p>");
82
            } else if (ERRORS[status] != undefined) {
72 83
                if (serverID == undefined){
73 84
                    $("#error-success p").text(ERRORS[status]);
74 85
                } else {
75
                    var serverName = $("#"+serverID).parent().parent().find("a.name").text();
76 86
                    $("#error-success p").html("<b>" + serverName + "</b>" + ": " + ERRORS[status]);
77 87
                }
78 88
            } else {
......
110 120
                    var CREATE_VM_SUCCESS_MSG = SUCCESS["CREATE_VM_SUCCESS_ONE"] + '<br />'
111 121
                        + SUCCESS["CREATE_VM_SUCCESS_TWO"] + '<br /><br />' + '<b>' + password + '</b>'
112 122
                        + '<br /><br />' + SUCCESS["CREATE_VM_SUCCESS_THREE"] ;
113
                    $("#error-success p").html(CREATE_VM_SUCCESS_MSG);             
123
                    $("#error-success div").html("<p>" + CREATE_VM_SUCCESS_MSG + "</p>");             
114 124
                } else {
115 125
                    $("#error-success h3").text(SUCCESS['HEADER']);
116
                    $("#error-success p").text(SUCCESS[status]);             
126
                    $("#error-success div").text("<p>" + SUCCESS[status] + "</p>");             
117 127
                }
118 128
            } else {
119 129
                $("#error-success h3").text(SUCCESS['HEADER']);
120
                $("#error-success p").text(SUCCESS['DEFAULT']);             
130
                $("#error-success div").html("<p>" + SUCCESS['DEFAULT'] + "</p>");             
121 131

  
122 132
            }
123 133

  

Also available in: Unified diff