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
f2e98160
Commit
f2e98160
authored
May 27, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy data/DiffStore.js from manager to manager5
parent
53ff0b98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
DiffStore.js
www/manager5/data/DiffStore.js
+84
-0
No files found.
www/manager5/data/DiffStore.js
0 → 100644
View file @
f2e98160
/* Config properties:
* rstore: A storage to track changes
* Only works if rstore has a model and use 'idProperty'
*/
Ext
.
define
(
'
PVE.data.DiffStore
'
,
{
extend
:
'
Ext.data.Store
'
,
sortAfterUpdate
:
false
,
constructor
:
function
(
config
)
{
var
me
=
this
;
config
=
config
||
{};
if
(
!
config
.
rstore
)
{
throw
"
no rstore specified
"
;
}
if
(
!
config
.
rstore
.
model
)
{
throw
"
no rstore model specified
"
;
}
var
rstore
=
config
.
rstore
;
Ext
.
apply
(
config
,
{
model
:
rstore
.
model
,
proxy
:
{
type
:
'
memory
'
}
});
me
.
callParent
([
config
]);
var
first_load
=
true
;
var
cond_add_item
=
function
(
data
,
id
)
{
var
olditem
=
me
.
getById
(
id
);
if
(
olditem
)
{
olditem
.
beginEdit
();
me
.
model
.
prototype
.
fields
.
eachKey
(
function
(
field
)
{
if
(
olditem
.
data
[
field
]
!==
data
[
field
])
{
olditem
.
set
(
field
,
data
[
field
]);
}
});
olditem
.
endEdit
(
true
);
olditem
.
commit
();
}
else
{
var
newrec
=
Ext
.
ModelMgr
.
create
(
data
,
me
.
model
,
id
);
var
pos
=
(
me
.
appendAtStart
&&
!
first_load
)
?
0
:
me
.
data
.
length
;
me
.
insert
(
pos
,
newrec
);
}
};
me
.
mon
(
rstore
,
'
load
'
,
function
(
s
,
records
,
success
)
{
if
(
!
success
)
{
return
;
}
me
.
suspendEvents
();
// remove vanished items
(
me
.
snapshot
||
me
.
data
).
each
(
function
(
olditem
)
{
var
item
=
rstore
.
getById
(
olditem
.
getId
());
if
(
!
item
)
{
me
.
remove
(
olditem
);
}
});
rstore
.
each
(
function
(
item
)
{
cond_add_item
(
item
.
data
,
item
.
getId
());
});
me
.
filter
();
if
(
me
.
sortAfterUpdate
)
{
me
.
sort
();
}
first_load
=
false
;
me
.
resumeEvents
();
me
.
fireEvent
(
'
datachanged
'
,
me
);
});
}
});
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