moved delete buttons to edit pages and added the update portion to the crud tests w/ burnettk

This commit is contained in:
jasquat 2022-06-20 15:07:09 -04:00
parent 8f1ad42d6d
commit 2471dff174
6 changed files with 57 additions and 38 deletions

View File

@ -7,6 +7,7 @@ describe('process-groups', () => {
const uuid = () => Cypress._.random(0, 1e6)
const id = uuid()
const groupDisplayName = `Test Group 1 ${id}`;
const newGroupDisplayName = `${groupDisplayName} edited`;
const groupId = `test-group-1-${id}`;
cy.createGroup(groupId, groupDisplayName);
@ -16,6 +17,14 @@ describe('process-groups', () => {
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(`Process Group: ${groupId}`);
cy.contains('Edit process group').click();
cy.get('input[name=display_name]').clear().type(newGroupDisplayName);
cy.contains('Submit').click();
cy.contains(`Process Group: ${groupId}`);
cy.contains('Edit process group').click();
cy.get('input[name=display_name]').should('have.value', newGroupDisplayName)
cy.contains('Delete Process Group').click();
cy.url().should('include', `process-groups`);
cy.contains(groupId).should('not.exist');

View File

@ -8,6 +8,7 @@ describe('process-models', () => {
const id = uuid()
const groupId = 'acceptance-tests-group-one';
const modelDisplayName = `Test Model 2 ${id}`;
const newModelDisplayName = `${modelDisplayName} edited`;
const modelId = `test-model-2-${id}`;
cy.contains(groupId).click();
cy.createModel(groupId, modelId, modelDisplayName);
@ -18,6 +19,14 @@ describe('process-models', () => {
cy.url().should('include', `process-models/${groupId}/${modelId}`);
cy.contains(`Process Model: ${modelId}`);
cy.contains('Edit process model').click();
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
cy.contains('Submit').click();
cy.contains(`Process Model: ${modelId}`);
cy.contains('Edit process model').click();
cy.get('input[name=display_name]').should('have.value', newModelDisplayName)
cy.contains('Delete process model').click();
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(modelId).should('not.exist');
@ -72,6 +81,7 @@ describe('process-models', () => {
cy.contains(`Process Model: ${modelId}`);
cy.contains(dmnFileName + '.dmn').should('exist');
cy.contains('Edit process model').click();
cy.contains('Delete process model').click();
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(modelId).should('not.exist');

View File

@ -54,6 +54,24 @@ export default function ProcessGroupEdit() {
});
const deleteProcessGroup = (() => {
fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, {
headers: new Headers({
'Authorization': `Bearer ${HOT_AUTH_TOKEN}`
}),
method: 'DELETE',
})
.then(res => res.json())
.then(
(result) => {
navigate(`/process-groups`);
},
(error) => {
console.log(error);
}
)
});
const onDisplayNameChanged = ((newDisplayName) => {
setDisplayName(newDisplayName);
});
@ -76,6 +94,7 @@ export default function ProcessGroupEdit() {
<Stack direction="horizontal" gap={3}>
<Button type="submit">Submit</Button>
<Button variant="secondary" href={`/process-groups/${processGroup.id}`}>Cancel</Button>
<Button onClick={deleteProcessGroup} variant="danger">Delete Process Group</Button>
</Stack>
</form>
</main>

View File

@ -49,24 +49,6 @@ export default function ProcessGroupShow() {
)
}, [params, searchParams]);
const deleteProcessGroup = (() => {
fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, {
headers: new Headers({
'Authorization': `Bearer ${HOT_AUTH_TOKEN}`
}),
method: 'DELETE',
})
.then(res => res.json())
.then(
(result) => {
navigate(`/process-groups`);
},
(error) => {
console.log(error);
}
)
});
const buildTable = (() => {
const rows = processModels.map((row,index) => {
return (
@ -104,7 +86,6 @@ export default function ProcessGroupShow() {
<Stack direction="horizontal" gap={3}>
<Button href={`/process-models/${processGroup.id}/new`}>Add a process model</Button>
<Button href={`/process-groups/${processGroup.id}/edit`} variant="secondary">Edit process group</Button>
<Button onClick={deleteProcessGroup} variant="danger">Delete Process Group</Button>
</Stack>
<br />
<br />

View File

@ -62,6 +62,24 @@ export default function ProcessModelEdit() {
});
const deleteProcessModel = (() => {
fetch(`${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}`, {
headers: new Headers({
'Authorization': `Bearer ${HOT_AUTH_TOKEN}`
}),
method: 'DELETE',
})
.then(res => res.json())
.then(
(result) => {
navigate(`/process-groups/${params.process_group_id}`);
},
(error) => {
console.log(error);
}
)
});
const onDisplayNameChanged = ((newDisplayName) => {
setDisplayName(newDisplayName);
});
@ -84,6 +102,7 @@ export default function ProcessModelEdit() {
<Stack direction="horizontal" gap={3}>
<Button type="submit">Submit</Button>
<Button variant="secondary" href={`/${processModelPath}`}>Cancel</Button>
<Button onClick={deleteProcessModel} variant="danger">Delete process model</Button>
</Stack>
</form>
</main>

View File

@ -49,24 +49,6 @@ export default function ProcessModelShow() {
)
});
const deleteProcessModel = (() => {
fetch(`${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}`, {
headers: new Headers({
'Authorization': `Bearer ${HOT_AUTH_TOKEN}`
}),
method: 'DELETE',
})
.then(res => res.json())
.then(
(result) => {
navigate(`/process-groups/${params.process_group_id}`);
},
(error) => {
console.log(error);
}
)
});
let processInstanceResultTag = ""
if (processInstanceResult) {
processInstanceResultTag = <pre>{processInstanceResult.status}: {JSON.stringify(processInstanceResult.data)}</pre>
@ -103,7 +85,6 @@ export default function ProcessModelShow() {
<Stack direction="horizontal" gap={3}>
<Button onClick={processModelRun} variant="primary">Run Primary</Button>
<Button href={`/process-models/${processModel.process_group_id}/${processModel.id}/edit`} variant="secondary">Edit process model</Button>
<Button onClick={deleteProcessModel} variant="danger">Delete process model</Button>
<Button href={`/process-models/${processModel.process_group_id}/${processModel.id}/file?file_type=bpmn`} variant="warning">Add New BPMN File</Button>
<Button href={`/process-models/${processModel.process_group_id}/${processModel.id}/file?file_type=dmn`} variant="success">Add New DMN File</Button>
</Stack>