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
bb5a9ed8
Commit
bb5a9ed8
authored
Jul 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy form/NodeSelector.js from manager to manager5
parent
c86325eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
NodeSelector.js
www/manager5/form/NodeSelector.js
+99
-0
No files found.
www/manager5/form/NodeSelector.js
0 → 100644
View file @
bb5a9ed8
Ext
.
define
(
'
PVE.form.NodeSelector
'
,
{
extend
:
'
PVE.form.ComboGrid
'
,
alias
:
[
'
widget.PVE.form.NodeSelector
'
],
// invalidate nodes which are offline
onlineValidator
:
false
,
selectCurNode
:
false
,
// only allow those nodes (array)
allowedNodes
:
undefined
,
initComponent
:
function
()
{
var
me
=
this
;
var
store
=
Ext
.
create
(
'
Ext.data.Store
'
,
{
fields
:
[
'
node
'
,
'
cpu
'
,
'
maxcpu
'
,
'
mem
'
,
'
maxmem
'
,
'
uptime
'
],
autoLoad
:
true
,
proxy
:
{
type
:
'
pve
'
,
url
:
'
/api2/json/nodes
'
},
sorters
:
[
{
property
:
'
node
'
,
direction
:
'
ASC
'
},
{
property
:
'
mem
'
,
direction
:
'
DESC
'
}
]
});
Ext
.
apply
(
me
,
{
store
:
store
,
valueField
:
'
node
'
,
displayField
:
'
node
'
,
listConfig
:
{
columns
:
[
{
header
:
gettext
(
'
Node
'
),
dataIndex
:
'
node
'
,
sortable
:
true
,
hideable
:
false
,
flex
:
1
},
{
header
:
gettext
(
'
Memory usage
'
),
renderer
:
PVE
.
Utils
.
render_mem_usage
,
sortable
:
true
,
width
:
100
,
dataIndex
:
'
mem
'
},
{
header
:
gettext
(
'
CPU usage
'
),
renderer
:
PVE
.
Utils
.
render_cpu
,
sortable
:
true
,
width
:
100
,
dataIndex
:
'
cpu
'
}
]
},
validator
:
function
(
value
)
{
/*jslint confusion: true */
if
(
!
me
.
onlineValidator
||
(
me
.
allowBlank
&&
!
value
))
{
return
true
;
}
var
offline
=
[];
var
notAllowed
=
[];
Ext
.
Array
.
each
(
value
.
split
(
/
\s
*,
\s
*/
),
function
(
node
)
{
var
rec
=
me
.
store
.
findRecord
(
me
.
valueField
,
node
);
if
(
!
(
rec
&&
rec
.
data
)
||
!
Ext
.
isNumeric
(
rec
.
data
.
mem
))
{
offline
.
push
(
node
);
}
else
if
(
me
.
allowedNodes
&&
!
Ext
.
Array
.
contains
(
me
.
allowedNodes
,
node
))
{
notAllowed
.
push
(
node
);
}
});
if
(
notAllowed
.
length
!==
0
)
{
return
"
Node
"
+
notAllowed
.
join
(
'
,
'
)
+
"
is not allowed for this action!
"
;
}
if
(
offline
.
length
!==
0
)
{
return
"
Node
"
+
offline
.
join
(
'
,
'
)
+
"
seems to be offline!
"
;
}
return
true
;
}
});
if
(
me
.
selectCurNode
&&
PVE
.
curSelectedNode
.
data
.
node
)
{
me
.
preferredValue
=
PVE
.
curSelectedNode
.
data
.
node
;
}
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