Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
ed99d9c7
Commit
ed99d9c7
authored
Apr 21, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc GUI: implement resource panel (set cpu, memory and swap)
parent
02912495
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
210 additions
and
0 deletions
+210
-0
Makefile
www/manager/Makefile
+1
-0
Config.js
www/manager/lxc/Config.js
+5
-0
Resources.js
www/manager/lxc/Resources.js
+204
-0
No files found.
www/manager/Makefile
View file @
ed99d9c7
...
@@ -142,6 +142,7 @@ JSSRC= \
...
@@ -142,6 +142,7 @@ JSSRC= \
lxc/StatusView.js
\
lxc/StatusView.js
\
lxc/Summary.js
\
lxc/Summary.js
\
lxc/Network.js
\
lxc/Network.js
\
lxc/Resources.js
\
lxc/Config.js
\
lxc/Config.js
\
lxc/CreateWizard.js
\
lxc/CreateWizard.js
\
pool/StatusView.js
\
pool/StatusView.js
\
...
...
www/manager/lxc/Config.js
View file @
ed99d9c7
...
@@ -125,6 +125,11 @@ Ext.define('PVE.lxc.Config', {
...
@@ -125,6 +125,11 @@ Ext.define('PVE.lxc.Config', {
xtype
:
'
pveLxcSummary
'
,
xtype
:
'
pveLxcSummary
'
,
itemId
:
'
summary
'
itemId
:
'
summary
'
},
},
{
title
:
gettext
(
'
Resources
'
),
itemId
:
'
resources
'
,
xtype
:
'
pveLxcRessourceView
'
},
{
{
title
:
gettext
(
'
Network
'
),
title
:
gettext
(
'
Network
'
),
itemId
:
'
network
'
,
itemId
:
'
network
'
,
...
...
www/manager/lxc/Resources.js
0 → 100644
View file @
ed99d9c7
Ext
.
define
(
'
PVE.lxc.RessourceInputPanel
'
,
{
extend
:
'
PVE.panel.InputPanel
'
,
alias
:
'
widget.pveLxcResourceInputPanel
'
,
insideWizard
:
false
,
initComponent
:
function
()
{
var
me
=
this
;
var
labelWidth
=
120
;
me
.
column1
=
[
{
xtype
:
'
numberfield
'
,
name
:
'
memory
'
,
minValue
:
32
,
maxValue
:
512
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
gettext
(
'
Memory
'
)
+
'
(MB)
'
,
labelWidth
:
labelWidth
,
allowBlank
:
false
},
{
xtype
:
'
numberfield
'
,
name
:
'
swap
'
,
minValue
:
0
,
maxValue
:
128
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
gettext
(
'
Swap
'
)
+
'
(MB)
'
,
labelWidth
:
labelWidth
,
allowBlank
:
false
}
];
me
.
column2
=
[
// {
// xtype: 'numberfield',
// name: 'disk',
// minValue: 0.001,
// maxValue: 128*1024,
// decimalPrecision: 3,
// value: '4',
// step: 1,
// fieldLabel: gettext('Disk size') + ' (GB)',
// labelWidth: labelWidth,
// allowBlank: false
// },
{
xtype
:
'
numberfield
'
,
name
:
'
cpus
'
,
minValue
:
0
,
value
:
'
1
'
,
step
:
1
,
fieldLabel
:
gettext
(
'
CPUs
'
),
labelWidth
:
labelWidth
,
allowBlank
:
false
}
];
me
.
callParent
();
}
});
Ext
.
define
(
'
PVE.lxc.RessourceEdit
'
,
{
extend
:
'
PVE.window.Edit
'
,
initComponent
:
function
()
{
var
me
=
this
;
Ext
.
apply
(
me
,
{
subject
:
gettext
(
'
Resources
'
),
items
:
Ext
.
create
(
'
PVE.lxc.RessourceInputPanel
'
)
});
me
.
callParent
();
me
.
load
();
}
});
/*jslint confusion: true */
Ext
.
define
(
'
PVE.lxc.RessourceView
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
alias
:
[
'
widget.pveLxcRessourceView
'
],
initComponent
:
function
()
{
var
me
=
this
;
var
i
,
confid
;
var
nodename
=
me
.
pveSelNode
.
data
.
node
;
if
(
!
nodename
)
{
throw
"
no node name specified
"
;
}
var
vmid
=
me
.
pveSelNode
.
data
.
vmid
;
if
(
!
vmid
)
{
throw
"
no VM ID specified
"
;
}
var
caps
=
Ext
.
state
.
Manager
.
get
(
'
GuiCap
'
);
var
resEditor
=
(
caps
.
vms
[
'
VM.Config.Memory
'
]
||
caps
.
vms
[
'
VM.Config.Disk
'
]
||
caps
.
vms
[
'
VM.Config.CPU
'
])
?
'
PVE.lxc.RessourceEdit
'
:
undefined
;
var
rows
=
{
memory
:
{
header
:
gettext
(
'
Memory
'
),
editor
:
resEditor
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
);
}
},
swap
:
{
header
:
gettext
(
'
Swap
'
),
editor
:
resEditor
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
);
}
},
cpus
:
{
header
:
gettext
(
'
Processors
'
),
never_delete
:
true
,
editor
:
resEditor
,
defaultValue
:
1
,
renderer
:
function
(
value
)
{
if
(
value
)
{
return
value
;
};
return
gettext
(
'
unlimited
'
);
}
},
disk
:
{
header
:
gettext
(
'
Disk size
'
),
editor
:
resEditor
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
*
1024
);
}
}
};
var
reload
=
function
()
{
me
.
rstore
.
load
();
};
var
baseurl
=
'
nodes/
'
+
nodename
+
'
/lxc/
'
+
vmid
+
'
/config
'
;
var
sm
=
Ext
.
create
(
'
Ext.selection.RowModel
'
,
{});
var
run_editor
=
function
()
{
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
var
rowdef
=
rows
[
rec
.
data
.
key
];
if
(
!
rowdef
.
editor
)
{
return
;
}
var
editor
=
rowdef
.
editor
;
var
win
=
Ext
.
create
(
editor
,
{
pveSelNode
:
me
.
pveSelNode
,
confid
:
rec
.
data
.
key
,
url
:
'
/api2/extjs/
'
+
baseurl
});
win
.
show
();
win
.
on
(
'
destroy
'
,
reload
);
};
var
edit_btn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Edit
'
),
selModel
:
sm
,
disabled
:
true
,
enableFn
:
function
(
rec
)
{
if
(
!
rec
)
{
return
false
;
}
var
rowdef
=
rows
[
rec
.
data
.
key
];
return
!!
rowdef
.
editor
;
},
handler
:
run_editor
});
Ext
.
applyIf
(
me
,
{
url
:
'
/api2/json/
'
+
baseurl
,
selModel
:
sm
,
cwidth1
:
170
,
tbar
:
[
edit_btn
],
rows
:
rows
,
listeners
:
{
show
:
reload
,
itemdblclick
:
run_editor
}
});
me
.
callParent
();
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment