Skip to content

Commit 286fc04

Browse files
committedJan 6, 2025
Generate a new id for reports imported into a dashboard
This fixes a bug that was preventing to import the same report multiple times in the same dashboard. Problematic reports need to be removed from dashboard then imported again.
1 parent 4ae381b commit 286fc04

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Several pages already work without any AngularJS code:
3131
- After a successful login, redirect the user to where it was before being
3232
redirected to the login page
3333

34+
### Fixed
35+
36+
- Fixed a bug that was preventing to import the same report multiple times in
37+
the same dashboard.
38+
Problematic reports need to be removed from dashboard then imported again
39+
3440
### Dependencies
3541

3642
- Added gettext.js 2.0.3

‎public/js/ng/dashboard-edit/dashboard-edit.component.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
modal.result.then(reportID => {
9797
reportModel.getReportDefinition(reportID).then(function (report) {
9898
if (report) {
99-
report.id = report._id;
99+
report.id = uuid.v4();
100100
$scope.selectedDashboard.reports.push(report);
101101
} else {
102102
notify.error(i18n.gettext('Error : failed to import report'));

‎server/models/dashboard.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const dashboardReportSchema = new mongoose.Schema({
1515
reportSubType: { type: String },
1616
reportType: { type: String },
1717
selectedLayerID: { type: mongoose.Schema.Types.ObjectId, ref: 'Layer' },
18+
}, {
19+
id: false,
20+
_id: false,
1821
});
1922

2023
const dashboardSchema = new mongoose.Schema({

0 commit comments

Comments
 (0)