From 2cd13bc7d5f6b249b0cf81d1f6d82359ea0b8450 Mon Sep 17 00:00:00 2001
From: tianlinzhong <673359306@qq.com>
Date: Mon, 19 Jul 2021 17:59:56 +0800
Subject: [PATCH 1/6] Add Child Spaces Share Pie to Space Cost Report Web UI
---
web/src/components/MyEMS/Space/SpaceCost.js | 37 +++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/web/src/components/MyEMS/Space/SpaceCost.js b/web/src/components/MyEMS/Space/SpaceCost.js
index 02c352ca..a59bc58f 100644
--- a/web/src/components/MyEMS/Space/SpaceCost.js
+++ b/web/src/components/MyEMS/Space/SpaceCost.js
@@ -83,7 +83,8 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
const [spaceLineChartLabels, setSpaceLineChartLabels] = useState([]);
const [spaceLineChartData, setSpaceLineChartData] = useState({});
const [spaceLineChartOptions, setSpaceLineChartOptions] = useState([]);
-
+ const [childSpaceProportionList, setChildSpaceProportionList] = useState([]);
+
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]);
const [parameterLineChartData, setParameterLineChartData] = useState({});
const [parameterLineChartOptions, setParameterLineChartOptions] = useState([]);
@@ -318,7 +319,28 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
costDataArray.push(costDataItem);
});
setCostShareData(costDataArray);
-
+
+ let childSpaceProportionArray = [];
+ json['child_space']['energy_category_names'].forEach((currentValue, energyCategoryIndex) => {
+ if (json['child_space']['child_space_names_array'][energyCategoryIndex].length > 0) {
+ let childSpaceProportionItem = {}
+ childSpaceProportionItem['data'] = []
+ json['child_space']['child_space_names_array'][energyCategoryIndex].forEach((currentSpaceName, spaceIndex) => {
+ let childSpaceProportionItemDataItem = {}
+ childSpaceProportionItemDataItem['id'] = spaceIndex;
+ childSpaceProportionItemDataItem['name'] = currentSpaceName;
+ childSpaceProportionItemDataItem['value'] = json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex];
+ childSpaceProportionItemDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16);
+ childSpaceProportionItem['data'].push(childSpaceProportionItemDataItem);
+ });
+
+ childSpaceProportionItem['name'] = json['child_space']['energy_category_names'][energyCategoryIndex];
+ childSpaceProportionItem['unit'] = json['child_space']['units'][energyCategoryIndex];
+ childSpaceProportionArray.push(childSpaceProportionItem);
+ };
+ });
+ setChildSpaceProportionList(childSpaceProportionArray);
+
let timestamps = {}
json['reporting_period']['timestamps'].forEach((currentValue, index) => {
timestamps['a' + index] = currentValue;
@@ -637,6 +659,17 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
+ {childSpaceProportionList.map(childSpaceProportionItem => (
+
+
+
+ ))}
Date: Mon, 26 Jul 2021 20:45:50 +0800
Subject: [PATCH 2/6] Added a total cost ratio chart
---
web/src/components/MyEMS/Space/SpaceCost.js | 35 +++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/web/src/components/MyEMS/Space/SpaceCost.js b/web/src/components/MyEMS/Space/SpaceCost.js
index a59bc58f..bcbc5971 100644
--- a/web/src/components/MyEMS/Space/SpaceCost.js
+++ b/web/src/components/MyEMS/Space/SpaceCost.js
@@ -84,6 +84,7 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
const [spaceLineChartData, setSpaceLineChartData] = useState({});
const [spaceLineChartOptions, setSpaceLineChartOptions] = useState([]);
const [childSpaceProportionList, setChildSpaceProportionList] = useState([]);
+ const [childSpacesProportionList, setChildSpacesProportionList] = useState([]);
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]);
const [parameterLineChartData, setParameterLineChartData] = useState({});
@@ -341,6 +342,29 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
});
setChildSpaceProportionList(childSpaceProportionArray);
+ let childSpacesProportionArray = [];
+ if (json['child_space']['child_space_names_array'].length > 0) {
+ let childSpacesProportionItem = {}
+ childSpacesProportionItem['data'] = []
+ json['child_space']['child_space_names_array'][0].forEach((currentSpaceName, spaceIndex) => {
+ let total = 0.0;
+ json['child_space']['energy_category_names'].forEach((currentValue, energyCategoryIndex) => {
+ total += json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex]
+ // total = total.toFixed()
+ });
+ let childSpacesProportionItemDataItem = {};
+ childSpacesProportionItemDataItem['id'] = spaceIndex;
+ childSpacesProportionItemDataItem['name'] = currentSpaceName;
+ childSpacesProportionItemDataItem['value'] = total;
+ childSpacesProportionItemDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16);
+ childSpacesProportionItem['data'].push(childSpacesProportionItemDataItem);
+ });
+ childSpacesProportionItem['name'] = "";
+ childSpacesProportionItem['unit'] = "";
+ childSpacesProportionArray.push(childSpacesProportionItem);
+ };
+ setChildSpacesProportionList(childSpacesProportionArray);
+
let timestamps = {}
json['reporting_period']['timestamps'].forEach((currentValue, index) => {
timestamps['a' + index] = currentValue;
@@ -670,6 +694,17 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
/>
))}
+ {childSpacesProportionList.map(childSpacesProportionItem => (
+
+
+
+ ))}
Date: Tue, 27 Jul 2021 18:40:25 +0800
Subject: [PATCH 3/6] Fixed some bugs
---
web/src/components/MyEMS/Space/SpaceCost.js | 23 +++++++--------------
web/src/i18n.js | 1 +
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/web/src/components/MyEMS/Space/SpaceCost.js b/web/src/components/MyEMS/Space/SpaceCost.js
index bcbc5971..32fc073c 100644
--- a/web/src/components/MyEMS/Space/SpaceCost.js
+++ b/web/src/components/MyEMS/Space/SpaceCost.js
@@ -84,7 +84,7 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
const [spaceLineChartData, setSpaceLineChartData] = useState({});
const [spaceLineChartOptions, setSpaceLineChartOptions] = useState([]);
const [childSpaceProportionList, setChildSpaceProportionList] = useState([]);
- const [childSpacesProportionList, setChildSpacesProportionList] = useState([]);
+ const [childSpacetotalProportion, setChildSpacetotalProportion] = useState([]);
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]);
const [parameterLineChartData, setParameterLineChartData] = useState({});
@@ -344,26 +344,21 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
let childSpacesProportionArray = [];
if (json['child_space']['child_space_names_array'].length > 0) {
- let childSpacesProportionItem = {}
- childSpacesProportionItem['data'] = []
json['child_space']['child_space_names_array'][0].forEach((currentSpaceName, spaceIndex) => {
let total = 0.0;
json['child_space']['energy_category_names'].forEach((currentValue, energyCategoryIndex) => {
total += json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex]
- // total = total.toFixed()
+ total = total.toFixed()
});
let childSpacesProportionItemDataItem = {};
childSpacesProportionItemDataItem['id'] = spaceIndex;
childSpacesProportionItemDataItem['name'] = currentSpaceName;
childSpacesProportionItemDataItem['value'] = total;
childSpacesProportionItemDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16);
- childSpacesProportionItem['data'].push(childSpacesProportionItemDataItem);
+ childSpacesProportionArray.push(childSpacesProportionItemDataItem);
});
- childSpacesProportionItem['name'] = "";
- childSpacesProportionItem['unit'] = "";
- childSpacesProportionArray.push(childSpacesProportionItem);
};
- setChildSpacesProportionList(childSpacesProportionArray);
+ setChildSpacetotalProportion(childSpacesProportionArray);
let timestamps = {}
json['reporting_period']['timestamps'].forEach((currentValue, index) => {
@@ -694,17 +689,13 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
/>
))}
- {childSpacesProportionList.map(childSpacesProportionItem => (
- ))}
+
Date: Wed, 28 Jul 2021 12:35:17 +0800
Subject: [PATCH 4/6] added translation of Child Space Total Proportion for
SpaceCost in Web UI
---
web/src/components/MyEMS/Space/SpaceCost.js | 35 ++++++++++-----------
web/src/i18n.js | 10 +++---
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/web/src/components/MyEMS/Space/SpaceCost.js b/web/src/components/MyEMS/Space/SpaceCost.js
index 32fc073c..024de40a 100644
--- a/web/src/components/MyEMS/Space/SpaceCost.js
+++ b/web/src/components/MyEMS/Space/SpaceCost.js
@@ -84,7 +84,7 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
const [spaceLineChartData, setSpaceLineChartData] = useState({});
const [spaceLineChartOptions, setSpaceLineChartOptions] = useState([]);
const [childSpaceProportionList, setChildSpaceProportionList] = useState([]);
- const [childSpacetotalProportion, setChildSpacetotalProportion] = useState([]);
+ const [childSpaceSubtotalShareData, setChildSpaceSubtotalShareData] = useState([]);
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]);
const [parameterLineChartData, setParameterLineChartData] = useState({});
@@ -342,23 +342,22 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
});
setChildSpaceProportionList(childSpaceProportionArray);
- let childSpacesProportionArray = [];
+ let childSpaceSubtotalShareDataArray = [];
if (json['child_space']['child_space_names_array'].length > 0) {
json['child_space']['child_space_names_array'][0].forEach((currentSpaceName, spaceIndex) => {
- let total = 0.0;
+ let subtotal = 0.0;
json['child_space']['energy_category_names'].forEach((currentValue, energyCategoryIndex) => {
- total += json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex]
- total = total.toFixed()
+ subtotal += json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex];
});
- let childSpacesProportionItemDataItem = {};
- childSpacesProportionItemDataItem['id'] = spaceIndex;
- childSpacesProportionItemDataItem['name'] = currentSpaceName;
- childSpacesProportionItemDataItem['value'] = total;
- childSpacesProportionItemDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16);
- childSpacesProportionArray.push(childSpacesProportionItemDataItem);
+ let childSpaceSubtotalDataItem = {};
+ childSpaceSubtotalDataItem['id'] = spaceIndex;
+ childSpaceSubtotalDataItem['name'] = currentSpaceName;
+ childSpaceSubtotalDataItem['value'] = subtotal;
+ childSpaceSubtotalDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16);
+ childSpaceSubtotalShareDataArray.push(childSpaceSubtotalDataItem);
});
};
- setChildSpacetotalProportion(childSpacesProportionArray);
+ setChildSpaceSubtotalShareData(childSpaceSubtotalShareDataArray);
let timestamps = {}
json['reporting_period']['timestamps'].forEach((currentValue, index) => {
@@ -689,12 +688,12 @@ const SpaceCost = ({ setRedirect, setRedirectUrl, t }) => {
/>
))}
-
-
-
+
+
+
Date: Thu, 29 Jul 2021 11:33:14 +0800
Subject: [PATCH 5/6] Added how to install Apache
---
admin/README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
web/README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+)
diff --git a/admin/README.md b/admin/README.md
index 15a0a5ac..0ef12057 100644
--- a/admin/README.md
+++ b/admin/README.md
@@ -75,3 +75,54 @@ The 'upload' folder is for user uploaded files. DO NOT delete/move/overwrite the
```
/var/www/html/admin/upload
```
+
+
+## Install Apache2 Server
+sudo apt-get install apache2
+
+* Configure Apache2
+```
+$ sudo vi /etc/apache2/ports.conf
+```
+add a Listen
+```
+Listen 8001
+```
+$ sudo vi /etc/apache2/sites-available/000-default.conf
+```
+Add a new 'VirtualHost' as below
+```
+
+ ServerAdmin MyEMS-admin
+ DocumentRoot /var/www/admin
+
+
+ Options FollowSymLinks
+ AllowOverride All
+ Require all granted
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+```
+* Download myems-admin
+```
+$ cd ~
+$ git clone https://github.com/MyEMS/myems.git
+```
+Build and Compress
+```
+$ cd ~/myems/admin/
+$ sudo npm run build
+$ tar czvf myems-admin.tar.gz build
+```
+Install Upload the file myems-admin.tar.gz to you admin server. Note that the following path should be same as that was configured in nginx.conf.
+```
+$ tar xzf myems-admin.tar.gz
+$ sudo rm -r /var/www/admin
+$ sudo mv build /var/www/admin
+```
+Restart Apache2
+```
+$ sudo service apache2 restart
+```
\ No newline at end of file
diff --git a/web/README.md b/web/README.md
index 9664cc61..6804aba4 100644
--- a/web/README.md
+++ b/web/README.md
@@ -104,3 +104,54 @@ $ sudo systemctl restart nginx
$ sudo rm -r /var/www/html/web
$ sudo mv build /var/www/html/web
```
+
+## Install Apache2 Server
+sudo apt-get install apache2
+
+* Configure Apache2
+```
+$ sudo vi /etc/apache2/ports.conf
+```
+add a Listen
+```
+Listen 8002
+```
+$ sudo vi /etc/apache2/sites-available/000-default.conf
+```
+Add a new 'VirtualHost' as below
+```
+
+ ServerAdmin MyEMS-web
+ DocumentRoot /var/www/web
+
+
+ Options FollowSymLinks
+ AllowOverride All
+ Require all granted
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+
+* Download myems-web
+```
+$ cd ~
+$ git clone https://github.com/MyEMS/myems.git
+```
+Build and Compress
+```
+$ cd ~/myems/web/
+$ sudo npm run build
+$ tar czvf myems-web.tar.gz build
+```
+Install Upload the file myems-web.tar.gz to you web server. Note that the following path should be same as that was configured in nginx.conf.
+```
+$ tar xzf myems-web.tar.gz
+$ sudo rm -r /var/www/web
+$ sudo mv build /var/www/web
+
+```
+Restart Apache2
+```
+$ sudo service apache2 restart
+```
\ No newline at end of file
From fcc2c3e30bcda9dfc07a9e3c0bfc4d306f533412 Mon Sep 17 00:00:00 2001
From: "13621160019@163.com" <13621160019@163.com>
Date: Thu, 29 Jul 2021 13:26:50 +0800
Subject: [PATCH 6/6] updated REAEME files in Admin UI and Web UI
---
admin/README.md | 37 ++++++++++++++++----------------
web/README.md | 56 ++++++++++++++++++++++++++++---------------------
2 files changed, 50 insertions(+), 43 deletions(-)
diff --git a/admin/README.md b/admin/README.md
index 0ef12057..1ecae0b2 100644
--- a/admin/README.md
+++ b/admin/README.md
@@ -8,9 +8,9 @@ Providing admin panel for MyEMS system administration and configuration
nginx-1.18.0 or later
-## Installation
+## Option 1: Install on NGINX Server
-* Install NGINX Server
+* Install NGINX Server
refer to http://nginx.org/en/docs/install.html
@@ -53,7 +53,7 @@ Add a new 'server' section with direstives as below:
}
```
-* Download myems-admin
+* Download myems
```
$ cd ~
$ git clone https://github.com/MyEMS/myems.git
@@ -77,17 +77,20 @@ The 'upload' folder is for user uploaded files. DO NOT delete/move/overwrite the
```
-## Install Apache2 Server
-sudo apt-get install apache2
+## Option 2: Install on Apache2 Server
+* Install Apache2 Server
+
+refer to https://httpd.apache.org/docs/2.4/install.html
* Configure Apache2
```
-$ sudo vi /etc/apache2/ports.conf
+ $ sudo vi /etc/apache2/ports.conf
```
-add a Listen
+Add a Listen
```
Listen 8001
```
+```
$ sudo vi /etc/apache2/sites-available/000-default.conf
```
Add a new 'VirtualHost' as below
@@ -105,24 +108,20 @@ Add a new 'VirtualHost' as below
CustomLog ${APACHE_LOG_DIR}/access.log combined
```
+
* Download myems-admin
```
$ cd ~
$ git clone https://github.com/MyEMS/myems.git
```
-Build and Compress
+
+* Install myems-admin :
+ If the server can not connect to the internet, please compress the myems/admin folder and upload it to the server and extract it to ~/myems/admin
```
-$ cd ~/myems/admin/
-$ sudo npm run build
-$ tar czvf myems-admin.tar.gz build
+$ sudo cp -r ~/myems/admin /var/www/html/admin
+$ sudo chmod 0755 -R /var/www/html/admin
```
-Install Upload the file myems-admin.tar.gz to you admin server. Note that the following path should be same as that was configured in nginx.conf.
+ Check the config file and change it if necessary:
```
-$ tar xzf myems-admin.tar.gz
-$ sudo rm -r /var/www/admin
-$ sudo mv build /var/www/admin
-```
-Restart Apache2
-```
-$ sudo service apache2 restart
+$ sudo nano /var/www/html/admin/app/api.js
```
\ No newline at end of file
diff --git a/web/README.md b/web/README.md
index 6804aba4..be402f5c 100644
--- a/web/README.md
+++ b/web/README.md
@@ -30,7 +30,7 @@ This will create an optimized production build by compililing, merging and minif
You can run 'node server.js' to run the production build locally at http://localhost:5000.
-## Install Production Build on NGINX Server
+## Option 1: Install Production Build on NGINX Server
* Install NGINX Server
@@ -105,22 +105,25 @@ $ sudo systemctl restart nginx
$ sudo mv build /var/www/html/web
```
-## Install Apache2 Server
-sudo apt-get install apache2
+## Option 2: Install Production Build on Apache2 Server
+* Install Apache2 Server
+
+refer to https://httpd.apache.org/docs/2.4/install.html
* Configure Apache2
```
-$ sudo vi /etc/apache2/ports.conf
+ $ sudo vi /etc/apache2/ports.conf
```
-add a Listen
+Add a Listen
```
-Listen 8002
+Listen 80
```
-$ sudo vi /etc/apache2/sites-available/000-default.conf
+```
+ $ sudo vi /etc/apache2/sites-available/000-default.conf
```
Add a new 'VirtualHost' as below
```
-
+
ServerAdmin MyEMS-web
DocumentRoot /var/www/web
@@ -132,26 +135,31 @@ Add a new 'VirtualHost' as below
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
+```
-* Download myems-web
+* Download myems:
```
-$ cd ~
-$ git clone https://github.com/MyEMS/myems.git
+ $ cd ~
+ $ git clone https://github.com/MyEMS/myems.git
```
-Build and Compress
-```
-$ cd ~/myems/web/
-$ sudo npm run build
-$ tar czvf myems-web.tar.gz build
-```
-Install Upload the file myems-web.tar.gz to you web server. Note that the following path should be same as that was configured in nginx.conf.
-```
-$ tar xzf myems-web.tar.gz
-$ sudo rm -r /var/www/web
-$ sudo mv build /var/www/web
+* Install myems-web :
+ Check and change the config file if necessary:
```
-Restart Apache2
+ $ cd ~/myems/web
+ $ sudo nano src/config.js
```
-$ sudo service apache2 restart
+ Build and Compress
+```
+ $ cd ~/myems/web/
+ $ sudo npm run build
+ $ tar czvf myems-web.tar.gz build
+```
+ Install
+ Upload the file myems-web.tar.gz to you web server.
+ Note that the following path should be same as that was configured in 000-default.conf
+```
+ $ tar xzf myems-web.tar.gz
+ $ sudo rm -r /var/www/web
+ $ sudo mv build /var/www/web
```
\ No newline at end of file