Skip to content

Commit

Permalink
fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ridz1208 committed Nov 26, 2024
1 parent 6b85103 commit 5d535fa
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 13 deletions.
4 changes: 2 additions & 2 deletions modules/biobank/jsx/Shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class Shipment {
/**
* Constructor
*
* @param {Object} params - The shipment parameters
* @param {object} params - The shipment parameters
* @param {string} params.id - Shipment ID
* @param {string} params.barcode - Shipment barcode
* @param {string} params.type - Shipment type
* @param {number} params.destinationCenterId - Destination center ID
* @param {Array} params.logs - Logs for this shipment
* @param {Array} params.containerIds - Container IDs in this shipment
*/
*/
constructor({
id = null,
barcode = null,
Expand Down
2 changes: 1 addition & 1 deletion modules/biobank/jsx/containerDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function ContainerDisplay(props) {
}

// containerDisplay.propTypes
containerDisplay.propTypes = {
ContainerDisplay.propTypes = {
barcodes: PropTypes.arrayOf(PropTypes.string).isRequired,
coordinates: PropTypes.arrayOf(PropTypes.string).isRequired,
current: PropTypes.shape({
Expand Down
3 changes: 1 addition & 2 deletions modules/biobank/jsx/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';

import {
FormElement,
TextboxElement,
Expand Down Expand Up @@ -240,7 +239,7 @@ Header.propTypes = {
}).isRequired,
}).isRequired,
data: PropTypes.obj.isRequired,
setContainer: PropType.func.isRequired,
setContainer: PropTypes.func.isRequired,
updateContainer: PropTypes.func.isRequired,
edit: PropTypes.func.isRequired,
increaseCoordinate: PropTypes.func.isRequired,
Expand Down
3 changes: 3 additions & 0 deletions modules/biobank/jsx/processForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ const SpecimenProcessForm = (props) => {

// ProcessForm.propTypes
SpecimenProcessForm.propTypes = {
edit: PropTypes.bool.isRequired,
process: PropTypes.shape({
data: PropTypes.object,
protocolId: PropTypes.number,
Expand Down Expand Up @@ -272,6 +273,7 @@ SpecimenProcessForm.propTypes = {
),
units: PropTypes.obj.isRequired,
protocols: PropTypes.arrayOf(PropTypes.string),
processes: PropTypes.arrayOf(PropTypes.string),
protocolAttributes: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
Expand All @@ -286,6 +288,7 @@ SpecimenProcessForm.propTypes = {
}).isRequired,
specimen: PropTypes.object.isRequired,
errors: PropTypes.shape({
data: PropTypes.obj,
quantity: PropTypes.string,
unitId: PropTypes.string,
protocolId: PropTypes.string,
Expand Down
190 changes: 190 additions & 0 deletions modules/biobank/jsx/shipmentTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,82 @@ function ShipmentTab({
);
}

// ShipmentTab.propTypes
import PropTypes from 'prop-types';

ShipmentTab.propTypes = {
// Data prop: Contains nested data objects
data: PropTypes.shape({
data: PropTypes.object.isRequired, // Define more specific shape if possible
containers: PropTypes.arrayOf(
PropTypes.shape({
specimenId: PropTypes.number.isRequired,
// Add other container-specific properties if necessary
})
).isRequired,
specimens: PropTypes.arrayOf(
PropTypes.shape({
specimenId: PropTypes.number.isRequired,
// Add other specimen-specific properties if necessary
})
).isRequired,
pools: PropTypes.array.isRequired,
}).isRequired,

// Function to set data
setData: PropTypes.func.isRequired,

// Options prop: Configuration options for shipment, specimen, container, etc.
options: PropTypes.shape({
specimen: PropTypes.shape({
units: PropTypes.string.isRequired, // Added based on error
types: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
})
).isRequired,
}).isRequired,
container: PropTypes.shape({
typesPrimary: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
})
).isRequired,
stati: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
})
).isRequired,
}).isRequired,
diagnoses: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
})
),
centers: PropTypes.arrayOf(PropTypes.string).isRequired,
projects: PropTypes.arrayOf(PropTypes.string).isRequired,
candidates: PropTypes.arrayOf(PropTypes.string).isRequired,
sessions: PropTypes.arrayOf(PropTypes.string).isRequired,
candidateSessions: PropTypes.arrayOf(PropTypes.string).isRequired,
}).isRequired,

// Functional props
increaseCoordinate: PropTypes.func.isRequired,
createSpecimens: PropTypes.func.isRequired,

// Other props (ensure these are actually used in the component)
loading: PropTypes.bool.isRequired,

// History prop: For navigation
history: PropTypes.shape({
push: PropTypes.func.isRequired,
}).isRequired,

// UI Control props
title: PropTypes.string.isRequired,
show: PropTypes.bool.isRequired,
};

