iterate through keys in data

This commit is contained in:
Andrew Bauer 2020-08-02 13:33:25 -05:00 committed by GitHub
parent 2b29a7983a
commit d6999f5628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -338,12 +338,12 @@ if ( currentView != 'none' && currentView != 'login' ) {
auth_hash = data.auth; auth_hash = data.auth;
} }
} }
// TO-DO: just interate through all the keys instead // iterate through all the keys then update each element id with the same name
if ( $j('#getBandwidthHTML').length ) $j('#getBandwidthHTML').replaceWith(data.getBandwidthHTML); for (var key of Object.keys(data)) {
if ( $j('#getSysLoadHTML').length ) $j('#getSysLoadHTML').replaceWith(data.getSysLoadHTML); if ( key == "auth" ) continue;
if ( $j('#getDbConHTML').length ) $j('#getDbConHTML').replaceWith(data.getDbConHTML); if ( $j('#'+key).length ) $j('#'+key).replaceWith(data[key]);
if ( $j('#getStorageHTML').length ) $j('#getStorageHTML').replaceWith(data.getStorageHTML); }
if ( $j('#getShmHTML').length ) $j('#getShmHTML').replaceWith(data.getShmHTML);
} }
} }