Skip to content

Commit ccac933

Browse files
committed
Merge branch 'bugfix/10.5.20/add-compliance-data' into bugfix/10.5.20/update-agent-hostname
2 parents 1fc3e0d + 79c7f98 commit ccac933

File tree

18 files changed

+1479
-41
lines changed

18 files changed

+1479
-41
lines changed

CHANGELOG.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
# UTMStack 10.5.19 Release Notes
1+
# UTMStack 10.5.21 Release Notes
22
## Bug Fixes
3-
- Fixed issue where log fields in the table didn't match the data when adding filters.
4-
- Fixed time filter updates not reflecting in the filter string.
5-
- Fixed index pattern changes not updating the browser URL.
6-
- Fixed container memory resource distribution
7-
- Fixed empty column status in cvs export
3+
84
## New Features
9-
- Restricted time filter to a maximum range of one month.
10-
- Made the timestamp field mandatory and added a summary view when no fields are selected.
11-
- Moved “Add Filter” button to the left and improved filter UI with better icons.
12-
- Removed unnecessary header space to enhance table visibility.
13-
- Added "contains one of" and "does not contain one of" operators to filters.
5+
- Introduced new standards, sections, dashboards, and visualizations to compliance reports.

backend/src/main/java/com/park/utmstack/repository/chart_builder/UtmDashboardRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
public interface UtmDashboardRepository extends JpaRepository<UtmDashboard, Long>, JpaSpecificationExecutor<UtmDashboard> {
1818

1919
Optional<UtmDashboard> findByName(String name);
20+
Optional<UtmDashboard> findByIdAndSystemOwnerIsFalse(Long id);
2021

2122
Optional<UtmDashboard> findByIdAndName(Long id, String name);
2223

backend/src/main/java/com/park/utmstack/repository/chart_builder/UtmVisualizationRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ public interface UtmVisualizationRepository extends JpaRepository<UtmVisualizati
2727
Optional<UtmVisualization> findFirstBySystemOwnerIsTrueOrderByIdDesc();
2828

2929
List<UtmVisualization> findAllByChTypeIn(List<String> types);
30+
31+
Optional<UtmVisualization> findByIdAndSystemOwnerIsFalse(Long id);
3032
}

backend/src/main/java/com/park/utmstack/service/impl/chart_builder/UtmDashboardServiceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.springframework.transaction.annotation.Transactional;
1818
import org.springframework.util.CollectionUtils;
1919

