mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Connection Type cell was not honouring to 'Kind' option in Subnode control.
2) Kind option was not saved properly 3) User was not be able to update Kind option in edit mode. Fixes #2633
This commit is contained in:
parent
2c6c4a16ce
commit
2df4625ce0
@ -1,8 +1,8 @@
|
||||
define('pgadmin.node.pga_jobstep', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'underscore.string', 'sources/pgadmin', 'pgadmin.browser', 'alertify', 'backform',
|
||||
'pgadmin.backform'
|
||||
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
'backgrid', 'pgadmin.backform', 'pgadmin.backgrid'
|
||||
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, Backform, Backgrid) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-pga_jobstep']) {
|
||||
pgBrowser.Nodes['coll-pga_jobstep'] =
|
||||
@ -18,6 +18,40 @@ define('pgadmin.node.pga_jobstep', [
|
||||
});
|
||||
}
|
||||
|
||||
// Switch Cell with Deps, Needed for SubNode control
|
||||
var SwitchDepsCell = Backgrid.Extension.SwitchCell.extend({
|
||||
initialize: function initialize() {
|
||||
Backgrid.Extension.SwitchCell.prototype.initialize.apply(this, arguments);
|
||||
Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
dependentChanged: function dependentChanged() {
|
||||
var model = this.model,
|
||||
column = this.column,
|
||||
editable = this.column.get("editable"),
|
||||
input = this.$el.find('input[type=checkbox]').first(),
|
||||
self_name = column.get('name'),
|
||||
is_editable;
|
||||
|
||||
is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable;
|
||||
if (is_editable) {
|
||||
this.$el.addClass("editable");
|
||||
input.bootstrapSwitch('disabled', false);
|
||||
} else {
|
||||
this.$el.removeClass("editable");
|
||||
input.bootstrapSwitch('disabled', true);
|
||||
// Set self value into model
|
||||
setTimeout(function () {
|
||||
model.set(self_name, true);
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
},
|
||||
remove: Backgrid.Extension.DependentCell.prototype.remove
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['pga_jobstep']) {
|
||||
pgBrowser.Nodes['pga_jobstep'] = pgBrowser.Node.extend({
|
||||
parent_type: 'pga_job',
|
||||
@ -118,6 +152,11 @@ define('pgadmin.node.pga_jobstep', [
|
||||
id: 'jstconntype', label: gettext('Connection type'),
|
||||
type: 'switch', deps: ['jstkind'], mode: ['create', 'edit'],
|
||||
disabled: function(m) { return !m.get('jstkind'); },
|
||||
cell: SwitchDepsCell,
|
||||
editable: function(m) {
|
||||
// If jstkind is Batch then disable it
|
||||
return m.get('jstkind');
|
||||
},
|
||||
options: {
|
||||
'onText': gettext('Local'), 'offText': gettext('Remote'),
|
||||
'onColor': 'primary', 'offColor': 'primary'
|
||||
|
@ -14,10 +14,15 @@ INSERT INTO pgagent.pga_jobstep (
|
||||
) {% if jid %}RETURNING jstid{% endif %};
|
||||
{%- endmacro %}
|
||||
{% macro UPDATE(has_connstr, jid, jstid, data) -%}
|
||||
{% if 'jstname' in data or 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %}
|
||||
{% set is_comma_required = True %}
|
||||
{% else %}
|
||||
{% set is_comma_required = False %}
|
||||
{% endif %}
|
||||
-- Updating the existing step (id: {{ jstid|qtLiteral }} jobid: {{ jid|qtLiteral }})
|
||||
UPDATE pgagent.pga_jobstep
|
||||
SET
|
||||
{% if has_connstr %}{% if 'jstconntype' in data %}{% if data.jstconntype %}jstdbname={{ data.jstdbname|qtLiteral }}, jstconnstr=''{% else %}jstdbname='', jstconnstr={{ data.jstconnstr|qtLiteral }}{% endif %}{% if 'jstname' in data or 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %},{% endif %}{% endif %}{% else %}{% if 'jstdbname' in data %}jstdbname={{ data.jstdbname|qtLiteral }}::name{% endif %}{% if 'jstname' in data or 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %},{% endif %}{% endif %}{% if 'jstname' in data %}
|
||||
{% if has_connstr %}{% if 'jstkind' in data %}{% if data.jstkind %}jstkind='s'::character(1), jstdbname={{ data.jstdbname|qtLiteral }}{% else %}jstkind='b'::character(1), jstdbname='', jstconnstr=''{% endif %}{% if is_comma_required %}, {% endif %}{% elif 'jstconntype' in data %}{% if data.jstconntype %}jstdbname={{ data.jstdbname|qtLiteral }}, jstconnstr=''{% else %}jstdbname='', jstconnstr={{ data.jstconnstr|qtLiteral }}{% endif %}{% if is_comma_required %},{% endif %}{% endif %}{% else %}{% if 'jstdbname' in data %}jstdbname={{ data.jstdbname|qtLiteral }}::name{% endif %}{% if is_comma_required %},{% endif %}{% endif %}{% if 'jstname' in data %}
|
||||
|
||||
jstname={{ data.jstname|qtLiteral }}::text{% if 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %},{% endif %}{% endif %}{% if 'jstenabled' in data %}
|
||||
|
||||
@ -38,7 +43,7 @@ DELETE FROM pgagent.pga_jobstep WHERE jstid={{ jstid|qtLiteral }}::integer AND j
|
||||
{% macro PROPERTIES(has_connstr, jid, jstid) -%}
|
||||
SELECT
|
||||
jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind = 's'::bpchar as jstkind,
|
||||
jstcode, CASE WHEN jstdbname != '' THEN true ELSE false END AS jstconntype,
|
||||
jstcode, CASE WHEN (jstdbname != '' OR jstkind = 'b'::bpchar) THEN true ELSE false END AS jstconntype,
|
||||
{% if has_connstr %}jstconnstr, {% endif %} jstdbname, jstonerror, jscnextrun
|
||||
FROM
|
||||
pgagent.pga_jobstep
|
||||
|
Loading…
Reference in New Issue
Block a user