Skip to content

Commit

Permalink
Merge pull request #620 from alan-turing-institute/chrisdburr-patch-1
Browse files Browse the repository at this point in the history
Update docs-publish.yaml
  • Loading branch information
chrisdburr authored Sep 26, 2024
2 parents 99cf6d8 + 06404cb commit 5516608
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 246 deletions.
20 changes: 5 additions & 15 deletions .github/ISSUE_TEMPLATE/user-story.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ body:
id: acceptance-criteria
attributes:
label: Acceptance Criteria
description:
Please describe the conditions that must be met for this story to be
considered complete.
description: Please describe the conditions that must be met for this story to be considered complete.
placeholder: |
**GIVEN** [precondition]
**AND** [another precondition if necessary]
Expand All @@ -65,9 +63,7 @@ body:
id: technical-notes
attributes:
label: Technical Notes
description:
Any technical notes, potential challenges, or architectural
considerations for implementation?
description: Any technical notes, potential challenges, or architectural considerations for implementation?
placeholder: |
- Note 1
- Note 2
Expand All @@ -78,19 +74,13 @@ body:
id: definition-of-done
attributes:
label: Definition of Done
description:
Please confirm the following are completed before this story can be
considered done.
description: Please confirm the following are completed before this story can be considered done.
options:
- label: The feature fulfills all acceptance criteria.
- label: The code is reviewed and meets team coding standards.
- label: All unit, integration, and end-to-end tests are passed.
- label: The feature meets accessibility standards set for the project.
- label:
The code passes the CI/CD pipeline quality controls (style and
linting).
- label: The code passes the CI/CD pipeline quality controls (style and linting).
- label: The feature is merged into the main branch.
- label: The feature is deployed and functional in the QA environment.
- label:
The feature was demonstrated to the team and accepted by the product
owner.
- label: The feature was demonstrated to the team and accepted by the product owner.
1 change: 0 additions & 1 deletion .github/workflows/docs-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- develop
release:
types:
- published
Expand Down
106 changes: 53 additions & 53 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.7"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
exclude: \.md$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.7"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
exclude: \.md$

- repo: https://github.com/psf/black
rev: "24.4.2"
hooks:
- id: black
language: python
files: ^eap_backend/
exclude: \.md$
- repo: https://github.com/psf/black
rev: "24.4.2"
hooks:
- id: black
language: python
files: ^eap_backend/
exclude: \.md$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
# - id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
#- id: name-tests-test
# args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
# - id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
#- id: name-tests-test
# args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, html, css, scss, javascript, json]
exclude: \.md$
args: [--prose-wrap=never]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, html, css, scss, javascript, json]
exclude: \.md$
args: [--prose-wrap=never]

- repo: https://github.com/asottile/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.3.0]
exclude: \.md$
- repo: https://github.com/asottile/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.3.0]
exclude: \.md$

# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: "v0.9.0.2"
# hooks:
# - id: shellcheck
# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: "v0.9.0.2"
# hooks:
# - id: shellcheck
26 changes: 13 additions & 13 deletions next_frontend/components/Websocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
// clearInterval(interval);
// };
// }, []); // Empty dependency array ensures the effect runs only once on mount


// return (
// <div className={`${!debug ? 'hidden' : 'absolute'} w-full h-full z-50 top-0 left-0 bg-background p-4 rounded-md`}>
Expand Down Expand Up @@ -112,29 +112,29 @@ const WebSocketComponent = () => {
console.error("AssuranceCase or AssuranceCase ID is undefined, WebSocket cannot be established.");
return;
}

let interval: any;
const wsUrl = `wss://staging-eap-backend.azurewebsites.net/ws/case/${assuranceCase.id}/?token=${token}`;

const setupWebSocket = () => {
const websocket = new WebSocket(wsUrl);
websocketRef.current = websocket; // Store the WebSocket instance in the ref

websocket.addEventListener("open", (event: any) => {
console.log("WebSocket connection established: ", event);
const pingMessage = JSON.stringify({ content: "ping" });

// Send an initial ping message and start ping interval
websocket.send(pingMessage);
interval = setInterval(() => {
websocket.send(pingMessage);
}, pingInterval);
});

websocket.addEventListener("message", (event: any) => {
console.log("Message received from server: ", event);
setMessages((prevMessages) => [...prevMessages, `Received "${event.data}" from server.`]);

const data = JSON.parse(event.data);

// Handle current connections update
Expand All @@ -153,20 +153,20 @@ const WebSocketComponent = () => {
console.log("Updated assurance case goals:", updatedGoals);
}
});

websocket.addEventListener("close", (event: any) => {
console.log("WebSocket connection closed: ", event);
clearInterval(interval);
});

websocket.addEventListener("error", (event: any) => {
console.error("WebSocket error occurred: ", event);
});
};

// Initialize the WebSocket connection
setupWebSocket();

// Cleanup function to close WebSocket and clear interval on unmount
return () => {
if (websocketRef.current && websocketRef.current.readyState === WebSocket.OPEN) {
Expand All @@ -175,7 +175,7 @@ const WebSocketComponent = () => {
clearInterval(interval);
};
}, [assuranceCase?.id, token]); // Run effect when assuranceCase.id or token changes


const prevAssuranceCaseString = usePrevious(JSON.stringify(assuranceCase));

Expand Down Expand Up @@ -209,4 +209,4 @@ const WebSocketComponent = () => {
);
};

export default WebSocketComponent;
export default WebSocketComponent;
8 changes: 4 additions & 4 deletions next_frontend/components/auth/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ const RegisterForm = () => {
password1: values.password1,
password2: values.password2,
};

const requestOptions: RequestInit = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(user),
}

const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL ?? process.env.NEXT_PUBLIC_API_URL_STAGING}/api/auth/register/`, requestOptions)

console.log(response)

if(!response.ok || response.status === 400) {
setErrors(['Invalid details, please try again.'])
}

const result = await response.json()

if (result.key) {
setToken(result.key);
router.push('/dashboard')
Expand Down
2 changes: 1 addition & 1 deletion next_frontend/hooks/usePrevious.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export function usePrevious(value: any) {
ref.current = value;
}, [value]);
return ref.current;
}
}
Loading

0 comments on commit 5516608

Please sign in to comment.