Skip to content

Commit

Permalink
Merge pull request #761 from digirati-co-uk/hotfix/MAD-1403/MAD-1405
Browse files Browse the repository at this point in the history
Hotfix/mad 1403/mad 1405
  • Loading branch information
Heather0K committed Jun 29, 2023
2 parents a551c04 + b939628 commit 658ab45
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 54 deletions.
17 changes: 11 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ services:
tasks-api:
tty: true
image: ghcr.io/digirati-co-uk/tasks-api:latest
platform: linux/amd64
environment:
- SERVER_PORT=3000
- DATABASE_HOST=shared-postgres
Expand All @@ -119,6 +120,7 @@ services:
model-api:
tty: true
image: digirati/capture-models:latest
platform: linux/amd64
environment:
- SERVER_PORT=3000
- DATABASE_HOST=shared-postgres
Expand Down Expand Up @@ -171,6 +173,7 @@ services:

config-service:
image: digirati/madoc_config_service_django:175410fc5b7dbef4cc259686564fbedeb60c8789
platform: linux/amd64
environment:
- USE_DOCKER=yes
- IPYTHONDIR=/app/.ipython
Expand All @@ -194,6 +197,7 @@ services:
storage-api:
tty: true
image: ghcr.io/digirati-co-uk/storage-api:main
platform: linux/amd64
environment:
- GATEWAY_HOST=${GATEWAY_HOST}
volumes:
Expand All @@ -204,9 +208,10 @@ services:

search:
image: ghcr.io/digirati-co-uk/madoc-search-service:247f854b1258e3971907e6912cef2374a1da8474
# build:
# context: services/search
# dockerfile: Dockerfile
platform: linux/amd64
# build:
# context: services/search
# dockerfile: Dockerfile
environment:
- BROWSABLE=False
- USE_DOCKER=yes
Expand All @@ -225,9 +230,9 @@ services:
- DATABASE_URL=postgres://${POSTGRES_SEARCH_API_USER}:${POSTGRES_SEARCH_API_PASSWORD}@shared-postgres:${POSTGRES_PORT}/${POSTGRES_DB}
links:
- shared-postgres
# volumes:
# - ./services/search/search_service:/app
# volumes:
# - ./services/search/search_service:/app

okra:
image: digirati/okra:latest

