Commit b7b4d339 authored by Kevin Robert's avatar Kevin Robert
Browse files

Prise en compte des remarques de PR.

parent 24c21542
......@@ -7,7 +7,7 @@
</ol>
<!-- Tabs-->
<ul class="px-4 py-2 border-b md:flex md:justify-center md:text-center md:py-0">
<tab-item v-for="tab in tabs()" :title="tab.title" :link="tab.link" :state="tab.isCurrent ? 'current' : ''" />
<tab-item v-for="(tab, index) in tabs()" :key="index" :title="tab.title" :link="tab.link" :state="tab.isCurrent ? 'current' : ''" />
</ul>
</nav>
<login username="Bob" />
......
......@@ -2,17 +2,12 @@ import { Store } from 'vuex';
import axios from 'axios';
import VueI18n from 'vue-i18n';
import TranslationService from '@/locale/translation.service';
import { TABS } from '@/shared/service/tabs-constants';
const filArianeBaseApiUrl = 'api/filariane';
export default class HeaderService {
public static readonly TAB_KEY_SETTINGS = 'settings';
public static readonly TAB_KEY_VIEW = 'view';
public static readonly TAB_KEY_VARIABLE = 'variable';
public static readonly TAB_KEY_WORKSPACES = 'workspaces';
public static readonly TAB_KEY_USERS= 'users';
constructor(private store: Store<any>, private translationService: TranslationService, private i18n: VueI18n) {
this.translationService.refreshTranslation(this.store.getters.currentLanguage);
}
......@@ -22,12 +17,12 @@ export default class HeaderService {
{
title: this.i18n.t('onglets.parametrages'),
link: `/admin/workspace/${workspaceId}/settings`,
isCurrent: currentKey === HeaderService.TAB_KEY_SETTINGS,
isCurrent: currentKey === TABS.KEY_SETTINGS,
},
{
title: this.i18n.t('onglets.forms'),
link: `/admin/workspace/${workspaceId}/view`,
isCurrent: currentKey === HeaderService.TAB_KEY_VIEW,
isCurrent: currentKey === TABS.KEY_VIEW,
},
];
this.store.commit('tabs', tabs);
......@@ -38,17 +33,17 @@ export default class HeaderService {
{
title: this.i18n.t('onglets.parametrages'),
link: `/admin/workspace/${workspaceId}/form/${formId}/settings`,
isCurrent: currentKey === HeaderService.TAB_KEY_SETTINGS,
isCurrent: currentKey === TABS.KEY_SETTINGS,
},
{
title: this.i18n.t('onglets.edition'),
link: `/admin/workspace/${workspaceId}/form/${formId}/view`,
isCurrent: currentKey === HeaderService.TAB_KEY_VIEW,
isCurrent: currentKey === TABS.KEY_VIEW,
},
{
'title': this.i18n.t('variable.onglets.list'),
'link': `/admin/workspace/${workspaceId}/form/${formId}/variable/list`,
'isCurrent': currentKey === HeaderService.TAB_KEY_VARIABLE
'isCurrent': currentKey === TABS.KEY_VARIABLE
},
];
this.store.commit('tabs', tabs);
......@@ -59,12 +54,12 @@ export default class HeaderService {
{
title: this.i18n.t('onglets.workspaces'),
link: '/admin/workspace/list',
isCurrent: currentTab === HeaderService.TAB_KEY_WORKSPACES,
isCurrent: currentTab === TABS.KEY_WORKSPACES,
},
{
title: this.i18n.t('onglets.utilisateurs'),
link: '/admin/user/list',
isCurrent: currentTab === HeaderService.TAB_KEY_USERS,
isCurrent: currentTab === TABS.KEY_USERS,
},
];
this.store.commit('tabs', tabs);
......
export const TABS = {
KEY_SETTINGS: 'settings',
KEY_VIEW: 'view',
KEY_VARIABLE: 'variable',
KEY_WORKSPACES: 'workspaces',
KEY_USERS: 'users',
};
......@@ -9,6 +9,7 @@ import OaButton from '@/components/button/oa-button.vue';
import AdminUsersTable from '@/components/table/admin-users-table.vue';
import HeaderService from '@/shared/service/header-service';
import { IUser } from '@/shared/model/user.model';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -37,7 +38,7 @@ export default class FormSettings extends Vue {
next(vm => {
vm.headerService().filArianeForForm(to.params.idForm);
if (to.params.idForm) {
vm.headerService().updateTabsForFormId(to.params.idWorkspace, to.params.idForm, HeaderService.TAB_KEY_SETTINGS);
vm.headerService().updateTabsForFormId(to.params.idWorkspace, to.params.idForm, TABS.KEY_SETTINGS);
vm.retrieveForm(to.params.idForm);
vm.retrieveAuthorizedUsers(to.params.idForm);
}
......
......@@ -4,6 +4,7 @@ import Toolbar from '@/components/toolbar/toolbar.vue';
import { Inject } from 'vue-property-decorator';
import UserManagementService from '@/admin/user-management/user-management.service';
import HeaderService from '@/shared/service/header-service';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -25,7 +26,7 @@ export default class UserList extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.headerService().filArianeForHome();
vm.headerService().updateTabsForAdmin(HeaderService.TAB_KEY_USERS);
vm.headerService().updateTabsForAdmin(TABS.KEY_USERS);
});
}
......
import Vue from 'vue';
import Component from 'vue-class-component';
import {Inject} from 'vue-property-decorator';
import { Inject } from 'vue-property-decorator';
import VariableService from '@/entities/variable/variable.service';
import {IVariable, Variable} from '@/shared/model/variable.model';
import { IVariable, Variable } from '@/shared/model/variable.model';
import HeaderService from '@/shared/service/header-service';
import OaInput from '@/components/forms/input/oa-input.vue';
import OaTextarea from '@/components/forms/textarea/oa-textarea.vue';
import OaButton from '@/components/button/oa-button.vue';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -34,7 +35,7 @@ export default class VariableEdit extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.headerService().updateTabsForFormId(to.params.idWorkspace, to.params.idForm, HeaderService.TAB_KEY_VARIABLE);
vm.headerService().updateTabsForFormId(to.params.idWorkspace, to.params.idForm, TABS.KEY_VARIABLE);
let idVariable = to.params.idVariable;
vm.variable.formId = to.params.idForm;
if (idVariable) {
......
......@@ -4,7 +4,8 @@ import HeaderService from '@/shared/service/header-service';
import VariableService from '@/entities/variable/variable.service';
import Toolbar from '@/components/toolbar/toolbar.vue';
import Icon from '@/components/icon/icon.vue';
import {IVariable} from "@/shared/model/variable.model";
import { IVariable } from '@/shared/model/variable.model';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -33,7 +34,7 @@ export default class VariableList extends Vue {
next(vm => {
vm.idForm = to.params.idForm;
vm.idWorkspace = to.params.idWorkspace;
vm.headerService().updateTabsForFormId(vm.idWorkspace, vm.idForm, HeaderService.TAB_KEY_VARIABLE);
vm.headerService().updateTabsForFormId(vm.idWorkspace, vm.idForm, TABS.KEY_VARIABLE);
vm.loadAll(to.params.idForm)
});
}
......
......@@ -4,6 +4,7 @@ import WorkspaceService from '@/entities/workspace/workspace.service';
import Card from '@/components/card/card.vue';
import Toolbar from '@/components/toolbar/toolbar.vue';
import HeaderService from '@/shared/service/header-service';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -35,7 +36,7 @@ export default class WorkspaceList extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.retrieveWorkspace();
vm.headerService().updateTabsForAdmin(HeaderService.TAB_KEY_WORKSPACES);
vm.headerService().updateTabsForAdmin(TABS.KEY_WORKSPACES);
vm.headerService().filArianeForHome();
});
}
......
......@@ -9,6 +9,7 @@ import OaButton from '@/components/button/oa-button.vue';
import AdminUsersTable from '@/components/table/admin-users-table.vue';
import HeaderService from '@/shared/service/header-service';
import { IUser } from '@/shared/model/user.model';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -38,7 +39,7 @@ export default class WorkspaceSettings extends Vue {
if (to.params.idWorkspace) {
vm.retrieveWorkspace(to.params.idWorkspace);
vm.retrieveAuthorizedUsers(to.params.idWorkspace);
vm.headerService().updateTabsForWorkspaceId(to.params.idWorkspace, HeaderService.TAB_KEY_SETTINGS);
vm.headerService().updateTabsForWorkspaceId(to.params.idWorkspace, TABS.KEY_SETTINGS);
vm.headerService().filArianeForWorkspace(to.params.idWorkspace);
}
});
......
......@@ -5,6 +5,7 @@ import Card from '@/components/card/card.vue';
import Toolbar from '@/components/toolbar/toolbar.vue';
import FormService from '@/entities/form/form.service';
import HeaderService from '@/shared/service/header-service';
import { TABS } from '@/shared/service/tabs-constants';
@Component({
components: {
......@@ -38,7 +39,7 @@ export default class WorkspaceView extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.retrieveWorkspace(to.params.idWorkspace);
vm.headerService().updateTabsForWorkspaceId(to.params.idWorkspace, HeaderService.TAB_KEY_VIEW);
vm.headerService().updateTabsForWorkspaceId(to.params.idWorkspace, TABS.KEY_VIEW);
vm.headerService().filArianeForWorkspace(to.params.idWorkspace);
});
}
......
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