Skip to content

Commit 3447d55

Browse files
committed
Merge from develop
2 parents 69f736f + 4465c4a commit 3447d55

File tree

631 files changed

+15500
-4872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+15500
-4872
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
name: Bug report
33
about: Create a report for a bug or to help us improve
44
title: A brief clear title describing the bug from a user's perspective
5-
labels: bug, needs triage
6-
assignees: ''
7-
5+
labels: bug, needs triage, needs daily triage
6+
assignees: ""
87
---
98

109
## What went wrong? 😲
11-
<!-- Provide a clear and concise description of what the bug is. Screenshots are helpful! -->
10+
11+
<!-- Provide a clear and concise description of what the bug is. Screenshots are helpful! -->
1212

1313
## Expected behaviour 🤔
1414

@@ -22,7 +22,9 @@ Steps to reproduce the behaviour:
2222
4. See error
2323

2424
## Your environment 🌱
25+
2526
<!-- e.g. 1.2.3 -->
27+
2628
- Open mSupply Version:
2729
- Legacy mSupply Central Server Version:
2830
<!-- e.g. android, browser (extra points if you tell us which one), desktop (windows), desktop (macOS), server (windows) -->

build/windows/omsupply_demo.suf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ g_HandleSystemReboot();
34773477
<CustomSegSizeMode>0</CustomSegSizeMode>
34783478
<Platform>1</Platform>
34793479
<CollectLaunchUserInfo>0</CollectLaunchUserInfo>
3480-
<CodeSignSetups>1</CodeSignSetups>
3480+
<CodeSignSetups>0</CodeSignSetups>
34813481
<CodeSignLocation>C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe</CodeSignLocation>
34823482
<CodeSignWithSHA256>1</CodeSignWithSHA256>
34833483
<CodeSignCertificateFileSHA256>C:\mSupply_installer_codesigning\mSupply_installer_code_signing.pfx</CodeSignCertificateFileSHA256>

build/windows/omsupply_desktop.suf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3244,7 +3244,7 @@ g_HandleSystemReboot();
32443244
<CustomSegSizeMode>0</CustomSegSizeMode>
32453245
<Platform>1</Platform>
32463246
<CollectLaunchUserInfo>0</CollectLaunchUserInfo>
3247-
<CodeSignSetups>1</CodeSignSetups>
3247+
<CodeSignSetups>0</CodeSignSetups>
32483248
<CodeSignLocation>C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe</CodeSignLocation>
32493249
<CodeSignWithSHA256>1</CodeSignWithSHA256>
32503250
<CodeSignCertificateFileSHA256>C:\mSupply_installer_codesigning\mSupply_installer_code_signing.pfx</CodeSignCertificateFileSHA256>

build/windows/omsupply_server.suf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4594,7 +4594,7 @@ g_HandleSystemReboot();
45944594
<CustomSegSizeMode>0</CustomSegSizeMode>
45954595
<Platform>1</Platform>
45964596
<CollectLaunchUserInfo>0</CollectLaunchUserInfo>
4597-
<CodeSignSetups>1</CodeSignSetups>
4597+
<CodeSignSetups>0</CodeSignSetups>
45984598
<CodeSignLocation>C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe</CodeSignLocation>
45994599
<CodeSignWithSHA256>1</CodeSignWithSHA256>
46004600
<CodeSignCertificateFileSHA256>C:\mSupply_installer_codesigning\mSupply_installer_code_signing.pfx</CodeSignCertificateFileSHA256>

build/windows/omsupply_standalone.suf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3527,7 +3527,7 @@ g_HandleSystemReboot();
35273527
<CustomSegSizeMode>0</CustomSegSizeMode>
35283528
<Platform>1</Platform>
35293529
<CollectLaunchUserInfo>0</CollectLaunchUserInfo>
3530-
<CodeSignSetups>1</CodeSignSetups>
3530+
<CodeSignSetups>0</CodeSignSetups>
35313531
<CodeSignLocation>C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe</CodeSignLocation>
35323532
<CodeSignWithSHA256>1</CodeSignWithSHA256>
35333533
<CodeSignCertificateFileSHA256>C:\mSupply_installer_codesigning\mSupply_installer_code_signing.pfx</CodeSignCertificateFileSHA256>

