Skip to content

Commit

Permalink
Fix demo mode (#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
atrovato authored Feb 26, 2024
1 parent 5977dc4 commit 0c9f27f
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 52 deletions.
2 changes: 1 addition & 1 deletion front/src/actions/dashboard/boxes/humidityInRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function createActions(store) {
async getHumidityInRoom(state, box, x, y) {
boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Getting);
try {
const room = await state.httpClient.get(`/api/v1/room/${box.room}?expand=humidity,devices`);
const room = await state.httpClient.get(`/api/v1/room/${box.room}`, { expand: 'humidity,devices' });
boxActions.mergeBoxData(state, BOX_KEY, x, y, {
room
});
Expand Down
2 changes: 1 addition & 1 deletion front/src/actions/dashboard/boxes/temperatureInRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function createActions(store) {
async getTemperatureInRoom(state, box, x, y) {
boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Getting);
try {
const room = await state.httpClient.get(`/api/v1/room/${box.room}?expand=temperature,devices`);
const room = await state.httpClient.get(`/api/v1/room/${box.room}`, { expand: 'temperature,devices' });
boxActions.mergeBoxData(state, BOX_KEY, x, y, {
room
});
Expand Down
2 changes: 1 addition & 1 deletion front/src/actions/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function createActions(store) {
DeviceGetStatus: DeviceGetByRoomStatus.Getting
});
try {
const rooms = await state.httpClient.get('/api/v1/room?expand=devices');
const rooms = await state.httpClient.get('/api/v1/room', { expand: 'devices' });
store.setState({
rooms,
DeviceGetStatus: DeviceGetByRoomStatus.Success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EditDeviceInRoom extends Component {
try {
this.setState({ loading: true });
// we get the rooms with the devices
const room = await this.props.httpClient.get(`/api/v1/room/${this.props.box.room}?expand=devices`);
const room = await this.props.httpClient.get(`/api/v1/room/${this.props.box.room}`, { expand: 'devices' });
const deviceOptions = [];
const selectedDeviceFeaturesOptions = [];

Expand Down
2 changes: 1 addition & 1 deletion front/src/components/device/SelectDeviceFeature.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SelectDeviceFeature extends Component {
getOptions = async () => {
try {
// we get the rooms with the devices
const rooms = await this.props.httpClient.get('/api/v1/room?expand=devices');
const rooms = await this.props.httpClient.get('/api/v1/room', { expand: 'devices' });
const deviceOptions = [];

const deviceDictionnary = {};
Expand Down
88 changes: 44 additions & 44 deletions front/src/config/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ const data = {
is_read: true,
created_at: dayjs()
.subtract(1, 'hour')
.toDate()
.toISOString()
},
{
id: '247b1dd0-6fab-47a8-a9c8-1405deae0ae8',
Expand All @@ -1012,7 +1012,7 @@ const data = {
created_at: dayjs()
.subtract(1, 'hour')
.subtract(1, 'seconds')
.toDate()
.toISOString()
},
{
id: '247b1dd0-6fab-47a8-a9c8-1405deae0ae8',
Expand All @@ -1023,7 +1023,7 @@ const data = {
created_at: dayjs()
.subtract(1, 'hour')
.subtract(2, 'seconds')
.toDate()
.toISOString()
},
{
id: '247b1dd0-6fab-47a8-a9c8-1405deae0ae8',
Expand All @@ -1034,7 +1034,7 @@ const data = {
created_at: dayjs()
.subtract(1, 'hour')
.subtract(3, 'seconds')
.toDate()
.toISOString()
}
],
'post /api/v1/message': {
Expand Down Expand Up @@ -3836,185 +3836,185 @@ const data = {
name: 'Kitchen temperature'
},
values: [
{ created_at: dayjs().toDate(), value: 28 },
{ created_at: dayjs().toISOString(), value: 28 },
{
created_at: dayjs()
.subtract(1, 'day')
.toDate(),
.toISOString(),
value: 33
},
{
created_at: dayjs()
.subtract(2, 'day')
.toDate(),
.toISOString(),
value: 44
},
{
created_at: dayjs()
.subtract(3, 'day')
.toDate(),
.toISOString(),
value: 28
},
{
created_at: dayjs()
.subtract(4, 'day')
.toDate(),
.toISOString(),
value: 36
},
{
created_at: dayjs()
.subtract(5, 'day')
.toDate(),
.toISOString(),
value: 24
},
{
created_at: dayjs()
.subtract(5, 'day')
.toDate(),
.toISOString(),
value: 65
},
{
created_at: dayjs()
.subtract(6, 'day')
.toDate(),
.toISOString(),
value: 31
},
{
created_at: dayjs()
.subtract(7, 'day')
.toDate(),
.toISOString(),
value: 37
},
{
created_at: dayjs()
.subtract(8, 'day')
.toDate(),
.toISOString(),
value: 39
},
{
created_at: dayjs()
.subtract(9, 'day')
.toDate(),
.toISOString(),
value: 62
},
{
created_at: dayjs()
.subtract(10, 'day')
.toDate(),
.toISOString(),
value: 51
},
{
created_at: dayjs()
.subtract(11, 'day')
.toDate(),
.toISOString(),
value: 35
},
{
created_at: dayjs()
.subtract(12, 'day')
.toDate(),
.toISOString(),
value: 41
},
{
created_at: dayjs()
.subtract(13, 'day')
.toDate(),
.toISOString(),
value: 35
},
{
created_at: dayjs()
.subtract(14, 'day')
.toDate(),
.toISOString(),
value: 27
},
{
created_at: dayjs()
.subtract(15, 'day')
.toDate(),
.toISOString(),
value: 93
},
{
created_at: dayjs()
.subtract(16, 'day')
.toDate(),
.toISOString(),
value: 53
},
{
created_at: dayjs()
.subtract(17, 'day')
.toDate(),
.toISOString(),
value: 61
},
{
created_at: dayjs()
.subtract(18, 'day')
.toDate(),
.toISOString(),
value: 27
},
{
created_at: dayjs()
.subtract(19, 'day')
.toDate(),
.toISOString(),
value: 54
},
{
created_at: dayjs()
.subtract(20, 'day')
.toDate(),
.toISOString(),
value: 43
},
{
created_at: dayjs()
.subtract(21, 'day')
.toDate(),
.toISOString(),
value: 19
},
{
created_at: dayjs()
.subtract(22, 'day')
.toDate(),
.toISOString(),
value: 46
},
{
created_at: dayjs()
.subtract(23, 'day')
.toDate(),
.toISOString(),
value: 39
},
{
created_at: dayjs()
.subtract(24, 'day')
.toDate(),
.toISOString(),
value: 62
},
{
created_at: dayjs()
.subtract(25, 'day')
.toDate(),
.toISOString(),
value: 51
},
{
created_at: dayjs()
.subtract(26, 'day')
.toDate(),
.toISOString(),
value: 35
},
{
created_at: dayjs()
.subtract(27, 'day')
.toDate(),
.toISOString(),
value: 41
},
{
created_at: dayjs()
.subtract(28, 'day')
.toDate(),
.toISOString(),
value: 33
}
]
}
],
'get /api/v1/job?take=500': [
'get /api/v1/job': [
{
id: 'f69252f4-1216-4021-8fc0-83234da71a4a',
type: 'monthly-device-state-aggregate',
Expand All @@ -4023,7 +4023,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(1, 'hour')
.toDate()
.toISOString()
},
{
id: 'b2d590aa-40d7-435a-910a-cf370dde06a9',
Expand All @@ -4033,7 +4033,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(1, 'hour')
.toDate()
.toISOString()
},
{
id: 'd1e7ee47-229c-4b9f-bbaa-201db860cc25',
Expand All @@ -4043,7 +4043,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(1, 'hour')
.toDate()
.toISOString()
},
{
id: '06411e01-a909-4531-9246-2e935c16ba69',
Expand All @@ -4053,7 +4053,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(2, 'hour')
.toDate()
.toISOString()
},
{
id: '10469873-569a-4dfb-b35c-4468c26542a4',
Expand All @@ -4063,7 +4063,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(2, 'hour')
.toDate()
.toISOString()
},
{
id: '5307b306-8d95-41e3-9ec6-a5c29d386c9b',
Expand All @@ -4073,7 +4073,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(2, 'hour')
.toDate()
.toISOString()
},
{
id: 'c3da516f-3565-4b00-be82-ddd00fe39a12',
Expand All @@ -4083,7 +4083,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(3, 'hour')
.toDate()
.toISOString()
},
{
id: '5ca896b5-e810-48f5-bfb6-f3039a6776c5',
Expand All @@ -4093,7 +4093,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(3, 'hour')
.toDate()
.toISOString()
},
{
id: 'ae916efe-6209-49cb-a2fc-323f3ab5f91d',
Expand All @@ -4103,7 +4103,7 @@ const data = {
data: {},
created_at: dayjs()
.subtract(3, 'hour')
.toDate()
.toISOString()
}
],
'get /api/v1/service/sonos/device': [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SettingsSystem extends Component {
getJobs = async page => {
try {
const skip = page * NUMBER_OF_JOBS_PER_PAGE;
const jobs = await this.props.httpClient.get(`/api/v1/job?take=${NUMBER_OF_JOBS_PER_PAGE}&skip=${skip}`);
const jobs = await this.props.httpClient.get('/api/v1/job', { take: NUMBER_OF_JOBS_PER_PAGE, skip });

jobs.forEach(job => (job.created_at = this.convertGladysDateToISO8601(job.created_at)));

Expand Down
Loading

0 comments on commit 0c9f27f

Please sign in to comment.