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
019434e5
Commit
019434e5
authored
Jan 02, 2015
by
Alexandre Derumier
Committed by
Dietmar Maurer
Jan 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement pendinggrid and pendingstore
Signed-off-by:
Alexandre Derumier
<
aderumier@odiso.com
>
parent
c8943118
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
208 additions
and
17 deletions
+208
-17
Makefile
www/manager/Makefile
+2
-0
PVEProxy.js
www/manager/data/PVEProxy.js
+6
-0
PendingObjectStore.js
www/manager/data/PendingObjectStore.js
+29
-0
JsonObject.js
www/manager/data/reader/JsonObject.js
+39
-13
PendingObjectGrid.js
www/manager/grid/PendingObjectGrid.js
+128
-0
HardwareView.js
www/manager/qemu/HardwareView.js
+2
-2
Options.js
www/manager/qemu/Options.js
+2
-2
No files found.
www/manager/Makefile
View file @
019434e5
...
...
@@ -19,6 +19,7 @@ JSSRC= \
data/UpdateStore.js
\
data/DiffStore.js
\
data/ObjectStore.js
\
data/PendingObjectStore.js
\
data/ResourceStore.js
\
form/VLanField.js
\
form/Checkbox.js
\
...
...
@@ -76,6 +77,7 @@ JSSRC= \
grid/CheckColumn.js
\
grid/SelectFeature.js
\
grid/ObjectGrid.js
\
grid/PendingObjectGrid.js
\
grid/ResourceGrid.js
\
grid/PoolMembers.js
\
grid/FirewallRules.js
\
...
...
www/manager/data/PVEProxy.js
View file @
019434e5
...
...
@@ -67,6 +67,12 @@ Ext.define('PVE.RestProxy', {
idProperty
:
'
key
'
});
Ext
.
define
(
'
KeyValuePendingDelete
'
,
{
extend
:
"
Ext.data.Model
"
,
fields
:
[
'
key
'
,
'
value
'
,
'
pending
'
,
'
delete
'
],
idProperty
:
'
key
'
});
Ext
.
define
(
'
pve-string-list
'
,
{
extend
:
'
Ext.data.Model
'
,
fields
:
[
'
n
'
,
'
t
'
],
...
...
www/manager/data/PendingObjectStore.js
0 → 100644
View file @
019434e5
Ext
.
define
(
'
PVE.data.PendingObjectStore
'
,
{
extend
:
'
PVE.data.UpdateStore
'
,
constructor
:
function
(
config
)
{
var
me
=
this
;
config
=
config
||
{};
if
(
!
config
.
storeid
)
{
config
.
storeid
=
'
pve-store-
'
+
(
++
Ext
.
idSeed
);
}
Ext
.
applyIf
(
config
,
{
model
:
'
KeyValuePendingDelete
'
,
proxy
:
{
type
:
'
pve
'
,
url
:
config
.
url
,
extraParams
:
config
.
extraParams
,
reader
:
{
type
:
'
jsonobject
'
,
rows
:
config
.
rows
,
pending
:
1
}
}
});
me
.
callParent
([
config
]);
}
});
www/manager/data/reader/JsonObject.js
View file @
019434e5
...
...
@@ -37,21 +37,47 @@ Ext.define('PVE.data.reader.JsonObject', {
}
}
if
(
me
.
rows
)
{
Ext
.
Object
.
each
(
me
.
rows
,
function
(
key
,
rowdef
)
{
if
(
Ext
.
isDefined
(
root
[
key
]))
{
data
.
push
({
key
:
key
,
value
:
root
[
key
]});
}
else
if
(
Ext
.
isDefined
(
rowdef
.
defaultValue
))
{
data
.
push
({
key
:
key
,
value
:
rowdef
.
defaultValue
});
}
else
if
(
rowdef
.
required
)
{
data
.
push
({
key
:
key
,
value
:
undefined
});
}
});
if
(
me
.
pending
)
{
if
(
me
.
rows
)
{
Ext
.
Object
.
each
(
me
.
rows
,
function
(
key
,
rowdef
)
{
if
(
Ext
.
isDefined
(
root
[
key
]))
{
if
(
Ext
.
isDefined
(
root
[
key
][
"
value
"
])){
data
.
push
({
key
:
key
,
value
:
root
[
key
][
"
value
"
],
pending
:
root
[
key
][
"
pending
"
],
delete
:
root
[
key
][
"
delete
"
]});
}
else
if
(
Ext
.
isDefined
(
rowdef
.
defaultValue
)){
data
.
push
({
key
:
key
,
value
:
rowdef
.
defaultValue
,
pending
:
root
[
key
][
"
pending
"
],
delete
:
root
[
key
][
"
delete
"
]});
}
}
else
if
(
Ext
.
isDefined
(
rowdef
.
defaultValue
))
{
data
.
push
({
key
:
key
,
value
:
rowdef
.
defaultValue
,
pending
:
undefined
,
delete
:
undefined
});
}
else
if
(
rowdef
.
required
)
{
data
.
push
({
key
:
key
,
value
:
undefined
,
pending
:
undefined
,
delete
:
undefined
});
}
});
}
else
{
Ext
.
Object
.
each
(
root
,
function
(
key
,
value
)
{
data
.
push
({
key
:
key
,
value
:
root
[
key
][
"
value
"
],
pending
:
root
[
key
][
"
pending
"
],
delete
:
root
[
key
][
"
delete
"
]});
});
}
}
else
{
Ext
.
Object
.
each
(
root
,
function
(
key
,
value
)
{
data
.
push
({
key
:
key
,
value
:
value
});
});
if
(
me
.
rows
)
{
Ext
.
Object
.
each
(
me
.
rows
,
function
(
key
,
rowdef
)
{
if
(
Ext
.
isDefined
(
root
[
key
]))
{
data
.
push
({
key
:
key
,
value
:
root
[
key
]});
}
else
if
(
Ext
.
isDefined
(
rowdef
.
defaultValue
))
{
data
.
push
({
key
:
key
,
value
:
rowdef
.
defaultValue
});
}
else
if
(
rowdef
.
required
)
{
data
.
push
({
key
:
key
,
value
:
undefined
});
}
});
}
else
{
Ext
.
Object
.
each
(
root
,
function
(
key
,
value
)
{
data
.
push
({
key
:
key
,
value
:
value
});
});
}
}
}
catch
(
ex
)
{
Ext
.
Error
.
raise
({
...
...
www/manager/grid/PendingObjectGrid.js
0 → 100644
View file @
019434e5
Ext
.
define
(
'
PVE.grid.PendingObjectGrid
'
,
{
extend
:
'
Ext.grid.GridPanel
'
,
alias
:
[
'
widget.pvePendingObjectGrid
'
],
getObjectValue
:
function
(
key
,
defaultValue
)
{
var
me
=
this
;
var
rec
=
me
.
store
.
getById
(
key
);
if
(
rec
)
{
return
rec
.
data
.
value
;
}
return
defaultValue
;
},
renderKey
:
function
(
key
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
)
{
var
me
=
this
;
var
rows
=
me
.
rows
;
var
rowdef
=
(
rows
&&
rows
[
key
])
?
rows
[
key
]
:
{};
return
rowdef
.
header
||
key
;
},
renderValue
:
function
(
value
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
)
{
var
me
=
this
;
var
rows
=
me
.
rows
;
var
key
=
record
.
data
.
key
;
var
rowdef
=
(
rows
&&
rows
[
key
])
?
rows
[
key
]
:
{};
var
renderer
=
rowdef
.
renderer
;
var
current
=
''
;
var
pendingdelete
=
''
;
var
pending
=
''
;
if
(
renderer
)
{
current
=
renderer
(
value
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
);
if
(
record
.
data
[
'
pending
'
]){
pending
=
renderer
(
record
.
data
[
'
pending
'
],
metaData
,
record
,
rowIndex
,
colIndex
,
store
);
}
}
else
{
current
=
value
;
pending
=
record
.
data
[
'
pending
'
];
}
if
(
record
.
data
[
'
delete
'
]){
pendingdelete
=
'
<div style="text-decoration: line-through;">
'
+
current
+
'
</div>
'
;
}
value
=
current
;
if
(
pending
||
pendingdelete
){
value
+=
'
<div style="color:red">
'
+
pending
+
pendingdelete
+
'
</div>
'
;
}
return
value
;
},
initComponent
:
function
()
{
var
me
=
this
;
var
rows
=
me
.
rows
;
if
(
!
me
.
rstore
)
{
if
(
!
me
.
url
)
{
throw
"
no url specified
"
;
}
me
.
rstore
=
Ext
.
create
(
'
PVE.data.PendingObjectStore
'
,
{
url
:
me
.
url
,
interval
:
me
.
interval
,
extraParams
:
me
.
extraParams
,
rows
:
me
.
rows
,
});
}
var
rstore
=
me
.
rstore
;
var
store
=
Ext
.
create
(
'
PVE.data.DiffStore
'
,
{
rstore
:
rstore
});
if
(
rows
)
{
Ext
.
Object
.
each
(
rows
,
function
(
key
,
rowdef
)
{
//fixme : add missing options from config file ?
if
(
Ext
.
isDefined
(
rowdef
.
defaultValue
))
{
store
.
add
({
key
:
key
,
value
:
rowdef
.
defaultValue
,
pending
:
undefined
,
delete
:
undefined
});
}
else
if
(
rowdef
.
required
)
{
store
.
add
({
key
:
key
,
value
:
undefined
,
pending
:
undefined
,
delete
:
undefined
});
}
});
}
if
(
me
.
sorterFn
)
{
store
.
sorters
.
add
(
new
Ext
.
util
.
Sorter
({
sorterFn
:
me
.
sorterFn
}));
}
store
.
filters
.
add
(
new
Ext
.
util
.
Filter
({
filterFn
:
function
(
item
)
{
if
(
rows
)
{
var
rowdef
=
rows
[
item
.
data
.
key
];
if
(
!
rowdef
||
(
rowdef
.
visible
===
false
))
{
return
false
;
}
}
return
true
;
}
}));
PVE
.
Utils
.
monStoreErrors
(
me
,
rstore
);
Ext
.
applyIf
(
me
,
{
store
:
store
,
hideHeaders
:
true
,
stateful
:
false
,
columns
:
[
{
header
:
gettext
(
'
Name
'
),
width
:
me
.
cwidth1
||
100
,
dataIndex
:
'
key
'
,
renderer
:
me
.
renderKey
},
{
flex
:
1
,
header
:
gettext
(
'
Value
'
),
dataIndex
:
'
value
'
,
renderer
:
me
.
renderValue
}
]
});
me
.
callParent
();
}
});
www/manager/qemu/HardwareView.js
View file @
019434e5
// fixme: howto avoid jslint type confusion?
/*jslint confusion: true */
Ext
.
define
(
'
PVE.qemu.HardwareView
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
extend
:
'
PVE.grid.
Pending
ObjectGrid
'
,
alias
:
[
'
widget.PVE.qemu.HardwareView
'
],
renderKey
:
function
(
key
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
)
{
...
...
@@ -359,7 +359,7 @@ Ext.define('PVE.qemu.HardwareView', {
});
Ext
.
applyIf
(
me
,
{
url
:
'
/api2/json/
'
+
baseurl
,
url
:
'
/api2/json/
'
+
'
nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
+
'
/pending
'
,
selModel
:
sm
,
cwidth1
:
170
,
tbar
:
[
...
...
www/manager/qemu/Options.js
View file @
019434e5
/*jslint confusion: true */
Ext
.
define
(
'
PVE.qemu.Options
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
extend
:
'
PVE.grid.
Pending
ObjectGrid
'
,
alias
:
[
'
widget.PVE.qemu.Options
'
],
initComponent
:
function
()
{
...
...
@@ -315,7 +315,7 @@ Ext.define('PVE.qemu.Options', {
};
Ext
.
applyIf
(
me
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/qemu/
"
+
vmid
+
"
/
confi
g
"
,
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/qemu/
"
+
vmid
+
"
/
pendin
g
"
,
cwidth1
:
170
,
tbar
:
[
edit_btn
],
rows
:
rows
,
...
...
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