mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(environments): remove endpoints cache [DTD-100] (#6408)
This commit is contained in:
parent
9ef2e27aae
commit
37d4a80769
51 changed files with 155 additions and 353 deletions
17
app/app.js
17
app/app.js
|
@ -1,10 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import { PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
|
||||
|
||||
/* @ngInject */
|
||||
export function onStartupAngular($rootScope, $state, $interval, LocalStorage, EndpointProvider, SystemService, cfpLoadingBar, $transitions, HttpRequestHelper) {
|
||||
EndpointProvider.initialize();
|
||||
|
||||
export function onStartupAngular($rootScope, $state, LocalStorage, cfpLoadingBar, $transitions, HttpRequestHelper, EndpointProvider) {
|
||||
$rootScope.$state = $state;
|
||||
const defaultTitle = document.title;
|
||||
|
||||
|
@ -26,11 +23,6 @@ export function onStartupAngular($rootScope, $state, $interval, LocalStorage, En
|
|||
HttpRequestHelper.resetAgentHeaders();
|
||||
});
|
||||
|
||||
// Keep-alive Edge endpoints by sending a ping request every minute
|
||||
$interval(() => {
|
||||
ping(EndpointProvider, SystemService);
|
||||
}, 60 * 1000);
|
||||
|
||||
$(document).ajaxSend((event, jqXhr, jqOpts) => {
|
||||
const type = jqOpts.type === 'POST' || jqOpts.type === 'PUT' || jqOpts.type === 'PATCH';
|
||||
const hasNoContentType = jqOpts.contentType !== 'application/json' && jqOpts.headers && !jqOpts.headers['Content-Type'];
|
||||
|
@ -40,10 +32,3 @@ export function onStartupAngular($rootScope, $state, $interval, LocalStorage, En
|
|||
jqXhr.setRequestHeader('Authorization', 'Bearer ' + LocalStorage.getJWT());
|
||||
});
|
||||
}
|
||||
|
||||
function ping(EndpointProvider, SystemService) {
|
||||
const endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint && endpoint.Type == PortainerEndpointTypes.EdgeAgentOnDockerEnvironment) {
|
||||
SystemService.ping(endpoint.Id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue