-
Notifications
You must be signed in to change notification settings - Fork 2
implement computation result filters uuid #884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ghazwarhili
wants to merge
3
commits into
main
Choose a base branch
from
implement-computation-result-filters-uuid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
src/main/java/org/gridsuite/study/server/controller/ComputationResultFiltersController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package org.gridsuite.study.server.controller; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import jakarta.validation.Valid; | ||
| import org.gridsuite.study.server.StudyApi; | ||
| import org.gridsuite.study.server.service.StudyService; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.UUID; | ||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
|
|
||
| @RestController | ||
| @RequestMapping(value = "/" + StudyApi.API_VERSION + "/studies/{studyUuid}/computation-result-filters") | ||
| @Tag(name = "Study server - Computation result filters") | ||
| public class ComputationResultFiltersController { | ||
| private final StudyService studyService; | ||
|
|
||
| public ComputationResultFiltersController(StudyService studyService) { | ||
| this.studyService = studyService; | ||
| } | ||
|
|
||
| @GetMapping() | ||
| @Operation(summary = "Get study's computation result filters") | ||
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The computation result filters")}) | ||
| public ResponseEntity<String> getComputationResultFilters( | ||
| @PathVariable("studyUuid") UUID studyUuid) { | ||
| return ResponseEntity.ok().body(studyService.getComputationResultFilters(studyUuid)); | ||
| } | ||
|
|
||
| @PostMapping("/{id}/global-filters") | ||
| @Operation(summary = "Set global filters", | ||
| description = "Replaces all existing global filters with the provided list for a computation result") | ||
| @ApiResponse(responseCode = "204", description = "Global filters set successfully") | ||
| @ApiResponse(responseCode = "404", description = "computation result global filters not found") | ||
| public ResponseEntity<Void> setGlobalFiltersForComputationResult( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @Parameter(description = "ID of the global filters") @PathVariable UUID id, | ||
| @RequestBody String filters) { | ||
| studyService.setGlobalFiltersForComputationResult(studyUuid, id, filters); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
|
|
||
| @PutMapping("/{id}/columns/{columnUuid}") | ||
| @Operation(summary = "Update a column", description = "Updates an existing column") | ||
| @ApiResponse(responseCode = "204", description = "Column updated") | ||
| public ResponseEntity<Void> updateColumns( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @Parameter(description = "ID of the spreadsheet config") @PathVariable UUID id, | ||
| @Parameter(description = "ID of the column to update") @PathVariable UUID columnUuid, | ||
| @Valid @RequestBody String columnInfos) { | ||
| studyService.updateColumns(studyUuid, id, columnUuid, columnInfos); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/resources/db/changelog/changesets/changelog_20251117T095627Z.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
| <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
| <changeSet author="rehiligha (generated)" id="1763373405443-18"> | ||
| <addColumn tableName="study"> | ||
| <column name="computation_result_filters_uuid" type="uuid"/> | ||
| </addColumn> | ||
| </changeSet> | ||
| </databaseChangeLog> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the spreadsheet, they made the choice to define the default tabs and columns of the spreadsheet for a new study in the back. That's the why the spreadsheet is not empty for a new study.
But here, we don't set default computations filters. It's all empty. So you can delete this endpoint and just manage the null in the front