Skip to content

Commit

Permalink
v1.202.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
varovaro committed Feb 24, 2025
2 parents 076955f + 4d42a55 commit aff2954
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 22 deletions.
8 changes: 1 addition & 7 deletions app/react/Forms/components/MultiSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable max-classes-per-file */
/* eslint-disable class-methods-use-this,max-lines */

import { Link } from 'react-router';
import ShowIf from 'app/App/ShowIf';
import { filterOptions } from 'shared/optionsUtils';
import { t, Translate } from 'app/I18N';
Expand Down Expand Up @@ -367,11 +365,7 @@ abstract class MultiSelectBase<ValueType> extends Component<
</span>
<span className="multiselectItem-name" onClick={clickEvent}>
<CustomIcon className="item-icon" data={option.icon} />
{this.state.serverSideRender && option.url ? (
<Link to={option.url}>{option[optionsLabel]}</Link>
) : (
option[optionsLabel]
)}
{option[optionsLabel]}
</span>
&nbsp;
</label>
Expand Down
24 changes: 19 additions & 5 deletions app/react/Library/LibraryLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ import { LibraryFooter } from './components/LibraryFooter';

class LibraryLayoutBase extends Component {
render() {
const { className, children, quickLabelThesaurus, sidePanelMode, scrollCallback, scrollCount } =
this.props;
const {
className,
children,
quickLabelThesaurus,
sidePanelMode,
scrollCallback,
scrollCount,
noindex,
} = this.props;
const contentDivClass = `${
quickLabelThesaurus ? 'with-header ' : ''
} content-holder library-viewer document-viewer with-footer with-panel ${sidePanelMode} ]`;
Expand All @@ -25,6 +32,7 @@ class LibraryLayoutBase extends Component {
<div className="row panels-layout" data-testid="library-content">
<Helmet>
<title>{t('System', 'Library', null, false)}</title>
{noindex && <meta name="robots" content="noindex" />}
</Helmet>
{quickLabelThesaurus && <QuickLabelHeader />}
<div className={contentDivClass} onScroll={scrollCallback}>
Expand Down Expand Up @@ -59,10 +67,16 @@ LibraryLayoutBase.propTypes = {
sidePanelMode: PropTypes.string,
scrollCallback: PropTypes.instanceOf(Function),
scrollCount: PropTypes.number,
noindex: PropTypes.bool.isRequired,
};

export { LibraryLayoutBase };

export default connect(state => ({
quickLabelThesaurus: state.library.sidepanel.quickLabelState.get('thesaurus'),
}))(LibraryLayoutBase);
export default connect(state => {
const filters = state.library.search.filters;
const noindex = filters && Object.keys(filters).length > 0;
return {
quickLabelThesaurus: state.library.sidepanel.quickLabelState.get('thesaurus'),
noindex,
};
})(LibraryLayoutBase);
9 changes: 6 additions & 3 deletions app/react/Relationships/actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,12 @@ function saveRelationships() {
])
)
.then(([response, parentEntity]) => {
dispatch(actions.set('entityView/entity', parentEntity));
dispatch(actions.set('viewer/doc', parentEntity));

if (parentEntity.documents?.length) {
const defaultDoc = getState().documentViewer.doc.get('defaultDoc');
dispatch(actions.set('viewer/doc', { ...parentEntity, defaultDoc }));
} else {
dispatch(actions.set('entityView/entity', parentEntity));
}
dispatch(uiActions.closePanel());
dispatch(
edit(
Expand Down
61 changes: 55 additions & 6 deletions app/react/Relationships/actions/specs/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { fromJS as Immutable } from 'immutable';
import { mockID } from 'shared/uniqueID.js';
import { RequestParams } from 'app/utils/RequestParams';
import SearchApi from 'app/Search/SearchAPI';

import api from 'app/utils/api';
import * as types from '../actionTypes';
import * as actions from '../actions';

import * as routeUtils from '../../utils/routeUtils';

const middlewares = [thunk];
Expand Down Expand Up @@ -235,6 +233,13 @@ describe('Relationships actions', () => {
describe('saveRelationships', () => {
let store;
let hubs;
let entity = {
_id: '1',
sharedId: 'entityId',
entity: 'fullEntity',
searchResults: 'storeSearchResults',
};
let defaultDoc;

function getState() {
return {
Expand All @@ -246,6 +251,9 @@ describe('Relationships actions', () => {
},
hubs,
},
documentViewer: {
doc: Immutable({ ...entity, ...(defaultDoc && { defaultDoc, documents: [defaultDoc] }) }),
},
};
}

Expand Down Expand Up @@ -313,7 +321,7 @@ describe('Relationships actions', () => {
]);

spyOn(api, 'post').and.returnValue(Promise.resolve('POSTresponse'));
spyOn(api, 'get').and.returnValue(Promise.resolve({ json: { rows: ['entity'] } }));
spyOn(api, 'get').and.returnValue(Promise.resolve({ json: { rows: [entity] } }));
spyOn(routeUtils, 'requestState').and.returnValue(
Promise.resolve(['reloadedConnectionsGroups', 'reloadedSearchResults'])
);
Expand All @@ -332,8 +340,49 @@ describe('Relationships actions', () => {
value: 'reloadedConnectionsGroups',
},
{ type: 'relationships/list/searchResults/SET', value: 'reloadedSearchResults' },
{ type: 'entityView/entity/SET', value: 'entity' },
{ type: 'viewer/doc/SET', value: 'entity' },
{ type: 'entityView/entity/SET', value: entity },
{ type: 'CLOSE_RELATIONSHIPS_PANEL' },
{
type: 'EDIT_RELATIONSHIPS',
value: false,
results: 'storeSearchResults',
parentEntity: 'fullEntity',
editing: false,
},
{ type: 'SAVED_RELATIONSHIPS', response: 'POSTresponse' },
{
type: 'NOTIFY',
notification: { message: 'Relationships saved', type: 'success', id: 'unique_id' },
},
{
type: 'SET_REFERENCES',
references: {
rows: [entity],
},
},
]);
done();
});
});

it('should update the store to update the document viewer if the entity has document', done => {
defaultDoc = { _id: '1', title: 'MyDoc' };
entity.documents = [defaultDoc];

actions
.saveRelationships()(store.dispatch, getState)
.then(() => {
expect(store.getActions()).toEqual([
{ type: types.SAVING_RELATIONSHIPS },
{
type: 'relationships/list/connectionsGroups/SET',
value: 'reloadedConnectionsGroups',
},
{ type: 'relationships/list/searchResults/SET', value: 'reloadedSearchResults' },
{
type: 'viewer/doc/SET',
value: { ...entity, defaultDoc: Immutable(defaultDoc) },
},
{ type: 'CLOSE_RELATIONSHIPS_PANEL' },
{
type: 'EDIT_RELATIONSHIPS',
Expand All @@ -350,7 +399,7 @@ describe('Relationships actions', () => {
{
type: 'SET_REFERENCES',
references: {
rows: ['entity'],
rows: [entity],
},
},
]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uwazi",
"version": "1.201.0-rc3",
"version": "1.202.0-rc1",
"description": "Uwazi is a free, open-source solution for organising, analysing and publishing your documents.",
"keywords": [
"react"
Expand Down

0 comments on commit aff2954

Please sign in to comment.