client/.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ module.exports = {
5252
'react-hooks/exhaustive-deps': 'warn',
5353
'@typescript-eslint/no-explicit-any': 'warn',
5454
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
55+
'prefer-const': [
56+
'error',
57+
{
58+
destructuring: 'any',
59+
ignoreReadBeforeAssign: true,
60+
},
61+
],
5562
},
5663
ignorePatterns: ['**/operations.generated.ts', '**/types/schema.ts'],
5764
};

client/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To see it in action, check out the [demo server](https://demo-open.msupply.org/)
2828

2929
- If there are feature flags in use, they are set as environment variables. For example:
3030

31-
`yarn start-local-features FEATURE_INVENTORY_ADJUSTMENTS=true`
31+
`yarn start-local FEATURE_INVENTORY_ADJUSTMENTS=true`
3232

3333
- Bundle for production:
3434

client/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"sideEffects": false,
66
"private": true,
77
"scripts": {
8-
"start-local-features": "yarn start-local -- -- --env $1",
9-
"start-local": "lerna run --scope @openmsupply-client/* --parallel start-local",
10-
"start-remote": "lerna run --scope @openmsupply-client/* --parallel start-remote",
8+
"start-local": "lerna run --scope @openmsupply-client/* --parallel start-local -- --env $1 _",
9+
"start-remote": "lerna run --scope @openmsupply-client/* --parallel start-remote -- --env $1 _",
1110
"start": "yarn start-local",
1211
"build": "lerna run --scope @openmsupply-client/* build",
1312
"build-stats": "lerna run --scope @openmsupply-client/* build-stats",
@@ -127,4 +126,4 @@
127126
"msw": {
128127
"workerDirectory": "packages/host/public"
129128
}
130-
}
129+
}

client/packages/coldchain/src/Equipment/DetailView/DetailView.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
useConfirmOnLeaving,
1313
TableProvider,
1414
createTableStore,
15+
ObjUtils,
1516
} from '@openmsupply-client/common';
1617
import { AppRoute } from '@openmsupply-client/config';
1718
import { Toolbar } from './Toolbar';
@@ -23,6 +24,7 @@ import { StatusLogs } from './Tabs/StatusLogs';
2324
import { Documents } from './Tabs/Documents';
2425
import { ActivityLogList, useLocation } from '@openmsupply-client/system';
2526
import { DraftAsset } from '../types';
27+
import { Details } from './Tabs/Details';
2628

