Skip to content

Commit

Permalink
Merge pull request #88 from EmmanuelDemey/master
Browse files Browse the repository at this point in the history
zenika
  • Loading branch information
alicela authored Nov 27, 2019
2 parents db464de + 1079635 commit 1ce752f
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/.env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_API_BASE_HOST = './api'

REACT_APP_APPLICATIONS = "classifications,concepts,operations,dsds"
REACT_APP_APPLICATIONS = "concepts,classifications,operations,dsds"

5 changes: 4 additions & 1 deletion app/src/js/actions/operations/utils/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export function loadCodesList(notations, dispatch) {
results =>
dispatch({
type: A.LOAD_OPERATIONS_CODES_LIST_SUCCESS,
payload: results,
payload: {
codes: [],
...results,
},
}),
err =>
dispatch({
Expand Down
2 changes: 1 addition & 1 deletion app/src/js/actions/operations/utils/setup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('setup operations', () => {
await loadCodesList(['notation'], dispatch);
expect(dispatch).toHaveBeenLastCalledWith({
type: A.LOAD_OPERATIONS_CODES_LIST_SUCCESS,
payload: { id: 'notation', label: 'bbb' },
payload: { id: 'notation', label: 'bbb', codes: [] },
});
});
it('should call dispatch LOAD_OPERATIONS_CODES_LIST_FAILURE action with the right operation', async () => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function App() {
<ul className="home-page-links">
{apps}
<Auth roles={[ADMIN]}>
<li className="concepts">
<li className="bauhaus-app">
<Link to="/administration/roles">
<h2 className="items page-title page-title-link">
{D.authorizationManagementTitle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class RolesContainer extends Component {
}

componentDidMount() {
document.body.classList = ['concepts'];
document.body.classList = ['bauhaus-app'];
}
render() {
const { addRequested, deleteRequested } = this.state;
Expand Down
5 changes: 3 additions & 2 deletions app/src/js/applications/operations/families/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { Loading } from 'bauhaus-library';
import { AbstractSearchComponent } from 'js/applications/shared/advanced-search/home-container';
import api from 'js/remote-api/operations-api';

import { filterKeyDeburr } from 'js/utils/array-utils';
import { filterKeyDeburr, sortArray } from 'js/utils/array-utils';
import SearchList from 'js/applications/shared/advanced-search/home';
const filterLabel = filterKeyDeburr(['prefLabelLg1']);
const fields = ['prefLabelLg1'];
const sortByLabel = sortArray('prefLabelLg1');

class SearchFormList extends AbstractSearchComponent {
static defaultState = {
Expand Down Expand Up @@ -60,7 +61,7 @@ class SearchListContainer extends Component {
}
componentWillMount() {
api.getFamiliesSearchList().then(data => {
this.setState({ data });
this.setState({ data: sortByLabel(data) });
});
}

Expand Down
5 changes: 3 additions & 2 deletions app/src/js/applications/operations/indicators/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AbstractSearchComponent } from 'js/applications/shared/advanced-search/
import api from 'js/remote-api/operations-api';
import SelectRmes from 'js/applications/shared/select-rmes';
import { connect } from 'react-redux';
import { filterKeyDeburr } from 'js/utils/array-utils';
import { filterKeyDeburr, sortArray } from 'js/utils/array-utils';
import SearchList from 'js/applications/shared/advanced-search/home';
import { toSelectModel } from '../shared/utils/itemToSelectModel';

Expand All @@ -15,6 +15,7 @@ const filterCreator = filterKeyDeburr(['creator']);
const filterGestionnaire = filterKeyDeburr(['gestionnaire']);

const fields = ['prefLabelLg1', 'creator', 'gestionnaire'];
const sortByLabel = sortArray('prefLabelLg1');

class SearchFormList extends AbstractSearchComponent {
static defaultState = {
Expand Down Expand Up @@ -107,7 +108,7 @@ class SearchListContainer extends Component {
}
componentDidMount() {
api.getIndicatorsSearchList().then(data => {
this.setState({ data });
this.setState({ data: sortByLabel(data) });
});
}

Expand Down
5 changes: 3 additions & 2 deletions app/src/js/applications/operations/series/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import api from 'js/remote-api/operations-api';
import { connect } from 'react-redux';
import SelectRmes from 'js/applications/shared/select-rmes';

import { filterKeyDeburr } from 'js/utils/array-utils';
import { filterKeyDeburr, sortArray } from 'js/utils/array-utils';
import SearchList from 'js/applications/shared/advanced-search/home';
import { CL_SOURCE_CATEGORY } from 'js/actions/constants/codeList';
import { toSelectModel } from '../shared/utils/itemToSelectModel';
Expand All @@ -22,6 +22,7 @@ const fields = [
'dataCollector',
'gestionnaire',
];
const sortByLabel = sortArray('prefLabelLg1');

class SearchFormList extends AbstractSearchComponent {
static defaultState = {
Expand Down Expand Up @@ -176,7 +177,7 @@ class SearchListContainer extends Component {
}
componentWillMount() {
api.getSeriesSearchList().then(data => {
this.setState({ data });
this.setState({ data: sortByLabel(data) });
});
}

Expand Down
36 changes: 36 additions & 0 deletions app/src/js/reducers/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
import * as selector from './index';

describe('getLangs', () => {
it('should return the langs object', () => {
const input = {
app: {
lg1: 'lg1',
lg2: 'lg2',
},
};
const output = {
lg1: 'lg1',
lg2: 'lg2',
};
expect(selector.getLangs(input)).toEqual(output);
});
});
describe('getPermission', () => {
it('should return the permission object', () => {
const input = {
app: {
auth: {
type: 'authType',
user: {
roles: 'roles',
stamp: 'stamp',
},
},
},
};
const output = {
authType: 'authType',
roles: 'roles',
stamp: 'stamp',
};
expect(selector.getPermission(input)).toEqual(output);
});
});
describe('getFamily', () => {
it('should return an empty object if the value is undefined', () => {
const input = {};
Expand Down
11 changes: 11 additions & 0 deletions app/src/styles/_colors.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
body {
--color-1: transparent;
--color-2: transparent;
--color-3: transparent;
}
.operations {
--color-1: #a96d88;
--color-2: #7e375b;
Expand All @@ -18,3 +23,9 @@
--color-2: #784d49;
--color-3: #a36a64;
}

.bauhaus-app {
--color-1: #775e88;
--color-2: #5b4867;
--color-3: #45374e;
}

0 comments on commit 1ce752f

Please sign in to comment.