@webiny/app-security-access-management 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f
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.
- package/README.md +6 -4
- package/components/GroupAutocomplete/graphql.d.ts +1 -1
- package/components/GroupAutocomplete/graphql.js +17 -5
- package/components/GroupAutocomplete/graphql.js.map +1 -0
- package/components/GroupAutocomplete/index.d.ts +5 -2
- package/components/GroupAutocomplete/index.js +10 -8
- package/components/GroupAutocomplete/index.js.map +1 -0
- package/components/GroupsMultiAutocomplete/graphql.d.ts +1 -0
- package/components/GroupsMultiAutocomplete/graphql.js +23 -0
- package/components/GroupsMultiAutocomplete/graphql.js.map +1 -0
- package/components/GroupsMultiAutocomplete/index.d.ts +5 -0
- package/components/GroupsMultiAutocomplete/index.js +19 -0
- package/components/GroupsMultiAutocomplete/index.js.map +1 -0
- package/components/NotAuthorizedError/NotAuthorizedError.d.ts +2 -2
- package/components/NotAuthorizedError/NotAuthorizedError.js +17 -44
- package/components/NotAuthorizedError/NotAuthorizedError.js.map +1 -0
- package/components/NotAuthorizedError/index.js +3 -1
- package/components/NotAuthorizedError/index.js.map +1 -0
- package/components/TeamAutocomplete/graphql.d.ts +1 -0
- package/components/TeamAutocomplete/graphql.js +18 -0
- package/components/TeamAutocomplete/graphql.js.map +1 -0
- package/components/TeamAutocomplete/index.d.ts +5 -0
- package/components/TeamAutocomplete/index.js +18 -0
- package/components/TeamAutocomplete/index.js.map +1 -0
- package/components/TeamsMultiAutocomplete/graphql.d.ts +1 -0
- package/components/TeamsMultiAutocomplete/graphql.js +23 -0
- package/components/TeamsMultiAutocomplete/graphql.js.map +1 -0
- package/components/TeamsMultiAutocomplete/index.d.ts +5 -0
- package/components/TeamsMultiAutocomplete/index.js +19 -0
- package/components/TeamsMultiAutocomplete/index.js.map +1 -0
- package/index.d.ts +2 -2
- package/index.js +83 -4
- package/index.js.map +1 -0
- package/package.json +24 -37
- package/plugins/constants.d.ts +1 -0
- package/plugins/constants.js +6 -4
- package/plugins/constants.js.map +1 -0
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +3 -5
- package/plugins/index.js.map +1 -0
- package/plugins/installation.d.ts +1 -1
- package/plugins/installation.js +68 -67
- package/plugins/installation.js.map +1 -0
- package/plugins/permissionRenderer/SecurityPermissions.d.ts +8 -5
- package/plugins/permissionRenderer/SecurityPermissions.js +93 -94
- package/plugins/permissionRenderer/SecurityPermissions.js.map +1 -0
- package/plugins/permissionRenderer/index.js +14 -13
- package/plugins/permissionRenderer/index.js.map +1 -0
- package/plugins/routes.d.ts +1 -1
- package/plugins/routes.js +14 -16
- package/plugins/routes.js.map +1 -0
- package/plugins/secureRouteError.d.ts +2 -2
- package/plugins/secureRouteError.js +5 -3
- package/plugins/secureRouteError.js.map +1 -0
- package/types.d.ts +28 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/ui/elements/GroupAutocompleteElement.d.ts +2 -1
- package/ui/elements/GroupAutocompleteElement.js +27 -30
- package/ui/elements/GroupAutocompleteElement.js.map +1 -0
- package/ui/elements/GroupsMultiAutocompleteElement.d.ts +6 -0
- package/ui/elements/GroupsMultiAutocompleteElement.js +32 -0
- package/ui/elements/GroupsMultiAutocompleteElement.js.map +1 -0
- package/ui/elements/TeamAutocompleteElement.d.ts +6 -0
- package/ui/elements/TeamAutocompleteElement.js +32 -0
- package/ui/elements/TeamAutocompleteElement.js.map +1 -0
- package/ui/views/ApiKeys/ApiKeyForm.d.ts +5 -3
- package/ui/views/ApiKeys/ApiKeyForm.js +125 -183
- package/ui/views/ApiKeys/ApiKeyForm.js.map +1 -0
- package/ui/views/ApiKeys/ApiKeys.d.ts +8 -3
- package/ui/views/ApiKeys/ApiKeys.js +7 -7
- package/ui/views/ApiKeys/ApiKeys.js.map +1 -0
- package/ui/views/ApiKeys/ApiKeysDataList.d.ts +5 -3
- package/ui/views/ApiKeys/ApiKeysDataList.js +105 -169
- package/ui/views/ApiKeys/ApiKeysDataList.js.map +1 -0
- package/ui/views/ApiKeys/graphql.d.ts +13 -5
- package/ui/views/ApiKeys/graphql.js +81 -10
- package/ui/views/ApiKeys/graphql.js.map +1 -0
- package/ui/views/ApiKeys/index.d.ts +1 -1
- package/ui/views/ApiKeys/index.js +3 -1
- package/ui/views/ApiKeys/index.js.map +1 -0
- package/ui/views/ApiKeys/utils.d.ts +2 -1
- package/ui/views/ApiKeys/utils.js +6 -5
- package/ui/views/ApiKeys/utils.js.map +1 -0
- package/ui/views/Groups/Groups.d.ts +8 -3
- package/ui/views/Groups/Groups.js +8 -8
- package/ui/views/Groups/Groups.js.map +1 -0
- package/ui/views/Groups/GroupsDataList.d.ts +5 -3
- package/ui/views/Groups/GroupsDataList.js +110 -176
- package/ui/views/Groups/GroupsDataList.js.map +1 -0
- package/ui/views/Groups/GroupsForm.d.ts +5 -3
- package/ui/views/Groups/GroupsForm.js +150 -170
- package/ui/views/Groups/GroupsForm.js.map +1 -0
- package/ui/views/Groups/graphql.d.ts +13 -5
- package/ui/views/Groups/graphql.js +84 -10
- package/ui/views/Groups/graphql.js.map +1 -0
- package/ui/views/Groups/index.d.ts +1 -1
- package/ui/views/Groups/index.js +3 -1
- package/ui/views/Groups/index.js.map +1 -0
- package/ui/views/Teams/Teams.d.ts +8 -0
- package/ui/views/Teams/Teams.js +12 -0
- package/ui/views/Teams/Teams.js.map +1 -0
- package/ui/views/Teams/TeamsDataList.d.ts +5 -0
- package/ui/views/Teams/TeamsDataList.js +151 -0
- package/ui/views/Teams/TeamsDataList.js.map +1 -0
- package/ui/views/Teams/TeamsForm.d.ts +5 -0
- package/ui/views/Teams/TeamsForm.js +173 -0
- package/ui/views/Teams/TeamsForm.js.map +1 -0
- package/ui/views/Teams/graphql.d.ts +13 -0
- package/ui/views/Teams/graphql.js +89 -0
- package/ui/views/Teams/graphql.js.map +1 -0
- package/ui/views/Teams/index.d.ts +1 -0
- package/ui/views/Teams/index.js +3 -0
- package/ui/views/Teams/index.js.map +1 -0
- package/ui/views/utils.d.ts +3 -2
- package/ui/views/utils.js +6 -23
- package/ui/views/utils.js.map +1 -0
- package/plugins/menus.d.ts +0 -4
- package/plugins/menus.js +0 -61
|
@@ -1,209 +1,145 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
6
|
-
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
1
|
import React, { useCallback, useMemo, useState } from "react";
|
|
9
2
|
import orderBy from "lodash/orderBy";
|
|
3
|
+
import { Button, Grid, Select } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent as AddIcon } from "@webiny/icons/add.svg";
|
|
10
5
|
import { i18n } from "@webiny/app/i18n";
|
|
11
|
-
import { DataList, ScrollList, ListItem, ListItemText, ListItemTextSecondary, ListItemMeta, ListActions, DataListModalOverlayAction, DataListModalOverlay } from "@webiny/ui/List";
|
|
12
|
-
import { ButtonIcon, ButtonSecondary } from "@webiny/ui/Button";
|
|
6
|
+
import { DataList, ScrollList, ListItem, ListItemText, ListItemTextSecondary, ListItemMeta, ListActions, DataListModalOverlayAction, DataListModalOverlay, ListItemTextPrimary } from "@webiny/ui/List";
|
|
13
7
|
import { DeleteIcon } from "@webiny/ui/List/DataList/icons";
|
|
14
|
-
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
15
|
-
import { Select } from "@webiny/ui/Select";
|
|
16
8
|
import { useRouter } from "@webiny/react-router";
|
|
17
9
|
import SearchUI from "@webiny/app-admin/components/SearchUI";
|
|
18
10
|
import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
|
|
19
11
|
import { useQuery, useMutation } from "@apollo/react-hooks";
|
|
20
12
|
import { useConfirmationDialog } from "@webiny/app-admin/hooks/useConfirmationDialog";
|
|
21
13
|
import * as GQL from "./graphql";
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
label: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Newest to oldest"]))),
|
|
28
|
-
sorters: {
|
|
29
|
-
createdOn: "desc"
|
|
30
|
-
}
|
|
14
|
+
import { deserializeSorters } from "../utils";
|
|
15
|
+
const t = i18n.ns("app-security/admin/groups/data-list");
|
|
16
|
+
const SORTERS = [{
|
|
17
|
+
label: t`Newest to oldest`,
|
|
18
|
+
sorter: "createdOn_DESC"
|
|
31
19
|
}, {
|
|
32
|
-
label: t
|
|
33
|
-
|
|
34
|
-
createdOn: "asc"
|
|
35
|
-
}
|
|
20
|
+
label: t`Oldest to newest`,
|
|
21
|
+
sorter: "createdOn_ASC"
|
|
36
22
|
}, {
|
|
37
|
-
label: t
|
|
38
|
-
|
|
39
|
-
name: "asc"
|
|
40
|
-
}
|
|
23
|
+
label: t`Name A-Z`,
|
|
24
|
+
sorter: "name_ASC"
|
|
41
25
|
}, {
|
|
42
|
-
label: t
|
|
43
|
-
|
|
44
|
-
name: "desc"
|
|
45
|
-
}
|
|
26
|
+
label: t`Name Z-A`,
|
|
27
|
+
sorter: "name_DESC"
|
|
46
28
|
}];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
history = _useRouter.history,
|
|
61
|
-
location = _useRouter.location;
|
|
62
|
-
|
|
63
|
-
var _useSnackbar = useSnackbar(),
|
|
64
|
-
showSnackbar = _useSnackbar.showSnackbar;
|
|
65
|
-
|
|
66
|
-
var _useConfirmationDialo = useConfirmationDialog({
|
|
29
|
+
export const ApiKeysDataList = () => {
|
|
30
|
+
const [filter, setFilter] = useState("");
|
|
31
|
+
const [sort, setSort] = useState(SORTERS[0].sorter);
|
|
32
|
+
const {
|
|
33
|
+
history,
|
|
34
|
+
location
|
|
35
|
+
} = useRouter();
|
|
36
|
+
const {
|
|
37
|
+
showSnackbar
|
|
38
|
+
} = useSnackbar();
|
|
39
|
+
const {
|
|
40
|
+
showConfirmation
|
|
41
|
+
} = useConfirmationDialog({
|
|
67
42
|
dataTestId: "default-data-list.delete-dialog"
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
name = _ref.name;
|
|
43
|
+
});
|
|
44
|
+
const filterAPIKey = useCallback(({
|
|
45
|
+
description,
|
|
46
|
+
name
|
|
47
|
+
}) => {
|
|
74
48
|
return description && description.toLowerCase().includes(filter) || name.toLowerCase().includes(filter);
|
|
75
49
|
}, [filter]);
|
|
76
|
-
|
|
50
|
+
const sortKeys = useCallback(list => {
|
|
77
51
|
if (!sort) {
|
|
78
52
|
return list;
|
|
79
53
|
}
|
|
80
|
-
|
|
81
|
-
var _Object$entries = Object.entries(deserializeSorters(sort)),
|
|
82
|
-
_Object$entries2 = _slicedToArray(_Object$entries, 1),
|
|
83
|
-
_Object$entries2$ = _slicedToArray(_Object$entries2[0], 2),
|
|
84
|
-
key = _Object$entries2$[0],
|
|
85
|
-
value = _Object$entries2$[1];
|
|
86
|
-
|
|
54
|
+
const [key, value] = deserializeSorters(sort);
|
|
87
55
|
return orderBy(list, [key], [value]);
|
|
88
56
|
}, [sort]);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
const {
|
|
58
|
+
data: listResponse,
|
|
59
|
+
loading: listLoading
|
|
60
|
+
} = useQuery(GQL.LIST_API_KEYS);
|
|
61
|
+
const [deleteIt, {
|
|
62
|
+
loading: deleteLoading
|
|
63
|
+
}] = useMutation(GQL.DELETE_API_KEY, {
|
|
95
64
|
refetchQueries: [{
|
|
96
65
|
query: GQL.LIST_API_KEYS
|
|
97
66
|
}]
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
error = data.security.deleteApiKey.error;
|
|
122
|
-
|
|
123
|
-
if (!error) {
|
|
124
|
-
_context.next = 7;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return _context.abrupt("return", showSnackbar(error.message));
|
|
129
|
-
|
|
130
|
-
case 7:
|
|
131
|
-
showSnackbar(t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Api key \"{id}\" deleted."])))({
|
|
132
|
-
id: item.id
|
|
133
|
-
}));
|
|
134
|
-
|
|
135
|
-
if (id === item.id) {
|
|
136
|
-
history.push("/access-management/api-keys");
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
case 9:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context.stop();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}, _callee);
|
|
145
|
-
})));
|
|
67
|
+
});
|
|
68
|
+
const data = listLoading && !listResponse ? [] : listResponse?.security.apiKeys.data || [];
|
|
69
|
+
const id = new URLSearchParams(location.search).get("id");
|
|
70
|
+
const deleteItem = useCallback(item => {
|
|
71
|
+
showConfirmation(async () => {
|
|
72
|
+
const {
|
|
73
|
+
data
|
|
74
|
+
} = await deleteIt({
|
|
75
|
+
variables: item
|
|
76
|
+
});
|
|
77
|
+
const {
|
|
78
|
+
error
|
|
79
|
+
} = data.security.deleteApiKey;
|
|
80
|
+
if (error) {
|
|
81
|
+
return showSnackbar(error.message);
|
|
82
|
+
}
|
|
83
|
+
showSnackbar(t`Api key "{id}" deleted.`({
|
|
84
|
+
id: item.id
|
|
85
|
+
}));
|
|
86
|
+
if (id === item.id) {
|
|
87
|
+
history.push(`/access-management/api-keys`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
146
90
|
}, [id]);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
value
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
}, [sort]);
|
|
163
|
-
|
|
164
|
-
|
|
91
|
+
const groupsDataListModalOverlay = useMemo(() => /*#__PURE__*/React.createElement(DataListModalOverlay, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
92
|
+
span: 12
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
94
|
+
value: sort,
|
|
95
|
+
onChange: setSort,
|
|
96
|
+
label: t`Sort by`,
|
|
97
|
+
options: SORTERS.map(({
|
|
98
|
+
label,
|
|
99
|
+
sorter: value
|
|
100
|
+
}) => {
|
|
101
|
+
return {
|
|
102
|
+
label,
|
|
103
|
+
value
|
|
104
|
+
};
|
|
105
|
+
})
|
|
106
|
+
})))), [sort]);
|
|
107
|
+
const filteredData = filter === "" ? data : data.filter(filterAPIKey);
|
|
108
|
+
const list = sortKeys(filteredData);
|
|
165
109
|
return /*#__PURE__*/React.createElement(DataList, {
|
|
166
|
-
title: t
|
|
167
|
-
actions: /*#__PURE__*/React.createElement(
|
|
110
|
+
title: t`API keys`,
|
|
111
|
+
actions: /*#__PURE__*/React.createElement(Button, {
|
|
112
|
+
text: t`New`,
|
|
113
|
+
icon: /*#__PURE__*/React.createElement(AddIcon, null),
|
|
114
|
+
size: "sm",
|
|
115
|
+
className: "wby-ml-xs",
|
|
168
116
|
"data-testid": "new-record-button",
|
|
169
|
-
onClick:
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
}, /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
173
|
-
icon: /*#__PURE__*/React.createElement(AddIcon, null)
|
|
174
|
-
}), " ", t(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["New API Key"])))),
|
|
117
|
+
onClick: () => history.push("/access-management/api-keys?new=true")
|
|
118
|
+
}),
|
|
175
119
|
data: list,
|
|
176
120
|
loading: listLoading || deleteLoading,
|
|
177
121
|
search: /*#__PURE__*/React.createElement(SearchUI, {
|
|
178
122
|
value: filter,
|
|
179
123
|
onChange: setFilter,
|
|
180
|
-
inputPlaceholder: t
|
|
124
|
+
inputPlaceholder: t`Search API keys...`
|
|
181
125
|
}),
|
|
182
126
|
modalOverlay: groupsDataListModalOverlay,
|
|
183
127
|
modalOverlayAction: /*#__PURE__*/React.createElement(DataListModalOverlayAction, {
|
|
184
|
-
icon: /*#__PURE__*/React.createElement(FilterIcon, null),
|
|
185
128
|
"data-testid": "default-data-list.filter"
|
|
186
129
|
})
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
onClick: function onClick() {
|
|
201
|
-
return deleteItem(item);
|
|
202
|
-
},
|
|
203
|
-
"data-testid": "default-data-list.delete"
|
|
204
|
-
}))));
|
|
205
|
-
}));
|
|
206
|
-
});
|
|
130
|
+
}, ({
|
|
131
|
+
data
|
|
132
|
+
}) => /*#__PURE__*/React.createElement(ScrollList, {
|
|
133
|
+
"data-testid": "default-data-list"
|
|
134
|
+
}, data.map(item => /*#__PURE__*/React.createElement(ListItem, {
|
|
135
|
+
key: item.id,
|
|
136
|
+
selected: item.id === id
|
|
137
|
+
}, /*#__PURE__*/React.createElement(ListItemText, {
|
|
138
|
+
onClick: () => history.push(`/access-management/api-keys?id=${item.id}`)
|
|
139
|
+
}, /*#__PURE__*/React.createElement(ListItemTextPrimary, null, item.name), /*#__PURE__*/React.createElement(ListItemTextSecondary, null, item.description)), /*#__PURE__*/React.createElement(ListItemMeta, null, /*#__PURE__*/React.createElement(ListActions, null, /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
140
|
+
onClick: () => deleteItem(item),
|
|
141
|
+
"data-testid": "default-data-list.delete"
|
|
142
|
+
})))))));
|
|
207
143
|
};
|
|
208
144
|
|
|
209
|
-
|
|
145
|
+
//# sourceMappingURL=ApiKeysDataList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useState","orderBy","Button","Grid","Select","ReactComponent","AddIcon","i18n","DataList","ScrollList","ListItem","ListItemText","ListItemTextSecondary","ListItemMeta","ListActions","DataListModalOverlayAction","DataListModalOverlay","ListItemTextPrimary","DeleteIcon","useRouter","SearchUI","useSnackbar","useQuery","useMutation","useConfirmationDialog","GQL","deserializeSorters","t","ns","SORTERS","label","sorter","ApiKeysDataList","filter","setFilter","sort","setSort","history","location","showSnackbar","showConfirmation","dataTestId","filterAPIKey","description","name","toLowerCase","includes","sortKeys","list","key","value","data","listResponse","loading","listLoading","LIST_API_KEYS","deleteIt","deleteLoading","DELETE_API_KEY","refetchQueries","query","security","apiKeys","id","URLSearchParams","search","get","deleteItem","item","variables","error","deleteApiKey","message","push","groupsDataListModalOverlay","createElement","Column","span","onChange","options","map","filteredData","title","actions","text","icon","size","className","onClick","inputPlaceholder","modalOverlay","modalOverlayAction","selected"],"sources":["ApiKeysDataList.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\nimport orderBy from \"lodash/orderBy\";\nimport { Button, Grid, Select } from \"@webiny/admin-ui\";\nimport { ReactComponent as AddIcon } from \"@webiny/icons/add.svg\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport {\n DataList,\n ScrollList,\n ListItem,\n ListItemText,\n ListItemTextSecondary,\n ListItemMeta,\n ListActions,\n DataListModalOverlayAction,\n DataListModalOverlay,\n ListItemTextPrimary\n} from \"@webiny/ui/List\";\nimport { DeleteIcon } from \"@webiny/ui/List/DataList/icons\";\nimport { useRouter } from \"@webiny/react-router\";\nimport SearchUI from \"@webiny/app-admin/components/SearchUI\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport { useQuery, useMutation } from \"@apollo/react-hooks\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/useConfirmationDialog\";\nimport * as GQL from \"./graphql\";\nimport { deserializeSorters } from \"../utils\";\nimport type { ApiKey } from \"~/types\";\n\nconst t = i18n.ns(\"app-security/admin/groups/data-list\");\n\nconst SORTERS = [\n {\n label: t`Newest to oldest`,\n sorter: \"createdOn_DESC\"\n },\n {\n label: t`Oldest to newest`,\n sorter: \"createdOn_ASC\"\n },\n {\n label: t`Name A-Z`,\n sorter: \"name_ASC\"\n },\n {\n label: t`Name Z-A`,\n sorter: \"name_DESC\"\n }\n];\nexport interface ApiKeysDataListProps {\n // TODO @ts-refactor delete and go up the tree and sort it out\n [key: string]: any;\n}\nexport const ApiKeysDataList = () => {\n const [filter, setFilter] = useState(\"\");\n const [sort, setSort] = useState<string>(SORTERS[0].sorter);\n const { history, location } = useRouter();\n const { showSnackbar } = useSnackbar();\n const { showConfirmation } = useConfirmationDialog({\n dataTestId: \"default-data-list.delete-dialog\"\n });\n\n const filterAPIKey = useCallback(\n ({ description, name }: ApiKey) => {\n return (\n (description && description.toLowerCase().includes(filter)) ||\n name.toLowerCase().includes(filter)\n );\n },\n [filter]\n );\n\n const sortKeys = useCallback(\n (list: ApiKey[]) => {\n if (!sort) {\n return list;\n }\n const [key, value] = deserializeSorters(sort);\n return orderBy(list, [key], [value]);\n },\n [sort]\n );\n\n const { data: listResponse, loading: listLoading } = useQuery<GQL.ListApiKeysResponse>(\n GQL.LIST_API_KEYS\n );\n\n const [deleteIt, { loading: deleteLoading }] = useMutation(GQL.DELETE_API_KEY, {\n refetchQueries: [{ query: GQL.LIST_API_KEYS }]\n });\n\n const data = listLoading && !listResponse ? [] : listResponse?.security.apiKeys.data || [];\n const id = new URLSearchParams(location.search).get(\"id\");\n\n const deleteItem = useCallback(\n (item: ApiKey) => {\n showConfirmation(async () => {\n const { data } = await deleteIt({\n variables: item\n });\n\n const { error } = data.security.deleteApiKey;\n if (error) {\n return showSnackbar(error.message);\n }\n\n showSnackbar(t`Api key \"{id}\" deleted.`({ id: item.id }));\n\n if (id === item.id) {\n history.push(`/access-management/api-keys`);\n }\n });\n },\n [id]\n );\n\n const groupsDataListModalOverlay = useMemo(\n () => (\n <DataListModalOverlay>\n <Grid>\n <Grid.Column span={12}>\n <Select\n value={sort}\n onChange={setSort}\n label={t`Sort by`}\n options={SORTERS.map(({ label, sorter: value }) => {\n return {\n label,\n value\n };\n })}\n />\n </Grid.Column>\n </Grid>\n </DataListModalOverlay>\n ),\n [sort]\n );\n\n const filteredData = filter === \"\" ? data : data.filter(filterAPIKey);\n const list = sortKeys(filteredData);\n\n return (\n <DataList\n title={t`API keys`}\n actions={\n <Button\n text={t`New`}\n icon={<AddIcon />}\n size={\"sm\"}\n className={\"wby-ml-xs\"}\n data-testid=\"new-record-button\"\n onClick={() => history.push(\"/access-management/api-keys?new=true\")}\n />\n }\n data={list}\n loading={listLoading || deleteLoading}\n search={\n <SearchUI\n value={filter}\n onChange={setFilter}\n inputPlaceholder={t`Search API keys...`}\n />\n }\n modalOverlay={groupsDataListModalOverlay}\n modalOverlayAction={\n <DataListModalOverlayAction data-testid={\"default-data-list.filter\"} />\n }\n >\n {({ data }: { data: ApiKey[] }) => (\n <ScrollList data-testid=\"default-data-list\">\n {data.map(item => (\n <ListItem key={item.id} selected={item.id === id}>\n <ListItemText\n onClick={() =>\n history.push(`/access-management/api-keys?id=${item.id}`)\n }\n >\n <ListItemTextPrimary>{item.name}</ListItemTextPrimary>\n <ListItemTextSecondary>{item.description}</ListItemTextSecondary>\n </ListItemText>\n\n <ListItemMeta>\n <ListActions>\n <DeleteIcon\n onClick={() => deleteItem(item)}\n data-testid={\"default-data-list.delete\"}\n />\n </ListActions>\n </ListItemMeta>\n </ListItem>\n ))}\n </ScrollList>\n )}\n </DataList>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;AACvD,SAASC,cAAc,IAAIC,OAAO,QAAQ,uBAAuB;AACjE,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SACIC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,YAAY,EACZC,qBAAqB,EACrBC,YAAY,EACZC,WAAW,EACXC,0BAA0B,EAC1BC,oBAAoB,EACpBC,mBAAmB,QAChB,iBAAiB;AACxB,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,QAAQ,MAAM,uCAAuC;AAC5D,SAASC,WAAW,QAAQ,qCAAqC;AACjE,SAASC,QAAQ,EAAEC,WAAW,QAAQ,qBAAqB;AAC3D,SAASC,qBAAqB,QAAQ,+CAA+C;AACrF,OAAO,KAAKC,GAAG;AACf,SAASC,kBAAkB;AAG3B,MAAMC,CAAC,GAAGpB,IAAI,CAACqB,EAAE,CAAC,qCAAqC,CAAC;AAExD,MAAMC,OAAO,GAAG,CACZ;EACIC,KAAK,EAAEH,CAAC,kBAAkB;EAC1BI,MAAM,EAAE;AACZ,CAAC,EACD;EACID,KAAK,EAAEH,CAAC,kBAAkB;EAC1BI,MAAM,EAAE;AACZ,CAAC,EACD;EACID,KAAK,EAAEH,CAAC,UAAU;EAClBI,MAAM,EAAE;AACZ,CAAC,EACD;EACID,KAAK,EAAEH,CAAC,UAAU;EAClBI,MAAM,EAAE;A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EACzE,GAEA,CAAC;IAAEoC;EAAyB,CAAC,kBAC1BtD,KAAA,CAAA8E,aAAA,CAAClE,UAAU;IAAC,eAAY;EAAmB,GACtC0C,IAAI,CAAC6B,GAAG,CAACZ,IAAI,iBACVvE,KAAA,CAAA8E,aAAA,CAACjE,QAAQ;IAACuC,GAAG,EAAEmB,IAAI,CAACL,EAAG;IAAC6B,QAAQ,EAAExB,IAAI,CAACL,EAAE,KAAKA;EAAG,gBAC7ClE,KAAA,CAAA8E,aAAA,CAAChE,YAAY;IACT6E,OAAO,EAAEA,CAAA,KACLnD,OAAO,CAACoC,IAAI,CAAC,kCAAkCL,IAAI,CAACL,EAAE,EAAE;EAC3D,gBAEDlE,KAAA,CAAA8E,aAAA,CAAC1D,mBAAmB,QAAEmD,IAAI,CAACxB,IAA0B,CAAC,eACtD/C,KAAA,CAAA8E,aAAA,CAAC/D,qBAAqB,QAAEwD,IAAI,CAACzB,WAAmC,CACtD,CAAC,eAEf9C,KAAA,CAAA8E,aAAA,CAAC9D,YAAY,qBACThB,KAAA,CAAA8E,aAAA,CAAC7D,WAAW,qBACRjB,KAAA,CAAA8E,aAAA,CAACzD,UAAU;IACPsE,OAAO,EAAEA,CAAA,KAAMrB,UAAU,CAACC,IAAI,CAAE;IAChC,eAAa;EAA2B,CAC3C,CACQ,CACH,CACR,CACb,CACO,CAEV,CAAC;AAEnB,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ApiKey } from "../../../types";
|
|
2
|
+
export interface ListApiKeysResponse {
|
|
3
|
+
security: {
|
|
4
|
+
apiKeys: {
|
|
5
|
+
data: ApiKey[];
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const LIST_API_KEYS: import("graphql").DocumentNode;
|
|
10
|
+
export declare const READ_API_KEY: import("graphql").DocumentNode;
|
|
11
|
+
export declare const CREATE_API_KEY: import("graphql").DocumentNode;
|
|
12
|
+
export declare const UPDATE_API_KEY: import("graphql").DocumentNode;
|
|
13
|
+
export declare const DELETE_API_KEY: import("graphql").DocumentNode;
|
|
@@ -1,11 +1,82 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
|
-
|
|
5
1
|
import gql from "graphql-tag";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
const fields = `
|
|
3
|
+
id
|
|
4
|
+
name
|
|
5
|
+
description
|
|
6
|
+
token
|
|
7
|
+
permissions
|
|
8
|
+
createdOn
|
|
9
|
+
`;
|
|
10
|
+
export const LIST_API_KEYS = gql`
|
|
11
|
+
query ListApiKeys {
|
|
12
|
+
security {
|
|
13
|
+
apiKeys: listApiKeys {
|
|
14
|
+
data {
|
|
15
|
+
${fields}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
export const READ_API_KEY = gql`
|
|
22
|
+
query GetApiKey($id: ID!) {
|
|
23
|
+
security {
|
|
24
|
+
apiKey: getApiKey(id: $id){
|
|
25
|
+
data {
|
|
26
|
+
${fields}
|
|
27
|
+
}
|
|
28
|
+
error {
|
|
29
|
+
code
|
|
30
|
+
message
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
export const CREATE_API_KEY = gql`
|
|
37
|
+
mutation CreateApiKey($data: SecurityApiKeyInput!){
|
|
38
|
+
security {
|
|
39
|
+
apiKey: createApiKey(data: $data) {
|
|
40
|
+
data {
|
|
41
|
+
${fields}
|
|
42
|
+
}
|
|
43
|
+
error {
|
|
44
|
+
code
|
|
45
|
+
message
|
|
46
|
+
data
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
export const UPDATE_API_KEY = gql`
|
|
53
|
+
mutation UpdateApiKey($id: ID!, $data: SecurityApiKeyInput!){
|
|
54
|
+
security {
|
|
55
|
+
apiKey: updateApiKey(id: $id, data: $data) {
|
|
56
|
+
data {
|
|
57
|
+
${fields}
|
|
58
|
+
}
|
|
59
|
+
error {
|
|
60
|
+
code
|
|
61
|
+
message
|
|
62
|
+
data
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
export const DELETE_API_KEY = gql`
|
|
69
|
+
mutation DeleteApiKey($id: ID!) {
|
|
70
|
+
security {
|
|
71
|
+
deleteApiKey(id: $id) {
|
|
72
|
+
data
|
|
73
|
+
error {
|
|
74
|
+
code
|
|
75
|
+
message
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["gql","fields","LIST_API_KEYS","READ_API_KEY","CREATE_API_KEY","UPDATE_API_KEY","DELETE_API_KEY"],"sources":["graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport type { ApiKey } from \"~/types\";\n\nconst fields = `\n id\n name\n description\n token\n permissions\n createdOn\n`;\n\nexport interface ListApiKeysResponse {\n security: {\n apiKeys: {\n data: ApiKey[];\n };\n };\n}\n\nexport const LIST_API_KEYS = gql`\n query ListApiKeys {\n security {\n apiKeys: listApiKeys {\n data {\n ${fields}\n }\n }\n }\n }\n`;\n\nexport const READ_API_KEY = gql`\n query GetApiKey($id: ID!) {\n security {\n apiKey: getApiKey(id: $id){\n data {\n ${fields}\n }\n error {\n code\n message\n }\n }\n }\n }\n`;\n\nexport const CREATE_API_KEY = gql`\n mutation CreateApiKey($data: SecurityApiKeyInput!){\n security {\n apiKey: createApiKey(data: $data) {\n data {\n ${fields}\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\nexport const UPDATE_API_KEY = gql`\n mutation UpdateApiKey($id: ID!, $data: SecurityApiKeyInput!){\n security {\n apiKey: updateApiKey(id: $id, data: $data) {\n data {\n ${fields}\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\nexport const DELETE_API_KEY = gql`\n mutation DeleteApiKey($id: ID!) {\n security {\n deleteApiKey(id: $id) {\n data\n error {\n code\n message\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,aAAa;AAG7B,MAAMC,MAAM,GAAG;AACf;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAUD,OAAO,MAAMC,aAAa,GAAGF,GAAG;AAChC;AACA;AACA;AACA;AACA,qBAAqBC,MAAM;AAC3B;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,YAAY,GAAGH,GAAG;AAC/B;AACA;AACA;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,cAAc,GAAGJ,GAAG;AACjC;AACA;AACA;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,cAAc,GAAGL,GAAG;AACjC;AACA;AACA;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMK,cAAc,GAAGN,GAAG;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./ApiKeys";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ApiKeys\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ApiKey } from "../../../types";
|
|
2
|
+
export declare const pickDataForAPI: (data: ApiKey) => Pick<ApiKey, "name" | "description" | "permissions">;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import pick from "lodash/pick";
|
|
2
|
+
export const pickDataForAPI = data => ({
|
|
3
|
+
...pick(data, ["name", "description", "permissions"])
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["pick","pickDataForAPI","data"],"sources":["utils.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport type { ApiKey } from \"~/types\";\n\nexport const pickDataForAPI = (\n data: ApiKey\n): Pick<ApiKey, \"name\" | \"description\" | \"permissions\"> => ({\n ...pick(data, [\"name\", \"description\", \"permissions\"])\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,aAAa;AAG9B,OAAO,MAAMC,cAAc,GACvBC,IAAY,KAC4C;EACxD,GAAGF,IAAI,CAACE,IAAI,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC;AACxD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { GroupsDataListProps } from "./GroupsDataList";
|
|
3
|
+
import type { GroupsFormProps } from "./GroupsForm";
|
|
4
|
+
export interface GroupsProps {
|
|
5
|
+
listProps?: GroupsDataListProps;
|
|
6
|
+
formProps?: GroupsFormProps;
|
|
7
|
+
}
|
|
8
|
+
export declare const Groups: ({ formProps, listProps }: GroupsProps) => React.JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { SplitView, LeftPanel, RightPanel } from "@webiny/app-admin/components/SplitView";
|
|
3
|
-
import GroupsDataList from "./GroupsDataList";
|
|
4
|
-
import GroupsForm from "./GroupsForm";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { GroupsDataList } from "./GroupsDataList";
|
|
4
|
+
import { GroupsForm } from "./GroupsForm";
|
|
5
|
+
export const Groups = ({
|
|
6
|
+
formProps = {},
|
|
7
|
+
listProps = {}
|
|
8
|
+
}) => {
|
|
9
9
|
return /*#__PURE__*/React.createElement(SplitView, null, /*#__PURE__*/React.createElement(LeftPanel, null, /*#__PURE__*/React.createElement(GroupsDataList, listProps)), /*#__PURE__*/React.createElement(RightPanel, null, /*#__PURE__*/React.createElement(GroupsForm, formProps)));
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
//# sourceMappingURL=Groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","SplitView","LeftPanel","RightPanel","GroupsDataList","GroupsForm","Groups","formProps","listProps","createElement"],"sources":["Groups.tsx"],"sourcesContent":["import React from \"react\";\nimport { SplitView, LeftPanel, RightPanel } from \"@webiny/app-admin/components/SplitView\";\nimport type { GroupsDataListProps } from \"./GroupsDataList\";\nimport { GroupsDataList } from \"./GroupsDataList\";\nimport type { GroupsFormProps } from \"./GroupsForm\";\nimport { GroupsForm } from \"./GroupsForm\";\n\nexport interface GroupsProps {\n listProps?: GroupsDataListProps;\n formProps?: GroupsFormProps;\n}\nexport const Groups = ({ formProps = {}, listProps = {} }: GroupsProps) => {\n return (\n <SplitView>\n <LeftPanel>\n <GroupsDataList {...listProps} />\n </LeftPanel>\n <RightPanel>\n <GroupsForm {...formProps} />\n </RightPanel>\n </SplitView>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,wCAAwC;AAEzF,SAASC,cAAc;AAEvB,SAASC,UAAU;AAMnB,OAAO,MAAMC,MAAM,GAAGA,CAAC;EAAEC,SAAS,GAAG,CAAC,CAAC;EAAEC,SAAS,GAAG,CAAC;AAAe,CAAC,KAAK;EACvE,oBACIR,KAAA,CAAAS,aAAA,CAACR,SAAS,qBACND,KAAA,CAAAS,aAAA,CAACP,SAAS,qBACNF,KAAA,CAAAS,aAAA,CAACL,cAAc,EAAKI,SAAY,CACzB,CAAC,eACZR,KAAA,CAAAS,aAAA,CAACN,UAAU,qBACPH,KAAA,CAAAS,aAAA,CAACJ,UAAU,EAAKE,SAAY,CACpB,CACL,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface GroupsDataListProps {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export declare const GroupsDataList: () => React.JSX.Element;
|