Fix GMT offset

This commit is contained in:
Patrick McDonagh
2017-09-18 18:42:25 -05:00
parent 3a02e9354b
commit af862bdec1
9 changed files with 215 additions and 21 deletions

View File

@@ -7,9 +7,8 @@ export class Channel extends React.Component {
if (!isNaN(parseFloat(this.props.value))){
val = Math.round(parseFloat(this.props.value) * 1000) / 1000;
}
const timestamp = new Date(this.props.timestamp * 1000);
const age = Math.round((now - timestamp) / (1000 * 60 * 60) * 10) / 10;
let timestamp = new Date(this.props.timestamp * 1000);
const age = (Math.round((now - timestamp) / (1000 * 60 * 60) * 10) - (timestamp.getTimezoneOffset() / 6)) / 10;
let cellStyle = {
textAlign: "center"
};

View File

@@ -11,7 +11,6 @@ export class Company extends React.Component {
render(){
let devices = {};
let deviceTypes = [];
console.log(this.props.companyObj.devices);
for (let i = 0; i < Object.keys(this.props.companyObj.devices).length; i++)
deviceTypes = Object.keys(this.props.companyObj.devices).map((dType)=>{
if (this.props.companyObj.devices[dType].length > 0){
@@ -75,6 +74,23 @@ export class Company extends React.Component {
tableHead={tableHead} />
}
let pocDevices = [];
let pocCode = <span></span>
if (isDefined(this.props.companyObj.devices.poc)){
pocDevices = this.props.companyObj.devices.poc;
let tableHeadInner = Object.keys(channelStarter.poc).sort((a, b)=>{
return channelStarter.poc[a].order - channelStarter.poc[b].order;
}).map((ch, i)=>{
return <th key={"poc_" + i}>{channelStarter.poc[ch].name}</th>
})
let tableHead = <thead><tr><th>Well</th>{tableHeadInner}</tr></thead>
pocCode = <DeviceList
deviceList={pocDevices}
listName="Pump-Off Controller"
deviceType="poc"
tableHead={tableHead} />
}
return (
<div className="company" style={{marginLeft: "10px", marginRight: "10px"}} id={this.props.id}>

View File

@@ -12,8 +12,8 @@ export const auth = {
}
// export const baseURL = "https://henrypump.meshify.com/api/v3/";
// export const baseURL = "http://localhost:3000/"
export const baseURL = "http://api.henrypump.cloud/"
export const baseURL = "http://localhost:3000/"
// export const baseURL = "http://api.henrypump.cloud/"
export let channelStarter = {
abbflow: {
@@ -50,6 +50,34 @@ export let channelStarter = {
gpm_flow: {order: 5, name: "GPM Flow Rate", data:{}},
bpd_flow: {order: 6, name: "BPD Flow Rate", data:{}},
run_status: {order: 7, name: "Run Status", data:{}},
},
poc: {
go_percent_run: {order: 1, name: "Yest. % Run", data:{}},
go_kwh: {order: 2, name: "Yest. kWh", data:{}},
go_kwh_regen: {order: 3, name: "Yest. kWh Regen", data:{}},
go_electricity_cost: {order: 4, name: "Yest. Elect. Cost", data:{}},
go_peak_load: {order: 5, name: "Yest. Peak Load", data:{}},
go_min_load: {order: 6, name: "Yest. Min Load", data:{}},
go_average_spm: {order: 7, name: "Yest. Avg. SPM", data:{}},
go_production_calculated: {order: 8, name: "Yest. Production", data:{}},
go_polished_rod_hp: {order: 9, name: "Yest. PR HP", data:{}},
go_lifting_cost: {order: 10, name: "Yest. Lifting Cost", data:{}},
go_fluid_above_pump: {order: 11, name: "Yest. Fluid Level", data:{}},
go_pump_intake_pressure: {order: 12, name: "Yest. PIP", data:{}},
go_inflow_rate: {order: 13, name: "Yest. Inflow Rate", data:{}},
dt_percent_run: {order: 14, name: "Today % Run", data:{}},
dt_kwh: {order: 15, name: "Today kWh", data:{}},
dt_kwh_regen: {order: 16, name: "Today kWh Regen", data:{}},
dt_electricity_cost: {order: 17, name: "Today Elect. Cost", data:{}},
dt_peak_load: {order: 18, name: "Today Peak Load", data:{}},
dt_min_load: {order: 19, name: "Today Min Load", data:{}},
dt_average_spm: {order: 20, name: "Today Avg. SPM", data:{}},
dt_production_calculated: {order: 21, name: "Today Production", data:{}},
dt_polished_rod_hp: {order: 22, name: "Today PR HP", data:{}},
dt_lifting_cost: {order: 23, name: "Today Lifting Cost", data:{}},
dt_fluid_above_pump: {order: 24, name: "Today Fluid Level", data:{}},
dt_pump_intake_pressure: {order: 25, name: "Today PIP", data:{}},
dt_inflow_rate: {order: 26, name: "Today Inflow Rate", data:{}},
}
}

View File

@@ -4,8 +4,9 @@
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>POCloud Reports</title>
</head>
<body>
<div id="app"></div>