mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Using the client-side translation using the client-side 'gettext'
implementation. This is the first step towards 'Avoid creating the javascript modules using Jinja templates'.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
define([
|
||||
'jquery', 'underscore', 'underscore.string', 'pgadmin', 'moment',
|
||||
'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform'
|
||||
],
|
||||
function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'moment',
|
||||
'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform'
|
||||
], function(gettext, $, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-pga_schedule']) {
|
||||
pgBrowser.Nodes['coll-pga_schedule'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'pga_schedule',
|
||||
label: '{{ _('Schedules') }}',
|
||||
label: gettext('Schedules'),
|
||||
type: 'coll-pga_schedule',
|
||||
columns: ['jscid', 'jscname', 'jscenabled'],
|
||||
hasStatistics: false
|
||||
@@ -18,166 +17,166 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
if (!pgBrowser.Nodes['pga_schedule']) {
|
||||
|
||||
var weekdays = [
|
||||
'{{ _("Sunday") }}', '{{ _("Monday") }}', '{{ _("Tuesday") }}',
|
||||
'{{ _("Wednesday") }}', '{{ _("Thursday") }}', '{{ _("Friday") }}',
|
||||
'{{ _("Saturday") }}'
|
||||
],
|
||||
monthdays = [
|
||||
'{{ _("1st") }}', '{{ _("2nd") }}', '{{ _("3rd") }}',
|
||||
'{{ _("4th") }}', '{{ _("5th") }}', '{{ _("6th") }}',
|
||||
'{{ _("7th") }}', '{{ _("8th") }}', '{{ _("9th") }}',
|
||||
'{{ _("10th") }}', '{{ _("11th") }}', '{{ _("12th") }}',
|
||||
'{{ _("13th") }}', '{{ _("14th") }}', '{{ _("15th") }}',
|
||||
'{{ _("16th") }}', '{{ _("17th") }}', '{{ _("18th") }}',
|
||||
'{{ _("19th") }}', '{{ _("20th") }}', '{{ _("21st") }}',
|
||||
'{{ _("22nd") }}', '{{ _("23rd") }}', '{{ _("24th") }}',
|
||||
'{{ _("25th") }}', '{{ _("26th") }}', '{{ _("27th") }}',
|
||||
'{{ _("28th") }}', '{{ _("29th") }}', '{{ _("30th") }}',
|
||||
'{{ _("31st") }}', '{{ _("Last day") }}'
|
||||
],
|
||||
months = [
|
||||
'{{ _("January") }}', '{{ _("February") }}', '{{ _("March") }}',
|
||||
'{{ _("April") }}', '{{ _("May") }}', '{{ _("June") }}',
|
||||
'{{ _("July") }}', '{{ _("August") }}', '{{ _("September") }}',
|
||||
'{{ _("October") }}', '{{ _("November") }}', '{{ _("December") }}'
|
||||
],
|
||||
hours = [
|
||||
'{{ _("00") }}', '{{ _("01") }}', '{{ _("02") }}', '{{ _("03") }}',
|
||||
'{{ _("04") }}', '{{ _("05") }}', '{{ _("06") }}', '{{ _("07") }}',
|
||||
'{{ _("08") }}', '{{ _("09") }}', '{{ _("10") }}', '{{ _("11") }}',
|
||||
'{{ _("12") }}', '{{ _("13") }}', '{{ _("14") }}', '{{ _("15") }}',
|
||||
'{{ _("16") }}', '{{ _("17") }}', '{{ _("18") }}', '{{ _("19") }}',
|
||||
'{{ _("20") }}', '{{ _("21") }}', '{{ _("22") }}', '{{ _("23") }}'
|
||||
],
|
||||
minutes = [
|
||||
'{{ _("00") }}', '{{ _("01") }}', '{{ _("02") }}', '{{ _("03") }}',
|
||||
'{{ _("04") }}', '{{ _("05") }}', '{{ _("06") }}', '{{ _("07") }}',
|
||||
'{{ _("08") }}', '{{ _("09") }}', '{{ _("10") }}', '{{ _("11") }}',
|
||||
'{{ _("12") }}', '{{ _("13") }}', '{{ _("14") }}', '{{ _("15") }}',
|
||||
'{{ _("16") }}', '{{ _("17") }}', '{{ _("18") }}', '{{ _("19") }}',
|
||||
'{{ _("20") }}', '{{ _("21") }}', '{{ _("22") }}', '{{ _("23") }}',
|
||||
'{{ _("24") }}', '{{ _("25") }}', '{{ _("26") }}', '{{ _("27") }}',
|
||||
'{{ _("28") }}', '{{ _("29") }}', '{{ _("30") }}', '{{ _("31") }}',
|
||||
'{{ _("32") }}', '{{ _("33") }}', '{{ _("34") }}', '{{ _("35") }}',
|
||||
'{{ _("36") }}', '{{ _("37") }}', '{{ _("38") }}', '{{ _("39") }}',
|
||||
'{{ _("40") }}', '{{ _("41") }}', '{{ _("42") }}', '{{ _("43") }}',
|
||||
'{{ _("44") }}', '{{ _("45") }}', '{{ _("46") }}', '{{ _("47") }}',
|
||||
'{{ _("48") }}', '{{ _("49") }}', '{{ _("50") }}', '{{ _("51") }}',
|
||||
'{{ _("52") }}', '{{ _("53") }}', '{{ _("54") }}', '{{ _("55") }}',
|
||||
'{{ _("56") }}', '{{ _("57") }}', '{{ _("58") }}', '{{ _("59") }}'
|
||||
],
|
||||
AnyDatetimeCell = Backgrid.Extension.MomentCell.extend({
|
||||
editor: Backgrid.Extension.DatetimePickerEditor,
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
var model = this.model;
|
||||
this.$el.text(this.formatter.fromRaw(model.get(this.column.get("name")), model) || '{{ _('<any>') }}');
|
||||
this.delegateEvents();
|
||||
gettext('Sunday'), gettext('Monday'), gettext('Tuesday'),
|
||||
gettext('Wednesday'), gettext('Thursday'), gettext('Friday'),
|
||||
gettext('Saturday')
|
||||
],
|
||||
monthdays = [
|
||||
gettext('1st'), gettext('2nd'), gettext('3rd'),
|
||||
gettext('4th'), gettext('5th'), gettext('6th'),
|
||||
gettext('7th'), gettext('8th'), gettext('9th'),
|
||||
gettext('10th'), gettext('11th'), gettext('12th'),
|
||||
gettext('13th'), gettext('14th'), gettext('15th'),
|
||||
gettext('16th'), gettext('17th'), gettext('18th'),
|
||||
gettext('19th'), gettext('20th'), gettext('21st'),
|
||||
gettext('22nd'), gettext('23rd'), gettext('24th'),
|
||||
gettext('25th'), gettext('26th'), gettext('27th'),
|
||||
gettext('28th'), gettext('29th'), gettext('30th'),
|
||||
gettext('31st'), gettext('Last day')
|
||||
],
|
||||
months = [
|
||||
gettext('January'), gettext('February'), gettext('March'),
|
||||
gettext('April'), gettext('May'), gettext('June'),
|
||||
gettext('July'), gettext('August'), gettext('September'),
|
||||
gettext('October'), gettext('November'), gettext('December')
|
||||
],
|
||||
hours = [
|
||||
gettext('00'), gettext('01'), gettext('02'), gettext('03'),
|
||||
gettext('04'), gettext('05'), gettext('06'), gettext('07'),
|
||||
gettext('08'), gettext('09'), gettext('10'), gettext('11'),
|
||||
gettext('12'), gettext('13'), gettext('14'), gettext('15'),
|
||||
gettext('16'), gettext('17'), gettext('18'), gettext('19'),
|
||||
gettext('20'), gettext('21'), gettext('22'), gettext('23')
|
||||
],
|
||||
minutes = [
|
||||
gettext('00'), gettext('01'), gettext('02'), gettext('03'),
|
||||
gettext('04'), gettext('05'), gettext('06'), gettext('07'),
|
||||
gettext('08'), gettext('09'), gettext('10'), gettext('11'),
|
||||
gettext('12'), gettext('13'), gettext('14'), gettext('15'),
|
||||
gettext('16'), gettext('17'), gettext('18'), gettext('19'),
|
||||
gettext('20'), gettext('21'), gettext('22'), gettext('23'),
|
||||
gettext('24'), gettext('25'), gettext('26'), gettext('27'),
|
||||
gettext('28'), gettext('29'), gettext('30'), gettext('31'),
|
||||
gettext('32'), gettext('33'), gettext('34'), gettext('35'),
|
||||
gettext('36'), gettext('37'), gettext('38'), gettext('39'),
|
||||
gettext('40'), gettext('41'), gettext('42'), gettext('43'),
|
||||
gettext('44'), gettext('45'), gettext('46'), gettext('47'),
|
||||
gettext('48'), gettext('49'), gettext('50'), gettext('51'),
|
||||
gettext('52'), gettext('53'), gettext('54'), gettext('55'),
|
||||
gettext('56'), gettext('57'), gettext('58'), gettext('59')
|
||||
],
|
||||
AnyDatetimeCell = Backgrid.Extension.MomentCell.extend({
|
||||
editor: Backgrid.Extension.DatetimePickerEditor,
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
var model = this.model;
|
||||
this.$el.text(this.formatter.fromRaw(model.get(this.column.get("name")), model) || gettext('<any>'));
|
||||
this.delegateEvents();
|
||||
|
||||
return this;
|
||||
}
|
||||
}),
|
||||
BooleanArrayFormatter = function(selector, indexes) {
|
||||
var self = this;
|
||||
return this;
|
||||
}
|
||||
}),
|
||||
BooleanArrayFormatter = function(selector, indexes) {
|
||||
var self = this;
|
||||
|
||||
self.selector = selector;
|
||||
self.indexes = indexes;
|
||||
self.selector = selector;
|
||||
self.indexes = indexes;
|
||||
|
||||
this.fromRaw = function(rawData) {
|
||||
if (!_.isArray(rawData)) {
|
||||
return rawData;
|
||||
}
|
||||
|
||||
var res = [], idx = 0, resIdx = [];
|
||||
|
||||
for (; idx < rawData.length; idx++) {
|
||||
if (!rawData[idx])
|
||||
continue;
|
||||
res.push(self.selector[idx]);
|
||||
resIdx.push(idx + 1);
|
||||
}
|
||||
|
||||
return self.indexes ? resIdx : res.join(', ');
|
||||
}
|
||||
this.toRaw = function(d) {
|
||||
if (!self.indexes)
|
||||
return d;
|
||||
var res = [], i = 0, l = self.selector.length;
|
||||
|
||||
for (; i < l; i++) {
|
||||
res.push(_.indexOf(d, String(i + 1)) != -1);
|
||||
}
|
||||
return res;
|
||||
this.fromRaw = function(rawData) {
|
||||
if (!_.isArray(rawData)) {
|
||||
return rawData;
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
BooleanArrayOptions = function(ctrl) {
|
||||
var selector = ctrl.field.get('selector'),
|
||||
val = ctrl.model.get(ctrl.field.get('name')),
|
||||
res = [];
|
||||
var res = [], idx = 0, resIdx = [];
|
||||
|
||||
if (selector) {
|
||||
res = _.map(
|
||||
selector, function(v, i) {
|
||||
return {label: v, value: i + 1, selected: val[i]};
|
||||
}
|
||||
);
|
||||
for (; idx < rawData.length; idx++) {
|
||||
if (!rawData[idx])
|
||||
continue;
|
||||
res.push(self.selector[idx]);
|
||||
resIdx.push(idx + 1);
|
||||
}
|
||||
|
||||
return self.indexes ? resIdx : res.join(', ');
|
||||
}
|
||||
this.toRaw = function(d) {
|
||||
if (!self.indexes)
|
||||
return d;
|
||||
var res = [], i = 0, l = self.selector.length;
|
||||
|
||||
for (; i < l; i++) {
|
||||
res.push(_.indexOf(d, String(i + 1)) != -1);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
ExceptionModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
jexid: undefined,
|
||||
jexdate: null,
|
||||
jextime: null
|
||||
},
|
||||
idAttribute: 'jexid',
|
||||
schema: [{
|
||||
id: 'jexdate', type: 'text', label: '{{ _('Date') }}',
|
||||
editable: true, placeholder: '{{ _('<any>') }}',
|
||||
cell: AnyDatetimeCell, options: {format: 'YYYY-MM-DD'},
|
||||
displayFormat: 'YYYY-MM-DD', modelFormat: 'YYYY-MM-DD',
|
||||
cellHeaderClasses:'width_percent_50', allowEmpty: true
|
||||
},{
|
||||
id: 'jextime', type: 'text', placeholder: '{{ _('<any>') }}',
|
||||
label: '{{ _('Time') }}', editable: true, cell: AnyDatetimeCell,
|
||||
options: {format: 'HH:mm'}, displayFormat: 'HH:mm',
|
||||
modelFormat: 'HH:mm:ss', displayInUTC: false, allowEmpty: true,
|
||||
cellHeaderClasses:'width_percent_50', modalInUTC: false
|
||||
}],
|
||||
validate: function() {
|
||||
var self = this, exceptions = this.collection,
|
||||
dates = {}, errMsg, hasExceptionErr = false,
|
||||
d = (this.get('jexdate') || '<any>'),
|
||||
t = this.get('jextime') || '<any>',
|
||||
id = this.get('jexid') || this.cid;
|
||||
}
|
||||
|
||||
self.errorModel.unset('jscdate');
|
||||
if (d == t && d == '<any>') {
|
||||
errMsg = '{{ _('Please specify date/time.') }}';
|
||||
self.errorModel.set('jscdate', errMsg);
|
||||
return errMsg ;
|
||||
return self;
|
||||
},
|
||||
BooleanArrayOptions = function(ctrl) {
|
||||
var selector = ctrl.field.get('selector'),
|
||||
val = ctrl.model.get(ctrl.field.get('name')),
|
||||
res = [];
|
||||
|
||||
if (selector) {
|
||||
res = _.map(
|
||||
selector, function(v, i) {
|
||||
return {label: v, value: i + 1, selected: val[i]};
|
||||
}
|
||||
);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
ExceptionModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
jexid: undefined,
|
||||
jexdate: null,
|
||||
jextime: null
|
||||
},
|
||||
idAttribute: 'jexid',
|
||||
schema: [{
|
||||
id: 'jexdate', type: 'text', label: gettext('Date'),
|
||||
editable: true, placeholder: gettext('<any>'),
|
||||
cell: AnyDatetimeCell, options: {format: 'YYYY-MM-DD'},
|
||||
displayFormat: 'YYYY-MM-DD', modelFormat: 'YYYY-MM-DD',
|
||||
cellHeaderClasses:'width_percent_50', allowEmpty: true
|
||||
},{
|
||||
id: 'jextime', type: 'text', placeholder: gettext('<any>'),
|
||||
label: gettext('Time'), editable: true, cell: AnyDatetimeCell,
|
||||
options: {format: 'HH:mm'}, displayFormat: 'HH:mm',
|
||||
modelFormat: 'HH:mm:ss', displayInUTC: false, allowEmpty: true,
|
||||
cellHeaderClasses:'width_percent_50', modalInUTC: false
|
||||
}],
|
||||
validate: function() {
|
||||
var self = this, exceptions = this.collection,
|
||||
dates = {}, errMsg, hasExceptionErr = false,
|
||||
d = (this.get('jexdate') || '<any>'),
|
||||
t = this.get('jextime') || '<any>',
|
||||
id = this.get('jexid') || this.cid;
|
||||
|
||||
exceptions.each(function(ex) {
|
||||
if (hasExceptionErr || id == (ex.get('jexid') || ex.cid))
|
||||
return;
|
||||
|
||||
if (
|
||||
d == (ex.get('jexdate') || '<any>') &&
|
||||
t == (ex.get('jextime') || '<any>')
|
||||
) {
|
||||
errMsg = '{{ _('Please specify unique set of exceptions.') }}';
|
||||
if (ex.errorModel.get('jscdate') != errMsg)
|
||||
self.errorModel.set('jscdate', errMsg);
|
||||
hasExceptionErr = true;
|
||||
}
|
||||
});
|
||||
|
||||
return errMsg;
|
||||
self.errorModel.unset('jscdate');
|
||||
if (d == t && d == '<any>') {
|
||||
errMsg = gettext('Please specify date/time.');
|
||||
self.errorModel.set('jscdate', errMsg);
|
||||
return errMsg ;
|
||||
}
|
||||
});
|
||||
|
||||
exceptions.each(function(ex) {
|
||||
if (hasExceptionErr || id == (ex.get('jexid') || ex.cid))
|
||||
return;
|
||||
|
||||
if (
|
||||
d == (ex.get('jexdate') || '<any>') &&
|
||||
t == (ex.get('jextime') || '<any>')
|
||||
) {
|
||||
errMsg = gettext('Please specify unique set of exceptions.');
|
||||
if (ex.errorModel.get('jscdate') != errMsg)
|
||||
self.errorModel.set('jscdate', errMsg);
|
||||
hasExceptionErr = true;
|
||||
}
|
||||
});
|
||||
|
||||
return errMsg;
|
||||
}
|
||||
});
|
||||
|
||||
pgBrowser.Nodes['pga_schedule'] = pgBrowser.Node.extend({
|
||||
parent_type: 'pga_job',
|
||||
@@ -189,7 +188,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
canDrop: function(node) {
|
||||
return true;
|
||||
},
|
||||
label: '{{ _('Schedule') }}',
|
||||
label: gettext('Schedule'),
|
||||
node_image: 'icon-pga_schedule',
|
||||
Init: function() {
|
||||
/* Avoid mulitple registration of menus */
|
||||
@@ -201,17 +200,17 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
pgBrowser.add_menus([{
|
||||
name: 'create_pga_schedule_on_job', node: 'pga_job', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Schedule...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Schedule...'),
|
||||
icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}
|
||||
},{
|
||||
name: 'create_pga_schedule_on_coll', node: 'coll-pga_schedule', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Schedule...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Schedule...'),
|
||||
icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}
|
||||
},{
|
||||
name: 'create_pga_schedule', node: 'pga_schedule', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Schedule...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Schedule...'),
|
||||
icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}
|
||||
}]);
|
||||
},
|
||||
@@ -251,18 +250,18 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
return pgBrowser.Node.Model.prototype.parse.apply(this, arguments);
|
||||
},
|
||||
schema: [{
|
||||
id: 'jscid', label: '{{ _('ID') }}', type: 'integer',
|
||||
id: 'jscid', label: gettext('ID'), type: 'integer',
|
||||
cellHeaderClasses: 'width_percent_5', mode: ['properties']
|
||||
},{
|
||||
id: 'jscname', label: '{{ _('Name') }}', type: 'text',
|
||||
id: 'jscname', label: gettext('Name'), type: 'text',
|
||||
cellHeaderClasses: 'width_percent_45',
|
||||
disabled: function() { return false; }
|
||||
},{
|
||||
id: 'jscenabled', label: '{{ _('Enabled?') }}', type: 'switch',
|
||||
id: 'jscenabled', label: gettext('Enabled?'), type: 'switch',
|
||||
disabled: function() { return false; },
|
||||
cellHeaderClasses: 'width_percent_5'
|
||||
},{
|
||||
id: 'jscstart', label: '{{ _('Start') }}', type: 'text',
|
||||
id: 'jscstart', label: gettext('Start'), type: 'text',
|
||||
control: 'datetimepicker', cell: 'moment',
|
||||
disabled: function() { return false; },
|
||||
displayFormat: 'YYYY-MM-DD HH:mm:ss Z',
|
||||
@@ -270,7 +269,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
format: 'YYYY-MM-DD HH:mm:ss Z',
|
||||
}, cellHeaderClasses: 'width_percent_25'
|
||||
},{
|
||||
id: 'jscend', label: '{{ _('End') }}', type: 'text',
|
||||
id: 'jscend', label: gettext('End'), type: 'text',
|
||||
control: 'datetimepicker', cell: 'moment',
|
||||
disabled: function() { return false; }, displayInUTC: false,
|
||||
displayFormat: 'YYYY-MM-DD HH:mm:ss Z', options: {
|
||||
@@ -278,32 +277,32 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
}, cellHeaderClasses: 'width_percent_25',
|
||||
modelFormat: 'YYYY-MM-DD HH:mm:ss Z'
|
||||
},{
|
||||
id: 'jscweekdays', label:'{{ _('Week days') }}', type: 'text',
|
||||
id: 'jscweekdays', label: gettext('Week days'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new BooleanArrayFormatter(weekdays, false)
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
id: 'jscmonthdays', label:'{{ _('Month days') }}', type: 'text',
|
||||
id: 'jscmonthdays', label: gettext('Month days'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new BooleanArrayFormatter(monthdays, false)
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
id: 'jscmonths', label:'{{ _('Months') }}', type: 'text',
|
||||
id: 'jscmonths', label: gettext('Months'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new BooleanArrayFormatter(months, false)
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
id: 'jschours', label:'{{ _('Hours') }}', type: 'text',
|
||||
id: 'jschours', label: gettext('Hours'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new BooleanArrayFormatter(hours, false)
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
id: 'jscminutes', label:'{{ _('Minutes') }}', type: 'text',
|
||||
id: 'jscminutes', label: gettext('Minutes'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new BooleanArrayFormatter(minutes, false)
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
id: 'jscexceptions', label:'{{ _('Exceptions') }}', type: 'text',
|
||||
id: 'jscexceptions', label: gettext('Exceptions'), type: 'text',
|
||||
control: Backform.Control.extend({
|
||||
formatter: new function() {
|
||||
this.fromRaw = function(rawData) {
|
||||
@@ -328,7 +327,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
}
|
||||
}), mode: ['properties']
|
||||
},{
|
||||
type: 'nested', label: '{{ _('Days') }}', group: '{{ _('Repeat') }}',
|
||||
type: 'nested', label: gettext('Days'), group: gettext('Repeat'),
|
||||
mode: ['create', 'edit'],
|
||||
control: Backform.FieldsetControl.extend({
|
||||
render: function() {
|
||||
@@ -344,13 +343,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
}
|
||||
}),
|
||||
schema:[{
|
||||
id: 'jscweekdays', label:'{{ _('Week Days') }}', cell: 'select2',
|
||||
group: '{{ _('Days') }}', control: 'select2', type: 'array',
|
||||
id: 'jscweekdays', label: gettext('Week Days'), cell: 'select2',
|
||||
group: gettext('Days'), control: 'select2', type: 'array',
|
||||
select2: {
|
||||
first_empty: false,
|
||||
multiple: true,
|
||||
allowClear: true,
|
||||
placeholder: '{{ _("Select the weekdays...") }}',
|
||||
placeholder: gettext('Select the weekdays...'),
|
||||
width: 'style',
|
||||
dropdownAdapter: $.fn.select2.amd.require(
|
||||
'select2/selectAllAdapter'
|
||||
@@ -360,13 +359,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
formatter: new BooleanArrayFormatter(weekdays, true),
|
||||
options: BooleanArrayOptions
|
||||
},{
|
||||
id: 'jscmonthdays', label:'{{ _('Month Days') }}', cell: 'select2',
|
||||
group: '{{ _('Days') }}', control: 'select2', type: 'array',
|
||||
id: 'jscmonthdays', label: gettext('Month Days'), cell: 'select2',
|
||||
group: gettext('Days'), control: 'select2', type: 'array',
|
||||
select2: {
|
||||
first_empty: false,
|
||||
multiple: true,
|
||||
allowClear: true,
|
||||
placeholder: '{{ _("Select the month days...") }}',
|
||||
placeholder: gettext('Select the month days...'),
|
||||
width: 'style',
|
||||
dropdownAdapter: $.fn.select2.amd.require(
|
||||
'select2/selectAllAdapter'
|
||||
@@ -375,13 +374,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
formatter: new BooleanArrayFormatter(monthdays, true),
|
||||
selector: monthdays, options: BooleanArrayOptions
|
||||
},{
|
||||
id: 'jscmonths', label:'{{ _('Months') }}', cell: 'select2',
|
||||
group: '{{ _('Days') }}', control: 'select2', type: 'array',
|
||||
id: 'jscmonths', label: gettext('Months'), cell: 'select2',
|
||||
group: gettext('Days'), control: 'select2', type: 'array',
|
||||
select2: {
|
||||
first_empty: false,
|
||||
multiple: true,
|
||||
allowClear: true,
|
||||
placeholder: '{{ _("Select the months...") }}',
|
||||
placeholder: gettext('Select the months...'),
|
||||
width: 'style',
|
||||
dropdownAdapter: $.fn.select2.amd.require(
|
||||
'select2/selectAllAdapter'
|
||||
@@ -391,16 +390,16 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
selector: months, options: BooleanArrayOptions
|
||||
}]
|
||||
},{
|
||||
type: 'nested', control: 'fieldset', label: '{{ _('Times') }}',
|
||||
group: '{{ _('Repeat') }}', mode: ['create', 'edit'],
|
||||
type: 'nested', control: 'fieldset', label: gettext('Times'),
|
||||
group: gettext('Repeat'), mode: ['create', 'edit'],
|
||||
schema:[{
|
||||
id: 'jschours', label:'{{ _('Hours') }}', cell: 'select2',
|
||||
group: '{{ _('Times') }}', control: 'select2', type: 'array',
|
||||
id: 'jschours', label: gettext('Hours'), cell: 'select2',
|
||||
group: gettext('Times'), control: 'select2', type: 'array',
|
||||
select2: {
|
||||
first_empty: false,
|
||||
multiple: true,
|
||||
allowClear: true,
|
||||
placeholder: '{{ _("Select the hours...") }}',
|
||||
placeholder: gettext('Select the hours...'),
|
||||
width: 'style',
|
||||
dropdownAdapter: $.fn.select2.amd.require(
|
||||
'select2/selectAllAdapter'
|
||||
@@ -409,13 +408,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
formatter: new BooleanArrayFormatter(hours, true),
|
||||
selector: hours, options: BooleanArrayOptions
|
||||
},{
|
||||
id: 'jscminutes', label:'{{ _('Minutes') }}', cell: 'select2',
|
||||
group: '{{ _('Times') }}', control: 'select2', type: 'array',
|
||||
id: 'jscminutes', label: gettext('Minutes'), cell: 'select2',
|
||||
group: gettext('Times'), control: 'select2', type: 'array',
|
||||
select2: {
|
||||
first_empty: false,
|
||||
multiple: true,
|
||||
allowClear: true,
|
||||
placeholder: '{{ _("Select the minutes...") }}',
|
||||
placeholder: gettext('Select the minutes...'),
|
||||
width: 'style',
|
||||
dropdownAdapter: $.fn.select2.amd.require(
|
||||
'select2/selectAllAdapter'
|
||||
@@ -427,10 +426,10 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
},{
|
||||
id: 'jscexceptions', type: 'collection', mode: ['edit', 'create'],
|
||||
label: "", canEdit: false, model: ExceptionModel, canAdd: true,
|
||||
group: '{{ _('Exceptions') }}', canDelete: true,
|
||||
group: gettext('Exceptions'), canDelete: true,
|
||||
cols: ['jexdate', 'jextime'], control: 'sub-node-collection'
|
||||
},{
|
||||
id: 'jscdesc', label: '{{ _('Comment') }}', type: 'multiline'
|
||||
id: 'jscdesc', label: gettext('Comment'), type: 'multiline'
|
||||
}],
|
||||
validate: function(keys) {
|
||||
var val = this.get('jscname'),
|
||||
@@ -438,7 +437,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
var msg = '{{ _('Name cannot be empty.') }}';
|
||||
var msg = gettext('Name cannot be empty.');
|
||||
this.errorModel.set('jscname', msg);
|
||||
errMsg = msg;
|
||||
} else {
|
||||
@@ -448,7 +447,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
val = this.get('jscstart');
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
var msg = '{{ _('Please enter the start time.') }}';
|
||||
var msg = gettext('Please enter the start time.');
|
||||
this.errorModel.set('jscstart', msg);
|
||||
errMsg = errMsg || msg;
|
||||
} else {
|
||||
@@ -458,7 +457,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) {
|
||||
val = this.get('jscend');
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
var msg = '{{ _('Please enter the end time.') }}';
|
||||
var msg = gettext('Please enter the end time.');
|
||||
this.errorModel.set('jscend', msg);
|
||||
errMsg = errMsg || msg;
|
||||
} else {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
define([
|
||||
'jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||
'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform'
|
||||
],
|
||||
function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||
'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform'
|
||||
], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-pga_jobstep']) {
|
||||
pgBrowser.Nodes['coll-pga_jobstep'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'pga_jobstep',
|
||||
label: '{{ _('Steps') }}',
|
||||
label: gettext('Steps'),
|
||||
type: 'coll-pga_jobstep',
|
||||
columns: [
|
||||
'jstid', 'jstname', 'jstenabled', 'jstkind', 'jstconntype',
|
||||
@@ -32,9 +31,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
canDrop: function(node) {
|
||||
return true;
|
||||
},
|
||||
label: '{{ _('Steps') }}',
|
||||
label: gettext('Steps'),
|
||||
node_image: function() {
|
||||
console.log(arguments);
|
||||
return 'icon-pga_jobstep';
|
||||
},
|
||||
Init: function() {
|
||||
@@ -47,17 +45,17 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
pgBrowser.add_menus([{
|
||||
name: 'create_pga_jobstep_on_job', node: 'pga_job', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Job Step...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Job Step...'),
|
||||
data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep'
|
||||
},{
|
||||
name: 'create_pga_jobstep_on_coll', node: 'coll-pga_jobstep', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Job Step...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Job Step...'),
|
||||
data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep'
|
||||
},{
|
||||
name: 'create_pga_jobstep', node: 'pga_jobstep', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Job Step...') }}',
|
||||
category: 'create', priority: 4, label: gettext('Job Step...'),
|
||||
data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep'
|
||||
}]);
|
||||
},
|
||||
@@ -91,81 +89,81 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
},
|
||||
idAttribute: 'jstid',
|
||||
schema: [{
|
||||
id: 'jstid', label: '{{ _('ID') }}', type: 'integer',
|
||||
id: 'jstid', label: gettext('ID'), type: 'integer',
|
||||
cellHeaderClasses: 'width_percent_5', mode: ['properties']
|
||||
},{
|
||||
id: 'jstname', label: '{{ _('Name') }}', type: 'text',
|
||||
id: 'jstname', label: gettext('Name'), type: 'text',
|
||||
disabled: function(m) { return false; },
|
||||
cellHeaderClasses: 'width_percent_60'
|
||||
},{
|
||||
id: 'jstenabled', label: '{{ _('Enabled?') }}', type: 'switch',
|
||||
id: 'jstenabled', label: gettext('Enabled?'), type: 'switch',
|
||||
disabled: function(m) { return false; }
|
||||
},{
|
||||
id: 'jstkind', label: '{{ _('Kind') }}', type: 'switch',
|
||||
id: 'jstkind', label: gettext('Kind'), type: 'switch',
|
||||
options: {
|
||||
'onText': '{{ _('SQL') }}', 'offText': '{{ _('Batch') }}',
|
||||
'onText': gettext('SQL'), 'offText': gettext('Batch'),
|
||||
'onColor': 'primary', 'offColor': 'primary'
|
||||
}, control: Backform.SwitchControl,
|
||||
disabled: function(m) { return false; }
|
||||
},{
|
||||
id: 'jstconntype', label: '{{ _('Connection type') }}',
|
||||
id: 'jstconntype', label: gettext('Connection type'),
|
||||
type: 'switch', deps: ['jstkind'], mode: ['properties'],
|
||||
disabled: function(m) { return !m.get('jstkind'); },
|
||||
options: {
|
||||
'onText': '{{ _('Local') }}', 'offText': '{{ _('Remote') }}',
|
||||
'onText': gettext('Local'), 'offText': gettext('Remote'),
|
||||
'onColor': 'primary', 'offColor': 'primary'
|
||||
}
|
||||
},{
|
||||
id: 'jstconntype', label: '{{ _('Connection type') }}',
|
||||
id: 'jstconntype', label: gettext('Connection type'),
|
||||
type: 'switch', deps: ['jstkind'], mode: ['create', 'edit'],
|
||||
disabled: function(m) { return !m.get('jstkind'); },
|
||||
options: {
|
||||
'onText': '{{ _('Local') }}', 'offText': '{{ _('Remote') }}',
|
||||
'onText': gettext('Local'), 'offText': gettext('Remote'),
|
||||
'onColor': 'primary', 'offColor': 'primary'
|
||||
}, helpMessage: '{{ _('Select <b>Local</b> if the job step will execute on the local database server, or <b>Remote</b> to specify a remote database server.') }}'
|
||||
}, helpMessage: gettext('Select <b>Local</b> if the job step will execute on the local database server, or <b>Remote</b> to specify a remote database server.')
|
||||
},{
|
||||
id: 'jstdbname', label: '{{ _('Database') }}', type: 'text',
|
||||
id: 'jstdbname', label: gettext('Database'), type: 'text',
|
||||
mode: ['properties'], disabled: function(m) { return false; }
|
||||
},{
|
||||
id: 'jstconnstr', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Connection string') }}'
|
||||
label: gettext('Connection string')
|
||||
},{
|
||||
id: 'jstdbname', label: '{{ _('Database') }}', type: 'text',
|
||||
id: 'jstdbname', label: gettext('Database'), type: 'text',
|
||||
control: 'node-list-by-name', node: 'database',
|
||||
cache_node: 'database', select2: {allowClear: true, placeholder: ''},
|
||||
disabled: function(m) {
|
||||
return !m.get('jstkind') || !m.get('jstconntype');
|
||||
}, deps: ['jstkind', 'jstconntype'], mode: ['create', 'edit'],
|
||||
helpMessage: '{{ _('Please select the database on which the job step will run.') }}'
|
||||
helpMessage: gettext('Please select the database on which the job step will run.')
|
||||
},{
|
||||
id: 'jstconnstr', label: '{{ _('Connection string') }}', type: 'text',
|
||||
id: 'jstconnstr', label: gettext('Connection string'), type: 'text',
|
||||
deps: ['jstkind', 'jstconntype'], disabled: function(m) {
|
||||
return !m.get('jstkind') || m.get('jstconntype');
|
||||
}, helpMessage: S(
|
||||
'{{ _("Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = \\'a value\\'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \\\' and \\\\.<br>For more information, please see the documentation on %s") }}'
|
||||
gettext("Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.<br>For more information, please see the documentation on %s")
|
||||
).sprintf(
|
||||
'<a href="https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING" target="_blank">libpq connection strings</a>'
|
||||
).value(), mode: ['create', 'edit']
|
||||
},{
|
||||
id: 'jstonerror', label: '{{ _('On error') }}', cell: 'select2',
|
||||
id: 'jstonerror', label: gettext('On error'), cell: 'select2',
|
||||
control: 'select2', options: [
|
||||
{'label': '{{ _("Fail") }}', 'value': "f"},
|
||||
{'label': '{{ _("Success") }}', 'value': "s"},
|
||||
{'label': '{{ _("Ignore") }}', 'value': "i"}
|
||||
{'label': gettext('Fail'), 'value': "f"},
|
||||
{'label': gettext('Success'), 'value': "s"},
|
||||
{'label': gettext('Ignore'), 'value': "i"}
|
||||
], select2: {allowClear: false}, disabled: function(m) {
|
||||
return false;
|
||||
}
|
||||
},{
|
||||
id: 'jstdesc', label: '{{ _('Comment') }}', type: 'multiline'
|
||||
id: 'jstdesc', label: gettext('Comment'), type: 'multiline'
|
||||
},{
|
||||
id: 'jstcode', label: '', cell: 'string', deps: ['jstkind'],
|
||||
type: 'text', control: 'sql-field', group: '{{ _('Code') }}',
|
||||
type: 'text', control: 'sql-field', group: gettext('Code'),
|
||||
control: Backform.SqlFieldControl.extend({
|
||||
render: function() {
|
||||
if (this.model.get('jstkind')) {
|
||||
this.field.set('label', '{{ _('SQL query') }}');
|
||||
this.field.set('label', gettext('SQL query'));
|
||||
} else {
|
||||
this.field.set('label', '{{ _('Script') }}');
|
||||
this.field.set('label', gettext('Script'));
|
||||
}
|
||||
return Backform.SqlFieldControl.prototype.render.apply(
|
||||
this, arguments
|
||||
@@ -181,7 +179,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == ''
|
||||
) {
|
||||
errMsg = '{{ _('Name cannot be empty.') }}';
|
||||
errMsg = gettext('Name cannot be empty.');
|
||||
this.errorModel.set('jstname', errMsg);
|
||||
} else {
|
||||
this.errorModel.unset('jstname');
|
||||
@@ -194,7 +192,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == ''
|
||||
) {
|
||||
var msg = '{{ _('Please select a database.') }}';
|
||||
var msg = gettext('Please select a database.');
|
||||
errMsg = errMsg || msg;
|
||||
this.errorModel.set('jstdbname', msg);
|
||||
} else {
|
||||
@@ -209,9 +207,9 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == ''
|
||||
) {
|
||||
msg = '{{ _("Please enter a connection string.") }}';
|
||||
msg = gettext('Please enter a connection string.');
|
||||
} else if (String(val).replace(r, '') != '') {
|
||||
msg = '{{ _("Please enter a valid connection string.") }}';
|
||||
msg = gettext('Please enter a valid connection string.');
|
||||
} else {
|
||||
var m,
|
||||
params = {
|
||||
@@ -231,12 +229,12 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
if (params[m[1]]) {
|
||||
if (m[2])
|
||||
continue;
|
||||
msg = '{{ _("Please enter a valid connection string.") }}';
|
||||
msg = gettext('Please enter a valid connection string.');
|
||||
break;
|
||||
}
|
||||
|
||||
msg = S(
|
||||
'{{ _("Invalid parameter in the connection string - %s.") }}'
|
||||
gettext('Invalid parameter in the connection string - %s.')
|
||||
).sprintf(m[1]).value();
|
||||
break;
|
||||
}
|
||||
@@ -259,7 +257,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
|
||||
_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == ''
|
||||
) {
|
||||
var msg = '{{ _('Please specify code to execute.') }}';
|
||||
var msg = gettext('Please specify code to execute.');
|
||||
errMsg = errMsg || msg;
|
||||
this.errorModel.set('jstcode', msg);
|
||||
} else {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
define(
|
||||
[
|
||||
'jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||
'pgadmin.browser', 'alertify', 'pgadmin.node.pga_jobstep',
|
||||
'pgadmin.node.pga_schedule'
|
||||
],
|
||||
function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||
'pgadmin.browser', 'alertify', 'pgadmin.node.pga_jobstep',
|
||||
'pgadmin.node.pga_schedule'
|
||||
], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-pga_job']) {
|
||||
var pga_jobs = pgBrowser.Nodes['coll-pga_job'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'pga_job',
|
||||
label: '{{ _('pga_jobs') }}',
|
||||
label: gettext('pga_jobs'),
|
||||
type: 'coll-pga_job',
|
||||
columns: ['jobid', 'jobname', 'jobenabled', 'jlgstatus', 'jobnextrun', 'joblastrun', 'jobdesc'],
|
||||
hasStatistics: false
|
||||
@@ -31,7 +29,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
canDrop: function(node) {
|
||||
return true;
|
||||
},
|
||||
label: '{{ _('pgAgent Job') }}',
|
||||
label: gettext('pgAgent Job'),
|
||||
node_image: function() {
|
||||
return 'icon-pga_job';
|
||||
},
|
||||
@@ -45,17 +43,17 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
pgBrowser.add_menus([{
|
||||
name: 'create_pga_job_on_coll', node: 'coll-pga_job', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('pgAgent Job...') }}',
|
||||
category: 'create', priority: 4, label: gettext('pgAgent Job...'),
|
||||
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}
|
||||
},{
|
||||
name: 'create_pga_job', node: 'pga_job', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('pgAgent Job...') }}',
|
||||
category: 'create', priority: 4, label: gettext('pgAgent Job...'),
|
||||
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}
|
||||
}, {
|
||||
name: 'run_now_pga_job', node: 'pga_job', module: this,
|
||||
applies: ['object', 'context'], callback: 'run_pga_job_now',
|
||||
priority: 4, label: '{{ _('Run now') }}', data: {action: 'create'},
|
||||
priority: 4, label: gettext('Run now'), data: {action: 'create'},
|
||||
icon: 'fa fa-play-circle'
|
||||
}]);
|
||||
},
|
||||
@@ -81,59 +79,59 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
var d = pgBrowser.Node.Model.prototype.parse.apply(this, arguments);
|
||||
|
||||
if (d) {
|
||||
d.jobrunningat = d.jaghostagent || "{{ _('Not running currently.') }}";
|
||||
d.jlgstatus = d.jlgstatus || "{{ _('Unknown') }}";
|
||||
d.jobrunningat = d.jaghostagent || gettext("Not running currently.");
|
||||
d.jlgstatus = d.jlgstatus || gettext("Unknown");
|
||||
}
|
||||
return d;
|
||||
},
|
||||
schema: [{
|
||||
id: 'jobname', label: '{{ _('Name') }}', type: 'text',
|
||||
id: 'jobname', label: gettext('Name'), type: 'text',
|
||||
cellHeaderClasses: 'width_percent_30'
|
||||
},{
|
||||
id: 'jobid', label:'{{ _('ID') }}', mode: ['properties'],
|
||||
id: 'jobid', label: gettext('ID'), mode: ['properties'],
|
||||
type: 'int'
|
||||
},{
|
||||
id: 'jobenabled', label:'{{ _('Enabled?') }}', type: 'switch',
|
||||
id: 'jobenabled', label: gettext('Enabled?'), type: 'switch',
|
||||
cellHeaderClasses: 'width_percent_5'
|
||||
},{
|
||||
id: 'jobclass', label: '{{ _('Job class') }}', type: 'text',
|
||||
id: 'jobclass', label: gettext('Job class'), type: 'text',
|
||||
mode: ['properties']
|
||||
},{
|
||||
id: 'jobjclid', label: '{{ _('Job class') }}', type: 'integer',
|
||||
id: 'jobjclid', label: gettext('Job class'), type: 'integer',
|
||||
control: 'node-ajax-options', url: 'classes', url_with_id: false,
|
||||
cache_node: 'server', mode: ['create', 'edit'],
|
||||
select2: {allowClear: false},
|
||||
helpMessage: '{{ _('Please select a class to categorize the job. This option will not affect the way the job runs.') }}'
|
||||
helpMessage: gettext('Please select a class to categorize the job. This option will not affect the way the job runs.')
|
||||
},{
|
||||
id: 'jobhostagent', label: '{{ _('Host agent') }}', type: 'text',
|
||||
id: 'jobhostagent', label: gettext('Host agent'), type: 'text',
|
||||
mode: ['edit', 'create'],
|
||||
helpMessage: '{{ _('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.') }}'
|
||||
helpMessage: gettext('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.')
|
||||
},{
|
||||
id: 'jobhostagent', label: '{{ _('Host agent') }}', type: 'text',
|
||||
id: 'jobhostagent', label: gettext('Host agent'), type: 'text',
|
||||
mode: ['properties']
|
||||
},{
|
||||
id: 'jobcreated', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Created') }}'
|
||||
label: gettext('Created')
|
||||
},{
|
||||
id: 'jobchanged', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Changed') }}'
|
||||
label: gettext('Changed')
|
||||
},{
|
||||
id: 'jobnextrun', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Next run') }}', cellHeaderClasses: 'width_percent_20'
|
||||
label: gettext('Next run'), cellHeaderClasses: 'width_percent_20'
|
||||
},{
|
||||
id: 'joblastrun', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Last run') }}', cellHeaderClasses: 'width_percent_20'
|
||||
label: gettext('Last run'), cellHeaderClasses: 'width_percent_20'
|
||||
},{
|
||||
id: 'jlgstatus', type: 'text', label: '{{ _('Last result') }}',
|
||||
id: 'jlgstatus', type: 'text', label: gettext('Last result'),
|
||||
cellHeaderClasses: 'width_percent_5', mode: ['properties']
|
||||
},{
|
||||
id: 'jobrunningat', type: 'text', mode: ['properties'],
|
||||
label: '{{ _('Running at') }}'
|
||||
label: gettext('Running at')
|
||||
},{
|
||||
id: 'jobdesc', label:'{{ _('Comment') }}', type: 'multiline',
|
||||
id: 'jobdesc', label: gettext('Comment'), type: 'multiline',
|
||||
cellHeaderClasses: 'width_percent_15'
|
||||
},{
|
||||
id: 'jsteps', label: '', group: '{{ _("Steps") }}',
|
||||
id: 'jsteps', label: '', group: gettext('Steps'),
|
||||
type: 'collection', mode: ['edit', 'create'],
|
||||
model: pgBrowser.Nodes['pga_jobstep'].model, canEdit: true,
|
||||
control: 'sub-node-collection', canAdd: true, canDelete: true,
|
||||
@@ -141,7 +139,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
'jstname', 'jstenabled', 'jstkind', 'jstconntype', 'jstonerror'
|
||||
]
|
||||
},{
|
||||
id: 'jschedules', label: '', group: '{{ _("Schedules") }}',
|
||||
id: 'jschedules', label: '', group: gettext('Schedules'),
|
||||
type: 'collection', mode: ['edit', 'create'],
|
||||
control: 'sub-node-collection', canAdd: true, canDelete: true,
|
||||
canEdit: true, model: pgBrowser.Nodes['pga_schedule'].model,
|
||||
@@ -151,7 +149,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
var name = this.get('jobname');
|
||||
if (_.isUndefined(name) || _.isNull(name) ||
|
||||
String(name).replace(/^\s+|\s+$/g, '') == '') {
|
||||
var msg = '{{ _('Name cannot be empty.') }}';
|
||||
var msg = gettext('Name cannot be empty.');
|
||||
this.errorModel.set('jobname', msg);
|
||||
return msg;
|
||||
} else {
|
||||
@@ -182,16 +180,16 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
error: function(xhr, status, error) {
|
||||
var error_msg = "Unable to run pgagent job.";
|
||||
if (xhr.readyState == 0) {
|
||||
alertify.error('{{ _('Not connected to the server or the connection to the server has been closed.') }}');
|
||||
alertify.error(gettext('Not connected to the server or the connection to the server has been closed.'));
|
||||
}
|
||||
else {
|
||||
if (_.isUndefined(xhr.responseText)) {
|
||||
alertify.error("{{ _('" + error_msg + "') }}");
|
||||
alertify.error(error_msg);
|
||||
}
|
||||
else {
|
||||
var err = $.parseJSON(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
alertify.error("{{ _('" + err.errormsg + "') }}");
|
||||
alertify.error(err.errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user