Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate some files #942

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"react-app/jest"
],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"jest-dom/prefer-to-have-attribute": "off",
"jest/valid-title": "off",
"testing-library/no-container": "off",
Expand Down
7 changes: 7 additions & 0 deletions src/packages/model/operations/family.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ export type Family = {
prefLabelLg2?: string;
validationState: ValidationState;
};

export type FamilyHome = {};

export type FamilyAdvancedSearch = {
id: string;
prefLabelLg1: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const CreationContainer = () => {

useEffect(() => {
Promise.all([ConceptsApi.getConceptList()])
.then(([conceptsList, stampsList]) => {
.then(([conceptsList]) => {
setConcepts(sortArrayByLabel(conceptsList));
})
.finally(() => setLoading(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class LinksEdition extends Component {
/>
);

const tabs = linkTypes.map(({ title, memberType }, i) => (
const tabs = linkTypes.map(({ title }, i) => (
<Tab key={title} eventKey={i} title={title} style={{ marginTop: '20px' }}>
{title !== D1.equivalentTitle ? (
<ConceptToLink
Expand Down
2 changes: 1 addition & 1 deletion src/packages/modules-datasets/distributions/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useGoBack } from '../../utils/hooks/useGoBack';
import { useTitle } from '../../utils/hooks/useTitle';
import { DistributionApi } from '../../sdk';

export const DistributionEdit = (props) => {
export const DistributionEdit = () => {
const { id } = useParams();
const isEditing = !!id;

Expand Down
8 changes: 1 addition & 7 deletions src/packages/modules-datasets/distributions/view/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ import { useGoBack } from '../../../utils/hooks/useGoBack';
import { ADMIN, DATASET_CONTRIBUTOR } from '../../../auth/roles';
import { usePermission } from '../../../redux/hooks/usePermission';

export const ViewMenu = ({
distribution,
dataset,
onPublish,
onDelete,
...props
}) => {
export const ViewMenu = ({ distribution, dataset, onPublish, onDelete }) => {
const goBack = useGoBack();

const permission = usePermission();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import { useTitle } from '../../utils/hooks/useTitle';
import { OperationsApi } from '../../sdk/operations-api';
import { sortArray } from '../../utils/array-utils';
import { ADMIN } from '../../auth/roles';
import { FamilyHome } from '../../model/operations/family';

export const FamiliesHomeContainer = () => {
const [loading, setLoading] = useState(true);
const [families, setFamilies] = useState([]);
const [families, setFamilies] = useState<FamilyHome[]>([]);
useTitle(D.operationsTitle, D.familiesTitle);

useEffect(() => {
OperationsApi.getAllFamilies()
.then((results) => setFamilies(sortArray('label')(results)))
.then((results: FamilyHome[]) => setFamilies(sortArray('label')(results)))
.finally(() => setLoading(false));
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import useUrlQueryParameters from '../..//utils/hooks/useUrlQueryParameters';
import { useTitle } from '../../utils/hooks/useTitle';
import { OperationsApi } from '../../sdk/operations-api';
import { filterKeyDeburr } from '../../utils/array-utils';
import { FamilyAdvancedSearch } from '../../model/operations/family';

const filterLabel = filterKeyDeburr(['prefLabelLg1']);

const defaultFormState = {
prefLabelLg1: '',
};

const SearchFormList = ({ data }) => {
const SearchFormList = ({
data,
}: Readonly<{ data: FamilyAdvancedSearch[] }>) => {
const { form, reset, handleChange } = useUrlQueryParameters(defaultFormState);

const { prefLabelLg1 } = form;
Expand Down Expand Up @@ -50,7 +53,7 @@ const SearchFormList = ({ data }) => {

const SearchListContainer = () => {
useTitle(D.familiesTitle + ' - ' + D.operationsTitle, D.advancedSearch);
const [data, setData] = useState();
const [data, setData] = useState<FamilyAdvancedSearch[]>();

useEffect(() => {
OperationsApi.getAllFamiliesForAdvancedSearch().then(setData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ describe('FamilyInformation', () => {
abstractLg1: 'descriptionLg1',
};
const { container } = render(
<OperationsFamilyVisualization attr={attr} langs={locales} />
<OperationsFamilyVisualization
attr={attr}
langs={locales}
secondLang={false}
/>
);
expect(container.querySelectorAll('.wilco-note')).toHaveLength(4);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ import {
} from '../../../components';
import { renderMarkdownElement } from '../../../utils/html-utils';
import { useTitle } from '../../../utils/hooks/useTitle';

type OperationsFamilyVisualizationTypes = {
attr: any;
langs: { lg1: string; lg2: string };
secondLang: boolean;
};
function OperationsFamilyVisualization({
attr,
langs: { lg1, lg2 },
secondLang,
}) {
}: Readonly<OperationsFamilyVisualizationTypes>) {
useTitle(D.familiesTitle + ' - ' + D.operationsTitle, attr?.prefLabelLg1);

return (
Expand Down Expand Up @@ -73,9 +79,9 @@ function OperationsFamilyVisualization({
</Row>
<RelationsView
children={attr.series}
childrenTitle={'childrenSeries'}
childrenTitle="childrenSeries"
childrenPath="series"
title={'linksTitle'}
title="linksTitle"
langs={{ lg1, lg2 }}
secondLang={secondLang}
/>
Expand Down