-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add help button #541 #711
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
fstreit1
wants to merge
71
commits into
main
Choose a base branch
from
feature/541-add-help-button
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 58 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
0aeb3d8
feat(backend): add a new property containing the url the help button …
fstreit1 b737551
feat(backend): write a configuration method for getting the support p…
fstreit1 5d5eba7
feat(backend): add a new dto for transfering the support page url #541
fstreit1 4cacdd2
feat(backend): write a mapper for translating the url string to a dto…
fstreit1 3f9ca7f
feat(backend): change the old enpoint url and add a new endpoint for …
fstreit1 608453b
feat(backend): change the security config so the new endpoint for get…
fstreit1 a72c94b
feat(frontend): add a new help attribute to the de.json #541
fstreit1 bc211cc
feat(frontend): change the test so the url points to the old endpoint…
fstreit1 bac56f4
feat(frontend): add a fetch for the new endpoint which provides the s…
fstreit1 7f47000
feat(frontend): implement a new model for containing the support page…
fstreit1 29d43f2
fix(frontend): rewrite import so modelname fits PascalCase convention…
fstreit1 b06cd45
feat(frontend): add a new signal for containing the href to the suppo…
fstreit1 b98df21
feat(frontend): add the button in the top bar #541
fstreit1 3b7c04c
refactor(backend): remove unnecessary default value #541
fstreit1 0e05cf3
feat(backend): add check if configured url is valid #541
fstreit1 07bf144
fix(backend): rewrite check for valid url so the url can not contain …
fstreit1 b2a8d16
test(backend): write tests for the check if a url is valid #541
fstreit1 a5f2b56
feat(backend): add check if the url is valid #541
fstreit1 ac2add8
fix(backend): fix test so it uses the changed endpoint url #541
fstreit1 a281790
test(backend): write test if the endpoint deliveres the correct url …
fstreit1 f1d8b55
test: write test data in properties file and in test-data #541
fstreit1 de804ca
test(frontend): write a test if the fetch for the support page endpoi…
fstreit1 4dc3947
fix(backend): fix the test which checks if the endpoint for providing…
fstreit1 62e97b9
test(frontend): write frontend test #541
fstreit1 1048e85
fix(backend): fix naming of configuration property #541
fstreit1 c30349e
fix(backend): fix property naming #541
fstreit1 b2cf876
test(frontend): add e2e test #541
fstreit1 cb99225
refactor(backend): rename helpurlconfiguration into appconfiguration …
fstreit1 471256f
refactor(backend): rename property to help-url #541
fstreit1 4a45bc6
refactor(backend): rename support mapper to appconfigurationmapper #541
fstreit1 beedaa8
fix(backend): fix naming #541
fstreit1 ae59696
fix(frontend): refactor the test so it uses the test id and not the n…
fstreit1 338f059
fix(frontend): remove id from the <a> element #541
fstreit1 f04c54b
test(backend): remove broken tests after refactoring the check for va…
fstreit1 f10b664
refactor(backend): remove check and add annotation @URL #541
fstreit1 03d91f2
fix(frontend): fix test for checking if endpoint works #541
fstreit1 7d1ae3a
test(backend): write new tests for @url annotation testing #541
fstreit1 7684b05
test(backend): write a test for annotation violations #541
fstreit1 bcc040e
fix(backend): rename properties #541
fstreit1 8d09661
refactor(backend): rename method to prevent clash with parameter #541
fstreit1 82f4608
test(frontend): refactor the test so it fits into the angular testing…
fstreit1 e5ab920
test(frontend): refactor the test so it uses convention from angular …
fstreit1 68a1a2b
refactor(backend): rename constant to fit regex #541
fstreit1 e6523bf
test(frontend): make test function async #541
fstreit1 8a72d89
test(frontend): fix test by making it intercept the request to the ba…
fstreit1 d6f7097
fix(frontend): rewrite service to use rxresource #541
fstreit1 5bd9191
feat(backend): add new check if its a valid url #541
fstreit1 980d8f3
test(frontend): refactor fetching from endpoint and test #541
fstreit1 59aeb5a
feat(backend): fix naming of properties #541
fstreit1 0a1a6de
fix(backend): refactor e2e test url to make it conform to the new rul…
fstreit1 a71dd9e
refactor(backend): rename dto #541
fstreit1 3be11aa
refactor(frontend): adjust fetch to fit new endpoint naming #541
fstreit1 6487296
fix(frontend): change fetch to match new endpoint naming #541
fstreit1 a260700
feat(backend): add new check if the url configured contains a space …
fstreit1 016842c
test(backend): refactor tests into one parameterized one #541
fstreit1 1ca339a
Merge branch 'main' into feature/541-add-help-button
fstreit1 117b49c
fix(frontend): change url to point to renamed endpoint #541
fstreit1 3dd10f8
refactor(backend): change displayname of test #541
fstreit1 c1a14e4
refactor(backend): make the checks more readable and fix the naming …
fstreit1 722eb8d
refactor(backend): rename the properties to help-url #541
fstreit1 55b4ce7
refactor(backend): renamed many things #541
fstreit1 3820b4d
test(backend): split test into negative cases and positives for reada…
fstreit1 16eb747
refactor(frontend): rename attributes #541
fstreit1 7822ecb
test(backend): fix configurationcontroller integration test #541
fstreit1 8fe935b
refactor(frontend): rename attribute #541
fstreit1 4f756e1
refactor(frontend): refactor structure #541
fstreit1 2adf6ae
test(frontend): fix flakey test #541
fstreit1 1fd9514
fix(backend): resolve issues from sonarqube #541
fstreit1 0217948
Merge branch 'main' into feature/541-add-help-button
fstreit1 b567287
test(frontend): add new test #541
fstreit1 1c810fd
Merge branch 'main' into feature/541-add-help-button
fstreit1 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/ch/puzzle/pcts/configuration/AppConfiguration.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,19 @@ | ||
| package ch.puzzle.pcts.configuration; | ||
|
|
||
| import jakarta.validation.constraints.AssertTrue; | ||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.validation.annotation.Validated; | ||
|
|
||
| @Validated | ||
| @ConfigurationProperties(prefix = "pcts.app") | ||
| public record AppConfiguration(String helpurl) { | ||
| public String getHelpUrl() { | ||
| return helpurl; | ||
| } | ||
|
|
||
| @AssertTrue(message = "Help url is not a valid url") | ||
|
fstreit1 marked this conversation as resolved.
Outdated
|
||
| public boolean isValid() { | ||
| return helpurl != null && !helpurl.isBlank() && !helpurl.contains(" ") && helpurl.startsWith("https://") | ||
|
fstreit1 marked this conversation as resolved.
Outdated
fstreit1 marked this conversation as resolved.
Outdated
|
||
| && helpurl.length() >= 12 && (helpurl.contains(".ch") || helpurl.contains(".com")); | ||
|
fstreit1 marked this conversation as resolved.
Outdated
fstreit1 marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
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
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/ch/puzzle/pcts/dto/appconfiguration/AppConfigurationDto.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,7 @@ | ||
| package ch.puzzle.pcts.dto.appconfiguration; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record AppConfigurationDto(@Schema(description = "Provides the url the help button should lead to") String url) { | ||
|
fstreit1 marked this conversation as resolved.
Outdated
fstreit1 marked this conversation as resolved.
Outdated
fstreit1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| } | ||
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/ch/puzzle/pcts/mapper/AppConfigurationMapper.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,11 @@ | ||
| package ch.puzzle.pcts.mapper; | ||
|
|
||
| import ch.puzzle.pcts.dto.appconfiguration.AppConfigurationDto; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class AppConfigurationMapper { | ||
|
fstreit1 marked this conversation as resolved.
|
||
| public AppConfigurationDto toDto(String url) { | ||
| return new AppConfigurationDto(url); | ||
| } | ||
| } | ||
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
46 changes: 46 additions & 0 deletions
46
backend/src/test/java/ch/puzzle/pcts/configuration/AppConfigurationTest.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,46 @@ | ||
| package ch.puzzle.pcts.configuration; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| import jakarta.validation.Validation; | ||
| import jakarta.validation.Validator; | ||
| import jakarta.validation.ValidatorFactory; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.CsvSource; | ||
|
|
||
| class AppConfigurationTest { | ||
|
|
||
| private Validator validator; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); | ||
| validator = factory.getValidator(); | ||
| } | ||
|
|
||
| @DisplayName("Should return expected result") | ||
| @ParameterizedTest | ||
| @CsvSource(""" | ||
| https://example.com, true, | ||
| https://example.ch, true, | ||
| null, false, | ||
| , false, | ||
| http://example.com, false, | ||
| https://.ch, false, | ||
| https://example.de, false, | ||
| https://e x am.ch, false | ||
| """) | ||
| void shouldReturnExpected(String input, boolean expectedValid) { | ||
|
fstreit1 marked this conversation as resolved.
Outdated
|
||
| var config = new AppConfiguration(input); | ||
| var violations = validator.validate(config); | ||
|
|
||
| if (expectedValid) { | ||
| assertTrue(violations.isEmpty(), "Expected no violations for: " + input); | ||
| } else { | ||
| assertFalse(violations.isEmpty(), "Expected violations for: " + input); | ||
| } | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import * as users from '../fixtures/users.json'; | ||
|
|
||
| describe('Topbar', () => { | ||
| beforeEach(() => { | ||
| cy.loginAsUser(users.gl); | ||
| }); | ||
|
|
||
| it('should have correct url set', () => { | ||
| cy.intercept('GET', 'http://localhost:4200/api/v1/configuration/app') | ||
| .as('getURL'); | ||
|
|
||
| cy.visit('/'); | ||
|
|
||
| cy.wait('@getURL'); | ||
|
|
||
| cy.getByTestId('support-page-url') | ||
| .invoke('attr', 'href') | ||
| .then((href: string) => { | ||
| cy.get('@getURL.1') | ||
| .its('response.body.url') | ||
| .should('eq', href); | ||
| }); | ||
| }); | ||
| }); |
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
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,3 @@ | ||
| export interface HelpUrlModel { | ||
| url: string; | ||
| } |
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
Oops, something went wrong.
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.