Commit 14f7e90c authored by François-Xavier Lebastard's avatar François-Xavier Lebastard
Browse files

Merge branch 'develop' of gitlab.univ-nantes.fr:sigpublic/unantes-orientation-active into develop

parents 1a289670 9cfc2617
......@@ -5,7 +5,7 @@
<groupId>com.unantes.orientactive</groupId>
<artifactId>orientactive</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Unantes Orientation Active</name>
......
......@@ -5,19 +5,6 @@ import TranslationService from '@/locale/translation.service';
export default class AccountService {
constructor(private store: Store<any>, private translationService: TranslationService, private router: VueRouter) {
this.init();
}
public init(): void {
this.retrieveProfiles();
}
public retrieveProfiles(): void {
axios.get('management/info').then(res => {
if (res.data && res.data.activeProfiles) {
this.store.commit('setActiveProfiles', res.data['activeProfiles']);
}
});
}
public retrieveAccount(): Promise<boolean> {
......
......@@ -58,12 +58,4 @@ export default class JhiNavbar extends Vue {
});
return this.hasAnyAuthorityValue;
}
public get swaggerEnabled(): boolean {
return this.$store.getters.activeProfiles.indexOf('swagger') > -1;
}
public get inProduction(): boolean {
return this.$store.getters.activeProfiles.indexOf('prod') > -1;
}
}
......@@ -93,10 +93,6 @@
<font-awesome-icon icon="tasks" />
<span v-text="$t('global.menu.admin.logs')">Logs</span>
</b-dropdown-item>
<b-dropdown-item v-if="swaggerEnabled" to="/admin/docs" active-class="active">
<font-awesome-icon icon="book" />
<span v-text="$t('global.menu.admin.apidocs')">API</span>
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item-dropdown id="languagesnavBarDropdown" right v-if="languages && Object.keys(languages).length > 1">
<span slot="button-content">
......
......@@ -5,13 +5,11 @@ export const accountStore: Module<any, any> = {
logon: false,
userIdentity: null,
authenticated: false,
activeProfiles: '',
},
getters: {
logon: state => state.logon,
account: state => state.userIdentity,
authenticated: state => state.authenticated,
activeProfiles: state => state.activeProfiles,
},
mutations: {
authenticate(state) {
......@@ -27,8 +25,5 @@ export const accountStore: Module<any, any> = {
state.authenticated = false;
state.logon = false;
},
setActiveProfiles(state, profile) {
state.activeProfiles = profile;
},
},
};
......@@ -12,7 +12,7 @@
<link href="./content/images/icons/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png">
<link href="./content/images/icons/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png">
<link href="./manifest.webapp" rel="manifest"/>
<link href="./content/css/form.css" rel="stylesheet">
<link href="/content/css/form.css" rel="stylesheet">
<!-- jhipster-needle-add-resources-to-root - JHipster will add new resources here -->
</head>
<body>
......
......@@ -26,19 +26,6 @@ describe('Account Service test suite', () => {
i18n = config.initI18N(localVue);
});
it('should init service and do not retrieve account', async () => {
mockedAxios.get.mockReturnValue(Promise.resolve({data: {activeProfiles: ['dev', 'test']}}));
accountService = await new AccountService(store, new TranslationService(store, i18n), router);
expect(store.getters.logon).toBe(false);
expect(accountService.authenticated).toBe(false);
expect(store.getters.account).toBe(null);
expect(mockedAxios.get).toHaveBeenCalledWith('management/info');
expect(store.getters.activeProfiles[0]).toBe('dev');
expect(store.getters.activeProfiles[1]).toBe('test');
});
it('should init service and retrieve profiles if already logged in before but no account found', async () => {
localStorage.setItem('jhi-authenticationToken', 'token');
......@@ -49,7 +36,6 @@ describe('Account Service test suite', () => {
expect(store.getters.logon).toBe(false);
expect(accountService.authenticated).toBe(false);
expect(store.getters.account).toBe(null);
expect(mockedAxios.get).toHaveBeenCalledWith('management/info');
});
it('should init service and retrieve profiles if already logged in before but exception occurred and should be logged out', async () => {
......@@ -61,7 +47,6 @@ describe('Account Service test suite', () => {
expect((<any>router).history.current.fullPath).toBe('/');
expect(accountService.authenticated).toBe(false);
expect(store.getters.account).toBe(null);
expect(mockedAxios.get).toHaveBeenCalledWith('management/info');
});
it('should init service and check for authority after retrieving account but getAccount failed', async () => {
......
......@@ -186,13 +186,6 @@ describe('Metrics Component', () => {
classesUnloaded: 0.0,
},
services: {
'/management/info': {
GET: {
max: 0.0,
mean: 104.952893,
count: 1,
},
},
'/api/authenticate': {
POST: {
max: 0.0,
......
......@@ -46,8 +46,6 @@ describe('JhiNavbar', () => {
it('should not have user data set', () => {
expect(jhiNavbar.authenticated).toBeFalsy();
expect(jhiNavbar.swaggerEnabled).toBeFalsy();
expect(jhiNavbar.inProduction).toBeFalsy();
});
it('should have user data set after authentication', () => {
......@@ -56,13 +54,6 @@ describe('JhiNavbar', () => {
expect(jhiNavbar.authenticated).toBeTruthy();
});
it('should have profile info set after info retrieved', () => {
store.commit('setActiveProfiles', ['prod', 'swagger']);
expect(jhiNavbar.swaggerEnabled).toBeTruthy();
expect(jhiNavbar.inProduction).toBeTruthy();
});
it('should use login service', () => {
jhiNavbar.openLogin();
expect(loginService.openLogin).toHaveBeenCalled();
......
Markdown is supported
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