Revision 93f525a8

View differences:

src/sunstone/public/app/tabs/templates-tab/actions.js
26 26
    "Template.chgrp": _commonActions.multipleAction('chgrp'),
27 27
    "Template.chmod": _commonActions.singleAction('chmod'),
28 28
    "Template.rename": _commonActions.singleAction('rename'),
29
    "Template.create" : {
30
      type: "create",
31
      call: OpenNebulaResource.create,
32
      callback: function(request, response) {
33
        Sunstone.resetFormPanel(TAB_ID, CREATE_DIALOG_ID);
34
        Sunstone.hideFormPanel(TAB_ID);
35
        Sunstone.getDataTable(TAB_ID).addElement(request, response);
36
      },
37
      error: function(request, response) {
38
        Sunstone.hideFormPanelLoading(TAB_ID);
39
        Notifier.onError(request, response);
40
      },
41
      notify: true
42
    },
43
    "Template.create_dialog" : {
44
      type: "custom",
45
      call: function() {
46
        Sunstone.showFormPanel(TAB_ID, CREATE_DIALOG_ID, "create");
47
      }
48
    },
49
    "Template.import_dialog" : {
50
      type: "custom",
51
      call: function() {
52
        Sunstone.showFormPanel(TAB_ID, IMPORT_DIALOG_ID, "import");
53
      }
54
    },
55
    "Template.update_dialog" : {
56
      type: "custom",
57
      call: function() {
58
        var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
59
        if (selected_nodes.length != 1) {
60
          Notifier.notifyMessage("Please select one (and just one) Virtual Template to update.");
61
          return false;
62
        }
63

  
64
        var resource_id = "" + selected_nodes[0];
65
        Sunstone.runAction("Template.show_to_update", resource_id);
66
      }
67
    },
68
    "Template.show_to_update" : {
69
      type: "single",
70
      call: OpenNebulaResource.show,
71
      callback: function(request, response) {
72
        Sunstone.showFormPanel(TAB_ID, CREATE_DIALOG_ID, "update",
73
          function(formPanelInstance, context) {
74
            formPanelInstance.fill(context, response[XML_ROOT])
75
          });
76
      },
77
      error: Notifier.onError
78
    },
79
    "Template.update" : {
80
      type: "single",
81
      call: OpenNebulaResource.update,
82
      callback: function(request, response) {
83
        Sunstone.hideFormPanel(TAB_ID);
84
        Notifier.notifyMessage(Locale.tr("Virtual Template updated correctly"));
85
      },
86
      error: function(request, response) {
87
        Sunstone.hideFormPanelLoading(TAB_ID);
88
        Notifier.onError(request, response);
89
      }
90
    },
29
    "Template.create" : _commonActions.create(CREATE_DIALOG_ID),
30
    "Template.create_dialog" : _commonActions.showCreate(CREATE_DIALOG_ID),
31
    "Template.import_dialog" : _commonActions.showCreate(IMPORT_DIALOG_ID),
32
    "Template.update_template" : _commonActions.updateTemplate(),
33
    "Template.update_dialog" : _commonActions.checkAndShowUpdate(),
34
    "Template.show_to_update" : _commonActions.showUpdate(CREATE_DIALOG_ID),
91 35
    "Template.instantiate" : {
92 36
      type: "multiple",
93 37
      call: OpenNebulaResource.instantiate,

Also available in: Unified diff