Skip to content

Commit

Permalink
Merge pull request #2658 from responsible-ai-collaborative/staging
Browse files Browse the repository at this point in the history
Deploy to Production
  • Loading branch information
kepae authored Feb 29, 2024
2 parents 152c5c0 + 09ce3e3 commit 8520832
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cache-modifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set cache modifier
id: set-cache-modifier
run: |
if [[ "${{ inputs.skip-cache }}" == "true" ]]; then
if [[ "${{ inputs.skip-cache }}" == "true" ]] || [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
echo "cache-modifier=$(date +%s)" >> $GITHUB_OUTPUT
else
echo "cache-modifier=" >> $GITHUB_OUTPUT
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/realm-production.yml

This file was deleted.

19 changes: 19 additions & 0 deletions site/gatsby-site/cypress/e2e/integration/apps/submitted.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1726,4 +1726,23 @@ describe('Submitted reports', () => {
});
cy.get(".pagination [aria-current='page'] button").contains('2').should('exist');
});

maybeIt('Should display "No reports found" if no quick adds are found', () => {
cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'AllQuickAdd',
'AllQuickAdd',
{
data: {
quickadds: [],
},
}
);

cy.visit(url);

cy.wait('@AllQuickAdd');

cy.get('[data-cy="no-results"]').should('contain', 'No reports found');
});
});
3 changes: 2 additions & 1 deletion site/gatsby-site/i18n/locales/es/submitted.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"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"
"Reviewing": "Revisando",
"No reports found": "No se encontraron informes"
}
3 changes: 2 additions & 1 deletion site/gatsby-site/i18n/locales/fr/submitted.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"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"
"Reviewing": "Révision",
"No reports found": "Aucun rapport trouvé"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
const config = require('../config');
/**
*
* @param {{context: {client: import('mongodb').MongoClient}}} context
*/

exports.up = async ({ context: { client } }) => {
await client.connect();

// New created_at field on incidents, reports, submissions collections from production db and history db
const incidentsCollection = client.db(config.realm.production_db.db_name).collection('incidents');

const submissionsCollection = client
.db(config.realm.production_db.db_name)
.collection('submissions');

const reportsCollection = client.db(config.realm.production_db.db_name).collection('reports');

const incidentsHistoryCollection = client
.db(config.realm.production_db.db_history_name)
.collection('incidents');

const submissionsHistoryCollection = client
.db(config.realm.production_db.db_history_name)
.collection('submissions');

const reportsHistoryCollection = client
.db(config.realm.production_db.db_history_name)
.collection('reports');

const incidentsCursor = incidentsCollection.find({});

const incidentsHistoryCursor = incidentsHistoryCollection.find({});

const submissionsCursor = submissionsCollection.find({});

const submissionsHistoryCursor = submissionsHistoryCollection.find({});

const reportsCursor = reportsCollection.find({});

const reportsHistoryCursor = reportsHistoryCollection.find({});

let updatedCount = 0;

while (await incidentsCursor.hasNext()) {
const incident = await incidentsCursor.next();

const created_at = new Date(incident.date);

await incidentsCollection.updateOne(
{ _id: incident._id },
{
$set: {
created_at: created_at,
},
}
);

incident.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} incidents with new created_at field`);

updatedCount = 0;

while (await incidentsHistoryCursor.hasNext()) {
const incident = await incidentsHistoryCursor.next();

const created_at = new Date(incident.date);

await incidentsHistoryCollection.updateOne(
{ _id: incident._id },
{
$set: {
created_at: created_at,
},
}
);

incident.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} incidents history with new created_at field`);

updatedCount = 0;

while (await submissionsCursor.hasNext()) {
const submission = await submissionsCursor.next();

const created_at = new Date(submission.date_submitted);

await submissionsCollection.updateOne(
{ _id: submission._id },
{
$set: {
created_at: created_at,
},
}
);

submission.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} submissions with new created_at field`);

updatedCount = 0;

while (await submissionsHistoryCursor.hasNext()) {
const submission = await submissionsHistoryCursor.next();

const created_at = new Date(submission.date_submitted);

await submissionsHistoryCollection.updateOne(
{ _id: submission._id },
{
$set: {
created_at: created_at,
},
}
);

submission.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} submissions history with new created_at field`);

updatedCount = 0;

while (await reportsCursor.hasNext()) {
const report = await reportsCursor.next();

const created_at = new Date(report.date_submitted);

await reportsCollection.updateOne(
{ _id: report._id },
{
$set: {
created_at: created_at,
},
}
);

report.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} reports with new created_at field`);

updatedCount = 0;

while (await reportsHistoryCursor.hasNext()) {
const report = await reportsHistoryCursor.next();

const created_at = new Date(report.date_submitted);

await reportsHistoryCollection.updateOne(
{ _id: report._id },
{
$set: {
created_at: created_at,
},
}
);

report.created_at = created_at;

updatedCount++;
}

console.log(`Updated ${updatedCount} reports history with new created_at field`);
};
26 changes: 23 additions & 3 deletions site/gatsby-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions site/gatsby-site/src/contexts/ToastContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ export function ToastContextProvider({ children }) {
return (
<Toast className="tw-toast" data-cy="toast" key={id}>
<div
className={`w-full h-full flex ${severity.className} items-center p-4 rounded gap-3 text-white`}
className={`w-full h-full flex ${severity.className} items-center p-4 rounded gap-3 text-white max-w-full`}
>
<div className="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-white">
<FontAwesomeIcon icon={severity.icon} className={severity.faClass} />
</div>
<div className="text-sm font-normal">{message}</div>
<div className="text-sm font-normal max-w-full break-words overflow-auto">
{message}
</div>
<Toast.Toggle className="mx-0" onClick={(e) => removeToast(e, index)} />
</div>
</Toast>
Expand Down
Loading

0 comments on commit 8520832

Please sign in to comment.