Skip to content

Commit 249e279

Browse files
MOBILE-4077 ReportBuilder: Open in browser report detail if fails
1 parent 4a93fd3 commit 249e279

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/core/features/reportbuilder/components/report-detail/report-detail.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import {
2323
import { IonRefresher } from '@ionic/angular';
2424
import { CoreNavigator } from '@services/navigator';
2525
import { CoreScreen } from '@services/screen';
26+
import { CoreSites } from '@services/sites';
2627
import { CoreDomUtils } from '@services/utils/dom';
28+
import { CoreTextErrorObject } from '@services/utils/text';
2729
import { CoreUtils } from '@services/utils/utils';
30+
import { Translate } from '@singletons';
2831
import { BehaviorSubject, Observable } from 'rxjs';
2932
import { map } from 'rxjs/operators';
3033

@@ -111,8 +114,33 @@ export class CoreReportBuilderReportDetailComponent implements OnInit {
111114
});
112115

113116
this.onReportLoaded.emit(report.details);
114-
} catch (err) {
115-
await CoreDomUtils.showErrorModal(err);
117+
} catch {
118+
const errorConfig: CoreTextErrorObject = {
119+
title: Translate.instant('core.error'),
120+
body: `
121+
<p>${Translate.instant('addon.mod_page.errorwhileloadingthepage')}</p>
122+
<p>${Translate.instant('core.course.useactivityonbrowser')}</p>
123+
`,
124+
buttons: [
125+
{
126+
text: Translate.instant('core.cancel'),
127+
role: 'cancel',
128+
handler: async () => await CoreNavigator.back(),
129+
},
130+
{
131+
text: Translate.instant('core.openinbrowser'),
132+
role: 'confirm',
133+
handler: async () => {
134+
const site = CoreSites.getRequiredCurrentSite();
135+
const href = `${site.getURL()}/reportbuilder/view.php?id=${this.reportId}`;
136+
await CoreUtils.openInBrowser(href, { showBrowserWarning: false });
137+
await CoreNavigator.back();
138+
},
139+
},
140+
],
141+
};
142+
143+
await CoreDomUtils.showErrorModal(errorConfig);
116144
}
117145
}
118146

0 commit comments

Comments
 (0)