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
38d1f88d
Commit
38d1f88d
authored
Apr 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement ha resource editor
parent
ac69b6b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
4 deletions
+188
-4
Makefile
www/manager/Makefile
+1
-0
Groups.js
www/manager/ha/Groups.js
+2
-2
ResourceEdit.js
www/manager/ha/ResourceEdit.js
+125
-0
Resources.js
www/manager/ha/Resources.js
+60
-2
No files found.
www/manager/Makefile
View file @
38d1f88d
...
...
@@ -166,6 +166,7 @@ JSSRC= \
storage/ZFSEdit.js
\
storage/ZFSPoolEdit.js
\
ha/StatusView.js
\
ha/ResourceEdit.js
\
ha/Resources.js
\
ha/GroupEdit.js
\
ha/Groups.js
\
...
...
www/manager/ha/Groups.js
View file @
38d1f88d
...
...
@@ -113,8 +113,8 @@ Ext.define('PVE.ha.GroupsView', {
}
],
listeners
:
{
show
:
reload
//
itemdblclick: run_editor
show
:
reload
,
itemdblclick
:
run_editor
}
});
...
...
www/manager/ha/ResourceEdit.js
0 → 100644
View file @
38d1f88d
Ext
.
define
(
'
PVE.ha.VMResourceInputPanel
'
,
{
extend
:
'
PVE.panel.InputPanel
'
,
// only usable to type 'vm'
vmid
:
undefined
,
onGetValues
:
function
(
values
)
{
var
me
=
this
;
if
(
me
.
create
)
{
values
.
type
=
'
vm
'
;
values
.
sid
=
values
.
vmid
;
delete
values
[
'
delete
'
];
// ignore
}
delete
values
.
vmid
;
if
(
values
.
enable
)
{
values
.
state
=
'
enabled
'
;
}
else
{
values
.
state
=
'
disabled
'
;
}
delete
values
.
enable
;
return
values
;
},
initComponent
:
function
()
{
var
me
=
this
;
me
.
column1
=
[
{
xtype
:
me
.
vmid
?
'
displayfield
'
:
'
pveVMIDSelector
'
,
name
:
'
vmid
'
,
fieldLabel
:
'
VM ID
'
,
value
:
me
.
vmid
,
loadNextFreeVMID
:
false
,
validateExists
:
true
}
];
me
.
column2
=
[
{
xtype
:
'
pvetextfield
'
,
// fixme: group selector
name
:
'
group
'
,
value
:
''
,
deleteEmpty
:
true
,
fieldLabel
:
gettext
(
'
Group
'
)
},
{
xtype
:
'
pvecheckbox
'
,
name
:
'
enable
'
,
checked
:
true
,
uncheckedValue
:
0
,
fieldLabel
:
gettext
(
'
enable
'
)
}
];
me
.
columnB
=
[
{
xtype
:
'
textfield
'
,
name
:
'
comment
'
,
fieldLabel
:
gettext
(
'
Comment
'
)
}
];
me
.
callParent
();
}
});
Ext
.
define
(
'
PVE.ha.VMResourceEdit
'
,
{
extend
:
'
PVE.window.Edit
'
,
vmid
:
undefined
,
initComponent
:
function
()
{
var
me
=
this
;
me
.
create
=
!
me
.
vmid
;
if
(
me
.
create
)
{
me
.
url
=
'
/api2/extjs/cluster/ha/resources
'
;
me
.
method
=
'
POST
'
;
}
else
{
me
.
url
=
'
/api2/extjs/cluster/ha/resources/vm:
'
+
me
.
vmid
;
me
.
method
=
'
PUT
'
;
}
var
ipanel
=
Ext
.
create
(
'
PVE.ha.VMResourceInputPanel
'
,
{
create
:
me
.
create
,
vmid
:
me
.
vmid
});
Ext
.
apply
(
me
,
{
subject
:
gettext
(
'
VM Resource
'
),
isAdd
:
true
,
items
:
[
ipanel
]
});
me
.
callParent
();
if
(
!
me
.
create
)
{
me
.
load
({
success
:
function
(
response
,
options
)
{
var
values
=
response
.
result
.
data
;
values
.
enable
=
false
;
if
(
values
.
state
===
'
enabled
'
)
{
values
.
enable
=
true
;
}
var
regex
=
/^
(\S
+
)
:
(\S
+
)
$/
;
var
res
=
regex
.
exec
(
values
.
sid
);
if
(
res
[
1
]
!==
'
vm
'
)
{
throw
"
got unexpected resource type
"
;
};
values
.
vmid
=
res
[
2
];
ipanel
.
setValues
(
values
);
}
});
}
}
});
www/manager/ha/Resources.js
View file @
38d1f88d
...
...
@@ -23,6 +23,52 @@ Ext.define('PVE.ha.ResourcesView', {
var
sm
=
Ext
.
create
(
'
Ext.selection.RowModel
'
,
{});
var
run_editor
=
function
()
{
var
rec
=
sm
.
getSelection
()[
0
];
var
sid
=
rec
.
data
.
sid
;
var
regex
=
/^
(\S
+
)
:
(\S
+
)
$/
;
var
res
=
regex
.
exec
(
sid
);
if
(
res
[
1
]
!==
'
vm
'
)
{
return
;
};
var
vmid
=
res
[
2
];
var
win
=
Ext
.
create
(
'
PVE.ha.VMResourceEdit
'
,{
vmid
:
vmid
});
win
.
on
(
'
destroy
'
,
reload
);
win
.
show
();
};
var
remove_btn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Remove
'
),
disabled
:
true
,
selModel
:
sm
,
handler
:
function
(
btn
,
event
,
rec
)
{
var
sid
=
rec
.
data
.
sid
;
PVE
.
Utils
.
API2Request
({
url
:
'
/cluster/ha/resources/
'
+
sid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
callback
:
function
()
{
reload
();
},
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
gettext
(
'
Error
'
),
response
.
htmlStatus
);
}
});
}
});
var
edit_btn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Edit
'
),
disabled
:
true
,
selModel
:
sm
,
handler
:
run_editor
});
Ext
.
apply
(
me
,
{
store
:
store
,
selModel
:
sm
,
...
...
@@ -30,6 +76,18 @@ Ext.define('PVE.ha.ResourcesView', {
viewConfig
:
{
trackOver
:
false
},
tbar
:
[
{
text
:
gettext
(
'
Add
'
),
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.ha.VMResourceEdit
'
,{});
win
.
on
(
'
destroy
'
,
reload
);
win
.
show
();
}
},
edit_btn
,
remove_btn
],
columns
:
[
{
header
:
'
ID
'
,
...
...
@@ -59,8 +117,8 @@ Ext.define('PVE.ha.ResourcesView', {
}
],
listeners
:
{
show
:
reload
//
itemdblclick: run_editor
show
:
reload
,
itemdblclick
:
run_editor
}
});
...
...
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