@bigbinary/neeto-api-keys-frontend 1.0.1 → 1.0.3
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 +2 -0
- package/dist/index.cjs.js +234 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +236 -51
- package/dist/index.js.map +1 -1
- package/package.json +34 -31
- package/types.d.ts +17 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, { createElement, isValidElement, cloneElement, createContext, useContext,
|
|
1
|
+
import React, { createElement, isValidElement, cloneElement, createContext, useContext, useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
3
3
|
import { isPresent, isNotPresent, isNotEmpty } from '@bigbinary/neeto-commons-frontend/pure';
|
|
4
|
-
import { useMutationWithInvalidation,
|
|
5
|
-
import Container from '@bigbinary/neeto-molecules/Container';
|
|
4
|
+
import { useMutationWithInvalidation, useDebounce, withTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
5
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
7
6
|
import { Dropdown, Typography, Button, Tag, DatePicker as DatePicker$1, Pane, NoData, Table as Table$1, Alert } from '@bigbinary/neetoui';
|
|
8
7
|
import { useQuery } from 'react-query';
|
|
@@ -2337,6 +2336,62 @@ function warnOnce() {
|
|
|
2337
2336
|
if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
|
|
2338
2337
|
warn(...args);
|
|
2339
2338
|
}
|
|
2339
|
+
const loadedClb = (i18n, cb) => () => {
|
|
2340
|
+
if (i18n.isInitialized) {
|
|
2341
|
+
cb();
|
|
2342
|
+
} else {
|
|
2343
|
+
const initialized = () => {
|
|
2344
|
+
setTimeout(() => {
|
|
2345
|
+
i18n.off('initialized', initialized);
|
|
2346
|
+
}, 0);
|
|
2347
|
+
cb();
|
|
2348
|
+
};
|
|
2349
|
+
i18n.on('initialized', initialized);
|
|
2350
|
+
}
|
|
2351
|
+
};
|
|
2352
|
+
function loadNamespaces(i18n, ns, cb) {
|
|
2353
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
2354
|
+
}
|
|
2355
|
+
function loadLanguages(i18n, lng, ns, cb) {
|
|
2356
|
+
if (typeof ns === 'string') ns = [ns];
|
|
2357
|
+
ns.forEach(n => {
|
|
2358
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
2359
|
+
});
|
|
2360
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
2361
|
+
}
|
|
2362
|
+
function oldI18nextHasLoadedNamespace(ns, i18n) {
|
|
2363
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2364
|
+
const lng = i18n.languages[0];
|
|
2365
|
+
const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
|
|
2366
|
+
const lastLng = i18n.languages[i18n.languages.length - 1];
|
|
2367
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
2368
|
+
const loadNotPending = (l, n) => {
|
|
2369
|
+
const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
|
|
2370
|
+
return loadState === -1 || loadState === 2;
|
|
2371
|
+
};
|
|
2372
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
|
|
2373
|
+
if (i18n.hasResourceBundle(lng, ns)) return true;
|
|
2374
|
+
if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
|
|
2375
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
2376
|
+
return false;
|
|
2377
|
+
}
|
|
2378
|
+
function hasLoadedNamespace(ns, i18n) {
|
|
2379
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2380
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
2381
|
+
warnOnce('i18n.languages were undefined or empty', i18n.languages);
|
|
2382
|
+
return true;
|
|
2383
|
+
}
|
|
2384
|
+
const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
|
|
2385
|
+
if (!isNewerI18next) {
|
|
2386
|
+
return oldI18nextHasLoadedNamespace(ns, i18n, options);
|
|
2387
|
+
}
|
|
2388
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
2389
|
+
lng: options.lng,
|
|
2390
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
2391
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2340
2395
|
|
|
2341
2396
|
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
2342
2397
|
const htmlEntities = {
|
|
@@ -2640,6 +2695,19 @@ const initReactI18next = {
|
|
|
2640
2695
|
};
|
|
2641
2696
|
|
|
2642
2697
|
const I18nContext = createContext();
|
|
2698
|
+
class ReportNamespaces {
|
|
2699
|
+
constructor() {
|
|
2700
|
+
this.usedNamespaces = {};
|
|
2701
|
+
}
|
|
2702
|
+
addUsedNamespaces(namespaces) {
|
|
2703
|
+
namespaces.forEach(ns => {
|
|
2704
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
getUsedNamespaces() {
|
|
2708
|
+
return Object.keys(this.usedNamespaces);
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2643
2711
|
|
|
2644
2712
|
function Trans(_ref) {
|
|
2645
2713
|
let {
|
|
@@ -2682,6 +2750,112 @@ function Trans(_ref) {
|
|
|
2682
2750
|
});
|
|
2683
2751
|
}
|
|
2684
2752
|
|
|
2753
|
+
const usePrevious = (value, ignore) => {
|
|
2754
|
+
const ref = useRef();
|
|
2755
|
+
useEffect(() => {
|
|
2756
|
+
ref.current = ignore ? ref.current : value;
|
|
2757
|
+
}, [value, ignore]);
|
|
2758
|
+
return ref.current;
|
|
2759
|
+
};
|
|
2760
|
+
function useTranslation(ns) {
|
|
2761
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2762
|
+
const {
|
|
2763
|
+
i18n: i18nFromProps
|
|
2764
|
+
} = props;
|
|
2765
|
+
const {
|
|
2766
|
+
i18n: i18nFromContext,
|
|
2767
|
+
defaultNS: defaultNSFromContext
|
|
2768
|
+
} = useContext(I18nContext) || {};
|
|
2769
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2770
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
2771
|
+
if (!i18n) {
|
|
2772
|
+
warnOnce('You will need to pass in an i18next instance by using initReactI18next');
|
|
2773
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
2774
|
+
if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
|
|
2775
|
+
if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
|
|
2776
|
+
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
2777
|
+
};
|
|
2778
|
+
const retNotReady = [notReadyT, {}, false];
|
|
2779
|
+
retNotReady.t = notReadyT;
|
|
2780
|
+
retNotReady.i18n = {};
|
|
2781
|
+
retNotReady.ready = false;
|
|
2782
|
+
return retNotReady;
|
|
2783
|
+
}
|
|
2784
|
+
if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
|
|
2785
|
+
const i18nOptions = {
|
|
2786
|
+
...getDefaults(),
|
|
2787
|
+
...i18n.options.react,
|
|
2788
|
+
...props
|
|
2789
|
+
};
|
|
2790
|
+
const {
|
|
2791
|
+
useSuspense,
|
|
2792
|
+
keyPrefix
|
|
2793
|
+
} = i18nOptions;
|
|
2794
|
+
let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
|
|
2795
|
+
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
2796
|
+
if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
|
|
2797
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
2798
|
+
function getT() {
|
|
2799
|
+
return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
2800
|
+
}
|
|
2801
|
+
const [t, setT] = useState(getT);
|
|
2802
|
+
let joinedNS = namespaces.join();
|
|
2803
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
2804
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
2805
|
+
const isMounted = useRef(true);
|
|
2806
|
+
useEffect(() => {
|
|
2807
|
+
const {
|
|
2808
|
+
bindI18n,
|
|
2809
|
+
bindI18nStore
|
|
2810
|
+
} = i18nOptions;
|
|
2811
|
+
isMounted.current = true;
|
|
2812
|
+
if (!ready && !useSuspense) {
|
|
2813
|
+
if (props.lng) {
|
|
2814
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
2815
|
+
if (isMounted.current) setT(getT);
|
|
2816
|
+
});
|
|
2817
|
+
} else {
|
|
2818
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
2819
|
+
if (isMounted.current) setT(getT);
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
2824
|
+
setT(getT);
|
|
2825
|
+
}
|
|
2826
|
+
function boundReset() {
|
|
2827
|
+
if (isMounted.current) setT(getT);
|
|
2828
|
+
}
|
|
2829
|
+
if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
|
|
2830
|
+
if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
|
|
2831
|
+
return () => {
|
|
2832
|
+
isMounted.current = false;
|
|
2833
|
+
if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
|
|
2834
|
+
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
2835
|
+
};
|
|
2836
|
+
}, [i18n, joinedNS]);
|
|
2837
|
+
const isInitial = useRef(true);
|
|
2838
|
+
useEffect(() => {
|
|
2839
|
+
if (isMounted.current && !isInitial.current) {
|
|
2840
|
+
setT(getT);
|
|
2841
|
+
}
|
|
2842
|
+
isInitial.current = false;
|
|
2843
|
+
}, [i18n, keyPrefix]);
|
|
2844
|
+
const ret = [t, i18n, ready];
|
|
2845
|
+
ret.t = t;
|
|
2846
|
+
ret.i18n = i18n;
|
|
2847
|
+
ret.ready = ready;
|
|
2848
|
+
if (ready) return ret;
|
|
2849
|
+
if (!ready && !useSuspense) return ret;
|
|
2850
|
+
throw new Promise(resolve => {
|
|
2851
|
+
if (props.lng) {
|
|
2852
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
2853
|
+
} else {
|
|
2854
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
2855
|
+
}
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2685
2859
|
var common = {
|
|
2686
2860
|
apiKey_one: "API key",
|
|
2687
2861
|
apiKey_other: "API keys",
|
|
@@ -2766,6 +2940,21 @@ instance.use(initReactI18next).init({
|
|
|
2766
2940
|
fallbackLng: "en"
|
|
2767
2941
|
});
|
|
2768
2942
|
|
|
2943
|
+
function _extends() {
|
|
2944
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
2945
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2946
|
+
var source = arguments[i];
|
|
2947
|
+
for (var key in source) {
|
|
2948
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2949
|
+
target[key] = source[key];
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
return target;
|
|
2954
|
+
};
|
|
2955
|
+
return _extends.apply(this, arguments);
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2769
2958
|
function _arrayWithHoles(arr) {
|
|
2770
2959
|
if (Array.isArray(arr)) return arr;
|
|
2771
2960
|
}
|
|
@@ -2887,21 +3076,6 @@ var useDeleteApiKey = function useDeleteApiKey(onSuccess) {
|
|
|
2887
3076
|
});
|
|
2888
3077
|
};
|
|
2889
3078
|
|
|
2890
|
-
function _extends() {
|
|
2891
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
2892
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2893
|
-
var source = arguments[i];
|
|
2894
|
-
for (var key in source) {
|
|
2895
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2896
|
-
target[key] = source[key];
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
}
|
|
2900
|
-
return target;
|
|
2901
|
-
};
|
|
2902
|
-
return _extends.apply(this, arguments);
|
|
2903
|
-
}
|
|
2904
|
-
|
|
2905
3079
|
var dayjs_min = {exports: {}};
|
|
2906
3080
|
|
|
2907
3081
|
dayjs_min.exports;
|
|
@@ -2915,10 +3089,11 @@ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
|
2915
3089
|
|
|
2916
3090
|
var Menu = Dropdown.Menu,
|
|
2917
3091
|
MenuItem = Dropdown.MenuItem;
|
|
2918
|
-
var ActionDropdown =
|
|
2919
|
-
var
|
|
2920
|
-
handleEdit = _ref.handleEdit,
|
|
3092
|
+
var ActionDropdown = function ActionDropdown(_ref) {
|
|
3093
|
+
var handleEdit = _ref.handleEdit,
|
|
2921
3094
|
handleDelete = _ref.handleDelete;
|
|
3095
|
+
var _useTranslation = useTranslation(),
|
|
3096
|
+
t = _useTranslation.t;
|
|
2922
3097
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
2923
3098
|
buttonStyle: "text",
|
|
2924
3099
|
icon: MenuHorizontal,
|
|
@@ -2929,7 +3104,7 @@ var ActionDropdown = withT(function (_ref) {
|
|
|
2929
3104
|
style: "danger",
|
|
2930
3105
|
onClick: handleDelete
|
|
2931
3106
|
}, t("buttons.delete"))));
|
|
2932
|
-
}
|
|
3107
|
+
};
|
|
2933
3108
|
|
|
2934
3109
|
var isInPast = function isInPast(date) {
|
|
2935
3110
|
return dayjs(date).isBefore(dayjs());
|
|
@@ -3081,14 +3256,15 @@ var VALIDATION_SCHEMA = yup.object({
|
|
|
3081
3256
|
});
|
|
3082
3257
|
var DEFAULT_PAGE_SIZE = 15;
|
|
3083
3258
|
|
|
3084
|
-
var Form =
|
|
3085
|
-
var
|
|
3086
|
-
_ref$initialValues = _ref.initialValues,
|
|
3259
|
+
var Form = function Form(_ref) {
|
|
3260
|
+
var _ref$initialValues = _ref.initialValues,
|
|
3087
3261
|
initialValues = _ref$initialValues === void 0 ? INITIAL_VALUES : _ref$initialValues,
|
|
3088
3262
|
isSubmitting = _ref.isSubmitting,
|
|
3089
3263
|
onClose = _ref.onClose,
|
|
3090
3264
|
onSubmit = _ref.onSubmit,
|
|
3091
3265
|
initialFocusRef = _ref.initialFocusRef;
|
|
3266
|
+
var _useTranslation = useTranslation(),
|
|
3267
|
+
t = _useTranslation.t;
|
|
3092
3268
|
return /*#__PURE__*/React.createElement(Form$1, {
|
|
3093
3269
|
formikProps: {
|
|
3094
3270
|
validationSchema: VALIDATION_SCHEMA,
|
|
@@ -3142,16 +3318,17 @@ var Form = withT(function (_ref) {
|
|
|
3142
3318
|
}
|
|
3143
3319
|
})));
|
|
3144
3320
|
});
|
|
3145
|
-
}
|
|
3321
|
+
};
|
|
3146
3322
|
|
|
3147
|
-
var Create =
|
|
3148
|
-
var
|
|
3149
|
-
onClose = _ref.onClose,
|
|
3323
|
+
var Create = function Create(_ref) {
|
|
3324
|
+
var onClose = _ref.onClose,
|
|
3150
3325
|
isOpen = _ref.isOpen;
|
|
3151
3326
|
var initialFocusRef = useRef(null);
|
|
3152
3327
|
var _useCreateApiKey = useCreateApiKey(onClose),
|
|
3153
3328
|
createApiKey = _useCreateApiKey.mutate,
|
|
3154
3329
|
isCreating = _useCreateApiKey.isLoading;
|
|
3330
|
+
var _useTranslation = useTranslation(),
|
|
3331
|
+
t = _useTranslation.t;
|
|
3155
3332
|
return /*#__PURE__*/React.createElement(Pane, {
|
|
3156
3333
|
initialFocusRef: initialFocusRef,
|
|
3157
3334
|
onClose: onClose,
|
|
@@ -3164,7 +3341,7 @@ var Create = withT(function (_ref) {
|
|
|
3164
3341
|
isSubmitting: isCreating,
|
|
3165
3342
|
onSubmit: createApiKey
|
|
3166
3343
|
}));
|
|
3167
|
-
}
|
|
3344
|
+
};
|
|
3168
3345
|
|
|
3169
3346
|
function _typeof(obj) {
|
|
3170
3347
|
"@babel/helpers - typeof";
|
|
@@ -3209,14 +3386,15 @@ function _defineProperty(obj, key, value) {
|
|
|
3209
3386
|
|
|
3210
3387
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3211
3388
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3212
|
-
var Update =
|
|
3213
|
-
var
|
|
3214
|
-
onClose = _ref.onClose,
|
|
3389
|
+
var Update = function Update(_ref) {
|
|
3390
|
+
var onClose = _ref.onClose,
|
|
3215
3391
|
apiKey = _ref.apiKey;
|
|
3216
3392
|
var initialFocusRef = useRef(null);
|
|
3217
3393
|
var _useUpdateApiKey = useUpdateApiKey(onClose),
|
|
3218
3394
|
updateApiKey = _useUpdateApiKey.mutate,
|
|
3219
3395
|
isUpdating = _useUpdateApiKey.isLoading;
|
|
3396
|
+
var _useTranslation = useTranslation(),
|
|
3397
|
+
t = _useTranslation.t;
|
|
3220
3398
|
var handleUpdate = function handleUpdate(values) {
|
|
3221
3399
|
updateApiKey({
|
|
3222
3400
|
id: apiKey.id,
|
|
@@ -3239,7 +3417,7 @@ var Update = withT(function (_ref) {
|
|
|
3239
3417
|
isSubmitting: isUpdating,
|
|
3240
3418
|
onSubmit: handleUpdate
|
|
3241
3419
|
}));
|
|
3242
|
-
}
|
|
3420
|
+
};
|
|
3243
3421
|
|
|
3244
3422
|
var getPageFromSearchParams = function getPageFromSearchParams() {
|
|
3245
3423
|
var _getQueryParams = getQueryParams(),
|
|
@@ -3293,12 +3471,15 @@ var usePagination = function usePagination(_ref) {
|
|
|
3293
3471
|
};
|
|
3294
3472
|
};
|
|
3295
3473
|
|
|
3296
|
-
var Table =
|
|
3297
|
-
var
|
|
3298
|
-
handleDelete = _ref.handleDelete,
|
|
3474
|
+
var Table = function Table(_ref) {
|
|
3475
|
+
var handleDelete = _ref.handleDelete,
|
|
3299
3476
|
handleEdit = _ref.handleEdit,
|
|
3300
|
-
searchTerm = _ref.searchTerm
|
|
3477
|
+
searchTerm = _ref.searchTerm,
|
|
3478
|
+
_ref$noDataProps = _ref.noDataProps,
|
|
3479
|
+
noDataProps = _ref$noDataProps === void 0 ? {} : _ref$noDataProps;
|
|
3301
3480
|
var debouncedSearchTerm = useDebounce(searchTerm);
|
|
3481
|
+
var _useTranslation = useTranslation(),
|
|
3482
|
+
t = _useTranslation.t;
|
|
3302
3483
|
var _usePagination = usePagination({
|
|
3303
3484
|
searchTerm: debouncedSearchTerm
|
|
3304
3485
|
}),
|
|
@@ -3327,10 +3508,10 @@ var Table = withT(function (_ref) {
|
|
|
3327
3508
|
if (isEmpty(apiKeys)) {
|
|
3328
3509
|
return /*#__PURE__*/React.createElement("div", {
|
|
3329
3510
|
className: "flex h-full w-full items-center justify-center"
|
|
3330
|
-
}, /*#__PURE__*/React.createElement(NoData, {
|
|
3511
|
+
}, /*#__PURE__*/React.createElement(NoData, _extends({
|
|
3331
3512
|
className: "w-full",
|
|
3332
3513
|
title: t("noData.title")
|
|
3333
|
-
}), ";");
|
|
3514
|
+
}, noDataProps)), ";");
|
|
3334
3515
|
}
|
|
3335
3516
|
return /*#__PURE__*/React.createElement(TableWrapper, {
|
|
3336
3517
|
hasPagination: totalCount > DEFAULT_PAGE_SIZE
|
|
@@ -3347,12 +3528,11 @@ var Table = withT(function (_ref) {
|
|
|
3347
3528
|
rowData: apiKeys,
|
|
3348
3529
|
totalCount: totalCount
|
|
3349
3530
|
}));
|
|
3350
|
-
}
|
|
3531
|
+
};
|
|
3351
3532
|
|
|
3352
|
-
var ApiKeys =
|
|
3353
|
-
var
|
|
3354
|
-
|
|
3355
|
-
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs;
|
|
3533
|
+
var ApiKeys = function ApiKeys(_ref) {
|
|
3534
|
+
var noDataProps = _ref.noDataProps,
|
|
3535
|
+
headerProps = _ref.headerProps;
|
|
3356
3536
|
var _useState = useState(""),
|
|
3357
3537
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3358
3538
|
searchTerm = _useState2[0],
|
|
@@ -3369,13 +3549,16 @@ var ApiKeys = withT(function (_ref) {
|
|
|
3369
3549
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3370
3550
|
isCreatePaneOpen = _useState8[0],
|
|
3371
3551
|
setIsCreatePaneOpen = _useState8[1];
|
|
3552
|
+
var _useTranslation = useTranslation(),
|
|
3553
|
+
t = _useTranslation.t;
|
|
3372
3554
|
var _useDeleteApiKey = useDeleteApiKey(function () {
|
|
3373
3555
|
return setApiKeyToBeDeleted({});
|
|
3374
3556
|
}),
|
|
3375
3557
|
deleteApiKey = _useDeleteApiKey.mutate,
|
|
3376
3558
|
isDeleting = _useDeleteApiKey.isLoading;
|
|
3377
|
-
return /*#__PURE__*/React.createElement(
|
|
3378
|
-
|
|
3559
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3560
|
+
className: "flex h-full w-full flex-col"
|
|
3561
|
+
}, /*#__PURE__*/React.createElement(Header, _extends({
|
|
3379
3562
|
title: t("common.apiKey", PLURAL),
|
|
3380
3563
|
actionBlock: /*#__PURE__*/React.createElement(Button, {
|
|
3381
3564
|
label: t("buttons.addApiKey"),
|
|
@@ -3391,10 +3574,11 @@ var ApiKeys = withT(function (_ref) {
|
|
|
3391
3574
|
},
|
|
3392
3575
|
placeholder: t("placeholders.search")
|
|
3393
3576
|
}
|
|
3394
|
-
}), /*#__PURE__*/React.createElement(Table, {
|
|
3577
|
+
}, headerProps)), /*#__PURE__*/React.createElement(Table, {
|
|
3395
3578
|
handleDelete: setApiKeyToBeDeleted,
|
|
3396
3579
|
handleEdit: setApiKeyToBeEdited,
|
|
3397
|
-
searchTerm: searchTerm
|
|
3580
|
+
searchTerm: searchTerm,
|
|
3581
|
+
noDataProps: noDataProps
|
|
3398
3582
|
}), /*#__PURE__*/React.createElement(Alert, {
|
|
3399
3583
|
isOpen: isNotEmpty(apiKeyToBeDeleted),
|
|
3400
3584
|
isSubmitting: isDeleting,
|
|
@@ -3426,7 +3610,8 @@ var ApiKeys = withT(function (_ref) {
|
|
|
3426
3610
|
return setApiKeyToBeEdited({});
|
|
3427
3611
|
}
|
|
3428
3612
|
}));
|
|
3429
|
-
}
|
|
3613
|
+
};
|
|
3614
|
+
var index = withTitle(ApiKeys, t$1("common.apiKey", PLURAL));
|
|
3430
3615
|
|
|
3431
|
-
export { ApiKeys };
|
|
3616
|
+
export { index as ApiKeys };
|
|
3432
3617
|
//# sourceMappingURL=index.js.map
|