@iotready/nextjs-components-library 1.0.0-preview16 → 1.0.0-preview17
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.
@@ -12,7 +12,7 @@ declare const GroupUpdate: ({ userInfo, groupInfo, usersGroup, usersList, device
|
|
12
12
|
handleAddUserToGroup: (groupID: string, userName: string, userID: string) => Promise<any>;
|
13
13
|
handleRemoveUserFromGroup: (groupID: string, userID: string) => Promise<any>;
|
14
14
|
handleUpdateDevice: (id: string, body: any, user: UserType) => Promise<any>;
|
15
|
-
handleGetGroups: (
|
15
|
+
handleGetGroups: (userInfo?: UserType) => Promise<any>;
|
16
16
|
handleUpdateGroup: (id: string, group: any) => Promise<void>;
|
17
17
|
handleDeleteGroup: (id: string) => Promise<void>;
|
18
18
|
container?: "Box" | "Card";
|
@@ -27,7 +27,7 @@ const GroupUpdate = ({ userInfo, groupInfo, usersGroup, usersList, devicesList,
|
|
27
27
|
if (response) {
|
28
28
|
if (devicesList.length > 0) {
|
29
29
|
// should check if device is present in other groups the user is member of
|
30
|
-
const groupsData = await handleGetGroups(
|
30
|
+
const groupsData = await handleGetGroups({ role: 'support', uid: userId });
|
31
31
|
const userGroupIds = groupsData.map((group) => group.id);
|
32
32
|
// for all devices in the group set the selectedUser as manager
|
33
33
|
for (const device of devicesList) {
|
@@ -11,7 +11,7 @@ declare const GroupsDevices: ({ userInfo, handleGetUsersList, handleAddUserToGro
|
|
11
11
|
}>;
|
12
12
|
handleAddUserToGroup: (groupID: string, userName: string, userID: string) => Promise<any>;
|
13
13
|
handleRemoveUserFromGroup: (groupID: string, userID: string) => Promise<any>;
|
14
|
-
handleGetGroups: (
|
14
|
+
handleGetGroups: (userInfo?: UserType) => Promise<any>;
|
15
15
|
handleGetUsersGroup: (groupID: string) => Promise<any>;
|
16
16
|
handleCreateGroup: (group: any) => Promise<any>;
|
17
17
|
handleGetDevices: (user: UserType, query: string) => Promise<any>;
|
@@ -102,7 +102,7 @@ const GroupsDevices = ({ userInfo, handleGetUsersList, handleAddUserToGroup, han
|
|
102
102
|
};
|
103
103
|
const getGroups = async () => {
|
104
104
|
try {
|
105
|
-
const responseData = await handleGetGroups(
|
105
|
+
const responseData = await handleGetGroups(userInfo);
|
106
106
|
setGroups(responseData);
|
107
107
|
}
|
108
108
|
catch (err) {
|
@@ -145,7 +145,6 @@ const GroupsDevices = ({ userInfo, handleGetUsersList, handleAddUserToGroup, han
|
|
145
145
|
const newGroup = {
|
146
146
|
name: groupName,
|
147
147
|
description,
|
148
|
-
productID: 1008, // Assuming this is the correct productID
|
149
148
|
};
|
150
149
|
const id = await handleCreateGroup(newGroup);
|
151
150
|
await getGroups();
|
@@ -198,7 +197,7 @@ const GroupsDevices = ({ userInfo, handleGetUsersList, handleAddUserToGroup, han
|
|
198
197
|
// add members to devices managers
|
199
198
|
await handleUpdateDevice(device.id, {
|
200
199
|
managers: [
|
201
|
-
...device
|
200
|
+
...(device?.managers || []),
|
202
201
|
...userIdsToAdd
|
203
202
|
]
|
204
203
|
}, userInfo);
|
@@ -229,7 +228,7 @@ const GroupsDevices = ({ userInfo, handleGetUsersList, handleAddUserToGroup, han
|
|
229
228
|
let managersToKeep = device.managers || [];
|
230
229
|
for (const manager of device.managers) {
|
231
230
|
// should check if device is present in other groups the user is member of
|
232
|
-
const groupsData = await handleGetGroups(
|
231
|
+
const groupsData = await handleGetGroups({ role: 'support', uid: manager });
|
233
232
|
const userGroupIds = groupsData.map((group) => group.id);
|
234
233
|
const found = device.groups && device.groups.some((gID) => userGroupIds.includes(gID));
|
235
234
|
if (!found) {
|
package/package.json
CHANGED