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: {
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) {
var url = Ext.urlEncode({
console: vmtype, // kvm, openvz or shell
......
......@@ -18,14 +18,14 @@ Ext.define('PVE.dc.ACLAdd', {
];
if (me.aclType === 'group') {
me.title = gettext('Add') + ': ' + gettext("Group Permission");
me.subject = gettext("Group Permission");
items.push({
xtype: 'pveGroupSelector',
name: 'groups',
fieldLabel: gettext('Group')
});
} else if (me.aclType === 'user') {
me.title = gettext('Add') + ': ' + gettext("User Permission");
me.subject = gettext("User Permission");
items.push({
xtype: 'pveUserSelector',
name: 'users',
......@@ -55,9 +55,10 @@ Ext.define('PVE.dc.ACLAdd', {
items: items
});
Ext.applyIf(me, {
Ext.apply(me, {
url: '/access/acl',
method: 'PUT',
isAdd: true,
items: [ ipanel ]
});
......
......@@ -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, {
subject: gettext('Realm'),
url: url,
method: method,
items: [ ipanel ]
......
......@@ -270,8 +270,7 @@ Ext.define('PVE.dc.BackupEdit', {
};
Ext.applyIf(me, {
title: me.create ? gettext("Create Backup Job") :
gettext("Edit Backup Job"),
subject: gettext("Backup Job"),
url: url,
method: method,
items: [ ipanel, vmgrid ]
......
......@@ -19,8 +19,7 @@ Ext.define('PVE.dc.GroupEdit', {
}
Ext.applyIf(me, {
title: me.create ? gettext('Create Group') :
Ext.String.format(gettext('Edit Group {0}'), "'" + me.groupid + "'"),
subject: gettext('Group'),
url: url,
method: method,
items: [
......@@ -48,4 +47,3 @@ Ext.define('PVE.dc.GroupEdit', {
}
}
});
......@@ -121,10 +121,10 @@ Ext.define('PVE.dc.HAConfig', {
var me = this;
me.commitBtn = new PVE.button.Button({
text: gettext('Commit'),
text: gettext('Activate'),
disabled: true,
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) {
PVE.Utils.API2Request({
......@@ -145,7 +145,7 @@ Ext.define('PVE.dc.HAConfig', {
text: gettext('Revert changes'),
disabled: true,
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) {
PVE.Utils.API2Request({
......
......@@ -150,7 +150,7 @@ Ext.define('PVE.dc.HAServiceView', {
dataIndex: 'owner'
},
{
header: gettext('State'),
header: gettext('Status'),
width: 80,
sortable: true,
dataIndex: 'state_str'
......
......@@ -23,47 +23,29 @@ Ext.define('PVE.dc.UserEdit', {
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'userid',
fieldLabel: 'Userid',
fieldLabel: gettext('User name'),
value: me.userid,
allowBlank: false,
submitValue: me.create ? true : false
},
new Ext.form.field.ComboBox({
fieldLabel: 'Group',
{
xtype: 'pveGroupSelector',
name: 'groups',
multiSelect: true,
hiddenName: 'groupid',
store: new Ext.data.Store({
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
}),
allowBlank: true,
fieldLabel: gettext('Group')
},
{
xtype: 'datefield',
name: 'expire',
emptyText: 'never',
format: 'Y-m-d',
submitFormat: 'U',
fieldLabel: 'Expiration'
fieldLabel: gettext('Expire')
},
{
xtype: 'pvecheckbox',
fieldLabel: 'Enable',
fieldLabel: gettext('Enabled'),
name: 'enable',
uncheckedValue: 0,
defaultValue: 1
......@@ -74,23 +56,23 @@ Ext.define('PVE.dc.UserEdit', {
{
xtype: 'textfield',
name: 'firstname',
fieldLabel: 'First Name'
fieldLabel: gettext('First Name')
},
{
xtype: 'textfield',
name: 'lastname',
fieldLabel: 'Last Name'
fieldLabel: gettext('Last Name')
},
{
xtype: 'textfield',
name: 'email',
fieldLabel: 'Email',
fieldLabel: 'E-Mail',
vtype: 'email'
},
{
xtype: 'textfield',
name: 'comment',
fieldLabel: 'Comment'
fieldLabel: gettext('Comment')
}
];
......@@ -98,7 +80,7 @@ Ext.define('PVE.dc.UserEdit', {
column1.splice(1,0,{
xtype: 'pveRealmComboBox',
name: 'realm',
fieldLabel: 'Realm',
fieldLabel: gettext('Realm'),
allowBlank: false,
listeners: {
change: function(combo, newValue){
......@@ -127,8 +109,8 @@ Ext.define('PVE.dc.UserEdit', {
}
});
Ext.applyIf(me, {
title: me.create ? "Create User" : "Edit User '" + me.userid + "'",
Ext.applyIf(me, {
subject: gettext('User'),
url: url,
method: method,
items: [ ipanel ]
......
......@@ -20,7 +20,7 @@ Ext.define('PVE.dc.UserView', {
};
var remove_btn = new Ext.Button({
text: 'Delete',
text: gettext('Remove'),
disabled: true,
handler: function() {
var msg;
......@@ -68,7 +68,7 @@ Ext.define('PVE.dc.UserView', {
};
var edit_btn = new Ext.Button({
text: 'Modify',
text: gettext('Edit'),
disabled: true,
handler: run_editor
});
......@@ -90,7 +90,7 @@ Ext.define('PVE.dc.UserView', {
var tbar = [
{
text: 'Create',
text: gettext('Create'),
handler: function() {
var win = Ext.create('PVE.dc.UserEdit',{
});
......@@ -134,34 +134,34 @@ Ext.define('PVE.dc.UserView', {
columns: [
{
header: 'User name',
header: gettext('User name'),
width: 200,
sortable: true,
renderer: render_username,
dataIndex: 'userid'
},
{
header: 'Realm',
header: gettext('Realm'),
width: 100,
sortable: true,
renderer: render_realm,
dataIndex: 'userid'
},
{
header: 'Enabled',
header: gettext('Enabled'),
width: 80,
sortable: true,
dataIndex: 'enable'
},
{
header: 'Expire',
header: gettext('Expire'),
width: 80,
sortable: true,
renderer: render_expire,
dataIndex: 'expire'
},
{
header: 'Name',
header: gettext('Name'),
width: 150,
sortable: true,
renderer: render_full_name,
......@@ -169,7 +169,7 @@ Ext.define('PVE.dc.UserView', {
},
{
id: 'comment',
header: 'Comment',
header: gettext('Comment'),
sortable: false,
dataIndex: 'comment',
flex: 1
......
......@@ -2,6 +2,8 @@ Ext.define('PVE.form.GroupSelector', {
extend: 'PVE.form.ComboGrid',
alias: ['widget.pveGroupSelector'],
allowBlank: false,
initComponent: function() {
var me = this;
......@@ -11,7 +13,6 @@ Ext.define('PVE.form.GroupSelector', {
Ext.apply(me, {
store: store,
allowBlank: false,
autoSelect: false,
valueField: 'groupid',
displayField: 'groupid',
......
......@@ -59,7 +59,7 @@ Ext.define('PVE.openvz.CreateWizard', {
});
Ext.applyIf(me, {
title: 'Create new container',
subject: gettext('OpenVZ Container'),
items: [
{
xtype: 'inputpanel',
......
......@@ -102,7 +102,7 @@ Ext.define('PVE.qemu.Config', {
var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")";
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',
tbar: [ startBtn, shutdownBtn, stopBtn, resetBtn,
removeBtn, migrateBtn, consoleBtn ],
......
......@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.CreateWizard', {
});
Ext.applyIf(me, {
title: 'Create new virtual machine',
subject: gettext('Virtual Machine'),
items: [
{
xtype: 'inputpanel',
......
......@@ -101,14 +101,11 @@ Ext.define('PVE.storage.DirEdit', {
storageId: me.storageId
});
me.items = [ ipanel ];
if (me.create) {
me.title = gettext('Create directory storage');
} else {
me.title = Ext.String.format(gettext('Edit directory storage {0}'),
"'" + me.storageId + "'");
}
Ext.apply(me, {
subject: 'Directory',
isAdd: true,
items: [ ipanel ]
});
me.callParent();
......
......@@ -167,14 +167,11 @@ Ext.define('PVE.storage.IScsiEdit', {
storageId: me.storageId
});
me.items = [ ipanel ];
if (me.create) {
me.title = gettext('Create iSCSI storage');
} else {
me.title = Ext.String.format(gettext('Edit iSCSI storage {0}'),
"'" + me.storageId + "'");
}
Ext.apply(me, {
subject: 'iSCSI target',
isAdd: true,
items: [ ipanel ]
});
me.callParent();
......
......@@ -227,14 +227,11 @@ Ext.define('PVE.storage.LVMEdit', {
storageId: me.storageId
});
me.items = [ ipanel ];
if (me.create) {
me.title = gettext('Create LVM storage');
} else {
me.title = Ext.String.format(gettext('Edit LVM storage {0}'),
"'" + me.storageId + "'");
}
Ext.apply(me, {
subject: 'LVM group',
isAdd: true,
items: [ ipanel ]
});
me.callParent();
......
......@@ -169,14 +169,11 @@ Ext.define('PVE.storage.NFSEdit', {
storageId: me.storageId
});
me.items = [ ipanel ];
if (me.create) {
me.title = gettext('Create NFS storage');
} else {
me.title = Ext.String.format(gettext('Edit NFS storage {0}'),
"'" + me.storageId + "'");
}
Ext.apply(me, {
subject: 'NFS share',
isAdd: true,
items: [ ipanel ]
});
me.callParent();
......
......@@ -18,11 +18,11 @@ Ext.define('PVE.tree.ResourceTree', {
},
qemu: {
iconCls: 'x-tree-node-computer',
text: gettext('Virtual machines')
text: gettext('Virtual Machine')
},
openvz: {
iconCls: 'x-tree-node-openvz',
text: gettext('OpenVZ containers')
text: gettext('OpenVZ Container')
}
}
},
......
......@@ -6,10 +6,17 @@ Ext.define('PVE.window.Edit', {
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)
create: false,
// set to true if you want an Add button (instead of Create)
isAdd: false,
isValid: function() {
var me = this;
......@@ -163,7 +170,7 @@ Ext.define('PVE.window.Edit', {
var form = me.formPanel.getForm();
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,
handler: function() {
me.submit();
......@@ -196,6 +203,10 @@ Ext.define('PVE.window.Edit', {
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, {
modal: true,
layout: 'auto',
......
......@@ -70,7 +70,7 @@ Ext.define('PVE.window.Wizard', {
items: [
'->',
{
text: 'Back',
text: gettext('Back'),
disabled: true,
itemId: 'back',
minWidth: 60,
......@@ -90,7 +90,7 @@ Ext.define('PVE.window.Wizard', {
}
},
{
text: 'Next',
text: gettext('Next'),
disabled: true,
itemId: 'next',
minWidth: 60,
......@@ -114,7 +114,7 @@ Ext.define('PVE.window.Wizard', {
}
},
{
text: 'Finish',
text: gettext('Finish'),
minWidth: 60,
hidden: true,
itemId: 'submit',
......@@ -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, {
width: 620,
height: 400,
......@@ -179,7 +183,6 @@ Ext.define('PVE.window.Wizard', {
closable: true,
resizable: false,
layout: 'border',
title: 'Proxmox VE Wizard',
items: [
{
// 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