@iotready/nextjs-components-library 1.0.0-preview5 → 1.0.0-preview6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -293,7 +293,7 @@ const TrendChart = ({ deviceId, measures, enableExportData, enableDatePicker, ha
293
293
  pointRadius: 1,
294
294
  pointHoverRadius: 5,
295
295
  pointHoverBackgroundColor: 'rgba(52, 125, 236, 0.5)',
296
- // showLine: measure.polltime ? true : false, //<- set this
296
+ change: !measure.polltime,
297
297
  fill: false
298
298
  };
299
299
  });
@@ -446,6 +446,7 @@ const TrendChart = ({ deviceId, measures, enableExportData, enableDatePicker, ha
446
446
  _jsx(_Fragment, { children: dataMeasures && dataMeasures[0]?.data?.length ?
447
447
  (_jsx(Line, { options: options, data: {
448
448
  datasets: dataMeasures || [{ data: [] }]
449
+ // datasets: dataMeasures.map(d => ({ ...d, showLine: spanGapsOption || !d.change })) || [{ data: [] }]
449
450
  } })) : _jsxs(Box, { sx: {
450
451
  display: 'flex',
451
452
  flexDirection: 'column',
@@ -14,7 +14,7 @@ declare const GroupsDevices: ({ userInfo, handleGetUsersList, handleAddUserToGro
14
14
  handleGetGroups: (productID: number, userInfo?: UserType) => Promise<any>;
15
15
  handleGetUsersGroup: (groupID: string) => Promise<any>;
16
16
  handleCreateGroup: (group: any) => Promise<any>;
17
- handleGetDevices: (user: UserType, group: string, selected: string) => Promise<any>;
17
+ handleGetDevices: (user: UserType, query: string) => Promise<any>;
18
18
  handleGetPositions: (devices: any) => Promise<any>;
19
19
  handleAddDevicesToGroup: (user: UserType, group: string, devicesToPatch: any[]) => Promise<any>;
20
20
  handleRemoveDevicesFromGroup: (user: UserType, group: string, devicesToPatch: any[]) => Promise<any>;
@@ -73,7 +73,20 @@ const GroupsDevices = ({ userInfo, handleGetUsersList, handleAddUserToGroup, han
73
73
  const fetchDevices = async (group, selected) => {
74
74
  try {
75
75
  setLoadingDevices(true);
76
- const devices = await handleGetDevices(userInfo, group, selected);
76
+ let queryParams = "last_handshake_at!=null";
77
+ if (group !== "all") {
78
+ queryParams = `last_handshake_at!=null&state.groups=/${group}/`;
79
+ if (userInfo.role === "admin") {
80
+ queryParams += "&quarantined=false";
81
+ }
82
+ }
83
+ else if (selected !== "all") {
84
+ queryParams = `last_handshake_at!=null&state.groups!=/${selected}/`;
85
+ if (userInfo.role === "admin") {
86
+ queryParams += "&quarantined=false";
87
+ }
88
+ }
89
+ const devices = await handleGetDevices(userInfo, queryParams);
77
90
  setDevices(devices);
78
91
  if (enableMaps) {
79
92
  const positions = await handleGetPositions(devices);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iotready/nextjs-components-library",
3
- "version": "1.0.0-preview5",
3
+ "version": "1.0.0-preview6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist && tsc --project tsconfig.build.json && cp package.json dist/",
@@ -13,7 +13,7 @@ export declare function createCustomer(trackleConfig: TrackleConfig, uid: string
13
13
  organization: string;
14
14
  uid: string;
15
15
  }>;
16
- export declare function getDevices(trackleConfig: TrackleConfig, productId?: number, uid?: string, group?: string, selected?: string): Promise<{
16
+ export declare function getDevices(trackleConfig: TrackleConfig, productId?: number, uid?: string, query?: string): Promise<{
17
17
  devices: any[];
18
18
  }>;
19
19
  export declare function getDevice(trackleConfig: TrackleConfig, id: string, productId?: number, uid?: string): Promise<{
@@ -55,25 +55,12 @@ export async function createCustomer(trackleConfig, uid) {
55
55
  .post({ uid })
56
56
  .json();
57
57
  }
58
- export async function getDevices(trackleConfig, productId, uid, group, selected) {
59
- let queryParams = "last_handshake_at!=null";
60
- if (group !== "all") {
61
- queryParams = `last_handshake_at!=null&state.groups=/${group}/`;
62
- if (!uid) {
63
- queryParams += "&quarantined=false";
64
- }
65
- }
66
- else if (selected !== "all") {
67
- queryParams = `last_handshake_at!=null&state.groups!=/${selected}/`;
68
- if (!uid) {
69
- queryParams += "&quarantined=false";
70
- }
71
- }
58
+ export async function getDevices(trackleConfig, productId, uid, query) {
72
59
  const api = uid ? wretchApi(trackleConfig, uid) : wretchApi(trackleConfig);
73
60
  const response = await api
74
61
  .get(uid
75
- ? `/devices?${queryParams}`
76
- : `/products/${productId}/devices?${queryParams}`)
62
+ ? `/devices${query ? "?" + query : ""}`
63
+ : `/products/${productId}/devices${query ? "?" + query : ""}`)
77
64
  .setTimeout(trackleConfig.apiTimeout)
78
65
  .json();
79
66
  return (uid ? { devices: response } : response);