@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.
Files changed (119) hide show
  1. package/README.md +6 -4
  2. package/components/GroupAutocomplete/graphql.d.ts +1 -1
  3. package/components/GroupAutocomplete/graphql.js +17 -5
  4. package/components/GroupAutocomplete/graphql.js.map +1 -0
  5. package/components/GroupAutocomplete/index.d.ts +5 -2
  6. package/components/GroupAutocomplete/index.js +10 -8
  7. package/components/GroupAutocomplete/index.js.map +1 -0
  8. package/components/GroupsMultiAutocomplete/graphql.d.ts +1 -0
  9. package/components/GroupsMultiAutocomplete/graphql.js +23 -0
  10. package/components/GroupsMultiAutocomplete/graphql.js.map +1 -0
  11. package/components/GroupsMultiAutocomplete/index.d.ts +5 -0
  12. package/components/GroupsMultiAutocomplete/index.js +19 -0
  13. package/components/GroupsMultiAutocomplete/index.js.map +1 -0
  14. package/components/NotAuthorizedError/NotAuthorizedError.d.ts +2 -2
  15. package/components/NotAuthorizedError/NotAuthorizedError.js +17 -44
  16. package/components/NotAuthorizedError/NotAuthorizedError.js.map +1 -0
  17. package/components/NotAuthorizedError/index.js +3 -1
  18. package/components/NotAuthorizedError/index.js.map +1 -0
  19. package/components/TeamAutocomplete/graphql.d.ts +1 -0
  20. package/components/TeamAutocomplete/graphql.js +18 -0
  21. package/components/TeamAutocomplete/graphql.js.map +1 -0
  22. package/components/TeamAutocomplete/index.d.ts +5 -0
  23. package/components/TeamAutocomplete/index.js +18 -0
  24. package/components/TeamAutocomplete/index.js.map +1 -0
  25. package/components/TeamsMultiAutocomplete/graphql.d.ts +1 -0
  26. package/components/TeamsMultiAutocomplete/graphql.js +23 -0
  27. package/components/TeamsMultiAutocomplete/graphql.js.map +1 -0
  28. package/components/TeamsMultiAutocomplete/index.d.ts +5 -0
  29. package/components/TeamsMultiAutocomplete/index.js +19 -0
  30. package/components/TeamsMultiAutocomplete/index.js.map +1 -0
  31. package/index.d.ts +2 -2
  32. package/index.js +83 -4
  33. package/index.js.map +1 -0
  34. package/package.json +24 -37
  35. package/plugins/constants.d.ts +1 -0
  36. package/plugins/constants.js +6 -4
  37. package/plugins/constants.js.map +1 -0
  38. package/plugins/index.d.ts +1 -1
  39. package/plugins/index.js +3 -5
  40. package/plugins/index.js.map +1 -0
  41. package/plugins/installation.d.ts +1 -1
  42. package/plugins/installation.js +68 -67
  43. package/plugins/installation.js.map +1 -0
  44. package/plugins/permissionRenderer/SecurityPermissions.d.ts +8 -5
  45. package/plugins/permissionRenderer/SecurityPermissions.js +93 -94
  46. package/plugins/permissionRenderer/SecurityPermissions.js.map +1 -0
  47. package/plugins/permissionRenderer/index.js +14 -13
  48. package/plugins/permissionRenderer/index.js.map +1 -0
  49. package/plugins/routes.d.ts +1 -1
  50. package/plugins/routes.js +14 -16
  51. package/plugins/routes.js.map +1 -0
  52. package/plugins/secureRouteError.d.ts +2 -2
  53. package/plugins/secureRouteError.js +5 -3
  54. package/plugins/secureRouteError.js.map +1 -0
  55. package/types.d.ts +28 -0
  56. package/types.js +3 -0
  57. package/types.js.map +1 -0
  58. package/ui/elements/GroupAutocompleteElement.d.ts +2 -1
  59. package/ui/elements/GroupAutocompleteElement.js +27 -30
  60. package/ui/elements/GroupAutocompleteElement.js.map +1 -0
  61. package/ui/elements/GroupsMultiAutocompleteElement.d.ts +6 -0
  62. package/ui/elements/GroupsMultiAutocompleteElement.js +32 -0
  63. package/ui/elements/GroupsMultiAutocompleteElement.js.map +1 -0
  64. package/ui/elements/TeamAutocompleteElement.d.ts +6 -0
  65. package/ui/elements/TeamAutocompleteElement.js +32 -0
  66. package/ui/elements/TeamAutocompleteElement.js.map +1 -0
  67. package/ui/views/ApiKeys/ApiKeyForm.d.ts +5 -3
  68. package/ui/views/ApiKeys/ApiKeyForm.js +125 -183
  69. package/ui/views/ApiKeys/ApiKeyForm.js.map +1 -0
  70. package/ui/views/ApiKeys/ApiKeys.d.ts +8 -3
  71. package/ui/views/ApiKeys/ApiKeys.js +7 -7
  72. package/ui/views/ApiKeys/ApiKeys.js.map +1 -0
  73. package/ui/views/ApiKeys/ApiKeysDataList.d.ts +5 -3
  74. package/ui/views/ApiKeys/ApiKeysDataList.js +105 -169
  75. package/ui/views/ApiKeys/ApiKeysDataList.js.map +1 -0
  76. package/ui/views/ApiKeys/graphql.d.ts +13 -5
  77. package/ui/views/ApiKeys/graphql.js +81 -10
  78. package/ui/views/ApiKeys/graphql.js.map +1 -0
  79. package/ui/views/ApiKeys/index.d.ts +1 -1
  80. package/ui/views/ApiKeys/index.js +3 -1
  81. package/ui/views/ApiKeys/index.js.map +1 -0
  82. package/ui/views/ApiKeys/utils.d.ts +2 -1
  83. package/ui/views/ApiKeys/utils.js +6 -5
  84. package/ui/views/ApiKeys/utils.js.map +1 -0
  85. package/ui/views/Groups/Groups.d.ts +8 -3
  86. package/ui/views/Groups/Groups.js +8 -8
  87. package/ui/views/Groups/Groups.js.map +1 -0
  88. package/ui/views/Groups/GroupsDataList.d.ts +5 -3
  89. package/ui/views/Groups/GroupsDataList.js +110 -176
  90. package/ui/views/Groups/GroupsDataList.js.map +1 -0
  91. package/ui/views/Groups/GroupsForm.d.ts +5 -3
  92. package/ui/views/Groups/GroupsForm.js +150 -170
  93. package/ui/views/Groups/GroupsForm.js.map +1 -0
  94. package/ui/views/Groups/graphql.d.ts +13 -5
  95. package/ui/views/Groups/graphql.js +84 -10
  96. package/ui/views/Groups/graphql.js.map +1 -0
  97. package/ui/views/Groups/index.d.ts +1 -1
  98. package/ui/views/Groups/index.js +3 -1
  99. package/ui/views/Groups/index.js.map +1 -0
  100. package/ui/views/Teams/Teams.d.ts +8 -0
  101. package/ui/views/Teams/Teams.js +12 -0
  102. package/ui/views/Teams/Teams.js.map +1 -0
  103. package/ui/views/Teams/TeamsDataList.d.ts +5 -0
  104. package/ui/views/Teams/TeamsDataList.js +151 -0
  105. package/ui/views/Teams/TeamsDataList.js.map +1 -0
  106. package/ui/views/Teams/TeamsForm.d.ts +5 -0
  107. package/ui/views/Teams/TeamsForm.js +173 -0
  108. package/ui/views/Teams/TeamsForm.js.map +1 -0
  109. package/ui/views/Teams/graphql.d.ts +13 -0
  110. package/ui/views/Teams/graphql.js +89 -0
  111. package/ui/views/Teams/graphql.js.map +1 -0
  112. package/ui/views/Teams/index.d.ts +1 -0
  113. package/ui/views/Teams/index.js +3 -0
  114. package/ui/views/Teams/index.js.map +1 -0
  115. package/ui/views/utils.d.ts +3 -2
  116. package/ui/views/utils.js +6 -23
  117. package/ui/views/utils.js.map +1 -0
  118. package/plugins/menus.d.ts +0 -4
  119. package/plugins/menus.js +0 -61
@@ -1,244 +1,186 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
-
5
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
6
-
7
- import _regeneratorRuntime from "@babel/runtime/regenerator";
8
1
  import React, { useCallback } from "react";
9
2
  import { useMutation, useQuery } from "@apollo/react-hooks";
10
3
  import get from "lodash/get";
11
4
  import { useRouter } from "@webiny/react-router";
12
5
  import { i18n } from "@webiny/app/i18n";
13
6
  import { Form } from "@webiny/form";
14
- import { Grid, Cell } from "@webiny/ui/Grid";
15
- import { Input } from "@webiny/ui/Input";
16
- import { ButtonDefault, ButtonIcon, ButtonPrimary, CopyButton } from "@webiny/ui/Button";
17
- import { CircularProgress } from "@webiny/ui/Progress";
18
- import { FormElementMessage } from "@webiny/ui/FormElementMessage";
19
7
  import { Permissions } from "@webiny/app-admin/components/Permissions";
20
8
  import { validation } from "@webiny/validation";
21
9
  import { SimpleForm, SimpleFormFooter, SimpleFormContent, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
22
- import { Typography } from "@webiny/ui/Typography";
23
10
  import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
24
11
  import { pickDataForAPI } from "./utils";
25
12
  import * as GQL from "./graphql";
26
- import { SnackbarAction } from "@webiny/ui/Snackbar";
27
13
  import isEmpty from "lodash/isEmpty";
28
14
  import EmptyView from "@webiny/app-admin/components/EmptyView";
29
- import { ReactComponent as AddIcon } from "@svgr/webpack!@webiny/app-admin/assets/icons/add-18px.svg";
30
- import styled from "@emotion/styled";
31
- var t = i18n.ns("app-security-admin-users/admin/api-keys/form");
32
- var ButtonWrapper = /*#__PURE__*/styled("div", {
33
- target: "e18bg2x40",
34
- label: "ButtonWrapper"
35
- })({
36
- display: "flex",
37
- justifyContent: "space-between"
38
- });
39
-
40
- var ApiKeyForm = function ApiKeyForm() {
41
- var _useRouter = useRouter(),
42
- location = _useRouter.location,
43
- history = _useRouter.history;
44
-
45
- var _useSnackbar = useSnackbar(),
46
- showSnackbar = _useSnackbar.showSnackbar;
47
-
48
- var newEntry = new URLSearchParams(location.search).get("new") === "true";
49
- var id = new URLSearchParams(location.search).get("id");
50
- var getQuery = useQuery(GQL.READ_API_KEY, {
15
+ import { ReactComponent as AddIcon } from "@webiny/icons/add.svg";
16
+ import { ReactComponent as CopyIcon } from "@webiny/icons/content_copy.svg";
17
+ import { ReactComponent as SettingsIcon } from "@webiny/icons/settings.svg";
18
+ import { Alert, Button, CopyButton, Grid, IconButton, Input, Label, OverlayLoader, Textarea, Tooltip } from "@webiny/admin-ui";
19
+ const t = i18n.ns("app-security-admin-users/admin/api-keys/form");
20
+ export const ApiKeyForm = () => {
21
+ const {
22
+ location,
23
+ history
24
+ } = useRouter();
25
+ const {
26
+ showSnackbar
27
+ } = useSnackbar();
28
+ const newEntry = new URLSearchParams(location.search).get("new") === "true";
29
+ const id = new URLSearchParams(location.search).get("id");
30
+ const getQuery = useQuery(GQL.READ_API_KEY, {
51
31
  variables: {
52
- id: id
32
+ id
53
33
  },
54
34
  skip: !id,
55
- onCompleted: function onCompleted(data) {
35
+ onCompleted: data => {
56
36
  if (!data) {
57
37
  return;
58
38
  }
59
-
60
- var error = data.security.apiKey.error;
61
-
39
+ const {
40
+ error
41
+ } = data.security.apiKey;
62
42
  if (error) {
63
43
  history.push("/access-management/api-keys");
64
44
  showSnackbar(error.message);
65
45
  }
66
46
  }
67
47
  });
68
-
69
- var _useMutation = useMutation(GQL.CREATE_API_KEY, {
48
+ const [create, createMutation] = useMutation(GQL.CREATE_API_KEY, {
70
49
  refetchQueries: [{
71
50
  query: GQL.LIST_API_KEYS
72
51
  }]
73
- }),
74
- _useMutation2 = _slicedToArray(_useMutation, 2),
75
- create = _useMutation2[0],
76
- createMutation = _useMutation2[1];
77
-
78
- var _useMutation3 = useMutation(GQL.UPDATE_API_KEY, {
52
+ });
53
+ const [update, updateMutation] = useMutation(GQL.UPDATE_API_KEY, {
79
54
  refetchQueries: [{
80
55
  query: GQL.LIST_API_KEYS
81
56
  }]
82
- }),
83
- _useMutation4 = _slicedToArray(_useMutation3, 2),
84
- update = _useMutation4[0],
85
- updateMutation = _useMutation4[1];
86
-
87
- var loading = [getQuery, createMutation, updateMutation].find(function (item) {
88
- return item.loading;
89
57
  });
90
- var onSubmit = useCallback( /*#__PURE__*/function () {
91
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
92
- var isUpdate, _ref2, _ref3, operation, args, response, error, id;
93
-
94
- return _regeneratorRuntime.wrap(function _callee$(_context) {
95
- while (1) {
96
- switch (_context.prev = _context.next) {
97
- case 0:
98
- if (!(!data.permissions || !data.permissions.length)) {
99
- _context.next = 3;
100
- break;
101
- }
102
-
103
- showSnackbar(t(_templateObject || (_templateObject = _taggedTemplateLiteral(["You must configure permissions before saving!"]))), {
104
- timeout: 60000,
105
- dismissesOnAction: true,
106
- action: /*#__PURE__*/React.createElement(SnackbarAction, {
107
- label: "OK"
108
- })
109
- });
110
- return _context.abrupt("return");
111
-
112
- case 3:
113
- isUpdate = data.createdOn;
114
- _ref2 = isUpdate ? [update, {
115
- variables: {
116
- id: data.id,
117
- data: pickDataForAPI(data)
118
- }
119
- }] : [create, {
120
- variables: {
121
- data: pickDataForAPI(data)
122
- }
123
- }], _ref3 = _slicedToArray(_ref2, 2), operation = _ref3[0], args = _ref3[1];
124
- _context.next = 7;
125
- return operation(args);
126
-
127
- case 7:
128
- response = _context.sent;
129
- error = response.data.security.apiKey.error;
130
-
131
- if (!error) {
132
- _context.next = 11;
133
- break;
134
- }
135
-
136
- return _context.abrupt("return", showSnackbar(error.message));
137
-
138
- case 11:
139
- id = response.data.security.apiKey.data.id;
140
- !isUpdate && history.push("/access-management/api-keys?id=".concat(id));
141
- showSnackbar(t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["API key saved successfully."]))));
142
-
143
- case 14:
144
- case "end":
145
- return _context.stop();
146
- }
147
- }
148
- }, _callee);
149
- }));
150
-
151
- return function (_x) {
152
- return _ref.apply(this, arguments);
153
- };
154
- }(), [id]);
155
- var data = get(getQuery, "data.security.apiKey.data", {});
156
- var showEmptyView = !newEntry && !loading && isEmpty(data); // Render "No content" selected view.
157
-
58
+ const loading = [getQuery, createMutation, updateMutation].find(item => item.loading);
59
+ const onSubmit = useCallback(async formData => {
60
+ if (!formData.permissions || !formData.permissions.length) {
61
+ showSnackbar(t`You must configure permissions before saving!`, {
62
+ timeout: 60000,
63
+ dismissesOnAction: true
64
+ });
65
+ return;
66
+ }
67
+ const isUpdate = formData.createdOn;
68
+ const [operation, args] = isUpdate ? [update, {
69
+ variables: {
70
+ id: formData.id,
71
+ data: pickDataForAPI(formData)
72
+ }
73
+ }] : [create, {
74
+ variables: {
75
+ data: pickDataForAPI(formData)
76
+ }
77
+ }];
78
+ const response = await operation(args);
79
+ const {
80
+ error
81
+ } = response.data.security.apiKey;
82
+ if (error) {
83
+ return showSnackbar(error.message);
84
+ }
85
+ const {
86
+ id
87
+ } = response.data.security.apiKey.data;
88
+ !isUpdate && history.push(`/access-management/api-keys?id=${id}`);
89
+ showSnackbar(t`API key saved successfully.`);
90
+ }, [id]);
91
+ const data = get(getQuery, "data.security.apiKey.data", {});
92
+ const showEmptyView = !newEntry && !loading && isEmpty(data);
93
+ // Render "No content" selected view.
158
94
  if (showEmptyView) {
159
95
  return /*#__PURE__*/React.createElement(EmptyView, {
160
- title: t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Click on the left side list to display API key details or create a..."]))),
161
- action: /*#__PURE__*/React.createElement(ButtonDefault, {
96
+ icon: /*#__PURE__*/React.createElement(SettingsIcon, null),
97
+ title: t`Click on the left side list to display API key details or create a...`,
98
+ action: /*#__PURE__*/React.createElement(Button, {
99
+ icon: /*#__PURE__*/React.createElement(AddIcon, null),
100
+ text: t`New API Key`,
162
101
  "data-testid": "new-record-button",
163
- onClick: function onClick() {
164
- return history.push("/access-management/api-keys?new=true");
165
- }
166
- }, /*#__PURE__*/React.createElement(ButtonIcon, {
167
- icon: /*#__PURE__*/React.createElement(AddIcon, null)
168
- }), " ", t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["New API Key"]))))
102
+ onClick: () => history.push("/access-management/api-keys?new=true")
103
+ })
169
104
  });
170
105
  }
171
-
172
106
  return /*#__PURE__*/React.createElement(Form, {
173
107
  data: data,
174
108
  onSubmit: onSubmit
175
- }, function (_ref4) {
176
- var data = _ref4.data,
177
- form = _ref4.form,
178
- Bind = _ref4.Bind;
179
- return /*#__PURE__*/React.createElement(SimpleForm, null, loading && /*#__PURE__*/React.createElement(CircularProgress, null), /*#__PURE__*/React.createElement(SimpleFormHeader, {
109
+ }, ({
110
+ data,
111
+ form,
112
+ Bind
113
+ }) => {
114
+ return /*#__PURE__*/React.createElement(SimpleForm, {
115
+ size: "lg"
116
+ }, loading && /*#__PURE__*/React.createElement(OverlayLoader, null), /*#__PURE__*/React.createElement(SimpleFormHeader, {
180
117
  title: data.name ? data.name : "Untitled"
181
- }), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
118
+ }), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
182
119
  span: 12
183
120
  }, /*#__PURE__*/React.createElement(Bind, {
184
121
  name: "name",
185
122
  validators: validation.create("required")
186
123
  }, /*#__PURE__*/React.createElement(Input, {
187
- label: t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Name"])))
188
- })))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
124
+ size: "lg",
125
+ label: t`Name`,
126
+ "data-testid": "sam.key.new.form.name"
127
+ }))), /*#__PURE__*/React.createElement(Grid.Column, {
189
128
  span: 12
190
129
  }, /*#__PURE__*/React.createElement(Bind, {
191
130
  name: "description",
192
131
  validators: validation.create("required")
193
- }, /*#__PURE__*/React.createElement(Input, {
194
- label: t(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Description"]))),
195
- rows: 4
196
- })))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
132
+ }, /*#__PURE__*/React.createElement(Textarea, {
133
+ size: "lg",
134
+ label: t`Description`,
135
+ rows: 4,
136
+ "data-testid": "sam.key.new.form.description"
137
+ }))), /*#__PURE__*/React.createElement(Grid.Column, {
197
138
  span: 12
198
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
199
- use: "subtitle1"
200
- }, t(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["Token"])))), data.token ? /*#__PURE__*/React.createElement("div", {
201
- style: {
202
- background: "var(--mdc-theme-background)",
203
- padding: "8px",
204
- paddingLeft: "16px"
205
- }
206
- }, /*#__PURE__*/React.createElement("span", {
207
- style: {
208
- lineHeight: "48px",
209
- verticalAlign: "middle"
210
- }
211
- }, data.token), /*#__PURE__*/React.createElement("span", {
212
- style: {
213
- position: "absolute",
214
- right: "32px"
215
- }
216
- }, /*#__PURE__*/React.createElement(CopyButton, {
139
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, {
140
+ text: t`Token`
141
+ }), data.token ? /*#__PURE__*/React.createElement("div", {
142
+ className: "wby-py-sm wby-pl-sm-extra wby-pr-xs wby-rounded-md wby-mt-xs wby-bg-neutral-disabled wby-flex wby-justify-between wby-items-center"
143
+ }, /*#__PURE__*/React.createElement("div", null, data.token), /*#__PURE__*/React.createElement(CopyButton, {
144
+ variant: "ghost",
217
145
  value: data.token,
218
- onCopy: function onCopy() {
219
- return showSnackbar("Successfully copied!");
220
- }
221
- }))) : /*#__PURE__*/React.createElement(FormElementMessage, null, "Your token will be shown once you submit the form.")))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
222
- span: 12
223
- }, /*#__PURE__*/React.createElement(Typography, {
224
- use: "subtitle1"
225
- }, t(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["Permissions"]))))), /*#__PURE__*/React.createElement(Cell, {
146
+ onCopy: () => showSnackbar("Successfully copied!")
147
+ })) : /*#__PURE__*/React.createElement(Alert, {
148
+ className: "wby-mt-xs"
149
+ }, "Your token will be shown once you submit the form."))))), /*#__PURE__*/React.createElement(SimpleFormHeader, {
150
+ title: "Permissions",
151
+ rounded: false
152
+ }, /*#__PURE__*/React.createElement("div", {
153
+ className: "wby-flex wby-justify-end"
154
+ }, /*#__PURE__*/React.createElement(Tooltip, {
155
+ content: "Copy permissions as JSON",
156
+ trigger: /*#__PURE__*/React.createElement(IconButton, {
157
+ variant: "ghost",
158
+ icon: /*#__PURE__*/React.createElement(CopyIcon, null),
159
+ onClick: () => {
160
+ navigator.clipboard.writeText(JSON.stringify(data.permissions, null, 2));
161
+ showSnackbar("JSON data copied to clipboard.");
162
+ }
163
+ })
164
+ }))), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
226
165
  span: 12
227
166
  }, /*#__PURE__*/React.createElement(Bind, {
228
167
  name: "permissions",
229
168
  defaultValue: []
230
- }, function (bind) {
231
- return /*#__PURE__*/React.createElement(Permissions, Object.assign({
232
- id: data.id || "new"
233
- }, bind));
234
- })))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonDefault, {
235
- onClick: function onClick() {
236
- return history.push("/access-management/api-keys");
169
+ }, bind => /*#__PURE__*/React.createElement(Permissions, Object.assign({
170
+ id: data.id || "new"
171
+ }, bind)))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(Button, {
172
+ variant: "secondary",
173
+ text: t`Cancel`,
174
+ onClick: () => history.push("/access-management/api-keys"),
175
+ "data-testid": "sam.key.new.form.button.cancel"
176
+ }), /*#__PURE__*/React.createElement(Button, {
177
+ text: t`Save`,
178
+ "data-testid": "sam.key.new.form.button.save",
179
+ onClick: ev => {
180
+ form.submit(ev);
237
181
  }
238
- }, t(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["Cancel"])))), /*#__PURE__*/React.createElement(ButtonPrimary, {
239
- onClick: form.submit
240
- }, t(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["Save API key"])))))));
182
+ })));
241
183
  });
242
184
  };
243
185
 
