64 lines
2.8 KiB
Python
64 lines
2.8 KiB
Python
with open('/home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/web/bulk-api-tester/static/js/app.js', 'r') as f:
|
|||
|
|
content = f.read()
|
||
|
|
|
||
|
|
old_code = """ saveState() {
|
||
|
|
try {
|
||
|
|
const serializedTabs = this.tabs.map(t => ({
|
||
|
|
...t,
|
||
|
|
bulk: { ...t.bulk, running: false, results: [] },
|
||
|
|
response: null
|
||
|
|
}));
|
||
|
|
const persistentState = {
|
||
|
|
spaces: this._stateData.spaces,
|
||
|
|
activeSpaceId: this._stateData.activeSpaceId,
|
||
|
|
activeCollectionId: this._stateData.activeCollectionId,
|
||
|
|
outputFolderPath: this._stateData.outputFolderPath,
|
||
|
|
gridMaximized: this._stateData.gridMaximized,
|
||
|
|
resultsPanelHeight: this._stateData.resultsPanelHeight,
|
||
|
|
sidebarWidth: this._stateData.sidebarWidth,
|
||
|
|
searchQuery: this._stateData.searchQuery,
|
||
|
|
tabs: serializedTabs,
|
||
|
|
activeTabIndex: this.activeTabIndex
|
||
|
|
};
|
||
|
|
localStorage.setItem('phoenix-state-v2', JSON.stringify(persistentState));
|
||
|
|
} catch (e) {
|
||
|
|
console.error("Failed to save state:", e);
|
||
|
|
}
|
||
|
|
},"""
|
||
|
|
|
||
|
|
new_code = """ saveState() {
|
||
|
|
if (this._saveStateTimeout) clearTimeout(this._saveStateTimeout);
|
||
|
|
this._saveStateTimeout = setTimeout(() => {
|
||
|
|
try {
|
||
|
|
const serializedTabs = this.tabs.map(t => ({
|
||
|
|
...t,
|
||
|
|
bulk: { ...t.bulk, running: false, results: [] },
|
||
|
|
response: null
|
||
|
|
}));
|
||
|
|
const persistentState = {
|
||
|
|
spaces: this._stateData.spaces,
|
||
|
|
activeSpaceId: this._stateData.activeSpaceId,
|
||
|
|
activeCollectionId: this._stateData.activeCollectionId,
|
||
|
|
outputFolderPath: this._stateData.outputFolderPath,
|
||
|
|
gridMaximized: this._stateData.gridMaximized,
|
||
|
|
resultsPanelHeight: this._stateData.resultsPanelHeight,
|
||
|
|
sidebarWidth: this._stateData.sidebarWidth,
|
||
|
|
searchQuery: this._stateData.searchQuery,
|
||
|
|
tabs: serializedTabs,
|
||
|
|
activeTabIndex: this.activeTabIndex
|
||
|
|
};
|
||
|
|
localStorage.setItem('phoenix-state-v2', JSON.stringify(persistentState));
|
||
|
|
} catch (e) {
|
||
|
|
console.error("Failed to save state:", e);
|
||
|
|
}
|
||
|
|
}, 300);
|
||
|
|
},"""
|
||
|
|
|
||
|
|
if old_code in content:
|
||
|
|
content = content.replace(old_code, new_code)
|
||
|
|
with open('/home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/web/bulk-api-tester/static/js/app.js', 'w') as f:
|
||
|
|
f.write(content)
|
||
|
|
print("Patched!")
|
||
|
|
else:
|
||
|
|
print("Could not find old_code")
|