Revision 6a3a5bf7 ui/static/snf/js/models.js
b/ui/static/snf/js/models.js | ||
---|---|---|
476 | 476 |
// default values |
477 | 477 |
this.set({linked_to_nets:this.get("linked_to_nets") || []}); |
478 | 478 |
this.set({firewalls:this.get("firewalls") || []}); |
479 |
|
|
480 |
this.action_error = false; |
|
479 | 481 |
}, |
480 | 482 |
|
481 | 483 |
handle_firewall_change: function() { |
... | ... | |
876 | 878 |
success.apply(this, arguments); |
877 | 879 |
snf.api.trigger("call"); |
878 | 880 |
}, |
879 |
error); |
|
881 |
error, 'start');
|
|
880 | 882 |
break; |
881 | 883 |
case 'reboot': |
882 | 884 |
this.__make_api_call(this.get_action_url(), // vm actions url |
... | ... | |
889 | 891 |
snf.api.trigger("call"); |
890 | 892 |
self.set({'reboot_required': false}); |
891 | 893 |
}, |
892 |
error); |
|
894 |
error, 'reboot');
|
|
893 | 895 |
break; |
894 | 896 |
case 'shutdown': |
895 | 897 |
this.__make_api_call(this.get_action_url(), // vm actions url |
... | ... | |
901 | 903 |
success.apply(this, arguments) |
902 | 904 |
snf.api.trigger("call"); |
903 | 905 |
}, |
904 |
error); |
|
906 |
error, 'shutdown');
|
|
905 | 907 |
break; |
906 | 908 |
case 'console': |
907 | 909 |
this.__make_api_call(this.url() + "/action", "create", {'console': {'type':'vnc'}}, function(data) { |
908 | 910 |
var cons_data = data.console; |
909 | 911 |
success.apply(this, [cons_data]); |
910 |
}) |
|
912 |
}, undefined, 'console')
|
|
911 | 913 |
break; |
912 | 914 |
case 'destroy': |
913 | 915 |
this.__make_api_call(this.url(), // vm actions url |
... | ... | |
918 | 920 |
self.state('DESTROY'); |
919 | 921 |
success.apply(this, arguments) |
920 | 922 |
}, |
921 |
error); |
|
923 |
error, 'destroy');
|
|
922 | 924 |
break; |
923 | 925 |
default: |
924 | 926 |
throw "Invalid VM action ("+action_name+")"; |
... | ... | |
937 | 939 |
error: function(){ self.handle_action_fail.apply(self, arguments); error.apply(this, arguments)}, |
938 | 940 |
error_params: { ns: "Machines actions", |
939 | 941 |
message: "'" + this.get("name") + "'" + " action failed", |
940 |
extra_details: { 'Machine ID': this.id, url: url } |
|
941 |
} |
|
942 |
extra_details: { 'Machine ID': this.id, 'URL': url, 'Action': action || "undefined" }, |
|
943 |
allow_reload: false |
|
944 |
}, |
|
945 |
handles_error: true |
|
942 | 946 |
} |
943 | 947 |
this.sync(method, this, params); |
944 | 948 |
}, |
... | ... | |
946 | 950 |
handle_action_succeed: function() { |
947 | 951 |
this.trigger("action:success", arguments); |
948 | 952 |
}, |
953 |
|
|
954 |
reset_action_error: function() { |
|
955 |
this.action_error = false; |
|
956 |
this.trigger("action:fail:reset", this.action_error); |
|
957 |
}, |
|
949 | 958 |
|
950 | 959 |
handle_action_fail: function() { |
960 |
this.action_error = arguments; |
|
951 | 961 |
this.trigger("action:fail", arguments); |
952 | 962 |
}, |
953 | 963 |
|
Also available in: Unified diff