Skip to content

Commit

Permalink
problem with global link
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaroslav committed May 8, 2022
1 parent c4bbf14 commit c053706
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 67 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion client/src/GLOBAL_URL.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const GLOBAL_URL: string = "https://vpsli4228.a24vps.com/uuiot";
export const GLOBAL_URL: string = "http://localhost:5001";
//https://vpsli4228.a24vps.com/uuiot
//http://localhost:5001
115 changes: 59 additions & 56 deletions client/src/routes/iotDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,21 @@ const StudentsDashboard = () => {

const humidityData: IHumidity[] = await responseHumidity.json();
const temperatureData: ITemperature[] = await responseTemperature.json();
humidityData.forEach((h) => {
const niceDate = new Date(h.date).toLocaleDateString() + " " + new Date(h.date).toLocaleTimeString();
h.date = niceDate;
h.humidity = parseFloat(h.humidity.toFixed(1));
})
setHumidity(humidityData)
temperatureData.forEach((h: ITemperature) => {
const niceDate = new Date(h.date).toLocaleDateString() + " " + new Date(h.date).toLocaleTimeString();
h.date = niceDate;
h.temperature = parseFloat(h.temperature.toFixed(1));
})
setTemperature(temperatureData);

// humidityData.forEach((h) => {
// const niceDate = new Date(h.date).toLocaleDateString() + " " + new Date(h.date).toLocaleTimeString();
// h.date = niceDate;
// h.humidity = parseFloat(h.humidity.toFixed(1));
// })

// temperatureData.forEach((h: ITemperature) => {
// const niceDate = new Date(h.date).toLocaleDateString() + " " + new Date(h.date).toLocaleTimeString();
// h.date = niceDate;
// h.temperature = parseFloat(h.temperature.toFixed(1));
// })

setIsLoading(false);
} catch (error) {
setIsLoading(false)
Expand Down Expand Up @@ -168,52 +171,52 @@ const StudentsDashboard = () => {

<div className="gwData">
<div style={{ width: '100%', marginTop: 20 }}>
<React.Suspense fallback="<div>Loading</div>">
{temperature.length > 0 &&
<>
<h3>Teplota</h3>
<ResponsiveContainer width="100%" height={200}>
<LineChart
width={500}
height={200}
data={temperature}
margin={{
top: 10,
right: 30,
left: 0,
bottom: 0,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" style={{ fontSize: 8 }} />
<YAxis />
<Tooltip />
<Line connectNulls name="Teplota" type="monotone" dataKey="temperature" stroke="#8884d8" fill="#8884d8" />
</LineChart>
</ResponsiveContainer>
<h3>Vlhkost</h3>
<ResponsiveContainer width="100%" height={200}>
<LineChart
width={500}
height={200}
data={humidity}
margin={{
top: 10,
right: 30,
left: 0,
bottom: 0,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" style={{ fontSize: 8 }} />
<YAxis />
<Tooltip />
<Line connectNulls name="vlhkost" type="monotone" dataKey="humidity" stroke="#8884d8" fill="#8884d8" />
</LineChart>
</ResponsiveContainer>
</>
}
</React.Suspense>

{temperature.length > 0 &&
<>
<h3>Teplota</h3>
<ResponsiveContainer width="100%" height={200}>
<LineChart
width={500}
height={200}
data={temperature}
margin={{
top: 10,
right: 30,
left: 0,
bottom: 0,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" style={{ fontSize: 8 }} />
<YAxis />
<Tooltip />
<Line connectNulls name="Teplota" type="monotone" dataKey="temperature" stroke="#8884d8" fill="#8884d8" />
</LineChart>
</ResponsiveContainer>
<h3>Vlhkost</h3>
<ResponsiveContainer width="100%" height={200}>
<LineChart
width={500}
height={200}
data={humidity}
margin={{
top: 10,
right: 30,
left: 0,
bottom: 0,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" style={{ fontSize: 8 }} />
<YAxis />
<Tooltip />
<Line connectNulls name="vlhkost" type="monotone" dataKey="humidity" stroke="#8884d8" fill="#8884d8" />
</LineChart>
</ResponsiveContainer>
</>
}

</div>
</div>
</>}
Expand Down
4 changes: 0 additions & 4 deletions server/dist/gateway/gateway.controller.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/// <reference types="mongoose/types/pipelinestage" />
/// <reference types="mongoose/types/error" />
/// <reference types="mongoose/types/connection" />
/// <reference types="mongoose" />
import { BadRequestException } from '@nestjs/common';
import { createGateWayDto, GatewaySaveHumidityDto, GatewaySaveTemperatureDto } from './dto';
import { GatewayService } from './gateway.service';
Expand Down
7 changes: 2 additions & 5 deletions server/dist/gateway/gateway.service.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="mongoose/types/pipelinestage" />
/// <reference types="mongoose/types/error" />
/// <reference types="mongoose/types/connection" />
import { BadRequestException, InternalServerErrorException } from '@nestjs/common';
import { Gateway, GatewayDocument, Humidity, HumidityDocument, Temperature, TemperatureDocument } from 'src/schemas';
import { Model } from 'mongoose';
Expand All @@ -10,9 +7,9 @@ export declare class GatewayService {
private humidityModel;
private temperatureModel;
constructor(gatewayModel: Model<GatewayDocument>, humidityModel: Model<HumidityDocument>, temperatureModel: Model<TemperatureDocument>);
createGateway(dto: createGateWayDto): Promise<BadRequestException | (Gateway & import("mongoose").Document<any, any, any> & {
createGateway(dto: createGateWayDto): Promise<(Gateway & import("mongoose").Document<any, any, any> & {
_id: any;
})>;
}) | BadRequestException>;
getAllGateways(): Promise<(Gateway & import("mongoose").Document<any, any, any> & {
_id: any;
})[]>;
Expand Down
2 changes: 1 addition & 1 deletion server/dist/tsconfig.build.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit c053706

Please sign in to comment.