Skip to content

Commit

Permalink
Retry on error of loading the dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamouGisaia committed Feb 13, 2024
1 parent e98242e commit 570bf8e
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 32 deletions.
87 changes: 68 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/arlas-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arlas-wui-toolkit",
"version": "24.3.5",
"version": "24.3.5-alpha.6",
"description": "Tool Kit Library for ARLAS wui web App",
"author": "gisaia",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export class ActionModalComponent {
if (!!arlasConfig) {
const hasResources = this.configurationService.hasResources(arlasConfig);
if (hasResources) {

}
if (this.configurationService.hasResources(arlasConfig)) {
this.duplicateResourcesThenConfig$(arlasConfig, newName, config.org).subscribe({
error: error => this.raiseError(error),
next: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</button>
</div>
<div *ngIf="action.type === ConfigAction.DUPLICATE">
<button mat-menu-item [disabled]="!canCreateDashboard || !action.enabled" (click)="onActionClick(action)">
<button mat-menu-item [disabled]="!action.enabled" (click)="onActionClick(action)">
<mat-icon>filter_none</mat-icon>
<span>{{'Duplicate' | translate}}</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { ErrorService } from '../../../services/error/error.service';
})
export class ConfigMenuComponent implements OnInit {
@Input() public actions: Array<ConfigAction>;
@Input() public canCreateDashboard = false;

@Input() public zone: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class PersistenceService {

}
public get(id: string, options = this.options): Observable<DataWithLinks> {
console.log(options.headers?.Authorization);
return from(this.persistenceApi.getById(id, false, options));
}

Expand Down
24 changes: 17 additions & 7 deletions projects/arlas-toolkit/src/lib/services/startup/startup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import * as rootContributorConfSchema from 'arlas-web-contributors/jsonSchemas/r
import { CollaborativesearchService, ConfigService, Contributor } from 'arlas-web-core';
import { projType } from 'arlas-web-core/models/projections';
import YAML from 'js-yaml';
import { Subject } from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { Subject, defer, of, throwError, timer } from 'rxjs';
import { catchError, delayWhen, map, mergeMap, retry, retryWhen, take, tap } from 'rxjs/operators';
import { PersistenceService, PersistenceSetting } from '../persistence/persistence.service';
import {
CONFIG_ID_QUERY_PARAM, GET_OPTIONS, WidgetConfiguration, getFieldProperties,
Expand Down Expand Up @@ -627,12 +627,22 @@ export class ArlasStartupService {
let configData;
if (usePersistence) {
if (!!configurationId) {
configDataPromise = this.persistenceService.get(configurationId).toPromise()
configDataPromise = defer(() => this.persistenceService.get(configurationId)).pipe(
catchError(err => {
this.errorService.closeAll();
return throwError(() => err);
}),
retry({ count: 1, delay: 2000 })
).toPromise()
.then((s: DataWithLinks) => {
const config = JSON.parse(s.doc_value);
this.configService.appName = s.doc_key;
configData = config;
return Promise.resolve(config);
if (s) {
const config = JSON.parse(s.doc_value);
this.configService.appName = s.doc_key;
configData = config;
return Promise.resolve(config);
}
return Promise.resolve(null);

}).catch((err) => {
if (!(err instanceof Response)) {
this.shouldRunApp = false;
Expand Down

0 comments on commit 570bf8e

Please sign in to comment.