8000 2389 remove value by ThieryMichel · Pull Request #2504 · Inist-CNRS/lodex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

2389 remove value #2504

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

Merged
merged 20 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
20 changes: 15 additions & 5 deletions cypress/e2e/phase_4/annotation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('Annotation', () => {
).to.deep.equal([
'Home page',
'',
'comment',
'Dataset Description',
'[Doay]',
'',
Expand Down Expand Up @@ -104,6 +105,7 @@ describe('Annotation', () => {
).to.deep.equal([
'Resource URI',
'Resource title',
'Type',
'Field label',
'Field Id',
'Field Icons',
Expand All @@ -121,7 +123,7 @@ describe('Annotation', () => {

cy.findAllByRole('cell').then((cells) => {
const firstUri = cells[0].textContent;
const secondUri = cells[14].textContent;
const secondUri = cells[15].textContent;

expect(firstUri).to.match(/uid:\//);
expect(secondUri).to.match(/uid:\//);
Expand All @@ -131,6 +133,7 @@ describe('Annotation', () => {
).to.deep.equal([
firstUri,
'RoboCop',
'removal',
'rating',
'[bZE+]',
'',
Expand All @@ -145,6 +148,7 @@ describe('Annotation', () => {
new Date().toLocaleDateString(),
secondUri,
'Terminator 2',
'comment',
'actors',
'[K8Lu]',
'',
Expand All @@ -163,7 +167,7 @@ describe('Annotation', () => {
cy.findByText('RoboCop').click();

cy.findByRole('heading', {
name: /^Annotation: uid:\//,
name: /^Removal: uid:\//,
}).should('be.visible');
cy.findByRole('heading', {
name: 'RoboCop',
Expand Down Expand Up @@ -225,7 +229,7 @@ describe('Annotation', () => {

cy.findAllByRole('cell').then((cells) => {
const firstUri = cells[0].textContent;
const secondUri = cells[14].textContent;
const secondUri = cells[15].textContent;

expect(firstUri).to.match(/uid:\//);
expect(secondUri).to.match(/uid:\//);
Expand All @@ -235,6 +239,7 @@ describe('Annotation', () => {
).to.deep.equal([
firstUri,
'RoboCop',
'removal',
'rating',
'[bZE+]',
'',
Expand All @@ -249,6 +254,7 @@ describe('Annotation', () => {
new Date().toLocaleDateString(),
secondUri,
'Terminator 2',
'comment',
'actors',
'[K8Lu]',
'',
Expand Down Expand Up @@ -299,7 +305,7 @@ describe('Annotation', () => {

cy.findAllByRole('cell').then((cells) => {
const firstUri = cells[0].textContent;
const secondUri = cells[14].textContent;
const secondUri = cells[15].textContent;

expect(firstUri).to.match(/uid:\//);
expect(secondUri).to.match(/uid:\//);
Expand All @@ -309,6 +315,7 @@ describe('Annotation', () => {
).to.deep.equal([
firstUri,
'RoboCop',
'comment',
'rating',
'[bZE+]',
'',
Expand All @@ -323,6 +330,7 @@ describe('Annotation', () => {
new Date().toLocaleDateString(),
secondUri,
'Terminator 2',
'comment',
'actors',
'[K8Lu]',
'',
Expand All @@ -341,7 +349,7 @@ describe('Annotation', () => {
cy.findByText('Terminator 2').click();

cy.findByRole('heading', {
name: /^Annotation: uid:\//,
name: /^Comment: uid:\//,
}).should('be.visible');
cy.findByRole('heading', {
name: 'Terminator 2',
Expand Down Expand Up @@ -372,6 +380,7 @@ describe('Annotation', () => {
).to.deep.equal([
firstUri,
'RoboCop',
'comment',
'rating',
'[bZE+]',
'',
Expand Down Expand Up @@ -414,6 +423,7 @@ describe('Annotation', () => {
).to.deep.equal([
'Chart page',
'',
'comment',
'Répartition par réalisateurs uniques',
'[xkoP]',
'',
Expand Down
9 changes: 9 additions & 0 deletions cypress/support/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ function targetValue() {
}).click();
}

function chooseKindRemoval() {
cy.findByRole('menuitem', {
name: 'Remove some content',
timeout: 1500,
}).click();
}

function targetSection() {
cy.findByRole('menuitem', {
name: 'Comment the section',
Expand Down Expand Up @@ -100,6 +107,8 @@ export function createSingleValueAnnotation({

targetValue();

chooseKindRemoval();

fillComment(comment);
goToNextStep();
fillAuthor({ authorName, authorEmail });
Expand Down
1 change: 1 addition & 0 deletions src/api/controller/api/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const buildQuery = async ({
return {};
}
}
case 'kind':
case 'status': {
switch (filterOperator) {
case 'equals':
Expand Down
42 changes: 42 additions & 0 deletions src/api/controller/api/annotation.spec.js
10000
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
const ANNOTATIONS = [
{
resourceUri: 'uid:/65257776-4e3c-44f6-8652-85502a97e5ac',
kind: 'comment',
itemPath: [],
fieldId: 'GvaF',
authorName: 'Developer',
Expand All @@ -26,6 +27,7 @@ const ANNOTATIONS = [
},
{
resourceUri: 'uid:/2a8d429f-8134-4502-b9d3-d20c571592fa',
kind: 'comment',
itemPath: [],
fieldId: null,
authorName: 'John DOE',
Expand All @@ -38,6 +40,7 @@ const ANNOTATIONS = [
},
{
resourceUri: 'uid:/d4f1e376-d5dd-4853-b515-b7f63b34d67d',
kind: 'comment',
itemPath: [],
fieldId: null,
authorName: 'Jane SMITH',
Expand All @@ -50,6 +53,7 @@ const ANNOTATIONS = [
},
{
resourceUri: 'uid:/783f398d-0675-48d6-b851-137302820cf6',
kind: 'removal',
itemPath: [],
fieldId: null,
authorName: 'Jane SMITH',
Expand Down Expand Up @@ -1033,6 +1037,7 @@ describe('annotation', () => {
path: ['filterBy'],
options: [
'resource.title',
'kind',
'authorName',
'resourceUri',
'fieldId',
Expand All @@ -1054,6 +1059,43 @@ describe('annotation', () => {
data: [],
});
});

it('should allow to filter by kind', async () => {
const ctx = {
request: {
query: {
page: 0,
perPage: 2,
filterBy: 'kind',
filterOperator: 'equals',
filterValue: 'removal',
},
},
response: {},
annotation: annotationModel,
publishedDataset: publishedDatasetModel,
field: fieldModel,
};

await getAnnotations(ctx);

expect(ctx.response.status).toBe(200);

expect(ctx.body).toStrictEqual({
total: 1,
fullTotal: 1,
data: [
{
...annotationList[3],
resource: {
uri: annotationList[3].resourceUri,
title: 'A subresource',
},
field: field3,
},
],
});
});
});

describe('GET /annotations/:id', () => {
Expand Down
12 changes: 7 additions & 5 deletions src/app/custom/translations.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1247,23 +1247,25 @@
"annotation.authorEmail" "Email address" "Adresse e-mail"
"annotation.authorEmail_helpText" "The email address will allow us to contact you if needed" "L'e-mail permettra d'être contacté en cas de besoin"
"annotation_status" "Status" "Statut"
"annotation_kind" "Type" "Type"
"annotation_internal_comment" "Internal Comment" "Commentaire interne"
"annotation_administrator" "Administrator" "Gestionnaire"
"annotation_header" "Annotation:" "Annotation :"
"annotation_header_removal" "Removal:" "Suppression :"
"annotation_header_comment" "Comment:" "Commentaire :"
"annotation_status_to_review" "To Review" "À Traiter"
"annotation_status_ongoing" "Ongoing" "En cours"
"annotation_status_validated" "Validated" "Validée"
"annotation_status_rejected" "Rejected" "Refusée"
<<<<<<< HEAD
"annotation_correct_value" Correct "%{value}" Corriger "%{value}"
"annotation_remove_value" Remove "%{value}" Retirer "%{value}"
"annotation_choose_value" "Choose value to comment" "Choisir la valeur à commenter"
"annotation_error_empty_initial_value" "This field must be empty when comment targets the field" "Ce champ doit rester vide quand le commentaire cible le champ"
"annotation_error_required_initial_value" "This field is required when comment targets the value" "Ce champ est requis quand le commentaire cible la valeur"
"annotation_form_title" "Edit annotation" "Modifier l'annotation"
=======
"annotation_form_title" "Edit annotation" "Modifier l'annotation"
"annotation_delete_button_label" "Delete the annotation" "Supprimer l'annotation"
"annotation_delete_modal_title" "Are you sure you want to delete this annotation ?" "Êtes-vous sûr de vouloir supprimer cette annotation ?"
"annotation_delete_success" "The annotation has been deleted." "L'annotation a été supprimée."
"annotation_delete_error" "An error occured while deleteing this annotation, please try again later." "Une erreur est survenue lors de la supression de l'annotation, merci de réessayer ultérieurement."
>>>>>>> 7dc52990c (Feat(annotation): Add annotation deletion support)
"annotation_remove_content" "Remove some content" "Retirer du contenu"
"removal" "Removal" "Suppression"
"comment" "Comment" "Commentaire"
14 changes: 9 additions & 5 deletions src/app/js/admin/annotations/AnnotationDetail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('AnnotationDetail', () => {
resource: {
title: 'The resource title',
},
kind: 'comment',
comment: 'Just testing the annotation system',
status: 'ongoing',
internalComment: 'Just testing the annotation admin',
Expand All @@ -62,7 +63,7 @@ describe('AnnotationDetail', () => {

expect(
wrapper.getByRole('heading', {
name: 'annotation_header uid:/1234',
name: 'annotation_header_comment uid:/1234',
}),
).toBeInTheDocument();

Expand Down Expand Up @@ -168,6 +169,7 @@ describe('AnnotationDetail', () => {
data: {
resourceUri: null,
resource: null,
kind: 'comment',
comment: 'Just testing the annotation system',
field: {
name: 'GaZr',
Expand All @@ -185,7 +187,7 @@ describe('AnnotationDetail', () => {

expect(
wrapper.getByRole('heading', {
name: 'annotation_header annotation_home_page',
name: 'annotation_header_comment annotation_home_page',
}),
).toBeInTheDocument();

Expand All @@ -199,6 +201,7 @@ describe('AnnotationDetail', () => {
data: {
resourceUri: 'uid:/404',
resource: null,
kind: 'comment',
comment: 'Just testing the annotation system',
field: {
name: 'GaZr',
Expand All @@ -216,7 +219,7 @@ describe('AnnotationDetail', () => {

expect(
wrapper.getByRole('heading', {
name: 'annotation_header uid:/404',
BE96 name: 'annotation_header_comment uid:/404',
}),
).toBeInTheDocument();

Expand All @@ -238,6 +241,7 @@ describe('AnnotationDetail', () => {
resource: {
title: 'The resource title',
},
kind: 'comment',
comment: 'Just testing the annotation system',
field: null,
createdAt: new Date('01-01-2025').toISOString(),
Expand All @@ -250,7 +254,7 @@ describe('AnnotationDetail', () => {

expect(
wrapper.getByRole('heading', {
name: 'annotation_header uid:/1234',
name: 'annotation_header_comment uid:/1234',
}),
).toBeInTheDocument();

Expand Down Expand Up @@ -278,7 +282,7 @@ describe('AnnotationDetail', () => {

expect(
wrapper.queryByRole('heading', {
name: 'annotation_header uid:/1234',
name: 'annotation_header_comment uid:/1234',
}),
).not.toBeInTheDocument();

Expand Down
16 changes: 16 additions & 0 deletions src/app/js/admin/annotations/AnnotationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { StatusFilter } from './filters/StatusFilter';
import { useGetAnnotations } from './hooks/useGetAnnotations';
import { ResourceTitleCell } from './ResourceTitleCell';
import { ResourceUriCell } from './ResourceUriCell';
import { KindFilter } from './filters/KindFilter';

const AnnotationListToolBar = () => {
const { translate } = useTranslate();
Expand Down Expand Up @@ -116,6 +117,21 @@ export const AnnotationList = () => {
return <ResourceTitleCell row={row} />;
},
},
{
field: 'kind',
headerName: translate('annotation_kind'),
flex: 1,
sortable: true,
filterOperators: getGridStringOperators()
.filter((operator) => operator.value === 'equals')
.map((operator) => ({
...operator,
InputComponent: KindFilter,
})),
renderCell: ({ value }) => {
return <CellWithTooltip value={value} />;
},
},
{
field: 'field.label',
headerName: translate('annotation_field_label'),
Expand Down
Loading
Loading
0