2729
export const EquipmentDetailView = () => {
2830
const { data, isLoading } = useAssets.document.get();
@@ -73,11 +75,17 @@ export const EquipmentDetailView = () => {
7375

7476
useEffect(() => {
7577
if (!data) return;
78+
79+
const assetProperties = ObjUtils.parse(data.properties);
80+
const catalogProperties = ObjUtils.parse(data.catalogProperties);
81+
7682
setDraft({
7783
...data,
7884
locationIds: draft?.locationIds
7985
? draft.locationIds
8086
: data.locations.nodes.map(location => location.id),
87+
parsedProperties: assetProperties,
88+
parsedCatalogProperties: catalogProperties,
8189
});
8290
// eslint-disable-next-line react-hooks/exhaustive-deps
8391
}, [data, setDraft]);
@@ -97,6 +105,10 @@ export const EquipmentDetailView = () => {
97105
),
98106
value: 'Summary',
99107
},
108+
{
109+
Component: <Details onChange={onChange} draft={draft} />,
110+
value: 'Details',
111+
},
100112
{
101113
Component: draft === undefined ? null : <StatusLogs assetId={draft.id} />,
102114
value: 'StatusLogs',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import React from 'react';
2+
import {
3+
BasicSpinner,
4+
InfoTooltipIcon,
5+
InputWithLabelRow,
6+
Typography,
7+
} from '@common/components';
8+
import { useTranslation } from '@common/intl';
9+
import { ArrayUtils, Box, PropertyInput } from '@openmsupply-client/common';
10+
import { DraftAsset } from '../../types';
11+
import { useAssets } from '../../api';
12+
13+
interface DetailsProps {
14+
draft?: DraftAsset;
15+
onChange: (patch: Partial<DraftAsset>) => void;
16+
}
17+
18+
const Container = ({ children }: { children: React.ReactNode }) => (
19+
<Box display="flex" flexDirection="column" alignContent="center" padding={4}>
20+
{children}
21+
</Box>
22+
);
23+
24+
const Section = ({
25+
children,
26+
heading,
27+
}: {
28+
children: React.ReactNode;
29+
heading: string;
30+
}) => (
31+
<Box
32+
display="flex"
33+
flexDirection="column"
34+
padding={2}
35+
paddingRight={4}
36+
sx={{ maxWidth: '600px', width: '100%' }}
37+
>
38+
<Heading>{heading}</Heading>
39+
{children}
40+
</Box>
41+
);
42+
43+
const Heading = ({ children }: { children: React.ReactNode }) => (
44+
<Typography
45+
sx={{
46+
marginLeft: '158px',
47+
fontSize: '20px',
48+
fontWeight: 'bold',
49+
}}
50+
>
51+
{children}
52+
</Typography>
53+
);
54+
55+
const Row = ({
56+
children,
57+
tooltip,
58+
label,
59+
}: {
60+
children: React.ReactNode;
61+
tooltip?: string;
62+
label: string;
63+
}) => (
64+
<Box paddingTop={1.5}>
65+
<InputWithLabelRow
66+
labelWidth="300px"
67+
label={label}
68+
labelProps={{
69+
sx: {
70+
fontSize: '16px',
71+
paddingRight: 2,
72+
textAlign: 'right',
73+
},
74+
}}
75+
Input={
76+
<>
77+
<Box sx={{}} flex={1}>
78+
{children}{' '}
79+
</Box>
80+
<Box>
81+
{tooltip && (
82+
<InfoTooltipIcon
83+
iconSx={{ color: 'gray.main' }}
84+
title={tooltip}
85+
/>
86+
)}
87+
</Box>
88+
</>
89+
}
90+
/>
91+
</Box>
92+
);
93+
94+
export const Details = ({ draft, onChange }: DetailsProps) => {
95+
const t = useTranslation('coldchain');
96+
97+
const { data: assetProperties, isLoading } = useAssets.properties.list({
98+
assetCategoryId: { equalAnyOrNull: [draft?.assetCategory?.id ?? ''] },
99+
assetClassId: { equalAnyOrNull: [draft?.assetClass?.id ?? ''] },
100+
assetTypeId: { equalAnyOrNull: [draft?.assetType?.id ?? ''] },
101+
});
102+
103+
if (!draft) return null;
104+
105+
return (
106+
<Box display="flex" flex={3} justifyContent={'center'}>
107+
<Container>
108+
{isLoading ? <BasicSpinner /> : null}
109+
<Section heading={t('label.asset-properties')}>
110+
{!draft.parsedProperties ? (
111+
<Typography sx={{ textAlign: 'center' }}>
112+
{t('messages.no-properties')}
113+
</Typography>
114+
) : (
115+
<>
116+
{assetProperties &&
117+
ArrayUtils.uniqBy(assetProperties, 'key').map(property => {
118+
const isCatalogue =
119+
draft.parsedCatalogProperties?.hasOwnProperty(
120+
property.key
121+
) ?? false;
122+
const value =
123+
draft.parsedCatalogProperties?.[property.key] ??
124+
draft.parsedProperties?.[property.key] ??
125+
null;
126+
127+
return (
128+
<Row
129+
key={property.key}
130+
label={property.name}
131+
tooltip={
132+
isCatalogue
133+
? t('messages.catalogue-property')
134+
: undefined
135+
}
136+
>
137+
<PropertyInput
138+
valueType={property.valueType}
139+
allowedValues={property.allowedValues?.split(',')}
140+
value={value}
141+
onChange={v =>
142+
onChange({
143+
parsedProperties: {
144+
...draft.parsedProperties,
145+
[property.key]: v ?? null,
146+
},
147+
})
148+
}
149+
disabled={isCatalogue}
150+
/>
151+
</Row>
152+
);
153+
})}
154+
</>
155+
)}
156+
</Section>
157+
</Container>
158+
</Box>
159+
);
160+
};

0 commit comments

Comments
 (0)