Ext.define('PVE.window.ReplicaEdit', {
- extend: 'PVE.window.Edit',
+ extend: 'Proxmox.window.Edit',
xtype: 'pveReplicaEdit',
subject: gettext('Replication Job'),
},
{
xtype: 'numberfield',
- fieldLabel: gettext('Rate (MB/s)'),
+ fieldLabel: gettext('Rate limit') + ' (MB/s)',
step: 1,
minValue: 1,
emptyText: gettext('unlimited'),
name: 'comment'
},
{
- xtype: 'pvecheckbox',
+ xtype: 'proxmoxcheckbox',
name: 'enabled',
defaultValue: 'on',
checked: true,
}
});
+/* callback is a function and string */
Ext.define('PVE.grid.ReplicaView', {
extend: 'Ext.grid.Panel',
xtype: 'pveReplicaView',
win.show();
},
- removeJob: function(button,event,rec) {
- var me = this.getView();
- var controller = this;
- PVE.Utils.API2Request({
- url: '/api2/extjs/cluster/replication/' + rec.data.id,
- waitMsgTarget: me,
- method: 'DELETE',
- callback: function() { controller.reload(); },
- failure: function (response, opts) {
- Ext.Msg.alert('Error', response.htmlStatus);
- }
- });
- },
-
scheduleJobNow: function(button,event,rec) {
var me = this.getView();
var controller = this;
- PVE.Utils.API2Request({
+ Proxmox.Utils.API2Request({
url: "/api2/extjs/nodes/" + me.nodename + "/replication/" + rec.data.id + "/schedule_now",
method: 'POST',
waitMsgTarget: me,
showLog: function(button, event, rec) {
var me = this.getView();
var controller = this;
- var logView = Ext.create('PVE.panel.LogView', {
+ var logView = Ext.create('Proxmox.panel.LogView', {
border: false,
url: "/api2/extjs/nodes/" + me.nodename + "/replication/" + rec.data.id + "/log"
});
handler: 'addJob'
},
{
- xtype: 'pveButton',
+ xtype: 'proxmoxButton',
text: gettext('Edit'),
itemId: 'editButton',
handler: 'editJob',
disabled: true
},
{
- xtype: 'pveButton',
- text: gettext('Remove'),
+ xtype: 'proxmoxStdRemoveButton',
itemId: 'removeButton',
- handler: 'removeJob',
+ baseurl: '/api2/extjs/cluster/replication/',
dangerous: true,
- confirmMsg: function(rec) {
- var msg = Ext.String.format(gettext("Are you sure you want to remove replication job '{0}'?"), rec.id);
- return msg;
- },
- disabled: true
+ callback: 'reload'
},
{
- xtype: 'pveButton',
+ xtype: 'proxmoxButton',
text: gettext('Log'),
itemId: 'logButton',
handler: 'showLog',
disabled: true
},
{
- xtype: 'pveButton',
+ xtype: 'proxmoxButton',
text: gettext('Schedule now'),
itemId: 'scheduleNowButton',
handler: 'scheduleJobNow',
disabled: true
},
{
- text: gettext('ID'),
+ text: 'ID',
dataIndex: 'id',
width: 60,
hidden: true
{
text: gettext('Status'),
dataIndex: 'state',
- width: 60,
+ minWidth: 160,
+ flex: 1,
renderer: function(value, metadata, record) {
if (record.data.pid) {
return '';
}
+ var icons = [];
var states = [];
if (record.data.remove_job) {
- states.push('<i class="fa fa-ban warning" title="'
+ icons.push('<i class="fa fa-ban warning" title="'
+ gettext("Removal Scheduled") + '"></i>');
- }
-
- if (record.data.error) {
- states.push('<i class="fa fa-times critical" title="'
- + gettext("Error") + '"></i>');
- }
-
- if (states.length > 0) {
- return states.join(',');
- }
-
- return '<i class="fa fa-check good"></i>';
- }
- },
- {
- text: gettext('Status Text'),
- dataIndex: 'error',
- minWidth: 100,
- flex: 1,
- renderer: function(value, metadata, record) {
- var states = [];
-
- if (record.data.remove_job) {
states.push(gettext("Removal Scheduled"));
}
if (record.data.error) {
+ icons.push('<i class="fa fa-times critical" title="'
+ + gettext("Error") + '"></i>');
states.push(record.data.error);
}
- if (states.length > 0) {
- return states.join(', ');
+ if (icons.length == 0) {
+ icons.push('<i class="fa fa-check good"></i>');
+ states.push(gettext('OK'));
}
- return gettext('OK');
+ return icons.join(',') + ' ' + states.join(',');
}
},
{
return gettext('syncing');
}
- return PVE.Utils.render_timestamp(value);
+ return Proxmox.Utils.render_timestamp(value);
}
},
{
text: gettext('Duration'),
dataIndex: 'duration',
width: 60,
- renderer: PVE.Utils.render_duration
+ renderer: Proxmox.Utils.render_duration
},
{
text: gettext('Next Sync'),
return gettext('pending');
}
- return PVE.Utils.render_timestamp(value);
+ return Proxmox.Utils.render_timestamp(value);
}
}
);
dataIndex: 'schedule'
},
{
- text: gettext('Rate'),
+ text: gettext('Rate limit'),
dataIndex: 'rate',
renderer: function(value) {
if (!value) {
}
);
- me.rstore = Ext.create('PVE.data.UpdateStore', {
+ me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'pve-replica-' + me.nodename + me.vmid,
model: (mode === 'dc')? 'pve-replication' : 'pve-replication-state',
interval: 3000,
proxy: {
- type: 'pve',
+ type: 'proxmox',
url: "/api2/json" + url
}
});
- me.store = Ext.create('PVE.data.DiffStore', {
+ me.store = Ext.create('Proxmox.data.DiffStore', {
rstore: me.rstore,
sorters: [
{
return;
}
- PVE.Utils.monStoreErrors(me, me.rstore);
+ Proxmox.Utils.monStoreErrors(me, me.rstore);
me.on('destroy', me.rstore.stopUpdate);
me.rstore.startUpdate();