/**
* Returns some dom elements with information about a shipment
*
Expand Down Expand Up @@ -269,6 +345,29 @@ function ShipmentInformation({
);
}

ShipmentInformation.propTypes = {
// Shipment prop: Contains shipment details
shipment: PropTypes.shape({
barcode: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
logs: PropTypes.arrayOf(
PropTypes.shape({
centerId: PropTypes.number,
temperature: PropTypes.number,
date: PropTypes.string,
time: PropTypes.string,
user: PropTypes.string,
comments: PropTypes.string,
})
).isRequired,
containerBarcodes: PropTypes.arrayOf(PropTypes.string).isRequired,
destinationCenterId: PropTypes.number.isRequired,
}).isRequired,

// Centers prop: Array of centers
centers: PropTypes.arrayOf(PropTypes.string).isRequired,
};

/**
* Modal form to create a shipment
*
Expand Down Expand Up @@ -388,6 +487,43 @@ function CreateShipment({
);
}

CreateShipment.propTypes = {
// UI Control props
show: PropTypes.bool.isRequired,
setShow: PropTypes.func.isRequired,

// Data prop: Contains containers and other data
data: PropTypes.shape({
containers: PropTypes.arrayOf(
PropTypes.shape({
specimenId: PropTypes.number.isRequired,
// Add other container-specific properties if necessary
})
).isRequired,
// Add other data-specific properties if necessary
}).isRequired,

// Centers prop: Array of centers
centers: PropTypes.arrayOf(PropTypes.string).isRequired,

// Types prop: Array of shipment types
types: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
})
).isRequired,

// Users prop: Array of users
users: PropTypes.arrayOf(PropTypes.string).isRequired,

// Functional props
updateShipments: PropTypes.func.isRequired,
setData: PropTypes.func.isRequired,

// Additional props based on errors
// Ensure all necessary props are included
};

/**
* React Component for a received shipment
*
Expand Down Expand Up @@ -438,6 +574,32 @@ function ReceiveShipment({
);
}

ReceiveShipment.propTypes = {
// Shipment prop: Contains shipment details
shipment: PropTypes.shape({
barcode: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
destinationCenterId: PropTypes.number.isRequired,
logs: PropTypes.arrayOf(
PropTypes.shape({
centerId: PropTypes.number,
temperature: PropTypes.number,
date: PropTypes.string,
time: PropTypes.string,
user: PropTypes.string,
comments: PropTypes.string,
})
).isRequired,
}).isRequired,

// Users prop: Array of users
users: PropTypes.arrayOf(PropTypes.string).isRequired,

// Functional props
updateShipments: PropTypes.func.isRequired,
setData: PropTypes.func.isRequired,
};

/**
* Return a form for the shipment log
*
Expand Down Expand Up @@ -500,4 +662,32 @@ function ShipmentLogForm({
);
}

ShipmentLogForm.propTypes = {
// Log prop: Contains log details
log: PropTypes.shape({
temperature: PropTypes.number.isRequired,
date: PropTypes.string.isRequired,
time: PropTypes.string.isRequired,
user: PropTypes.string.isRequired,
comments: PropTypes.string,
// Add other log-specific properties if necessary
}).isRequired,

// Function to set log
setLog: PropTypes.func.isRequired,

// Errors prop: Validation errors for log
errors: PropTypes.shape({
temperature: PropTypes.string,
date: PropTypes.string,
time: PropTypes.string,
user: PropTypes.string,
comments: PropTypes.string,
// Add other error-specific properties if necessary
}).isRequired,

// Users prop: Array of users
users: PropTypes.arrayOf(PropTypes.string).isRequired,
};

export default ShipmentTab;
3 changes: 3 additions & 0 deletions modules/biobank/jsx/specimenForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,14 @@ class SpecimenBarcodeForm extends React.Component {

// SpecimenBarcodeForm.propTypes
SpecimenBarcodeForm.propTypes = {
typeId: PropTypes.number
// Item prop: Contains container and specimen information
item: PropTypes.shape({
container: PropTypes.shape({
barcode: PropTypes.string.isRequired,
typeId: PropTypes.number.isRequired,
lotNumber: PropTypes.string,
expirationDate: PropTypes.string,
}).isRequired,
typeId: PropTypes.number.isRequired,
collection: PropTypes.string,
Expand Down
12 changes: 4 additions & 8 deletions modules/biobank/jsx/specimenTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ class SpecimenTab extends Component {
return <td>{value.join(', ')}</td>;
case 'Container Barcode':
// check if container has be queried
if (Object.values(data.containers).find((container) => container.barcode == value)) {
if (
Object.values(data.containers)
.find((container) => container.barcode == value)
) {
return <td><Link to={`/barcode=${value}`}>{value}</Link></td>;
}
return <td>{value}</td>;
Expand Down Expand Up @@ -404,7 +407,6 @@ class SpecimenTab extends Component {
}

SpecimenTab.propTypes = {
// Options prop: Configuration options for specimen, containers, etc.
options: PropTypes.shape({
specimen: PropTypes.shape({
units: PropTypes.string, // Added based on errors
Expand Down Expand Up @@ -508,12 +510,6 @@ SpecimenTab.propTypes = {
}).isRequired,
}).isRequired,

// Options projects and centers
options: PropTypes.shape({
projects: PropTypes.arrayOf(PropTypes.string).isRequired,
centers: PropTypes.arrayOf(PropTypes.string).isRequired,
}).isRequired,

// Errors prop: Handles validation errors
errors: PropTypes.shape({
container: PropTypes.shape({
Expand Down

0 comments on commit 5d535fa

Please sign in to comment.