@sumaris-net/ngx-components 2.4.58 → 2.4.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc/changelog.md +4 -1
- package/esm2020/src/app/core/services/network.service.mjs +17 -4
- package/esm2020/src/app/shared/http/http.utils.mjs +3 -3
- package/esm2020/src/environments/environment.mjs +6 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +24 -5
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +22 -5
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/network.service.d.ts +5 -2
|
@@ -11537,6 +11537,11 @@ const environment = Object.freeze({
|
|
|
11537
11537
|
{
|
|
11538
11538
|
host: 'server.e-is.pro',
|
|
11539
11539
|
port: 443
|
|
11540
|
+
},
|
|
11541
|
+
{
|
|
11542
|
+
host: 'sih.sfa.sc',
|
|
11543
|
+
port: 80,
|
|
11544
|
+
useSsl: false
|
|
11540
11545
|
}
|
|
11541
11546
|
],
|
|
11542
11547
|
defaultAppName: 'SUMARiS',
|
|
@@ -14161,7 +14166,7 @@ class HttpUtils {
|
|
|
14161
14166
|
}
|
|
14162
14167
|
catch (err) {
|
|
14163
14168
|
if (err && err.message) {
|
|
14164
|
-
console.error(`[network] Error on get request ${uri}: ${err.message}`, err);
|
|
14169
|
+
console.error(`[network] Error on get request ${uri}: ${err.message}`, JSON.stringify(err));
|
|
14165
14170
|
}
|
|
14166
14171
|
else {
|
|
14167
14172
|
console.error(`[network] Error on get request ${uri}: ${err && err.statusText} - ${JSON.stringify(err)}`);
|
|
@@ -14185,7 +14190,7 @@ class HttpUtils {
|
|
|
14185
14190
|
}
|
|
14186
14191
|
catch (err) {
|
|
14187
14192
|
if (err && err.message) {
|
|
14188
|
-
console.error(`[network] Error on get request ${uri}: ${err.message}`, err);
|
|
14193
|
+
console.error(`[network] Error on get request ${uri}: ${err.message}`, JSON.stringify(err));
|
|
14189
14194
|
}
|
|
14190
14195
|
else {
|
|
14191
14196
|
console.error(`[network] Error on get request ${uri}: ${err && err.statusText} - ${JSON.stringify(err)}`);
|
|
@@ -15235,7 +15240,7 @@ const NetworkRefreshTimerPeriod = {
|
|
|
15235
15240
|
DESKTOP: 1000
|
|
15236
15241
|
}*/
|
|
15237
15242
|
class NetworkService extends StartableObservableService {
|
|
15238
|
-
constructor(_document, platform, modalCtrl, cryptoService, storage, settings, cache, http, environment, network, translate, toastController) {
|
|
15243
|
+
constructor(_document, platform, modalCtrl, cryptoService, storage, settings, cache, http, environment, loggingService, network, translate, toastController) {
|
|
15239
15244
|
super(platform);
|
|
15240
15245
|
this._document = _document;
|
|
15241
15246
|
this.platform = platform;
|
|
@@ -15246,6 +15251,7 @@ class NetworkService extends StartableObservableService {
|
|
|
15246
15251
|
this.cache = cache;
|
|
15247
15252
|
this.http = http;
|
|
15248
15253
|
this.environment = environment;
|
|
15254
|
+
this.loggingService = loggingService;
|
|
15249
15255
|
this.network = network;
|
|
15250
15256
|
this.translate = translate;
|
|
15251
15257
|
this.toastController = toastController;
|
|
@@ -15254,6 +15260,7 @@ class NetworkService extends StartableObservableService {
|
|
|
15254
15260
|
this.onResetNetworkCache = new EventEmitter(true);
|
|
15255
15261
|
this._listeners = {};
|
|
15256
15262
|
this._mobile = this.settings.mobile;
|
|
15263
|
+
this._logger = this.loggingService?.getLogger('network');
|
|
15257
15264
|
if (this._mobile) {
|
|
15258
15265
|
this._timerRefreshPeriod = NetworkRefreshTimerPeriod.MOBILE;
|
|
15259
15266
|
this._timerRefreshCondition = () => this.online; // Check only when online, and stop when offline
|
|
@@ -15424,11 +15431,16 @@ class NetworkService extends StartableObservableService {
|
|
|
15424
15431
|
return undefined; // No peer define. Skip
|
|
15425
15432
|
peer = Peer.parseUrl(settings.peerUrl);
|
|
15426
15433
|
}
|
|
15434
|
+
const peerUrl = typeof peer === 'string' ? peer : peer.url;
|
|
15435
|
+
this._logger?.info('checkPeerAlive', `Checking if peer {${peerUrl}} is alive, by calling /api/node/info ...`);
|
|
15427
15436
|
try {
|
|
15428
|
-
|
|
15437
|
+
const data = await this.getNodeInfo(peer);
|
|
15438
|
+
this._logger?.info('checkPeerAlive', `Peer {${peerUrl}} is alive:\n${JSON.stringify(data)}`);
|
|
15439
|
+
return data;
|
|
15429
15440
|
}
|
|
15430
15441
|
catch (err) {
|
|
15431
15442
|
console.debug('[network] Cannot get /api/node/info from peer: ' + (err && err.message || err), err);
|
|
15443
|
+
this._logger?.error('checkPeerAlive', '[network] Cannot get /api/node/info from peer: ' + (err && err.message || err) + ':\n' + JSON.stringify(err));
|
|
15432
15444
|
return undefined;
|
|
15433
15445
|
}
|
|
15434
15446
|
}
|
|
@@ -15762,7 +15774,7 @@ class NetworkService extends StartableObservableService {
|
|
|
15762
15774
|
}
|
|
15763
15775
|
}
|
|
15764
15776
|
}
|
|
15765
|
-
NetworkService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NetworkService, deps: [{ token: DOCUMENT }, { token: i1.Platform }, { token: i1.ModalController }, { token: CryptoService }, { token: i3$1.Storage }, { token: LocalSettingsService }, { token: i5$1.CacheService }, { token: i2$3.HttpClient }, { token: ENVIRONMENT }, { token: i7$2.Network, optional: true }, { token: i1$2.TranslateService, optional: true }, { token: i1.ToastController, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15777
|
+
NetworkService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NetworkService, deps: [{ token: DOCUMENT }, { token: i1.Platform }, { token: i1.ModalController }, { token: CryptoService }, { token: i3$1.Storage }, { token: LocalSettingsService }, { token: i5$1.CacheService }, { token: i2$3.HttpClient }, { token: ENVIRONMENT }, { token: APP_LOGGING_SERVICE, optional: true }, { token: i7$2.Network, optional: true }, { token: i1$2.TranslateService, optional: true }, { token: i1.ToastController, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15766
15778
|
NetworkService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NetworkService, providedIn: 'root' });
|
|
15767
15779
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NetworkService, decorators: [{
|
|
15768
15780
|
type: Injectable,
|
|
@@ -15773,6 +15785,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
15773
15785
|
}] }, { type: i1.Platform }, { type: i1.ModalController }, { type: CryptoService }, { type: i3$1.Storage }, { type: LocalSettingsService }, { type: i5$1.CacheService }, { type: i2$3.HttpClient }, { type: undefined, decorators: [{
|
|
15774
15786
|
type: Inject,
|
|
15775
15787
|
args: [ENVIRONMENT]
|
|
15788
|
+
}] }, { type: undefined, decorators: [{
|
|
15789
|
+
type: Optional
|
|
15790
|
+
}, {
|
|
15791
|
+
type: Inject,
|
|
15792
|
+
args: [APP_LOGGING_SERVICE]
|
|
15776
15793
|
}] }, { type: i7$2.Network, decorators: [{
|
|
15777
15794
|
type: Optional
|
|
15778
15795
|
}] }, { type: i1$2.TranslateService, decorators: [{
|