platform: linux/amd64
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function validateRevision(
const filteredDocument = filterDocumentByRevision(req.document, req.revision, captureModel.revisions);

if (!filteredDocument && (req.revision.deletedFields || []).length === 0) {
throw new RequestError('Invalid revision');
throw new RequestError('Invalid revision: No changes');
}

// If the source is `structure` we want to make sure a user was associated. We add this to the revision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { HrefLink } from '../../../utility/href-link';
import { Revisions } from '../../editor/stores/revisions';
import { useDeselectRevision } from '../hooks/use-deselect-revision';
import { EditorRenderingConfig, useSlotContext } from './EditorSlots';
import { ErrorMessage } from '../../../callouts/ErrorMessage';

export const DefaultSubmitButton: EditorRenderingConfig['SubmitButton'] = ({ afterSave, canSubmit = true }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -38,7 +39,6 @@ export const DefaultSubmitButton: EditorRenderingConfig['SubmitButton'] = ({ aft
// Change this to "draft" to save for later.
await updateFunction(currentRevision, status);
} catch (e) {
console.error(e);
throw new Error(t('Unable to save your submission'));
}
});
Expand All @@ -63,49 +63,56 @@ export const DefaultSubmitButton: EditorRenderingConfig['SubmitButton'] = ({ aft
}}
footerAlignRight
renderFooter={({ close }) => {
return isSuccess ? (
<>
<ButtonRow $noMargin>
{projectId ? (
<Button data-cy="back-to-project" as={HrefLink} href={`/projects/${projectId}`}>
{t('Back to project')}
return (
<div>
{status === 'error' && (
<div style={{ color: '#c74158', marginBottom: '0.5em' }}>
{t('Error - Unable to save your submission')}
</div>
)}
{isSuccess ? (
<ButtonRow $noMargin>
{projectId ? (
<Button data-cy="back-to-project" as={HrefLink} href={`/projects/${projectId}`}>
{t('Back to project')}
</Button>
) : null}
<Button data-cy="close-add-another" onClick={close}>
{t('Close and keep working')}
</Button>
) : null}
<Button data-cy="close-add-another" onClick={close}>
{t('Close and keep working')}
</Button>
</ButtonRow>
</>
) : (
<ButtonRow $noMargin>
{!disableSaveForLater ? (
<Button
data-cy="save-later-button"
disabled={isLoading}
onClick={() => {
saveRevision('draft').then(() => {
deselectRevision();
close();
});
}}
>
{t('Save for later')}
</Button>
) : null}
<Button
data-cy="publish-button"
data-testid="publish-button"
disabled={isLoading || !canSubmit}
$primary
onClick={() => {
saveRevision('submitted').then(() => {
deselectRevision();
});
}}
>
{isLoading ? t('Saving...') : t('Submit')}
</Button>
</ButtonRow>
</ButtonRow>
) : (
<ButtonRow $noMargin>
{!disableSaveForLater ? (
<Button
data-cy="save-later-button"
disabled={isLoading}
onClick={() => {
saveRevision('draft').then(() => {
deselectRevision();
close();
});
}}
>
{t('Save for later')}
</Button>
) : null}
<Button
data-cy="publish-button"
data-testid="publish-button"
disabled={isLoading || !canSubmit}
$primary
onClick={() => {
saveRevision('submitted').then(() => {
deselectRevision();
});
}}
>
{isLoading ? t('Saving...') : t('Submit')}
</Button>
</ButtonRow>
)}
</div>
);
}}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Revisions } from '../capture-models/editor/stores/revisions/index';
import { RevisionRequest } from '../capture-models/types/revision-request';
import { useApi, useOptionalApi } from './use-api';
import { useOptionalApi } from './use-api';
import { useMutation } from 'react-query';
import { createContext, useCallback, useContext } from 'react';
import { useUser } from './use-site';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ function ViewSingleReview({
const limitedReviewer =
user && user.scope && user.scope.indexOf('models.revision') !== -1 && user.scope.indexOf('models.create') === -1;
const reviewer =
(user && user.scope && user.scope.indexOf('models.revision') !== -1) ||
user.scope.indexOf('site.admin') ||
(-1 && user.scope.indexOf('models.admin'));
user &&
user.scope &&
(user.scope.indexOf('models.revision') !== -1 ||
user.scope.indexOf('site.admin') !== -1 ||
user.scope.indexOf('models.admin') !== -1);

const canReview = limitedReviewer ? review?.assignee?.id === user.user?.id : reviewer;
const isDone = task?.status === 3;
Expand Down
2 changes: 2 additions & 0 deletions services/madoc-ts/translations/en/madoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
"Enter scope": "Enter scope",
"Entity from model": "Entity from model",
"Entity labelled by property": "Entity labelled by property",
"Error - Unable to save your submission": "Error - Unable to save your submission",
"Errored": "Errored",
"Errored / Rejected": "Errored / Rejected",
"Exit edit mode": "Exit edit mode",
Expand Down Expand Up @@ -885,6 +886,7 @@
"You can continue working on another canvas.": "You can continue working on another canvas.",
"You can view your contribution in the left sidebar.": "You can view your contribution in the left sidebar.",
"You cannot edit annotations if you are rotating": "You cannot edit annotations if you are rotating",
"You do not have the correct permissions to review this task": "You do not have the correct permissions to review this task",
"You have already completed this item": "You have already completed this item",
"You have already completed this manifest": "You have already completed this manifest",
"You have been assigned a manifest": "You have been assigned a manifest",
Expand Down

0 comments on commit 658ab45

Please sign in to comment.