Skip to content
Snippets Groups Projects
Commit 04f939b1 authored by NOUMANE's avatar NOUMANE Committed by pybelecalo
Browse files

[US TRTL-526] update footer with release version

parent 86be7497
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 88 deletions
......@@ -36,11 +36,8 @@
*/
package fr.gouv.vitamui.ui.commons.config;
import java.util.Properties;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -64,15 +61,10 @@ public class UICommonsAutoConfiguration {
public UIProperties uiProperties() {
throw new InternalServerException("You must define ui properties");
}
@Bean
@ConditionalOnMissingBean
public BuildProperties buildProperties() {
throw new InternalServerException("You must define buildProperties");
}
@Bean
@ConditionalOnMissingBean
@DependsOn(value = { "uiProperties", "buildProperties" })
@DependsOn("uiProperties")
public IamExternalRestClientFactory iamRestClientFactory(final UIProperties uiProperties, final RestTemplateBuilder restTemplateBuilder) {
return new IamExternalRestClientFactory(uiProperties.getIamExternalClient(), restTemplateBuilder);
}
......
......@@ -2,12 +2,9 @@ package fr.gouv.vitamui.ui.commons.config;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -25,10 +22,11 @@ import fr.gouv.vitamui.ui.commons.service.ApplicationService;
@RunWith(SpringJUnit4ClassRunner.class)
public class UICommonsAutoConfigurationTest {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(UICommonsAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(UICommonsAutoSpringMockConfiguration.class))
.withSystemProperties("controller.subrogation.enabled=true", "controller.user.enabled=true");
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(UICommonsAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(UICommonsAutoSpringMockConfiguration.class))
.withSystemProperties("controller.subrogation.enabled=true", "controller.user.enabled=true");
@Test
public void serviceNameCanBeConfigured() {
......@@ -44,6 +42,7 @@ public class UICommonsAutoConfigurationTest {
@Configuration
static class UserConfiguration {
@Bean
public UIProperties uiProperties() {
final UIPropertiesImpl properties = new UIPropertiesImpl();
......@@ -57,13 +56,6 @@ public class UICommonsAutoConfigurationTest {
return casBean;
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
}
}
}
......@@ -11,14 +11,17 @@ import org.springframework.context.annotation.Configuration;
public class UICommonsAutoSpringMockConfiguration {
@Bean
public RestTemplateBuilder restTemplateBuilder() {
return new RestTemplateBuilder();
public BuildProperties buildProperties() {
Properties properties = new Properties();
properties.put("group", "fr.gouv.vitamui.ui");
properties.put("artifact", "test");
properties.put("version", "2.0.0");
return new BuildProperties(properties);
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
public RestTemplateBuilder restTemplateBuilder() {
return new RestTemplateBuilder();
}
}
package fr.gouv.vitamui.ui.commons.rest;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.mock.mockito.MockBean;
......@@ -42,12 +39,6 @@ public class ApplicationControllerTest extends UIControllerTest<ApplicationDto>
properties.setIamExternalClient(new RestClientConfiguration());
return properties;
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
}
}
protected String apiUrl = "/ui-api/ui";
......
......@@ -18,6 +18,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
......@@ -39,14 +40,6 @@ public class SecurityControllerTest extends UIControllerTest<UserDto> {
properties.setIamExternalClient(new RestClientConfiguration());
return properties;
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
}
}
@Value("${ui-prefix}")
......@@ -56,6 +49,9 @@ public class SecurityControllerTest extends UIControllerTest<UserDto> {
private static final VitamUILogger LOGGER = VitamUILoggerFactory.getInstance(SecurityControllerTest.class);
@MockBean
private BuildProperties buildProperties;
@Test
public void testGetUserConnected() throws Exception {
preparedServices();
......
......@@ -3,8 +3,6 @@ package fr.gouv.vitamui.ui.commons.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
......@@ -31,9 +29,9 @@ import fr.gouv.vitamui.ui.commons.security.SecurityConfig;
import fr.gouv.vitamui.ui.commons.service.SubrogationService;
@RunWith(SpringJUnit4ClassRunner.class)
@ImportAutoConfiguration(classes = { UICommonsAutoConfiguration.class, UICommonsAutoSpringMockConfiguration.class })
@WebMvcTest(controllers = { SubrogationController.class })
@Import(value = { SecurityConfig.class, ServerIdentityConfiguration.class })
@ImportAutoConfiguration(classes = {UICommonsAutoConfiguration.class, UICommonsAutoSpringMockConfiguration.class})
@WebMvcTest(controllers = {SubrogationController.class})
@Import(value = {SecurityConfig.class, ServerIdentityConfiguration.class})
public class SubrogationControllerTest extends UIControllerTest<SubrogationDto> {
@TestConfiguration
......@@ -47,13 +45,6 @@ public class SubrogationControllerTest extends UIControllerTest<SubrogationDto>
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
}
}
private static final VitamUILogger LOGGER = VitamUILoggerFactory.getInstance(SubrogationControllerTest.class);
......@@ -69,6 +60,9 @@ public class SubrogationControllerTest extends UIControllerTest<SubrogationDto>
@MockBean
private SubrogationService service;
@MockBean
private BuildProperties buildProperties;
@Test
public void testSubrogationControllerEnabled() {
assertThat(subrogationEnabled).isTrue();
......@@ -124,4 +118,5 @@ public class SubrogationControllerTest extends UIControllerTest<SubrogationDto>
Mockito.when(service.create(any(), any(SubrogationDto.class))).thenReturn(new SubrogationDto());
Mockito.when(service.getOne(any(), any(), any())).thenReturn(new SubrogationDto());
}
}
......@@ -6,7 +6,6 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.Map;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -63,12 +62,10 @@ public class UserControllerTest extends UIControllerTest<UserDto> {
properties.setIamExternalClient(new RestClientConfiguration());
return properties;
}
@Bean
public BuildProperties buildProperties() {
Properties props = new Properties();
props.put("version.release", "0.0.0");
return new BuildProperties(props);
}
@MockBean
private BuildProperties buildProperties;
}
......
<div class="d-flex flex-column align-items-center">
<img alt="compagny logo" [src]="footerLogoUrl" class="logo"/>
<span class="version">{{version}}</span>
<div><img alt="compagny logo" [src]="footerLogoUrl" class="logo"/></div>
<div class="text normal letter-spacing text-primary-300">{{version}}</div>
</div>
@import "../../../../sass/variables/colors";
$text-color: $white;
:host {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100px;
background-color: $white;
background-color: var(--vitamui-background);
align-items: center;
justify-content: center;
color: $text-color;
}
.version {
font-size: 12px;
line-height: 16px;
letter-spacing: 0.4px;
color: var(--vitamui-primary-300);
}
......@@ -12,7 +12,7 @@ import { ThemeService } from '../../theme.service';
})
export class FooterComponent implements OnInit {
public footerLogoUrl: SafeResourceUrl;
public version = 'v';
public version: string;
constructor(
private startupService: StartupService,
......@@ -21,11 +21,9 @@ export class FooterComponent implements OnInit {
) {}
ngOnInit() {
const versionRelease = this.startupService.getConfigStringValue(
'VERSION_RELEASE'
);
const versionRelease = this.startupService.getConfigStringValue( 'VERSION_RELEASE');
if (versionRelease) {
this.version = this.version + versionRelease;
this.version = 'v' + versionRelease;
}
this.footerLogoUrl = this.themeService.getData(
this.authService.user,
......
......@@ -59,6 +59,12 @@ body {
color: var(--vitamui-primary)!important;
}
.text-primary-300 {
color: var(--vitamui-primary-300)!important;
}
.text-secondary {
color: var(--vitamui-secondary)!important;
}
......
......@@ -143,3 +143,4 @@
<div class="vitamui-min-content">
<mat-spinner class="vitamui-spinner medium"></mat-spinner>
</div>
</ng-template>
......@@ -53,13 +53,14 @@ import fr.gouv.vitamui.ui.commons.security.SecurityConfig;
@Configuration
@EnableConfigurationProperties
@Import(value = { SecurityConfig.class, SwaggerConfiguration.class, RestExceptionHandler.class })
@Import(value = {SecurityConfig.class, SwaggerConfiguration.class, RestExceptionHandler.class})
public class IdentityContextConfiguration extends AbstractContextConfiguration {
@Bean
@ConditionalOnMissingBean
@DependsOn(value = { "uiProperties", "buildProperties" })
@DependsOn("uiProperties")
public IamExternalWebClientFactory iamWebClientFactory(final UIProperties uiProperties, final WebClient.Builder webClientBuilder) {
return new IamExternalWebClientFactory(uiProperties.getIamExternalClient(), webClientBuilder);
}
}
......@@ -14,6 +14,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
......@@ -36,6 +37,10 @@ public class CustomerControllerTest extends UiIdentityRestControllerTest<Custome
private static final String PREFIX = "/customers";
@MockBean
private BuildProperties buildProperties;
@Test
public void testGetCustomer() throws Exception {
super.testGetEntityById();
......
......@@ -6,6 +6,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
......@@ -29,6 +30,9 @@ public class OwnerControllerTest extends UiIdentityRestControllerTest<OwnerDto>
private static final String PREFIX = "/owners";
@MockBean
private BuildProperties buildProperties;
@Test
public void testCreateOwner() {
super.testCreateEntity();
......
......@@ -6,6 +6,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
......@@ -19,6 +20,9 @@ import fr.gouv.vitamui.identity.service.ProfileService;
@WebMvcTest(controllers = { ProfileController.class })
public class ProfileControllerTest extends UiIdentityRestControllerTest<ProfileDto> {
@MockBean
private BuildProperties buildProperties;
@Value("${ui-identity.prefix}")
protected String apiUrl;
......
......@@ -10,6 +10,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
......@@ -33,6 +34,10 @@ public class ProviderControllerTest extends UiIdentityRestControllerTest<Identit
@MockBean
private ProviderService service;
@MockBean
private BuildProperties buildProperties;
private static final VitamUILogger LOGGER = VitamUILoggerFactory.getInstance(ProviderControllerTest.class);
private static final String PREFIX = "/providers";
......
......@@ -4,7 +4,9 @@ import fr.gouv.vitamui.commons.api.domain.UserDto;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import fr.gouv.vitamui.commons.api.logger.VitamUILogger;
......@@ -22,6 +24,9 @@ public class SecurityControllerTest extends UiIdentityRestControllerTest<UserDto
private static final VitamUILogger LOGGER = VitamUILoggerFactory.getInstance(SecurityControllerTest.class);
@MockBean
private BuildProperties buildProperties;
@Test
public void testGetUserConnected() throws Exception {
super.testGetAllEntity();
......
......@@ -7,6 +7,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
......@@ -39,6 +40,9 @@ public class SubrogationControllerTest extends UIControllerTest<SubrogationDto>
@MockBean
private SubrogationService service;
@MockBean
private BuildProperties buildProperties;
private static final VitamUILogger LOGGER = VitamUILoggerFactory.getInstance(SubrogationControllerTest.class);
......
......@@ -42,6 +42,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
......@@ -70,6 +71,9 @@ public class TenantControllerTest extends UiIdentityRestControllerTest<TenantDto
private static final String PREFIX = "/tenants";
@MockBean
private BuildProperties buildProperties;
@Test
public void testCreateTenant() {
super.testCreateEntity();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment