Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nengyuanzhang committed Jun 29, 2024
2 parents 28b4491 + ab9c6b0 commit eee5b5a
Show file tree
Hide file tree
Showing 13 changed files with 1,153 additions and 1,071 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- replaced svg with svg_id in microgrid
- replaced svg with svg_id in energy storage power station
- set data result hidden for space reports in myems-web
- set data result hidden by default for space reports in myems-web
- set data result hidden by default for equipment reports in myems-web
### Fixed
- added check relations statements to point on_delete action in myems-api
- fixed issue of on_delete action in myems-api
Expand Down
19 changes: 13 additions & 6 deletions myems-web/src/components/MyEMS/Equipment/EquipmentBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const EquipmentBatch = ({ setRedirect, setRedirectUrl, t }) => {
const [submitButtonDisabled, setSubmitButtonDisabled] = useState(false);
const [spinnerHidden, setSpinnerHidden] = useState(true);
const [exportButtonHidden, setExportButtonHidden] = useState(true);
const [resultDataHidden, setResultDataHidden] = useState(true);

//Results
const [detailedDataTableColumns, setDetailedDataTableColumns] = useState([
Expand Down Expand Up @@ -196,6 +197,8 @@ const EquipmentBatch = ({ setRedirect, setRedirectUrl, t }) => {
setSpinnerHidden(false);
// hide export button
setExportButtonHidden(true);
// hide result data
setResultDataHidden(true);

// Reinitialize tables
setEquipmentList([]);
Expand Down Expand Up @@ -284,6 +287,8 @@ const EquipmentBatch = ({ setRedirect, setRedirectUrl, t }) => {
setSpinnerHidden(true);
// show export button
setExportButtonHidden(false);
// show result data
setResultDataHidden(false);
} else {
toast.error(t(json.description));
}
Expand Down Expand Up @@ -401,12 +406,14 @@ const EquipmentBatch = ({ setRedirect, setRedirectUrl, t }) => {
</Form>
</CardBody>
</Card>
<DetailedDataTable
data={equipmentList}
title={t('Detailed Data')}
columns={detailedDataTableColumns}
pagesize={50}
/>
<div style={{visibility: resultDataHidden ? 'hidden' : 'visible'}}>
<DetailedDataTable
data={equipmentList}
title={t('Detailed Data')}
columns={detailedDataTableColumns}
pagesize={50}
/>
</div>
</Fragment>
);
};
Expand Down
176 changes: 91 additions & 85 deletions myems-web/src/components/MyEMS/Equipment/EquipmentCarbon.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const EquipmentCarbon = ({ setRedirect, setRedirectUrl, t }) => {
const [submitButtonDisabled, setSubmitButtonDisabled] = useState(true);
const [spinnerHidden, setSpinnerHidden] = useState(true);
const [exportButtonHidden, setExportButtonHidden] = useState(true);

const [resultDataHidden, setResultDataHidden] = useState(true);
//Results
const [timeOfUseShareData, setTimeOfUseShareData] = useState([]);
const [carbonShareData, setCarbonShareData] = useState([]);
Expand Down Expand Up @@ -421,6 +421,8 @@ const EquipmentCarbon = ({ setRedirect, setRedirectUrl, t }) => {
setSpinnerHidden(false);
// hide export button
setExportButtonHidden(true);
// hide result data
setResultDataHidden(true);

// Reinitialize tables
setDetailedDataTableData([]);
Expand Down Expand Up @@ -839,6 +841,8 @@ const EquipmentCarbon = ({ setRedirect, setRedirectUrl, t }) => {
setSpinnerHidden(true);
// show export button
setExportButtonHidden(false);
// show result data
setResultDataHidden(false);
} else {
toast.error(t(json.description));
}
Expand Down Expand Up @@ -1027,91 +1031,93 @@ const EquipmentCarbon = ({ setRedirect, setRedirectUrl, t }) => {
</Form>
</CardBody>
</Card>
<div className="card-deck">
{cardSummaryList.map(cardSummaryItem => (
<CardSummary
key={cardSummaryItem['name']}
rate={cardSummaryItem['increment_rate']}
title={t('Reporting Period Carbon Dioxide Emissions CATEGORY UNIT', {
CATEGORY: cardSummaryItem['name'],
UNIT: '(' + cardSummaryItem['unit'] + ')'
})}
color="success"
>
{cardSummaryItem['subtotal'] && (
<CountUp
end={cardSummaryItem['subtotal']}
duration={2}
prefix=""
separator=","
decimal="."
decimals={2}
/>
)}
</CardSummary>
))}
<div style={{visibility: resultDataHidden ? 'hidden' : 'visible'}}>
<div className="card-deck">
{cardSummaryList.map(cardSummaryItem => (
<CardSummary
key={cardSummaryItem['name']}
rate={cardSummaryItem['increment_rate']}
title={t('Reporting Period Carbon Dioxide Emissions CATEGORY UNIT', {
CATEGORY: cardSummaryItem['name'],
UNIT: '(' + cardSummaryItem['unit'] + ')'
})}
color="success"
>
{cardSummaryItem['subtotal'] && (
<CountUp
end={cardSummaryItem['subtotal']}
duration={2}
prefix=""
separator=","
decimal="."
decimals={2}
/>
)}
</CardSummary>
))}
</div>
<Row noGutters>
<Col className="mb-3 pr-lg-2 mb-3">
<SharePie data={timeOfUseShareData} title={t('Electricity Carbon Dioxide Emissions by Time-Of-Use')} />
</Col>
<Col className="mb-3 pr-lg-2 mb-3">
<SharePie data={carbonShareData} title={t('Carbon Dioxide Emissions by Energy Category')} />
</Col>
</Row>

<MultiTrendChart
reportingTitle={{
name: 'Reporting Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: equipmentReportingSubtotals,
UNIT: equipmentBaseAndReportingUnits
}}
baseTitle={{
name: 'Base Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: equipmentBaseSubtotals,
UNIT: equipmentBaseAndReportingUnits
}}
reportingTooltipTitle={{
name: 'Reporting Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: null,
UNIT: equipmentBaseAndReportingUnits
}}
baseTooltipTitle={{
name: 'Base Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: null,
UNIT: equipmentBaseAndReportingUnits
}}
reportingLabels={equipmentReportingLabels}
reportingData={equipmentReportingData}
baseLabels={equipmentBaseLabels}
baseData={equipmentBaseData}
rates={equipmentReportingRates}
options={equipmentReportingOptions}
/>

<MultipleLineChart
reportingTitle={t('Operating Characteristic Curve')}
baseTitle=""
labels={parameterLineChartLabels}
data={parameterLineChartData}
options={parameterLineChartOptions}
/>

<br />
<DetailedDataTable
data={detailedDataTableData}
title={t('Detailed Data')}
columns={detailedDataTableColumns}
pagesize={50}
/>
</div>
<Row noGutters>
<Col className="mb-3 pr-lg-2 mb-3">
<SharePie data={timeOfUseShareData} title={t('Electricity Carbon Dioxide Emissions by Time-Of-Use')} />
</Col>
<Col className="mb-3 pr-lg-2 mb-3">
<SharePie data={carbonShareData} title={t('Carbon Dioxide Emissions by Energy Category')} />
</Col>
</Row>

<MultiTrendChart
reportingTitle={{
name: 'Reporting Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: equipmentReportingSubtotals,
UNIT: equipmentBaseAndReportingUnits
}}
baseTitle={{
name: 'Base Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: equipmentBaseSubtotals,
UNIT: equipmentBaseAndReportingUnits
}}
reportingTooltipTitle={{
name: 'Reporting Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: null,
UNIT: equipmentBaseAndReportingUnits
}}
baseTooltipTitle={{
name: 'Base Period Carbon Dioxide Emissions CATEGORY VALUE UNIT',
substitute: ['CATEGORY', 'VALUE', 'UNIT'],
CATEGORY: equipmentBaseAndReportingNames,
VALUE: null,
UNIT: equipmentBaseAndReportingUnits
}}
reportingLabels={equipmentReportingLabels}
reportingData={equipmentReportingData}
baseLabels={equipmentBaseLabels}
baseData={equipmentBaseData}
rates={equipmentReportingRates}
options={equipmentReportingOptions}
/>

<MultipleLineChart
reportingTitle={t('Operating Characteristic Curve')}
baseTitle=""
labels={parameterLineChartLabels}
data={parameterLineChartData}
options={parameterLineChartOptions}
/>

<br />
<DetailedDataTable
data={detailedDataTableData}
title={t('Detailed Data')}
columns={detailedDataTableColumns}
pagesize={50}
/>
</Fragment>
);
};
Expand Down
Loading

0 comments on commit eee5b5a

Please sign in to comment.