Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Laat ook ExtensionOnlyPresentConstraint toe bij locale constraints #367

Merged
merged 1 commit into from
May 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ De `zip_name` legt de naam van de zip vast en de `sub_constraints` bevat een lij
- `FileConstraint`
- `NotPresentConstraint`
- `ExtensionNotPresentConstraint`
- `ExtensionOnlyPresentConstraint`

De `global_constraints` zijn constraints die gelden voor de volledige zip indiening. Een element in de lijst van global constraints kan één van volgende types zijn:

Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/SimpleTests/SimpleTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ function json_to_submission(json: any): Submission {
case 'EXTENSION_NOT_PRESENT': {
constraint = new Constraint('EXTENSION_NOT_PRESENT', json['extension'], id, parent_id, depth);
break;
}
case 'EXTENSION_ONLY_PRESENT': {
constraint = new Constraint('EXTENSION_ONLY_PRESENT', json['extension'], id, parent_id, depth);
break;
}
}

Expand Down Expand Up @@ -762,24 +766,35 @@ export default function SimpleTests(props: {
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'DIRECTORY')}>{t('submission_files.menu.directory')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'NOT_PRESENT')}>{t('submission_files.menu.not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present')}</button>
</div>
case 'DIRECTORY':
return <div>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'FILE')}>{t('submission_files.menu.file')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'NOT_PRESENT')}>{t('submission_files.menu.not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present')}</button>
</div>
case 'NOT_PRESENT':
return <div>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'FILE')}>{t('submission_files.menu.file')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'DIRECTORY')}>{t('submission_files.menu.directory')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present')}</button>
</div>
case 'EXTENSION_NOT_PRESENT':
return <div>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'FILE')}>{t('submission_files.menu.file')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'DIRECTORY')}>{t('submission_files.menu.directory')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'NOT_PRESENT')}>{t('submission_files.menu.not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present')}</button>
</div>
case 'EXTENSION_ONLY_PRESENT':
return <div>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'FILE')}>{t('submission_files.menu.file')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'DIRECTORY')}>{t('submission_files.menu.directory')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'NOT_PRESENT')}>{t('submission_files.menu.not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleChangeConstraintType(constraint.id, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present')}</button>
</div>
} })()}
<button onClick={() => handleDeleteConstraint(constraint.id)}>{t('submission_files.menu.remove')}</button>
Expand Down