Skip to content

Commit

Permalink
Merge branch 'develop' into Fix-ohcnetwork#6944
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 committed Jun 16, 2024
2 parents 213fa46 + 160eaa7 commit 1f4eb6a
Show file tree
Hide file tree
Showing 33 changed files with 577 additions and 451 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/auto-testing-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,37 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const isDraft = pr.draft;
const isReadyForTestingComment = context.payload.comment?.body.includes('ready for testing');
const isChangesRequired = context.payload.review?.state === 'changes_requested';
const comment = context.payload.comment;
const review = context.payload.review;
if ((isReadyForTestingComment && !isDraft) || (!isDraft && pr.draft_changed)) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['needs testing']
});
}
if (pr) {
const isDraft = pr.draft;
const isReadyForTestingComment = comment && comment.body.includes('ready for testing');
const isChangesRequired = review && review.state === 'changes_requested';
if ((isReadyForTestingComment && !isDraft) || (!isDraft && pr.draft_changed)) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['needs testing']
});
}
if (isChangesRequired) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: 'Reminder: To add the "needs testing" label, comment "ready for testing" on this PR.'
});
if (isChangesRequired) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: 'Reminder: To add the "needs testing" label, comment "ready for testing" on this PR.'
});
if (pr.labels.some(label => label.name === 'needs testing')) {
await github.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: 'needs testing'
});
}
}
}
10 changes: 2 additions & 8 deletions .storybook/vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
import { defineConfig } from "vite";

export default defineConfig({
esbuild: {
loader: "tsx",
include: [/src\/.*\.[tj]sx?$/, /.storybook\/.*\.[tj]sx?$/],
},
});
/** @type {import('vite').UserConfig} */
export default {};
3 changes: 3 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Facility Manage Functions", () => {
const loginPage = new LoginPage();
const facilityManage = new FacilityManage();
const facilityPage = new FacilityPage();
const facilityName = "Dummy Facility 40";
const facilityMiddlewareUpdateButton = "Update";
const facilityMiddleware = "dev-middleware.coronasafe.live";
const facilityUpdatedMiddleware = "updated.coronasafe.live";
Expand Down Expand Up @@ -35,6 +36,8 @@ describe("Facility Manage Functions", () => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
facilityPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
facilityPage.visitAlreadyCreatedFacility();
});

Expand Down
7 changes: 6 additions & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class FacilityPage {
.should("eq", 200);
}

typeFacilitySearch(facilityName) {
cy.get("#search").click().clear();
cy.get("#search").click().type(facilityName);
}

visitUpdateFacilityPage(url: string) {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.visit(url);
Expand Down Expand Up @@ -292,8 +297,8 @@ class FacilityPage {
}

selectLocation(location: string) {
cy.intercept("https://maps.googleapis.com/**").as("mapApi");
cy.get("span > svg.care-svg-icon__baseline.care-l-map-marker").click();
cy.intercept("https://maps.googleapis.com/maps/api/mapsjs/*").as("mapApi");
cy.wait("@mapApi").its("response.statusCode").should("eq", 200);
cy.get("input#pac-input").type(location).type("{enter}");
cy.wait(2000);
Expand Down
10 changes: 10 additions & 0 deletions src/Common/hooks/useMSEplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export const useMSEMediaPlayer = ({
if (!mseSourceBuffer.updating) {
if (mseQueue.length > 0) {
const packet = mseQueue.shift();
// Check if SourceBuffer has been removed before appending buffer
if (mseSourceBuffer.removed) {
console.error("Attempted to append to a removed SourceBuffer.");
return;
}
mseSourceBuffer.appendBuffer(packet);
} else {
mseStreamingStarted = false;
Expand All @@ -122,6 +127,11 @@ export const useMSEMediaPlayer = ({

const readPacket = (packet: any) => {
if (!mseStreamingStarted) {
// Check if SourceBuffer has been removed before appending buffer
if (mseSourceBuffer.removed) {
console.error("Attempted to append to a removed SourceBuffer.");
return;
}
mseSourceBuffer.appendBuffer(packet);
mseStreamingStarted = true;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/BloodPressureFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BloodPressure } from "../Patient/models";
type Props = FormFieldBaseProps<BloodPressure>;

export default function BloodPressureFormField(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

const handleChange = (event: FieldChangeEvent<number>) => {
const value: BloodPressure = {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/FilePreviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const FilePreviewDialog = (props: FilePreviewProps) => {
<img
src={fileUrl}
alt="file"
className={`${
className={`h-full w-full object-contain ${
zoom_values[file_state.zoom - 1]
} ${getRotationClass(file_state.rotation)}`}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type PMJAYPackageItem = {
type Props = FormFieldBaseProps<PMJAYPackageItem>;

export default function PMJAYProcedurePackageAutocomplete(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

const { fetchOptions, isLoading, options } =
useAsyncOptions<PMJAYPackageItem>("code");
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/RouteToFacilitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const keys = Object.keys(ROUTE_TO_FACILITY_OPTIONS).map((key) =>
type Props = FormFieldBaseProps<keyof typeof ROUTE_TO_FACILITY_OPTIONS>;

export default function RouteToFacilitySelect(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

return (
<SelectFormField
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Common/UserAutocompleteFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = FormFieldBaseProps<UserModel> & {
};

export default function UserAutocompleteFormField(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);
const { fetchOptions, isLoading, options } = useAsyncOptions<UserModel>(
"id",
{ queryResponseExtractor: (data) => data.results },
Expand Down Expand Up @@ -65,6 +65,8 @@ export default function UserAutocompleteFormField(props: Props) {
<Autocomplete
id={field.id}
disabled={field.disabled}
// Voluntarily casting type as true to ignore type errors.
required={field.required as true}
placeholder={props.placeholder}
value={field.value}
onChange={field.handleChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,24 @@ let make = (
: <div>
<div className="grid grid-cols-1 items-center gap-4 justify-around mt-4">
<div className="flex flex-col items-center text-center">
<div className="text-black font-bold text-xl">
<div className="text-black font-bold text-xl flex items-center gap-2">
{str(Belt.Float.toString(painScale))}
<div
className={"text-sm font-bold text-white px-2 py-1 rounded-lg"}
style={ReactDOMStyle.make(
~backgroundColor=Js.String2.make(
switch getLabels(Belt.Float.toInt(painScale)) {
| (_, color) => color
},
),
(),
)}>
{str(
switch getLabels(Belt.Float.toInt(painScale)) {
| (label, _) => label
},
)}
</div>
</div>
<div className="text-sm text-gray-700"> {str("Pain Scale")} </div>
</div>
Expand All @@ -159,7 +175,7 @@ let make = (
? <button
type_="button"
onClick={e => {
if (painScale == 0.0) {
if painScale == 0.0 {
hideModal(e)
} else {
updatePart(state)
Expand Down
Loading

0 comments on commit 1f4eb6a

Please sign in to comment.