20+
import javax.persistence.EntityNotFoundException;
2021
import java.time.LocalDateTime;
2122
import java.time.ZoneOffset;
2223
import java.util.*;
@@ -98,6 +99,8 @@ public Optional<UtmDashboard> findOne(Long id) {
9899
@Override
99100
public void delete(Long id) {
100101
log.debug("Request to delete UtmDashboard : {}", id);
102+
dashboardRepository.findByIdAndSystemOwnerIsFalse(id)
103+
.orElseThrow(() -> new NoSuchElementException(String.format("Dashboard %1$s not found", id)));
101104
dashboardRepository.deleteById(id);
102105
}
103106

backend/src/main/java/com/park/utmstack/service/impl/chart_builder/UtmVisualizationServiceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.springframework.util.StringUtils;
1818

1919
import java.util.List;
20+
import java.util.NoSuchElementException;
2021
import java.util.Optional;
2122

2223
/**
@@ -127,6 +128,8 @@ public Optional<UtmVisualization> findOne(Long id) {
127128
@Override
128129
public void delete(Long id) {
129130
log.debug("Request to delete UtmVisualization : {}", id);
131+
utmVisualizationRepository.findByIdAndSystemOwnerIsFalse(id)
132+
.orElseThrow(() -> new NoSuchElementException(String.format("Visualization %1$s not found", id)));
130133
utmVisualizationRepository.deleteById(id);
131134
}
132135

backend/src/main/java/com/park/utmstack/web/rest/chart_builder/UtmDashboardResource.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.time.ZoneOffset;
3434
import java.util.Arrays;
3535
import java.util.List;
36+
import java.util.NoSuchElementException;
3637
import java.util.Optional;
3738

3839
/**
@@ -78,7 +79,7 @@ public ResponseEntity<UtmDashboard> createUtmDashboard(@Valid @RequestBody UtmDa
7879
UtmDashboard result = null;
7980
try {
8081
utmDashboard.setUserCreated(
81-
SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new UtmEntityCreationException("Missing user login")));
82+
SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new UtmEntityCreationException("Missing user login")));
8283
utmDashboard.setCreatedDate(LocalDateTime.now().toInstant(ZoneOffset.UTC));
8384

8485
// Set the next system sequence value only if the environment is dev
@@ -89,19 +90,19 @@ public ResponseEntity<UtmDashboard> createUtmDashboard(@Valid @RequestBody UtmDa
8990

9091
result = utmDashboardService.save(utmDashboard);
9192
return ResponseEntity.created(new URI("/api/utm-dashboards/" + result.getId())).headers(
92-
HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
93+
HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
9394
} catch (DataIntegrityViolationException e) {
9495
String msg = ctx + ": " + e.getMostSpecificCause().getMessage().replaceAll("\n", "");
9596
log.error(msg);
9697
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
9798
return ResponseEntity.status(HttpStatus.CONFLICT).headers(HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg))
98-
.body(result);
99+
.body(result);
99100
} catch (Exception e) {
100101
String msg = ctx + ": " + e.getMessage();
101102
log.error(msg);
102103
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
103104
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
104-
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).body(result);
105+
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).body(result);
105106
}
106107
}
107108

@@ -123,25 +124,25 @@ public ResponseEntity<UtmDashboard> updateUtmDashboard(@Valid @RequestBody UtmDa
123124
UtmDashboard result = null;
124125
try {
125126
utmDashboard.setUserModified(
126-
SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new UtmEntityCreationException("Missing user login")));
127+
SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new UtmEntityCreationException("Missing user login")));
127128
utmDashboard.setModifiedDate(Instant.now());
128129
utmDashboard.setSystemOwner(utmDashboard.getSystemOwner() == null ? utmDashboard.getId() < 1000000 : utmDashboard.getSystemOwner());
129130

130131
result = utmDashboardService.save(utmDashboard);
131132
return ResponseEntity.ok().headers(
132-
HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, utmDashboard.getId().toString())).body(result);
133+
HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, utmDashboard.getId().toString())).body(result);
133134
} catch (DataIntegrityViolationException e) {
134135
String msg = ctx + ": " + e.getMostSpecificCause().getMessage().replaceAll("\n", "");
135136
log.error(msg);
136137
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
137138
return ResponseEntity.status(HttpStatus.CONFLICT).headers(HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg))
138-
.body(result);
139+
.body(result);
139140
} catch (Exception e) {
140141
String msg = ctx + ": " + e.getMessage();
141142
log.error(msg);
142143
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
143144
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
144-
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).body(result);
145+
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).body(result);
145146
}
146147
}
147148

@@ -163,7 +164,7 @@ public ResponseEntity<List<UtmDashboard>> getAllUtmDashboards(UtmDashboardCriter
163164
log.error(msg);
164165
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
165166
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
166-
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
167+
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
167168
}
168169
}
169170

@@ -184,14 +185,15 @@ public ResponseEntity<UtmDashboard> getUtmDashboard(@PathVariable Long id) {
184185
log.error(msg);
185186
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
186187
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
187-
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
188+
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
188189
}
189190
}
190191

191192
/**
192193
* DELETE /utm-dashboards/:id : delete the "id" utmDashboard.
193194
*
194195
* @param id the id of the utmDashboard to delete
196+
* @throws NoSuchElementException 404 (Not Found) if the dashboard does not exist or is a system owner
195197
* @return the ResponseEntity with status 200 (OK)
196198
*/
197199
@DeleteMapping("/utm-dashboards/{id}")
@@ -200,12 +202,18 @@ public ResponseEntity<Void> deleteUtmDashboard(@PathVariable Long id) {
200202
try {
201203
utmDashboardService.delete(id);
202204
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
205+
} catch (NoSuchElementException e) {
206+
String msg = ctx + ": " + e.getMessage();
207+
log.error(msg);
208+
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
209+
return ResponseEntity.status(HttpStatus.NOT_FOUND).headers(
210+
HeaderUtil.createFailureAlert("", "", msg)).body(null);
203211
} catch (Exception e) {
204212
String msg = ctx + ": " + e.getMessage();
205213
log.error(msg);
206214
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
207215
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
208-
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
216+
HeaderUtil.createFailureAlert(null, null, msg)).body(null);
209217
}
210218
}
211219

@@ -223,13 +231,13 @@ public ResponseEntity<Void> importDashboards(@Valid @RequestBody ImportDashboard
223231
log.error(msg);
224232
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
225233
return ResponseEntity.status(HttpStatus.CONFLICT).headers(HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg))
226-
.build();
234+
.build();
227235
}
228236
msg = ctx + ": " + e.getMessage();
229237
log.error(msg);
230238
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
231239
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(
232-
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).build();
240+
HeaderUtil.createFailureAlert(ENTITY_NAME, null, msg)).build();
233241
}
234242
}
235243

backend/src/main/java/com/park/utmstack/web/rest/chart_builder/UtmVisualizationResource.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
import java.time.Instant;
3939
import java.time.LocalDateTime;
4040
import java.time.ZoneOffset;
41-
import java.util.Collections;
42-
import java.util.List;
43-
import java.util.Objects;
44-
import java.util.Optional;
41+
import java.util.*;
4542

4643
/**
4744
* REST controller for managing UtmVisualization.
@@ -251,6 +248,7 @@ public ResponseEntity<UtmVisualization> getUtmVisualization(@PathVariable Long i
251248
* DELETE /utm-visualizations/:id : delete the "id" utmVisualization.
252249
*
253250
* @param id the id of the utmVisualization to delete
251+
* @throws NoSuchElementException 404 (Not Found) if the visualization does not exist or is a system owner
254252
* @return the ResponseEntity with status 200 (OK)
255253
*/
256254
@DeleteMapping("/utm-visualizations/{id}")
@@ -259,7 +257,14 @@ public ResponseEntity<Void> deleteUtmVisualization(@PathVariable Long id) {
259257
try {
260258
visualizationService.delete(id);
261259
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
262-
} catch (Exception e) {
260+
} catch (NoSuchElementException e) {
261+
String msg = ctx + ": " + e.getMessage();
262+
log.error(msg);
263+
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);
264+
return ResponseEntity.status(HttpStatus.NOT_FOUND).headers(
265+
HeaderUtil.createFailureAlert("", "", msg)).body(null);
266+
}
267+
catch (Exception e) {
263268
String msg = ctx + ": " + e.getMessage();
264269
log.error(msg);
265270
applicationEventService.createEvent(msg, ApplicationEventType.ERROR);

0 commit comments

Comments
 (0)