-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackupMethodsRemoved.js
More file actions
51 lines (48 loc) · 2.01 KB
/
backupMethodsRemoved.js
File metadata and controls
51 lines (48 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class backup
{
updateState(state, response)
{
if (!response) {
return
}
if (typeof response === 'object' || response instanceof Map) {
if (!response.stateName) {
console.log("Error: statename missing")
}
let stateVar = state[response.stateName];
if (!stateVar) {
console.log("Error: state variable missing for this dataframe")
}
for (let i in response) {
if (i === 'additionalData') {
const additionalData = response[i];
Object.keys(additionalData).forEach(function (key) {
const dafrKey = additionalData[key];
if (dafrKey.hasOwnProperty('data')) {
if (dafrKey.data.hasOwnProperty('additionalData') && dafrKey.data.additionalData.data) {
// Todo make recursive for handling inner additonial datas for embedded dfrs
} else {
}
} else {
if (dafrKey) {
const dictionary = dafrKey['dictionary'];
stateVar[key + '_items'] = dictionary;
const headers = dafrKey['headers'];
if (headers) {
stateVar[key + '_headers'] = dafrKey['headers'];
} else {
const selectedData = dafrKey['selectedData'];
stateVar[key] = selectedData;
}
}
}
});
} else {
Vue.set(stateVar, i, response[i]);
}
}
} else {
console.log("PupulateState() method only works for object or map as of now");
}
}
}