Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: Add 'Apply' button to create/edit dialogs, fixes #3184
  • Loading branch information
perexg committed Nov 24, 2015
1 parent 0fda5ef commit d950028
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions src/webui/static/app/idnode.js
Expand Up @@ -943,13 +943,31 @@ tvheadend.idnode_editor = function(item, conf)
},
success: function(d) {
if (conf.win)
conf.win.hide();
conf.win.close();
}
});
}
});
buttons.push(saveBtn);

var applyBtn = new Ext.Button({
text: _('Apply'),
iconCls: 'apply',
handler: function() {
var node = panel.getForm().getFieldValues();
node.uuid = conf.uuids ? conf.uuids : item.uuid;
tvheadend.Ajax({
url: 'api/idnode/save',
params: {
node: Ext.encode(node)
},
success: function(d) {
}
});
}
});
buttons.push(applyBtn);

if (conf.help) {
var helpBtn = new Ext.Button({
text: _('Help'),
Expand Down Expand Up @@ -1018,6 +1036,26 @@ tvheadend.idnode_create = function(conf, onlyDefault)
});
}
});
var applyBtn = new Ext.Button({
tooltip: _('Apply settings'),
text: _('Apply'),
iconCls: 'apply',
hidden: true,
handler: function() {
var params = conf.create.params || {};
if (puuid)
params['uuid'] = puuid;
if (pclass)
params['class'] = pclass;
params['conf'] = Ext.encode(panel.getForm().getFieldValues());
tvheadend.Ajax({
url: conf.create.url || conf.url + '/create',
params: params,
success: function(d) {
}
});
}
});
var cancelBtn = new Ext.Button({
tooltip: _('Cancel operation'),
text: _('Cancel'),
Expand All @@ -1040,7 +1078,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
defaultType: 'textfield',
buttonAlign: 'left',
items: [],
buttons: [cancelBtn, saveBtn]
buttons: [cancelBtn, saveBtn, applyBtn]
});

/* Create window */
Expand Down Expand Up @@ -1080,6 +1118,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
panel.remove(s);
tvheadend.idnode_editor_form(d, null, panel, { create: true, showpwd: true });
saveBtn.setVisible(true);
applyBtn.setVisible(true);
win.setOriginSize(true);
}
}
Expand All @@ -1096,6 +1135,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
d = json_decode(d);
tvheadend.idnode_editor_form(d.props, d, panel, { create: true, showpwd: true });
saveBtn.setVisible(true);
applyBtn.setVisible(true);
win.setOriginSize(true);
}
});
Expand Down Expand Up @@ -1127,12 +1167,14 @@ tvheadend.idnode_create = function(conf, onlyDefault)
success: function(d) {
d = json_decode(d);
tvheadend.idnode_editor_form(d.props, d, panel, { create: true, showpwd: true });
saveBtn.setVisible(true);
if (onlyDefault) {
saveBtn.handler();
panel.destroy();
} else
} else {
saveBtn.setVisible(true);
applyBtn.setVisible(true);
win.show();
}
}
});
}
Expand Down

1 comment on commit d950028

@ProfYaffle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See line 954, above, and commit be56a38. It's there already.

Please sign in to comment.