Skip to content

Commit

Permalink
Merge pull request #2070 from clari182/feature/new-submission-list
Browse files Browse the repository at this point in the history
Feature/new submission list
  • Loading branch information
kepae authored Sep 22, 2023
2 parents 6107e63 + 8f82146 commit 3f856e1
Show file tree
Hide file tree
Showing 30 changed files with 1,788 additions and 381 deletions.
415 changes: 209 additions & 206 deletions site/gatsby-site/cypress/e2e/integration/apps/submitted.cy.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions site/gatsby-site/cypress/e2e/integration/pages.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ describe('Pages', () => {
if (selectorExists) {
cy.get('[data-cy="cloudinary-image-wrapper"]').each(($el) => {
cy.wrap($el)
.scrollIntoView()
.find('[data-cy="cloudinary-image"]')
.should('have.attr', 'src')
.then(($src) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ describe('Social Share buttons on pages', { retries: { runMode: 4 } }, () => {

cy.get('[data-cy=btn-share-twitter]').first().click();
cy.get('@popup_twitter', { timeout: 8000 }).should('be.called');
cy.url().should(
'contain',
`https://twitter.com/i/flow/login?redirect_after_login=%2Fintent%2Ftweet%3Ftext%3D`
);
cy.url().should('contain', `url%3D${encodeURIComponent(canonicalUrl)}`);
});

Expand Down
33 changes: 3 additions & 30 deletions site/gatsby-site/cypress/e2e/integration/submit.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { isArray } from 'lodash';
import { arrayToList } from '../../../src/utils/typography';
import parseNews from '../../fixtures/api/parseNews.json';
import semanticallyRelated from '../../fixtures/api/semanticallyRelated.json';
import probablyRelatedIncidents from '../../fixtures/incidents/probablyRelatedIncidents.json';
Expand Down Expand Up @@ -401,41 +399,16 @@ describe('The Submit form', () => {

cy.contains('Report successfully added to review queue').should('exist');

cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

cy.visit('/apps/submitted');

cy.wait('@findSubmissions');

cy.contains(
'[data-cy="submission"]',
'[data-cy="row"]',
'YouTube to crack down on inappropriate content masked as kids’ cartoons'
).should('exist');
cy.get('[data-cy="submission"] [data-cy="review-button"]').click();

const expectedValues = {
_id: '6272f2218933c7a9b512e13b',
text: 'Something',
submitters: 'Something',
authors: 'Valentina Palladino',
incident_date: '2021-09-21',
date_published: '2017-11-10',
image_url:
'https://cdn.arstechnica.net/wp-content/uploads/2017/11/Screen-Shot-2017-11-10-at-9.25.47-AM-760x380.png',
incident_ids: [1],
url: `https://www.arstechnica.com/gadgets/2017/11/youtube-to-crack-down-on-inappropriate-content-masked-as-kids-cartoons/`,
source_domain: 'arstechnica.com',
language: 'en',
editor_notes: 'Here are some notes',
};

for (let key in expectedValues) {
cy.get(`[data-cy="${key}"]`)
.contains(
isArray(expectedValues[key]) ? arrayToList(expectedValues[key]) : expectedValues[key]
)
.should('exist');
}

cy.contains('Please review. Some data is missing.').should('not.exist');
});

it('Should show a toast on error when failing to reach parsing endpoint', () => {
Expand Down
2 changes: 2 additions & 0 deletions site/gatsby-site/cypress/fixtures/submissions/submitted.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"epoch_date_modified": 1686163744,
"description": "By NEIL BEDI and KATHLEEN McGRORY\nTimes staff writers\nNov. 19, 2020\nThe Pasco Sheriff’s Office keeps a secret list of kids it thinks could “fall into a life of crime” based on factors like wheth",
"image_url": "https://s3.amazonaws.com/ledejs/resized/s2020-pasco-ilp/600/nocco5.jpg",
"incident_title": "Submisssion 1 title",
"incident_date": "2015-09-01",
"incident_ids": [],
"language": "en",
Expand Down Expand Up @@ -119,6 +120,7 @@
"date_submitted": "2021-08-23",
"epoch_date_modified": 1686163744,
"image_url": "https://skylightcyber.com/2019/07/18/cylance-i-kill-you/cylance-i-kill-you-small.gif",
"incident_title": "Submission 3 title",
"incident_date": "2019-07-18",
"incident_ids": [],
"language": "en",
Expand Down
22 changes: 21 additions & 1 deletion site/gatsby-site/i18n/locales/es/submitted.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,25 @@
"Successfully promoted submission to Issue {{report_number}}": "Envío promocionado con éxito al Problema {{report_number}}",
"Are you sure this is a new incident? This will create a permanent record with all the details you provided about the incident.": "¿Seguro que desea promocionar este Envío a un nuevo Incidente?",
"Sure you want to promote this Submission and link it to Incident {{incident_id}}?": "¿Seguro que desea promocionar este Envío y vincularlo al Incidente {{incident_id}}?",
"Are you sure you want to delete “{{url}}”?": "¿Estás seguro de que quieres eliminar “{{url}}”?"
"Are you sure you want to delete “{{url}}”?": "¿Estás seguro de que quieres eliminar “{{url}}”?",
"Editing Submission": "Editando Envío",
"Pending Review": "Revisión Pendiente",
"Back to Submission List": "Volver a la lista de envíos",
"Editors": "Editores",
"Unassigned": "Sin asignar",
"Status": "Estado",
"In Review": "En Revisión",
"Add as new": "Agregar como nuevo",
"Accept": "Aceptar",
"Reject": "Rechazar",
"Promoting to incident": "Promoviendo a incidente",
"Promoting to issue": "Promoviendo a problema",
"Adding as incident": "Agregando como incidente",
"Adding as issue": "Agregando como problema",
"Are you sure you want to reject this submission? This will permanently delete the submission.": "¿Estás seguro de que quieres rechazar este envío? Esto eliminará permanentemente el envío.",
"Changes saved": "Cambios guardados",
"There was an error claiming this submission. Please try again.": "Hubo un error al reclamar este envío. Por favor, inténtelo de nuevo.",
"Claim": "Reclamar",
"Claiming...": "Reclamando...",
"Reviewing": "Revisando"
}
1 change: 1 addition & 0 deletions site/gatsby-site/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
"Subscribe to the AI Incident Briefing and get monthly incident round-ups along with occasional major database updates.": "Subscribe to the AI Incident Briefing and get monthly incident round-ups along with occasional major database updates.",
"Check your inbox for the AI Incident Briefing, which includes incident round-ups along with occasional major database updates. You can manage your subscription status from the links in the email footer.": "Check your inbox for the AI Incident Briefing, which includes incident round-ups along with occasional major database updates. You can manage your subscription status from the links in the email footer.",
"Image URL is invalid, using fallback image": "La URL de la imagen no es válida, se utilizará la imagen de respaldo",
"Issue": "Problema",
"You have successfully create Incident {{newIncidentId}}. <4>View incident</4>.": "Incidente {{newIncidentId}} creado exitosamente. <4>Ver Incidente</4>.",
"New Incident": "Nuevo Incidente",

Expand Down
22 changes: 21 additions & 1 deletion site/gatsby-site/i18n/locales/fr/submitted.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,25 @@
"Successfully promoted submission to Issue {{report_number}}": "Soumission promue avec succès au problème {{report_number}}",
"Are you sure this is a new incident? This will create a permanent record with all the details you provided about the incident.": "Êtes-vous sûr qu'il s'agit d'un nouvel incident? Cela créera un enregistrement permanent avec tous les détails que vous avez fournis sur l'incident.",
"Sure you want to promote this Submission and link it to Incident {{incident_id}}?": "Voulez-vous vraiment promouvoir cette soumission et la lier à l'incident {{incident_id}}?",
"Are you sure you want to delete “{{url}}”?": "Voulez-vous vraiment effacer « {{url}} » ?"
"Are you sure you want to delete “{{url}}”?": "Voulez-vous vraiment effacer « {{url}} » ?",
"Editing Submission": "Édition de la soumission",
"Pending Review": "En attente de révision",
"Back to Submission List": "Retour à la liste des soumissions",
"Editors": "Éditeurs",
"Unassigned": "Non assigné",
"Status": "Statut",
"In Review": "En révision",
"Add as new": "Ajouter comme",
"Accept": "Accepter",
"Reject": "Rejeter",
"Promoting to incident": "Promouvoir en tant qu'incident",
"Promoting to issue": "Promouvoir en tant que problème",
"Adding as incident": "Ajout en tant qu'incident",
"Adding as issue": "Ajout en tant que problème",
"Are you sure you want to reject this submission? This will permanently delete the submission.": "Voulez-vous vraiment rejeter cette soumission? Cela supprimera définitivement la soumission.",
"Changes saved": "Modifications enregistrées",
"There was an error claiming this submission. Please try again.": "Une erreur s'est produite lors de la réclamation de cette soumission. Veuillez réessayer.",
"Claim": "Réclamer",
"Claiming...": "En cours...",
"Reviewing": "Révision"
}
1 change: 1 addition & 0 deletions site/gatsby-site/i18n/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
"Subscribe to the AI Incident Briefing and get monthly incident round-ups along with occasional major database updates.": "Subscribe to the AI Incident Briefing and get monthly incident round-ups along with occasional major database updates.",
"Check your inbox for the AI Incident Briefing, which includes incident round-ups along with occasional major database updates. You can manage your subscription status from the links in the email footer.": "Check your inbox for the AI Incident Briefing, which includes incident round-ups along with occasional major database updates. You can manage your subscription status from the links in the email footer.",
"Image URL is invalid, using fallback image": "L'URL de l'image n'est pas valide, utilisation d'une image de remplacement",
"Issue": "Problème",
"You have successfully create Incident {{newIncidentId}}. <4>View incident</4>.": "Vous avez réussi à créer l'incident {{newIncidentId}}. <4>Voir l'incident</4>.",
"New Incident": "Nouvel Incident",
"csetCharts": "La taxonomie CSET AI Harm pour AIID est la deuxième édition de la taxonomie CSET incident. Il caractérise les dommages, les entités et les technologies impliquées dans les incidents d'IA et les circonstances de leur apparition. Les graphiques ci-dessous montrent certains champs de la taxonomie CSET AI Harm pour AIID. Des détails sur chaque champ peuvent être trouvés <1>ici</1>. Cependant, de brèves descriptions du champ sont fournies au-dessus de chaque graphique.",
Expand Down
2 changes: 1 addition & 1 deletion site/gatsby-site/src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Layout = ({ children, className, sidebarCollapsed = false, location }) =>
<>
<Header location={location} />
<div className="tw-layout">
<div className="hidden md:block z-2 bg-text-light-gray shadow" data-cy="sidebar-desktop">
<div className="hidden md:block z-[1] bg-text-light-gray shadow" data-cy="sidebar-desktop">
<Sidebar defaultCollapsed={sidebarCollapsed} location={location} />
</div>
{config.sidebar.title && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { Badge } from 'flowbite-react';
import React from 'react';

const StepContainer = (props) => {
return (
<div
className={`p-6 border rounded-lg mt-8 mb-6 relative shadow-md dark:bg-gray-800 dark:border-gray-700`}
className={`relative border rounded-lg mt-8 mb-6 shadow-md dark:bg-gray-800 dark:border-gray-700 ${props.className}`}
>
<div className="absolute -top-4 bg-white px-2 text-xl whitespace-nowrap">{props.name}</div>
{props.children}
<div className={`${props.childClassName}`}>
{props.children}
<div className="absolute -top-3 bg-white px-2 text-xl whitespace-nowrap">
<Badge color={props.color ? props.color : 'info'}>{props.name}</Badge>
</div>
</div>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const StepOne = (props) => {
}, [props.data]);

return (
<StepContainer name={props.name}>
<StepContainer name={props.name} childClassName="p-6">
<Formik
initialValues={data}
onSubmit={() => {}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const StepThree = (props) => {
}

return (
<StepContainer name={props.name}>
<StepContainer name={props.name} childClassName="p-6">
<Formik
initialValues={data}
onSubmit={() => {}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const StepTwo = (props) => {
}, [props.data]);

return (
<StepContainer name={props.name}>
<StepContainer name={props.name} childClassName="p-6">
<Formik
initialValues={data}
onSubmit={() => {}}
Expand Down
Loading

0 comments on commit 3f856e1

Please sign in to comment.