Commit 6c37b50f authored by Dietmar Maurer's avatar Dietmar Maurer

use standard titles for create/edit dialogs

That way we can reduce the number of gettext() messages.
parent 7be96875
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -709,6 +709,18 @@ Ext.define('PVE.Utils', { statics: { ...@@ -709,6 +709,18 @@ Ext.define('PVE.Utils', { statics: {
return PVE.Utils.format_task_description(type, id); return PVE.Utils.format_task_description(type, id);
}, },
dialog_title: function(subject, create, isAdd) {
if (create) {
if (isAdd) {
return gettext('Add') + ': ' + subject;
} else {
return gettext('Create') + ': ' + subject;
}
} else {
return gettext('Edit') + ': ' + subject;
}
},
openConoleWindow: function(vmtype, vmid, nodename, vmname) { openConoleWindow: function(vmtype, vmid, nodename, vmname) {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: vmtype, // kvm, openvz or shell console: vmtype, // kvm, openvz or shell
......
...@@ -18,14 +18,14 @@ Ext.define('PVE.dc.ACLAdd', { ...@@ -18,14 +18,14 @@ Ext.define('PVE.dc.ACLAdd', {
]; ];
if (me.aclType === 'group') { if (me.aclType === 'group') {
me.title = gettext('Add') + ': ' + gettext("Group Permission"); me.subject = gettext("Group Permission");
items.push({ items.push({
xtype: 'pveGroupSelector', xtype: 'pveGroupSelector',
name: 'groups', name: 'groups',
fieldLabel: gettext('Group') fieldLabel: gettext('Group')
}); });
} else if (me.aclType === 'user') { } else if (me.aclType === 'user') {
me.title = gettext('Add') + ': ' + gettext("User Permission"); me.subject = gettext("User Permission");
items.push({ items.push({
xtype: 'pveUserSelector', xtype: 'pveUserSelector',
name: 'users', name: 'users',
...@@ -55,9 +55,10 @@ Ext.define('PVE.dc.ACLAdd', { ...@@ -55,9 +55,10 @@ Ext.define('PVE.dc.ACLAdd', {
items: items items: items
}); });
Ext.applyIf(me, { Ext.apply(me, {
url: '/access/acl', url: '/access/acl',
method: 'PUT', method: 'PUT',
isAdd: true,
items: [ ipanel ] items: [ ipanel ]
}); });
......
...@@ -108,13 +108,8 @@ Ext.define('PVE.dc.AuthEdit', { ...@@ -108,13 +108,8 @@ Ext.define('PVE.dc.AuthEdit', {
} }
}); });
if (me.create) {
me.title = gettext('Create realm');
} else {
me.title = Ext.String.format(gettext('Edit realm {0}'), "'" + me.realm + "'");
}
Ext.applyIf(me, { Ext.applyIf(me, {
subject: gettext('Realm'),
url: url, url: url,
method: method, method: method,
items: [ ipanel ] items: [ ipanel ]
......
...@@ -270,8 +270,7 @@ Ext.define('PVE.dc.BackupEdit', { ...@@ -270,8 +270,7 @@ Ext.define('PVE.dc.BackupEdit', {
}; };
Ext.applyIf(me, { Ext.applyIf(me, {
title: me.create ? gettext("Create Backup Job") : subject: gettext("Backup Job"),
gettext("Edit Backup Job"),
url: url, url: url,
method: method, method: method,
items: [ ipanel, vmgrid ] items: [ ipanel, vmgrid ]
......
...@@ -19,8 +19,7 @@ Ext.define('PVE.dc.GroupEdit', { ...@@ -19,8 +19,7 @@ Ext.define('PVE.dc.GroupEdit', {
} }
Ext.applyIf(me, { Ext.applyIf(me, {
title: me.create ? gettext('Create Group') : subject: gettext('Group'),
Ext.String.format(gettext('Edit Group {0}'), "'" + me.groupid + "'"),
url: url, url: url,
method: method, method: method,
items: [ items: [
...@@ -48,4 +47,3 @@ Ext.define('PVE.dc.GroupEdit', { ...@@ -48,4 +47,3 @@ Ext.define('PVE.dc.GroupEdit', {
} }
} }
}); });
...@@ -121,10 +121,10 @@ Ext.define('PVE.dc.HAConfig', { ...@@ -121,10 +121,10 @@ Ext.define('PVE.dc.HAConfig', {
var me = this; var me = this;
me.commitBtn = new PVE.button.Button({ me.commitBtn = new PVE.button.Button({
text: gettext('Commit'), text: gettext('Activate'),
disabled: true, disabled: true,
confirmMsg: function () { confirmMsg: function () {
return gettext('Are you sure you want to commit your changes'); return gettext('Are you sure you want to activate your changes');
}, },
handler: function(btn, event) { handler: function(btn, event) {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
...@@ -145,7 +145,7 @@ Ext.define('PVE.dc.HAConfig', { ...@@ -145,7 +145,7 @@ Ext.define('PVE.dc.HAConfig', {
text: gettext('Revert changes'), text: gettext('Revert changes'),
disabled: true, disabled: true,
confirmMsg: function () { confirmMsg: function () {
return gettext('Are you sure you want to revert (undo) your changes'); return gettext('Are you sure you want to revert your changes');
}, },
handler: function(btn, event) { handler: function(btn, event) {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
......
...@@ -150,7 +150,7 @@ Ext.define('PVE.dc.HAServiceView', { ...@@ -150,7 +150,7 @@ Ext.define('PVE.dc.HAServiceView', {
dataIndex: 'owner' dataIndex: 'owner'
}, },
{ {
header: gettext('State'), header: gettext('Status'),
width: 80, width: 80,
sortable: true, sortable: true,
dataIndex: 'state_str' dataIndex: 'state_str'
......
...@@ -23,47 +23,29 @@ Ext.define('PVE.dc.UserEdit', { ...@@ -23,47 +23,29 @@ Ext.define('PVE.dc.UserEdit', {
{ {
xtype: me.create ? 'textfield' : 'displayfield', xtype: me.create ? 'textfield' : 'displayfield',
name: 'userid', name: 'userid',
fieldLabel: 'Userid', fieldLabel: gettext('User name'),
value: me.userid, value: me.userid,
allowBlank: false, allowBlank: false,
submitValue: me.create ? true : false submitValue: me.create ? true : false
}, },
new Ext.form.field.ComboBox({ {
fieldLabel: 'Group', xtype: 'pveGroupSelector',
name: 'groups', name: 'groups',
multiSelect: true, multiSelect: true,
hiddenName: 'groupid', allowBlank: true,
store: new Ext.data.Store({ fieldLabel: gettext('Group')
autoLoad: true, },
model: 'pve-groups',
proxy: {
type: 'pve',
url: "/api2/json/access/groups"
},
sorters: {
property: 'groupid',
order: 'DESC'
}
}),
valueField: 'groupid',
displayField: 'groupid',
typeAhead: true,
queryMode: 'local',
triggerAction: 'all',
emptyText: 'No Groups Selected',
selectOnFocus: true
}),
{ {
xtype: 'datefield', xtype: 'datefield',
name: 'expire', name: 'expire',
emptyText: 'never', emptyText: 'never',
format: 'Y-m-d', format: 'Y-m-d',
submitFormat: 'U', submitFormat: 'U',
fieldLabel: 'Expiration' fieldLabel: gettext('Expire')
}, },
{ {
xtype: 'pvecheckbox', xtype: 'pvecheckbox',
fieldLabel: 'Enable', fieldLabel: gettext('Enabled'),
name: 'enable', name: 'enable',
uncheckedValue: 0, uncheckedValue: 0,
defaultValue: 1 defaultValue: 1
...@@ -74,23 +56,23 @@ Ext.define('PVE.dc.UserEdit', { ...@@ -74,23 +56,23 @@ Ext.define('PVE.dc.UserEdit', {
{ {
xtype: 'textfield', xtype: 'textfield',
name: 'firstname', name: 'firstname',
fieldLabel: 'First Name' fieldLabel: gettext('First Name')
}, },
{ {
xtype: 'textfield', xtype: 'textfield',
name: 'lastname', name: 'lastname',
fieldLabel: 'Last Name' fieldLabel: gettext('Last Name')
}, },
{ {
xtype: 'textfield', xtype: 'textfield',
name: 'email', name: 'email',
fieldLabel: 'Email', fieldLabel: 'E-Mail',
vtype: 'email' vtype: 'email'
}, },
{ {
xtype: 'textfield', xtype: 'textfield',
name: 'comment', name: 'comment',
fieldLabel: 'Comment' fieldLabel: gettext('Comment')
} }
]; ];
...@@ -98,7 +80,7 @@ Ext.define('PVE.dc.UserEdit', { ...@@ -98,7 +80,7 @@ Ext.define('PVE.dc.UserEdit', {
column1.splice(1,0,{ column1.splice(1,0,{
xtype: 'pveRealmComboBox', xtype: 'pveRealmComboBox',
name: 'realm', name: 'realm',
fieldLabel: 'Realm', fieldLabel: gettext('Realm'),
allowBlank: false, allowBlank: false,
listeners: { listeners: {
change: function(combo, newValue){ change: function(combo, newValue){
...@@ -127,8 +109,8 @@ Ext.define('PVE.dc.UserEdit', { ...@@ -127,8 +109,8 @@ Ext.define('PVE.dc.UserEdit', {
} }
}); });
Ext.applyIf(me, { Ext.applyIf(me, {
title: me.create ? "Create User" : "Edit User '" + me.userid + "'", subject: gettext('User'),
url: url, url: url,
method: method, method: method,
items: [ ipanel ] items: [ ipanel ]
......
...@@ -20,7 +20,7 @@ Ext.define('PVE.dc.UserView', { ...@@ -20,7 +20,7 @@ Ext.define('PVE.dc.UserView', {
}; };
var remove_btn = new Ext.Button({ var remove_btn = new Ext.Button({
text: 'Delete', text: gettext('Remove'),
disabled: true, disabled: true,
handler: function() { handler: function() {
var msg; var msg;
...@@ -68,7 +68,7 @@ Ext.define('PVE.dc.UserView', { ...@@ -68,7 +68,7 @@ Ext.define('PVE.dc.UserView', {
}; };
var edit_btn = new Ext.Button({ var edit_btn = new Ext.Button({
text: 'Modify', text: gettext('Edit'),
disabled: true, disabled: true,
handler: run_editor handler: run_editor
}); });
...@@ -90,7 +90,7 @@ Ext.define('PVE.dc.UserView', { ...@@ -90,7 +90,7 @@ Ext.define('PVE.dc.UserView', {
var tbar = [ var tbar = [
{ {
text: 'Create', text: gettext('Create'),
handler: function() { handler: function() {
var win = Ext.create('PVE.dc.UserEdit',{ var win = Ext.create('PVE.dc.UserEdit',{
}); });
...@@ -134,34 +134,34 @@ Ext.define('PVE.dc.UserView', { ...@@ -134,34 +134,34 @@ Ext.define('PVE.dc.UserView', {
columns: [ columns: [
{ {
header: 'User name', header: gettext('User name'),
width: 200, width: 200,
sortable: true, sortable: true,
renderer: render_username, renderer: render_username,
dataIndex: 'userid' dataIndex: 'userid'
}, },
{ {
header: 'Realm', header: gettext('Realm'),
width: 100, width: 100,
sortable: true, sortable: true,
renderer: render_realm, renderer: render_realm,
dataIndex: 'userid' dataIndex: 'userid'
}, },
{ {
header: 'Enabled', header: gettext('Enabled'),
width: 80, width: 80,
sortable: true, sortable: true,
dataIndex: 'enable' dataIndex: 'enable'
}, },
{ {
header: 'Expire', header: gettext('Expire'),
width: 80, width: 80,
sortable: true, sortable: true,
renderer: render_expire, renderer: render_expire,
dataIndex: 'expire' dataIndex: 'expire'
}, },
{ {
header: 'Name', header: gettext('Name'),
width: 150, width: 150,
sortable: true, sortable: true,
renderer: render_full_name, renderer: render_full_name,
...@@ -169,7 +169,7 @@ Ext.define('PVE.dc.UserView', { ...@@ -169,7 +169,7 @@ Ext.define('PVE.dc.UserView', {
}, },
{ {
id: 'comment', id: 'comment',
header: 'Comment', header: gettext('Comment'),
sortable: false, sortable: false,
dataIndex: 'comment', dataIndex: 'comment',
flex: 1 flex: 1
......
...@@ -2,6 +2,8 @@ Ext.define('PVE.form.GroupSelector', { ...@@ -2,6 +2,8 @@ Ext.define('PVE.form.GroupSelector', {
extend: 'PVE.form.ComboGrid', extend: 'PVE.form.ComboGrid',
alias: ['widget.pveGroupSelector'], alias: ['widget.pveGroupSelector'],
allowBlank: false,
initComponent: function() { initComponent: function() {
var me = this; var me = this;
...@@ -11,7 +13,6 @@ Ext.define('PVE.form.GroupSelector', { ...@@ -11,7 +13,6 @@ Ext.define('PVE.form.GroupSelector', {
Ext.apply(me, { Ext.apply(me, {
store: store, store: store,
allowBlank: false,
autoSelect: false, autoSelect: false,
valueField: 'groupid', valueField: 'groupid',
displayField: 'groupid', displayField: 'groupid',
......
...@@ -59,7 +59,7 @@ Ext.define('PVE.openvz.CreateWizard', { ...@@ -59,7 +59,7 @@ Ext.define('PVE.openvz.CreateWizard', {
}); });
Ext.applyIf(me, { Ext.applyIf(me, {
title: 'Create new container', subject: gettext('OpenVZ Container'),
items: [ items: [
{ {
xtype: 'inputpanel', xtype: 'inputpanel',
......
...@@ -102,7 +102,7 @@ Ext.define('PVE.qemu.Config', { ...@@ -102,7 +102,7 @@ Ext.define('PVE.qemu.Config', {
var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")"; var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")";
Ext.apply(me, { Ext.apply(me, {
title: Ext.String.format(gettext("Virtual machine {0} on node {1}"), descr, "'" + nodename + "'"), title: Ext.String.format(gettext("Virtual Machine {0} on node {1}"), descr, "'" + nodename + "'"),
hstateid: 'kvmtab', hstateid: 'kvmtab',
tbar: [ startBtn, shutdownBtn, stopBtn, resetBtn, tbar: [ startBtn, shutdownBtn, stopBtn, resetBtn,
removeBtn, migrateBtn, consoleBtn ], removeBtn, migrateBtn, consoleBtn ],
......
...@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.CreateWizard', { ...@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.CreateWizard', {
}); });
Ext.applyIf(me, { Ext.applyIf(me, {
title: 'Create new virtual machine', subject: gettext('Virtual Machine'),
items: [ items: [
{ {
xtype: 'inputpanel', xtype: 'inputpanel',
......
...@@ -101,14 +101,11 @@ Ext.define('PVE.storage.DirEdit', { ...@@ -101,14 +101,11 @@ Ext.define('PVE.storage.DirEdit', {
storageId: me.storageId storageId: me.storageId
}); });
me.items = [ ipanel ]; Ext.apply(me, {
subject: 'Directory',
if (me.create) { isAdd: true,
me.title = gettext('Create directory storage'); items: [ ipanel ]
} else { });
me.title = Ext.String.format(gettext('Edit directory storage {0}'),
"'" + me.storageId + "'");
}
me.callParent(); me.callParent();
......
...@@ -167,14 +167,11 @@ Ext.define('PVE.storage.IScsiEdit', { ...@@ -167,14 +167,11 @@ Ext.define('PVE.storage.IScsiEdit', {
storageId: me.storageId storageId: me.storageId
}); });
me.items = [ ipanel ]; Ext.apply(me, {
subject: 'iSCSI target',
if (me.create) { isAdd: true,
me.title = gettext('Create iSCSI storage'); items: [ ipanel ]
} else { });
me.title = Ext.String.format(gettext('Edit iSCSI storage {0}'),
"'" + me.storageId + "'");
}
me.callParent(); me.callParent();
......
...@@ -227,14 +227,11 @@ Ext.define('PVE.storage.LVMEdit', { ...@@ -227,14 +227,11 @@ Ext.define('PVE.storage.LVMEdit', {
storageId: me.storageId storageId: me.storageId
}); });
me.items = [ ipanel ]; Ext.apply(me, {
subject: 'LVM group',
if (me.create) { isAdd: true,
me.title = gettext('Create LVM storage'); items: [ ipanel ]
} else { });
me.title = Ext.String.format(gettext('Edit LVM storage {0}'),
"'" + me.storageId + "'");
}
me.callParent(); me.callParent();
......
...@@ -169,14 +169,11 @@ Ext.define('PVE.storage.NFSEdit', { ...@@ -169,14 +169,11 @@ Ext.define('PVE.storage.NFSEdit', {
storageId: me.storageId storageId: me.storageId
}); });
me.items = [ ipanel ]; Ext.apply(me, {
subject: 'NFS share',
if (me.create) { isAdd: true,
me.title = gettext('Create NFS storage'); items: [ ipanel ]
} else { });
me.title = Ext.String.format(gettext('Edit NFS storage {0}'),
"'" + me.storageId + "'");
}
me.callParent(); me.callParent();
......
...@@ -18,11 +18,11 @@ Ext.define('PVE.tree.ResourceTree', { ...@@ -18,11 +18,11 @@ Ext.define('PVE.tree.ResourceTree', {
}, },
qemu: { qemu: {
iconCls: 'x-tree-node-computer', iconCls: 'x-tree-node-computer',
text: gettext('Virtual machines') text: gettext('Virtual Machine')
}, },
openvz: { openvz: {
iconCls: 'x-tree-node-openvz', iconCls: 'x-tree-node-openvz',
text: gettext('OpenVZ containers') text: gettext('OpenVZ Container')
} }
} }
}, },
......
...@@ -6,10 +6,17 @@ Ext.define('PVE.window.Edit', { ...@@ -6,10 +6,17 @@ Ext.define('PVE.window.Edit', {
resizable: false, resizable: false,
// set create to true if you want a CREAT button (instead // use this tio atimatically generate a title like
// Create: <subject>
subject: undefined,
// set create to true if you want a Create button (instead
// OK and RESET) // OK and RESET)
create: false, create: false,
// set to true if you want an Add button (instead of Create)
isAdd: false,
isValid: function() { isValid: function() {
var me = this; var me = this;
...@@ -163,7 +170,7 @@ Ext.define('PVE.window.Edit', { ...@@ -163,7 +170,7 @@ Ext.define('PVE.window.Edit', {
var form = me.formPanel.getForm(); var form = me.formPanel.getForm();
var submitBtn = Ext.create('Ext.Button', { var submitBtn = Ext.create('Ext.Button', {
text: me.create ? gettext('Create') : gettext('OK'), text: me.create ? (me.isAdd ? gettext('Add') : gettext('Create')) : gettext('OK'),
disabled: !me.create, disabled: !me.create,
handler: function() { handler: function() {
me.submit(); me.submit();
...@@ -196,6 +203,10 @@ Ext.define('PVE.window.Edit', { ...@@ -196,6 +203,10 @@ Ext.define('PVE.window.Edit', {
var twoColumn = items[0].column1 || items[0].column2; var twoColumn = items[0].column1 || items[0].column2;
if (me.subject && !me.title) {
me.title = PVE.Utils.dialog_title(me.subject, me.create, me.isAdd);
}
Ext.applyIf(me, { Ext.applyIf(me, {
modal: true, modal: true,
layout: 'auto', layout: 'auto',
......
...@@ -70,7 +70,7 @@ Ext.define('PVE.window.Wizard', { ...@@ -70,7 +70,7 @@ Ext.define('PVE.window.Wizard', {
items: [ items: [
'->', '->',
{ {
text: 'Back', text: gettext('Back'),
disabled: true, disabled: true,
itemId: 'back', itemId: 'back',
minWidth: 60, minWidth: 60,
...@@ -90,7 +90,7 @@ Ext.define('PVE.window.Wizard', { ...@@ -90,7 +90,7 @@ Ext.define('PVE.window.Wizard', {
} }
}, },
{ {
text: 'Next', text: gettext('Next'),
disabled: true, disabled: true,
itemId: 'next', itemId: 'next',
minWidth: 60, minWidth: 60,
...@@ -114,7 +114,7 @@ Ext.define('PVE.window.Wizard', { ...@@ -114,7 +114,7 @@ Ext.define('PVE.window.Wizard', {
} }
}, },
{ {
text: 'Finish', text: gettext('Finish'),
minWidth: 60, minWidth: 60,
hidden: true, hidden: true,
itemId: 'submit', itemId: 'submit',
...@@ -170,6 +170,10 @@ Ext.define('PVE.window.Wizard', { ...@@ -170,6 +170,10 @@ Ext.define('PVE.window.Wizard', {
} }
}; };
if (me.subject && !me.title) {
me.title = PVE.Utils.dialog_title(me.subject, true, false);
}
Ext.applyIf(me, { Ext.applyIf(me, {
width: 620, width: 620,
height: 400, height: 400,
...@@ -179,7 +183,6 @@ Ext.define('PVE.window.Wizard', { ...@@ -179,7 +183,6 @@ Ext.define('PVE.window.Wizard', {
closable: true, closable: true,
resizable: false, resizable: false,
layout: 'border', layout: 'border',
title: 'Proxmox VE Wizard',
items: [ items: [
{ {
// disabled for now - not really needed // disabled for now - not really needed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment