@bigbinary/neeto-api-keys-frontend 1.1.13 → 1.2.0-beta1
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/app/javascript/src/translations/en.json +1 -1
- package/dist/index.cjs.js +331 -301
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +306 -288
- package/dist/index.js.map +1 -1
- package/package.json +17 -14
package/dist/index.js
CHANGED
|
@@ -1,37 +1,75 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { t } from 'i18next';
|
|
3
|
-
import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
4
3
|
import { isPresent, isNotPresent, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
4
|
+
import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
5
5
|
import { useMutationWithInvalidation, withT, useDebounce, withTitle, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
6
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
7
|
-
import
|
|
7
|
+
import Alert from '@bigbinary/neetoui/Alert';
|
|
8
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
8
9
|
import { useTranslation, Trans } from 'react-i18next';
|
|
9
|
-
import { useQuery } from 'react-query';
|
|
10
|
+
import { useQuery } from '@tanstack/react-query';
|
|
10
11
|
import axios from 'axios';
|
|
11
|
-
import
|
|
12
|
+
import Pane from '@bigbinary/neetoui/Pane';
|
|
13
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
14
|
+
import NeetoUIForm from '@bigbinary/neetoui/formik/Form';
|
|
15
|
+
import Input from '@bigbinary/neetoui/formik/Input';
|
|
16
|
+
import Checkbox from '@bigbinary/neetoui/formik/Checkbox';
|
|
17
|
+
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
12
18
|
import { Field } from 'formik';
|
|
19
|
+
import NeetoUIDatePicker from '@bigbinary/neetoui/DatePicker';
|
|
13
20
|
import { prop, isEmpty } from 'ramda';
|
|
21
|
+
import dayjs from 'dayjs';
|
|
14
22
|
import { dateFormat, getQueryParams, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
15
23
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
16
24
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
25
|
+
import Tag from '@bigbinary/neetoui/Tag';
|
|
17
26
|
import * as yup from 'yup';
|
|
27
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
18
28
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
19
29
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
30
|
+
import NeetoUITable from '@bigbinary/neetoui/Table';
|
|
31
|
+
import NoData from '@bigbinary/neetoui/NoData';
|
|
20
32
|
import { useHistory } from 'react-router-dom';
|
|
21
33
|
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
function _typeof(o) {
|
|
35
|
+
"@babel/helpers - typeof";
|
|
36
|
+
|
|
37
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
38
|
+
return typeof o;
|
|
39
|
+
} : function (o) {
|
|
40
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
41
|
+
}, _typeof(o);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _toPrimitive(input, hint) {
|
|
45
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
46
|
+
var prim = input[Symbol.toPrimitive];
|
|
47
|
+
if (prim !== undefined) {
|
|
48
|
+
var res = prim.call(input, hint || "default");
|
|
49
|
+
if (_typeof(res) !== "object") return res;
|
|
50
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
51
|
+
}
|
|
52
|
+
return (hint === "string" ? String : Number)(input);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _toPropertyKey(arg) {
|
|
56
|
+
var key = _toPrimitive(arg, "string");
|
|
57
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _defineProperty(obj, key, value) {
|
|
61
|
+
key = _toPropertyKey(key);
|
|
62
|
+
if (key in obj) {
|
|
63
|
+
Object.defineProperty(obj, key, {
|
|
64
|
+
value: value,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
obj[key] = value;
|
|
71
|
+
}
|
|
72
|
+
return obj;
|
|
35
73
|
}
|
|
36
74
|
|
|
37
75
|
function _arrayWithHoles(arr) {
|
|
@@ -122,12 +160,18 @@ var QUERY_KEYS = {
|
|
|
122
160
|
API_KEYS: "api-keys"
|
|
123
161
|
};
|
|
124
162
|
|
|
163
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
164
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
125
165
|
var useFetchApiKeys = function useFetchApiKeys(_ref) {
|
|
126
166
|
var params = _ref.params,
|
|
127
|
-
options = _ref.options
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
167
|
+
_ref$options = _ref.options,
|
|
168
|
+
options = _ref$options === void 0 ? {} : _ref$options;
|
|
169
|
+
return useQuery(_objectSpread$4({
|
|
170
|
+
queryKey: [QUERY_KEYS.API_KEYS, params],
|
|
171
|
+
queryFn: function queryFn() {
|
|
172
|
+
return apiKeysApi.fetch(params);
|
|
173
|
+
}
|
|
174
|
+
}, options));
|
|
131
175
|
};
|
|
132
176
|
var useCreateApiKey = function useCreateApiKey(onSuccess) {
|
|
133
177
|
return useMutationWithInvalidation(apiKeysApi.create, {
|
|
@@ -155,23 +199,6 @@ var useDeleteApiKey = function useDeleteApiKey(onSuccess) {
|
|
|
155
199
|
});
|
|
156
200
|
};
|
|
157
201
|
|
|
158
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
159
|
-
|
|
160
|
-
function getDefaultExportFromCjs (x) {
|
|
161
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
var dayjs_min = {exports: {}};
|
|
165
|
-
|
|
166
|
-
dayjs_min.exports;
|
|
167
|
-
|
|
168
|
-
(function (module, exports) {
|
|
169
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
170
|
-
} (dayjs_min, dayjs_min.exports));
|
|
171
|
-
|
|
172
|
-
var dayjs_minExports = dayjs_min.exports;
|
|
173
|
-
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
174
|
-
|
|
175
202
|
var INITIAL_VALUES = {
|
|
176
203
|
expiresAt: null,
|
|
177
204
|
label: "",
|
|
@@ -226,23 +253,25 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
226
253
|
dataIndex: "label",
|
|
227
254
|
width: 400,
|
|
228
255
|
render: function render(label, apiKey) {
|
|
229
|
-
return /*#__PURE__*/
|
|
230
|
-
className: "flex items-center justify-between space-x-3"
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
menuItems: getMenuItems({
|
|
238
|
-
onEdit: function onEdit() {
|
|
239
|
-
return handleEdit(apiKey);
|
|
256
|
+
return /*#__PURE__*/jsxs("div", {
|
|
257
|
+
className: "flex items-center justify-between space-x-3",
|
|
258
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
259
|
+
style: "body2",
|
|
260
|
+
children: label
|
|
261
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
262
|
+
dropdownProps: {
|
|
263
|
+
strategy: "fixed"
|
|
240
264
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
265
|
+
menuItems: getMenuItems({
|
|
266
|
+
onEdit: function onEdit() {
|
|
267
|
+
return handleEdit(apiKey);
|
|
268
|
+
},
|
|
269
|
+
onDelete: function onDelete() {
|
|
270
|
+
return handleDelete(apiKey);
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
246
275
|
}
|
|
247
276
|
}, {
|
|
248
277
|
title: t("neetoApiKeys.table.headers.token"),
|
|
@@ -250,14 +279,16 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
250
279
|
dataIndex: "token",
|
|
251
280
|
width: 400,
|
|
252
281
|
render: function render(token) {
|
|
253
|
-
return /*#__PURE__*/
|
|
254
|
-
className: "flex items-center justify-between gap-x-3"
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
282
|
+
return /*#__PURE__*/jsxs("div", {
|
|
283
|
+
className: "flex items-center justify-between gap-x-3",
|
|
284
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
285
|
+
style: "body2",
|
|
286
|
+
children: partlyHideToken(token)
|
|
287
|
+
}), /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
288
|
+
style: "text",
|
|
289
|
+
value: token
|
|
290
|
+
})]
|
|
291
|
+
});
|
|
261
292
|
}
|
|
262
293
|
}, {
|
|
263
294
|
title: t("neetoApiKeys.table.headers.status"),
|
|
@@ -265,11 +296,13 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
265
296
|
width: 144,
|
|
266
297
|
render: function render(_, _ref3) {
|
|
267
298
|
var expiresAt = _ref3.expiresAt;
|
|
268
|
-
return isPresent(expiresAt) && isInPast(expiresAt) ? /*#__PURE__*/
|
|
269
|
-
style: "warning"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
299
|
+
return isPresent(expiresAt) && isInPast(expiresAt) ? /*#__PURE__*/jsx(Tag, {
|
|
300
|
+
style: "warning",
|
|
301
|
+
children: t("neetoApiKeys.tags.expired")
|
|
302
|
+
}) : /*#__PURE__*/jsx(Tag, {
|
|
303
|
+
style: "success",
|
|
304
|
+
children: t("neetoApiKeys.tags.active")
|
|
305
|
+
});
|
|
273
306
|
}
|
|
274
307
|
}, {
|
|
275
308
|
title: t("neetoApiKeys.table.headers.expiresAt"),
|
|
@@ -277,9 +310,10 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
277
310
|
dataIndex: "expiresAt",
|
|
278
311
|
width: 200,
|
|
279
312
|
render: function render(expiresAt) {
|
|
280
|
-
return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/
|
|
281
|
-
style: "body2"
|
|
282
|
-
|
|
313
|
+
return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/jsx(Typography, {
|
|
314
|
+
style: "body2",
|
|
315
|
+
children: t("neetoApiKeys.common.never")
|
|
316
|
+
});
|
|
283
317
|
}
|
|
284
318
|
}, {
|
|
285
319
|
title: t("neetoApiKeys.table.headers.createdAt"),
|
|
@@ -287,9 +321,10 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
287
321
|
dataIndex: "createdAt",
|
|
288
322
|
width: 200,
|
|
289
323
|
render: function render(createdAt) {
|
|
290
|
-
return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/
|
|
291
|
-
style: "body2"
|
|
292
|
-
|
|
324
|
+
return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/jsx(Typography, {
|
|
325
|
+
style: "body2",
|
|
326
|
+
children: t("neetoApiKeys.common.never")
|
|
327
|
+
});
|
|
293
328
|
}
|
|
294
329
|
}];
|
|
295
330
|
};
|
|
@@ -297,6 +332,8 @@ var getStartOfTime = function getStartOfTime(time, unit) {
|
|
|
297
332
|
return dayjs(time).startOf(unit);
|
|
298
333
|
};
|
|
299
334
|
|
|
335
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
336
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
300
337
|
var DatePicker = function DatePicker(_ref) {
|
|
301
338
|
var defaultValue = _ref.defaultValue,
|
|
302
339
|
disabledDate = _ref.disabledDate,
|
|
@@ -305,29 +342,30 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
305
342
|
name = _ref.name,
|
|
306
343
|
_ref$disabled = _ref.disabled,
|
|
307
344
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
308
|
-
return /*#__PURE__*/
|
|
309
|
-
name: name
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
345
|
+
return /*#__PURE__*/jsx(Field, {
|
|
346
|
+
name: name,
|
|
347
|
+
children: function children(_ref2) {
|
|
348
|
+
var _globalProps;
|
|
349
|
+
var field = _ref2.field,
|
|
350
|
+
meta = _ref2.meta,
|
|
351
|
+
setFieldValue = _ref2.form.setFieldValue;
|
|
352
|
+
return /*#__PURE__*/jsx(NeetoUIDatePicker, _objectSpread$3(_objectSpread$3({
|
|
353
|
+
disabled: disabled,
|
|
354
|
+
disabledDate: disabledDate,
|
|
355
|
+
label: label,
|
|
356
|
+
placeholder: placeholder,
|
|
357
|
+
defaultValue: defaultValue,
|
|
358
|
+
allowClear: false,
|
|
359
|
+
className: "w-full",
|
|
360
|
+
error: meta.touched && meta.error,
|
|
361
|
+
format: (_globalProps = globalProps) === null || _globalProps === void 0 || (_globalProps = _globalProps.user) === null || _globalProps === void 0 ? void 0 : _globalProps.dateFormat,
|
|
362
|
+
getPopupContainer: prop("parentNode")
|
|
363
|
+
}, field), {}, {
|
|
364
|
+
onChange: function onChange(date) {
|
|
365
|
+
setFieldValue(field.name, getStartOfTime(date, "day"));
|
|
366
|
+
}
|
|
367
|
+
}));
|
|
368
|
+
}
|
|
331
369
|
});
|
|
332
370
|
};
|
|
333
371
|
|
|
@@ -339,50 +377,59 @@ var Form = withT(function (_ref) {
|
|
|
339
377
|
onClose = _ref.onClose,
|
|
340
378
|
onSubmit = _ref.onSubmit,
|
|
341
379
|
initialFocusRef = _ref.initialFocusRef;
|
|
342
|
-
return /*#__PURE__*/
|
|
380
|
+
return /*#__PURE__*/jsx(NeetoUIForm, {
|
|
343
381
|
formikProps: {
|
|
344
382
|
validationSchema: VALIDATION_SCHEMA,
|
|
345
383
|
initialValues: initialValues,
|
|
346
384
|
onSubmit: onSubmit
|
|
385
|
+
},
|
|
386
|
+
children: function children(_ref2) {
|
|
387
|
+
var setFieldValue = _ref2.setFieldValue,
|
|
388
|
+
_ref2$values = _ref2.values,
|
|
389
|
+
_ref2$values2 = _ref2$values === void 0 ? {} : _ref2$values,
|
|
390
|
+
hasNoExpiry = _ref2$values2.hasNoExpiry,
|
|
391
|
+
expiresAt = _ref2$values2.expiresAt;
|
|
392
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
393
|
+
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
394
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
395
|
+
className: "w-full space-y-4",
|
|
396
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
397
|
+
autoFocus: true,
|
|
398
|
+
label: t("neetoApiKeys.fields.label"),
|
|
399
|
+
name: "label",
|
|
400
|
+
placeholder: t("neetoApiKeys.placeholders.label"),
|
|
401
|
+
ref: initialFocusRef
|
|
402
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
403
|
+
className: "space-y-2",
|
|
404
|
+
children: [!hasNoExpiry && /*#__PURE__*/jsx(DatePicker, {
|
|
405
|
+
defaultValue: expiresAt,
|
|
406
|
+
disabledDate: function disabledDate(date) {
|
|
407
|
+
return date < NEXT_DAY;
|
|
408
|
+
},
|
|
409
|
+
label: t("neetoApiKeys.fields.expiryDate"),
|
|
410
|
+
name: "expiresAt",
|
|
411
|
+
placeholder: t("neetoApiKeys.placeholders.selectExpiryDate")
|
|
412
|
+
}), /*#__PURE__*/jsx(Checkbox, {
|
|
413
|
+
checked: hasNoExpiry,
|
|
414
|
+
label: t("neetoApiKeys.fields.neverExpire"),
|
|
415
|
+
name: "hasNoExpiry",
|
|
416
|
+
onChange: function onChange() {
|
|
417
|
+
setFieldValue("expiresAt", null);
|
|
418
|
+
setFieldValue("hasNoExpiry", !hasNoExpiry);
|
|
419
|
+
}
|
|
420
|
+
})]
|
|
421
|
+
})]
|
|
422
|
+
})
|
|
423
|
+
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
424
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
425
|
+
isSubmitting: isSubmitting,
|
|
426
|
+
cancelButtonProps: {
|
|
427
|
+
onClick: onClose
|
|
428
|
+
}
|
|
429
|
+
})
|
|
430
|
+
})]
|
|
431
|
+
});
|
|
347
432
|
}
|
|
348
|
-
}, function (_ref2) {
|
|
349
|
-
var setFieldValue = _ref2.setFieldValue,
|
|
350
|
-
_ref2$values = _ref2.values,
|
|
351
|
-
_ref2$values2 = _ref2$values === void 0 ? {} : _ref2$values,
|
|
352
|
-
hasNoExpiry = _ref2$values2.hasNoExpiry,
|
|
353
|
-
expiresAt = _ref2$values2.expiresAt;
|
|
354
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
355
|
-
className: "w-full space-y-4"
|
|
356
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
357
|
-
autoFocus: true,
|
|
358
|
-
label: t("neetoApiKeys.fields.label"),
|
|
359
|
-
name: "label",
|
|
360
|
-
placeholder: t("neetoApiKeys.placeholders.label"),
|
|
361
|
-
ref: initialFocusRef
|
|
362
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
363
|
-
className: "space-y-2"
|
|
364
|
-
}, !hasNoExpiry && /*#__PURE__*/React.createElement(DatePicker, {
|
|
365
|
-
defaultValue: expiresAt,
|
|
366
|
-
disabledDate: function disabledDate(date) {
|
|
367
|
-
return date < NEXT_DAY;
|
|
368
|
-
},
|
|
369
|
-
label: t("neetoApiKeys.fields.expiryDate"),
|
|
370
|
-
name: "expiresAt",
|
|
371
|
-
placeholder: t("neetoApiKeys.placeholders.selectExpiryDate")
|
|
372
|
-
}), /*#__PURE__*/React.createElement(Checkbox, {
|
|
373
|
-
checked: hasNoExpiry,
|
|
374
|
-
label: t("neetoApiKeys.fields.neverExpire"),
|
|
375
|
-
name: "hasNoExpiry",
|
|
376
|
-
onChange: function onChange() {
|
|
377
|
-
setFieldValue("expiresAt", null);
|
|
378
|
-
setFieldValue("hasNoExpiry", !hasNoExpiry);
|
|
379
|
-
}
|
|
380
|
-
})))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
|
|
381
|
-
isSubmitting: isSubmitting,
|
|
382
|
-
cancelButtonProps: {
|
|
383
|
-
onClick: onClose
|
|
384
|
-
}
|
|
385
|
-
})));
|
|
386
433
|
});
|
|
387
434
|
});
|
|
388
435
|
|
|
@@ -392,73 +439,36 @@ var Create = function Create(_ref) {
|
|
|
392
439
|
var initialFocusRef = useRef(null);
|
|
393
440
|
var _useCreateApiKey = useCreateApiKey(onClose),
|
|
394
441
|
createApiKey = _useCreateApiKey.mutate,
|
|
395
|
-
isCreating = _useCreateApiKey.
|
|
442
|
+
isCreating = _useCreateApiKey.isPending;
|
|
396
443
|
var _useTranslation = useTranslation(),
|
|
397
444
|
t = _useTranslation.t;
|
|
398
|
-
return /*#__PURE__*/
|
|
445
|
+
return /*#__PURE__*/jsxs(Pane, {
|
|
399
446
|
initialFocusRef: initialFocusRef,
|
|
447
|
+
isOpen: isOpen,
|
|
400
448
|
onClose: onClose,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
449
|
+
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
450
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
451
|
+
style: "h2",
|
|
452
|
+
children: t("neetoApiKeys.headers.createApiKey")
|
|
453
|
+
})
|
|
454
|
+
}), /*#__PURE__*/jsx(Form, {
|
|
455
|
+
initialFocusRef: initialFocusRef,
|
|
456
|
+
onClose: onClose,
|
|
457
|
+
isSubmitting: isCreating,
|
|
458
|
+
onSubmit: createApiKey
|
|
459
|
+
})]
|
|
460
|
+
});
|
|
410
461
|
};
|
|
411
462
|
|
|
412
|
-
function
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
416
|
-
return typeof o;
|
|
417
|
-
} : function (o) {
|
|
418
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
419
|
-
}, _typeof(o);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function _toPrimitive(input, hint) {
|
|
423
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
424
|
-
var prim = input[Symbol.toPrimitive];
|
|
425
|
-
if (prim !== undefined) {
|
|
426
|
-
var res = prim.call(input, hint || "default");
|
|
427
|
-
if (_typeof(res) !== "object") return res;
|
|
428
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
429
|
-
}
|
|
430
|
-
return (hint === "string" ? String : Number)(input);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function _toPropertyKey(arg) {
|
|
434
|
-
var key = _toPrimitive(arg, "string");
|
|
435
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
function _defineProperty(obj, key, value) {
|
|
439
|
-
key = _toPropertyKey(key);
|
|
440
|
-
if (key in obj) {
|
|
441
|
-
Object.defineProperty(obj, key, {
|
|
442
|
-
value: value,
|
|
443
|
-
enumerable: true,
|
|
444
|
-
configurable: true,
|
|
445
|
-
writable: true
|
|
446
|
-
});
|
|
447
|
-
} else {
|
|
448
|
-
obj[key] = value;
|
|
449
|
-
}
|
|
450
|
-
return obj;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
454
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
463
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
464
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
455
465
|
var Update = function Update(_ref) {
|
|
456
466
|
var onClose = _ref.onClose,
|
|
457
467
|
apiKey = _ref.apiKey;
|
|
458
468
|
var initialFocusRef = useRef(null);
|
|
459
469
|
var _useUpdateApiKey = useUpdateApiKey(onClose),
|
|
460
470
|
updateApiKey = _useUpdateApiKey.mutate,
|
|
461
|
-
isUpdating = _useUpdateApiKey.
|
|
471
|
+
isUpdating = _useUpdateApiKey.isPending;
|
|
462
472
|
var _useTranslation = useTranslation(),
|
|
463
473
|
t = _useTranslation.t;
|
|
464
474
|
var handleUpdate = function handleUpdate(values) {
|
|
@@ -467,22 +477,26 @@ var Update = function Update(_ref) {
|
|
|
467
477
|
payload: values
|
|
468
478
|
});
|
|
469
479
|
};
|
|
470
|
-
var initialValues = _objectSpread(_objectSpread({}, apiKey), {}, {
|
|
480
|
+
var initialValues = _objectSpread$2(_objectSpread$2({}, apiKey), {}, {
|
|
471
481
|
hasNoExpiry: isNotPresent(apiKey.expiresAt)
|
|
472
482
|
});
|
|
473
|
-
return /*#__PURE__*/
|
|
483
|
+
return /*#__PURE__*/jsxs(Pane, {
|
|
474
484
|
initialFocusRef: initialFocusRef,
|
|
475
485
|
onClose: onClose,
|
|
476
|
-
isOpen: isNotEmpty(apiKey)
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
+
isOpen: isNotEmpty(apiKey),
|
|
487
|
+
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
488
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
489
|
+
style: "h2",
|
|
490
|
+
children: t("neetoApiKeys.headers.updateApiKey")
|
|
491
|
+
})
|
|
492
|
+
}), /*#__PURE__*/jsx(Form, {
|
|
493
|
+
initialFocusRef: initialFocusRef,
|
|
494
|
+
initialValues: initialValues,
|
|
495
|
+
onClose: onClose,
|
|
496
|
+
isSubmitting: isUpdating,
|
|
497
|
+
onSubmit: handleUpdate
|
|
498
|
+
})]
|
|
499
|
+
});
|
|
486
500
|
};
|
|
487
501
|
|
|
488
502
|
var getPageFromSearchParams = function getPageFromSearchParams() {
|
|
@@ -537,6 +551,8 @@ var usePagination = function usePagination(_ref) {
|
|
|
537
551
|
};
|
|
538
552
|
};
|
|
539
553
|
|
|
554
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
555
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
540
556
|
var Table = function Table(_ref) {
|
|
541
557
|
var handleDelete = _ref.handleDelete,
|
|
542
558
|
handleEdit = _ref.handleEdit,
|
|
@@ -559,50 +575,51 @@ var Table = function Table(_ref) {
|
|
|
559
575
|
pageSize: DEFAULT_PAGE_SIZE
|
|
560
576
|
};
|
|
561
577
|
var _useFetchApiKeys = useFetchApiKeys({
|
|
562
|
-
params: queryParams
|
|
563
|
-
options: {
|
|
564
|
-
onSuccess: onFetchSuccess
|
|
565
|
-
}
|
|
578
|
+
params: queryParams
|
|
566
579
|
}),
|
|
567
|
-
|
|
568
|
-
_useFetchApiKeys$data2 = _useFetchApiKeys$data === void 0 ? {} : _useFetchApiKeys$data,
|
|
569
|
-
_useFetchApiKeys$data3 = _useFetchApiKeys$data2.apiKeys,
|
|
570
|
-
apiKeys = _useFetchApiKeys$data3 === void 0 ? [] : _useFetchApiKeys$data3,
|
|
571
|
-
totalCount = _useFetchApiKeys$data2.totalCount,
|
|
580
|
+
data = _useFetchApiKeys.data,
|
|
572
581
|
isLoading = _useFetchApiKeys.isLoading,
|
|
573
582
|
isFetching = _useFetchApiKeys.isFetching;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
+
useEffect(function () {
|
|
584
|
+
if (!data) return;
|
|
585
|
+
onFetchSuccess(data);
|
|
586
|
+
}, [data]);
|
|
587
|
+
if (isLoading) return /*#__PURE__*/jsx(PageLoader, {});
|
|
588
|
+
if (isEmpty(data === null || data === void 0 ? void 0 : data.apiKeys)) {
|
|
589
|
+
return /*#__PURE__*/jsxs("div", {
|
|
590
|
+
className: "flex h-full w-full items-center justify-center",
|
|
591
|
+
children: [/*#__PURE__*/jsx(NoData, _objectSpread$1({
|
|
592
|
+
className: "w-full",
|
|
593
|
+
title: t("neetoApiKeys.noData.title"),
|
|
594
|
+
primaryButtonProps: {
|
|
595
|
+
label: t("neetoApiKeys.buttons.addApiKey"),
|
|
596
|
+
onClick: function onClick() {
|
|
597
|
+
return setIsCreatePaneOpen(true);
|
|
598
|
+
}
|
|
583
599
|
}
|
|
584
|
-
},
|
|
585
|
-
|
|
586
|
-
title: t("neetoApiKeys.noData.title")
|
|
587
|
-
}, noDataProps)), ";");
|
|
600
|
+
}, noDataProps)), ";"]
|
|
601
|
+
});
|
|
588
602
|
}
|
|
589
|
-
return /*#__PURE__*/
|
|
590
|
-
hasPagination: totalCount > DEFAULT_PAGE_SIZE
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
603
|
+
return /*#__PURE__*/jsx(TableWrapper, {
|
|
604
|
+
hasPagination: (data === null || data === void 0 ? void 0 : data.totalCount) > DEFAULT_PAGE_SIZE,
|
|
605
|
+
children: /*#__PURE__*/jsx(NeetoUITable, {
|
|
606
|
+
handlePageChange: handlePageChange,
|
|
607
|
+
fixedHeight: true,
|
|
608
|
+
columnData: buildColumnData({
|
|
609
|
+
handleDelete: handleDelete,
|
|
610
|
+
handleEdit: handleEdit
|
|
611
|
+
}),
|
|
612
|
+
currentPageNumber: currentPage,
|
|
613
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
614
|
+
loading: isFetching,
|
|
615
|
+
rowData: data === null || data === void 0 ? void 0 : data.apiKeys,
|
|
616
|
+
totalCount: data === null || data === void 0 ? void 0 : data.totalCount
|
|
617
|
+
})
|
|
618
|
+
});
|
|
604
619
|
};
|
|
605
620
|
|
|
621
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
622
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
606
623
|
var ApiKeys = function ApiKeys(_ref) {
|
|
607
624
|
var noDataProps = _ref.noDataProps,
|
|
608
625
|
headerProps = _ref.headerProps;
|
|
@@ -627,57 +644,58 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
627
644
|
return setApiKeyToBeDeleted({});
|
|
628
645
|
}),
|
|
629
646
|
deleteApiKey = _useDeleteApiKey.mutate,
|
|
630
|
-
isDeleting = _useDeleteApiKey.
|
|
631
|
-
return /*#__PURE__*/
|
|
632
|
-
className: "flex h-full w-full flex-col"
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
647
|
+
isDeleting = _useDeleteApiKey.isPending;
|
|
648
|
+
return /*#__PURE__*/jsxs("div", {
|
|
649
|
+
className: "flex h-full w-full flex-col",
|
|
650
|
+
children: [/*#__PURE__*/jsx(Header, _objectSpread({
|
|
651
|
+
title: t("neetoApiKeys.common.apiKey", PLURAL),
|
|
652
|
+
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
653
|
+
label: t("neetoApiKeys.buttons.addApiKey"),
|
|
654
|
+
onClick: function onClick() {
|
|
655
|
+
return setIsCreatePaneOpen(true);
|
|
656
|
+
}
|
|
657
|
+
}),
|
|
658
|
+
searchProps: {
|
|
659
|
+
placeholder: t("neetoApiKeys.placeholders.search")
|
|
639
660
|
}
|
|
640
|
-
}),
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
661
|
+
}, headerProps)), /*#__PURE__*/jsx(Table, {
|
|
662
|
+
noDataProps: noDataProps,
|
|
663
|
+
searchTerm: searchTerm,
|
|
664
|
+
setIsCreatePaneOpen: setIsCreatePaneOpen,
|
|
665
|
+
handleDelete: setApiKeyToBeDeleted,
|
|
666
|
+
handleEdit: setApiKeyToBeEdited
|
|
667
|
+
}), /*#__PURE__*/jsx(Alert, {
|
|
668
|
+
isOpen: isNotEmpty(apiKeyToBeDeleted),
|
|
669
|
+
isSubmitting: isDeleting,
|
|
670
|
+
submitButtonLabel: t("neetoApiKeys.buttons.delete"),
|
|
671
|
+
title: t("neetoApiKeys.alert.titles.deleteApiKey"),
|
|
672
|
+
message: /*#__PURE__*/jsx(Trans, {
|
|
673
|
+
components: {
|
|
674
|
+
bold: /*#__PURE__*/jsx("strong", {})
|
|
675
|
+
},
|
|
676
|
+
i18nKey: "neetoApiKeys.alert.descriptions.deleteApiKey",
|
|
677
|
+
values: {
|
|
678
|
+
name: apiKeyToBeDeleted.label
|
|
679
|
+
}
|
|
680
|
+
}),
|
|
681
|
+
onClose: function onClose() {
|
|
682
|
+
return setApiKeyToBeDeleted({});
|
|
658
683
|
},
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
name: apiKeyToBeDeleted.label
|
|
684
|
+
onSubmit: function onSubmit() {
|
|
685
|
+
return deleteApiKey(apiKeyToBeDeleted.id);
|
|
662
686
|
}
|
|
663
|
-
}),
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}), /*#__PURE__*/React.createElement(Update, {
|
|
676
|
-
apiKey: apiKeyToBeEdited,
|
|
677
|
-
onClose: function onClose() {
|
|
678
|
-
return setApiKeyToBeEdited({});
|
|
679
|
-
}
|
|
680
|
-
}));
|
|
687
|
+
}), /*#__PURE__*/jsx(Create, {
|
|
688
|
+
isOpen: isCreatePaneOpen,
|
|
689
|
+
onClose: function onClose() {
|
|
690
|
+
return setIsCreatePaneOpen(false);
|
|
691
|
+
}
|
|
692
|
+
}), /*#__PURE__*/jsx(Update, {
|
|
693
|
+
apiKey: apiKeyToBeEdited,
|
|
694
|
+
onClose: function onClose() {
|
|
695
|
+
return setApiKeyToBeEdited({});
|
|
696
|
+
}
|
|
697
|
+
})]
|
|
698
|
+
});
|
|
681
699
|
};
|
|
682
700
|
var index = withTitle(ApiKeys, t("neetoApiKeys.common.apiKey", PLURAL));
|
|
683
701
|
|