244
- export default ApiKeyForm;
186
+ //# sourceMappingURL=ApiKeyForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useMutation","useQuery","get","useRouter","i18n","Form","Permissions","validation","SimpleForm","SimpleFormFooter","SimpleFormContent","SimpleFormHeader","useSnackbar","pickDataForAPI","GQL","isEmpty","EmptyView","ReactComponent","AddIcon","CopyIcon","SettingsIcon","Alert","Button","CopyButton","Grid","IconButton","Input","Label","OverlayLoader","Textarea","Tooltip","t","ns","ApiKeyForm","location","history","showSnackbar","newEntry","URLSearchParams","search","id","getQuery","READ_API_KEY","variables","skip","onCompleted","data","error","security","apiKey","push","message","create","createMutation","CREATE_API_KEY","refetchQueries","query","LIST_API_KEYS","update","updateMutation","UPDATE_API_KEY","loading","find","item","onSubmit","formData","permissions","length","timeout","dismissesOnAction","isUpdate","createdOn","operation","args","response","showEmptyView","createElement","icon","title","action","text","onClick","form","Bind","size","name","Column","span","validators","label","rows","token","className","variant","value","onCopy","rounded","content","trigger","navigator","clipboard","writeText","JSON","stringify","defaultValue","bind","Object","assign","ev","submit"],"sources":["ApiKeyForm.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useMutation, useQuery } from \"@apollo/react-hooks\";\nimport get from \"lodash/get\";\nimport { useRouter } from \"@webiny/react-router\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Form } from \"@webiny/form\";\nimport { Permissions } from \"@webiny/app-admin/components/Permissions\";\nimport { validation } from \"@webiny/validation\";\nimport {\n SimpleForm,\n SimpleFormFooter,\n SimpleFormContent,\n SimpleFormHeader\n} from \"@webiny/app-admin/components/SimpleForm\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport { pickDataForAPI } from \"./utils\";\nimport * as GQL from \"./graphql\";\nimport isEmpty from \"lodash/isEmpty\";\nimport EmptyView from \"@webiny/app-admin/components/EmptyView\";\nimport { ReactComponent as AddIcon } from \"@webiny/icons/add.svg\";\nimport { ReactComponent as CopyIcon } from \"@webiny/icons/content_copy.svg\";\nimport { ReactComponent as SettingsIcon } from \"@webiny/icons/settings.svg\";\nimport type { ApiKey } from \"~/types\";\nimport {\n Alert,\n Button,\n CopyButton,\n Grid,\n IconButton,\n Input,\n Label,\n OverlayLoader,\n Textarea,\n Tooltip\n} from \"@webiny/admin-ui\";\n\nconst t = i18n.ns(\"app-security-admin-users/admin/api-keys/form\");\n\nexport interface ApiKeyFormProps {\n // TODO @ts-refactor delete and go up the tree and sort it out\n [key: string]: any;\n}\n\nexport const ApiKeyForm = () => {\n const { location, history } = useRouter();\n const { showSnackbar } = useSnackbar();\n const newEntry = new URLSearchParams(location.search).get(\"new\") === \"true\";\n const id = new URLSearchParams(location.search).get(\"id\");\n\n const getQuery = useQuery(GQL.READ_API_KEY, {\n variables: { id },\n skip: !id,\n onCompleted: data => {\n if (!data) {\n return;\n }\n\n const { error } = data.security.apiKey;\n if (error) {\n history.push(\"/access-management/api-keys\");\n showSnackbar(error.message);\n }\n }\n });\n\n const [create, createMutation] = useMutation(GQL.CREATE_API_KEY, {\n refetchQueries: [{ query: GQL.LIST_API_KEYS }]\n });\n\n const [update, updateMutation] = useMutation(GQL.UPDATE_API_KEY, {\n refetchQueries: [{ query: GQL.LIST_API_KEYS }]\n });\n\n const loading = [getQuery, createMutation, updateMutation].find(item => item.loading);\n\n const onSubmit = useCallback(\n async (formData: ApiKey) => {\n if (!formData.permissions || !formData.permissions.length) {\n showSnackbar(t`You must configure permissions before saving!`, {\n timeout: 60000,\n dismissesOnAction: true\n });\n return;\n }\n\n const isUpdate = formData.createdOn;\n const [operation, args] = isUpdate\n ? [update, { variables: { id: formData.id, data: pickDataForAPI(formData) } }]\n : [create, { variables: { data: pickDataForAPI(formData) } }];\n\n const response = await operation(args);\n\n const { error } = response.data.security.apiKey;\n if (error) {\n return showSnackbar(error.message);\n }\n\n const { id } = response.data.security.apiKey.data;\n\n !isUpdate && history.push(`/access-management/api-keys?id=${id}`);\n showSnackbar(t`API key saved successfully.`);\n },\n [id]\n );\n\n const data: ApiKey = get(getQuery, \"data.security.apiKey.data\", {});\n\n const showEmptyView = !newEntry && !loading && isEmpty(data);\n // Render \"No content\" selected view.\n if (showEmptyView) {\n return (\n <EmptyView\n icon={<SettingsIcon />}\n title={t`Click on the left side list to display API key details or create a...`}\n action={\n <Button\n icon={<AddIcon />}\n text={t`New API Key`}\n data-testid=\"new-record-button\"\n onClick={() => history.push(\"/access-management/api-keys?new=true\")}\n />\n }\n />\n );\n }\n\n return (\n <Form data={data} onSubmit={onSubmit}>\n {({ data, form, Bind }) => {\n return (\n <SimpleForm size={\"lg\"}>\n {loading && <OverlayLoader />}\n <SimpleFormHeader title={data.name ? data.name : \"Untitled\"} />\n <SimpleFormContent>\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"name\" validators={validation.create(\"required\")}>\n <Input\n size={\"lg\"}\n label={t`Name`}\n data-testid=\"sam.key.new.form.name\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"description\"\n validators={validation.create(\"required\")}\n >\n <Textarea\n size={\"lg\"}\n label={t`Description`}\n rows={4}\n data-testid=\"sam.key.new.form.description\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div>\n <Label text={t`Token`} />\n {data.token ? (\n <div\n className={\n \"wby-py-sm wby-pl-sm-extra wby-pr-xs wby-rounded-md wby-mt-xs wby-bg-neutral-disabled wby-flex wby-justify-between wby-items-center\"\n }\n >\n <div>{data.token}</div>\n <CopyButton\n variant={\"ghost\"}\n value={data.token}\n onCopy={() =>\n showSnackbar(\"Successfully copied!\")\n }\n />\n </div>\n ) : (\n <Alert className={\"wby-mt-xs\"}>\n {\n \"Your token will be shown once you submit the form.\"\n }\n </Alert>\n )}\n </div>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormHeader title={\"Permissions\"} rounded={false}>\n <div className={\"wby-flex wby-justify-end\"}>\n <Tooltip\n content=\"Copy permissions as JSON\"\n trigger={\n <IconButton\n variant={\"ghost\"}\n icon={<CopyIcon />}\n onClick={() => {\n navigator.clipboard.writeText(\n JSON.stringify(data.permissions, null, 2)\n );\n showSnackbar(\"JSON data copied to clipboard.\");\n }}\n />\n }\n />\n </div>\n </SimpleFormHeader>\n <SimpleFormContent>\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"permissions\"} defaultValue={[]}>\n {bind => <Permissions id={data.id || \"new\"} {...bind} />}\n </Bind>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>\n <Button\n variant={\"secondary\"}\n text={t`Cancel`}\n onClick={() => history.push(\"/access-management/api-keys\")}\n data-testid=\"sam.key.new.form.button.cancel\"\n />\n <Button\n text={t`Save`}\n data-testid=\"sam.key.new.form.button.save\"\n onClick={ev => {\n form.submit(ev);\n }}\n />\n </SimpleFormFooter>\n </SimpleForm>\n );\n }}\n </Form>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,WAAW,EAAEC,QAAQ,QAAQ,qBAAqB;AAC3D,OAAOC,GAAG,MAAM,YAAY;AAC5B,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,WAAW,QAAQ,0CAA0C;AACtE,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SACIC,UAAU,EACVC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QACb,yCAAyC;AAChD,SAASC,WAAW,QAAQ,qCAAqC;AACjE,SAASC,cAAc;AACvB,OAAO,KAAKC,GAAG;AACf,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,SAAS,MAAM,wCAAwC;AAC9D,SAASC,cAAc,IAAIC,OAAO,QAAQ,uBAAuB;AACjE,SAASD,cAAc,IAAIE,QAAQ,QAAQ,gCAAgC;AAC3E,SAASF,cAAc,IAAIG,YAAY,QAAQ,4BAA4B;AAE3E,SACIC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACRC,OAAO,QACJ,kBAAkB;AAEzB,MAAMC,CAAC,GAAG3B,IAAI,CAAC4B,EAAE,CAAC,8CAA8C,CAAC;AAOjE,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGhC,SAAS,CAAC,CAAC;EACzC,MAAM;IAAEiC;EAAa,CAAC,GAAGxB,WAAW,CAAC,CAAC;EACtC,MAAMyB,QAAQ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,EAAEjD,CAAC,MAAO;MACd,eAAY,8BAA8B;MAC1CkD,OAAO,EAAE2B,EAAE,IAAI;QACX1B,IAAI,CAAC2B,MAAM,CAACD,EAAE,CAAC;MACnB;IAAE,CACL,CACa,CACV,CAAC;EAErB,CACE,CAAC;AAEf,CAAC","ignoreList":[]}
@@ -1,3 +1,8 @@
1
- /// <reference types="react" />
2
- declare const ApiKeys: ({ formProps, listProps }: any) => JSX.Element;
3
- export default ApiKeys;
1
+ import * as React from "react";
2
+ import type { ApiKeysDataListProps } from "./ApiKeysDataList";
3
+ import type { ApiKeyFormProps } from "./ApiKeyForm";
4
+ export interface ApiKeysProps {
5
+ listProps?: ApiKeysDataListProps;
6
+ formProps?: ApiKeyFormProps;
7
+ }
8
+ export declare const ApiKeys: ({ formProps, listProps }: ApiKeysProps) => React.JSX.Element;
@@ -1,12 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { SplitView, LeftPanel, RightPanel } from "@webiny/app-admin/components/SplitView";
3
- import ApiKeysDataList from "./ApiKeysDataList";
4
- import ApiKeyForm from "./ApiKeyForm";
5
-
6
- var ApiKeys = function ApiKeys(_ref) {
7
- var formProps = _ref.formProps,
8
- listProps = _ref.listProps;
3
+ import { ApiKeysDataList } from "./ApiKeysDataList";
4
+ import { ApiKeyForm } from "./ApiKeyForm";
5
+ export const ApiKeys = ({
6
+ formProps = {},
7
+ listProps = {}
8
+ }) => {
9
9
  return /*#__PURE__*/React.createElement(SplitView, null, /*#__PURE__*/React.createElement(LeftPanel, null, /*#__PURE__*/React.createElement(ApiKeysDataList, listProps)), /*#__PURE__*/React.createElement(RightPanel, null, /*#__PURE__*/React.createElement(ApiKeyForm, formProps)));
10
10
  };
11
11
 
12
- export default ApiKeys;
12
+ //# sourceMappingURL=ApiKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","SplitView","LeftPanel","RightPanel","ApiKeysDataList","ApiKeyForm","ApiKeys","formProps","listProps","createElement"],"sources":["ApiKeys.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { SplitView, LeftPanel, RightPanel } from \"@webiny/app-admin/components/SplitView\";\nimport type { ApiKeysDataListProps } from \"./ApiKeysDataList\";\nimport { ApiKeysDataList } from \"./ApiKeysDataList\";\nimport type { ApiKeyFormProps } from \"./ApiKeyForm\";\nimport { ApiKeyForm } from \"./ApiKeyForm\";\n\nexport interface ApiKeysProps {\n listProps?: ApiKeysDataListProps;\n formProps?: ApiKeyFormProps;\n}\nexport const ApiKeys = ({ formProps = {}, listProps = {} }: ApiKeysProps) => {\n return (\n <SplitView>\n <LeftPanel>\n <ApiKeysDataList {...listProps} />\n </LeftPanel>\n <RightPanel>\n <ApiKeyForm {...formProps} />\n </RightPanel>\n </SplitView>\n );\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,wCAAwC;AAEzF,SAASC,eAAe;AAExB,SAASC,UAAU;AAMnB,OAAO,MAAMC,OAAO,GAAGA,CAAC;EAAEC,SAAS,GAAG,CAAC,CAAC;EAAEC,SAAS,GAAG,CAAC;AAAgB,CAAC,KAAK;EACzE,oBACIR,KAAA,CAAAS,aAAA,CAACR,SAAS,qBACND,KAAA,CAAAS,aAAA,CAACP,SAAS,qBACNF,KAAA,CAAAS,aAAA,CAACL,eAAe,EAAKI,SAAY,CAC1B,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
- /// <reference types="react" />
2
- declare const ApiKeysDataList: () => JSX.Element;
3
- export default ApiKeysDataList;
1
+ import React from "react";
2
+ export interface ApiKeysDataListProps {
3
+ [key: string]: any;
4
+ }
5
+ export declare const ApiKeysDataList: () => React.JSX.Element;