diff --git a/.eslintignore b/.eslintignore index f51734dec..13cf14920 100755 --- a/.eslintignore +++ b/.eslintignore @@ -36,7 +36,6 @@ src/Common/Dialogs/ForceDeleteDialog.tsx src/Common/DraggableWrapper/DraggableButton.tsx src/Common/DraggableWrapper/DraggableWrapper.tsx src/Common/Drawer/Drawer.tsx -src/Common/EmptyState/EmptyState.tsx src/Common/EmptyState/GenericEmptyState.tsx src/Common/Error.tsx src/Common/ErrorScreenNotFound.tsx diff --git a/src/Common/Api.ts b/src/Common/Api.ts index 752c79cee..44dca8ccf 100644 --- a/src/Common/Api.ts +++ b/src/Common/Api.ts @@ -1,7 +1,7 @@ +import { MutableRefObject } from 'react' import { ServerErrors } from './ServerError' import { FALLBACK_REQUEST_TIMEOUT, Host, URLS } from './Constants' import { ResponseType, APIOptions } from './Types' -import { MutableRefObject } from 'react' const responseMessages = { 100: 'Continue', @@ -76,9 +76,7 @@ const responseMessages = { function handleLogout() { const continueParam = `${window.location.pathname.replace(window.__BASE_URL__, '')}${window.location.search}` - window.location.href = `${window.location.origin}${window.__BASE_URL__}${ - URLS.LOGIN_SSO - }?continue=${continueParam}` + window.location.href = `${window.location.origin}${window.__BASE_URL__}${URLS.LOGIN_SSO}?continue=${continueParam}` } async function handleServerError(contentType, response) { @@ -225,14 +223,13 @@ export const put = (url: string, data: object, options?: APIOptions): Promise => fetchInTime(url, 'GET', null, options) -export const trash = (url: string, data?: object, options?: APIOptions): Promise => { - return fetchInTime(url, 'DELETE', data, options) -} +export const trash = (url: string, data?: object, options?: APIOptions): Promise => + fetchInTime(url, 'DELETE', data, options) /** * Aborts the previous request before triggering next request */ -export const abortPreviousRequests = ( +export const abortPreviousRequests = ( callback: () => Promise, abortControllerRef: MutableRefObject, ): Promise => { diff --git a/src/Common/Helper.tsx b/src/Common/Helper.tsx index fb241a033..45e636b56 100644 --- a/src/Common/Helper.tsx +++ b/src/Common/Helper.tsx @@ -585,19 +585,19 @@ export const customStyles = { }), } -export const getFilteredChartVersions = (charts, selectedChartType) => { - // Filter chart versions based on selected chart type - return charts - .filter((item) => item?.chartType === selectedChartType.value) - .map((item) => ({ - value: item?.chartVersion, - label: item?.chartVersion, - chartRefId: item.chartRefId, - })) -} +export const getFilteredChartVersions = (charts, selectedChartType) => + // Filter chart versions based on selected chart type + charts + .filter((item) => item?.chartType === selectedChartType.value) + .map((item) => ({ + value: item?.chartVersion, + label: item?.chartVersion, + chartRefId: item.chartRefId, + })) + function removeEmptyObjectKeysAndNullValues(obj, originaljsonCopy) { // It recursively removes empty object keys and empty array keys - for (let key in obj) { + for (const key in obj) { if (Array.isArray(obj[key])) { // Check if the array is empty if (obj[key].length !== 0) { @@ -629,18 +629,18 @@ export function getUnlockedJSON(json, jsonPathArray, removeParentKeysAndEmptyArr const jsonCopy = JSON.parse(JSON.stringify(json)) const originaljsonCopy = JSON.parse(JSON.stringify(json)) - let removedPatches = [] - let patches = jsonPathArray.flatMap((jsonPath) => { + const removedPatches = [] + const patches = jsonPathArray.flatMap((jsonPath) => { const pathsToRemove = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' }) - //reversing patches to handle correct array index deletion + // reversing patches to handle correct array index deletion pathsToRemove.reverse() return pathsToRemove.map((result) => { - //storing removed patches to have functionality of undo + // storing removed patches to have functionality of undo removedPatches.push({ op: 'add', path: result.pointer, value: result.value }) return { op: 'remove', path: result.pointer } }) }) - let newDocument = jsonpatch.applyPatch(jsonCopy, patches).newDocument + const { newDocument } = jsonpatch.applyPatch(jsonCopy, patches) if (removeParentKeysAndEmptyArrays) removeEmptyObjectKeysAndNullValues(newDocument, originaljsonCopy) return { newDocument, removedPatches: removedPatches.reverse() } } diff --git a/src/Common/RJSF/utils.ts b/src/Common/RJSF/utils.ts index 8788670ba..608976bdc 100644 --- a/src/Common/RJSF/utils.ts +++ b/src/Common/RJSF/utils.ts @@ -13,65 +13,61 @@ export const translateString = (stringToTranslate: TranslatableString, params?: } } -export const getCommonSelectStyle = (styleOverrides = {}) => { - return { - menuList: (base) => ({ - ...base, - paddingTop: 0, - paddingBottom: 0, - cursor: 'pointer', - }), - control: (base, state) => ({ - ...base, - minHeight: '32px', - boxShadow: 'none', - backgroundColor: 'var(--N50)', - border: state.isFocused ? '1px solid var(--B500)' : '1px solid var(--N200)', - cursor: 'pointer', - }), - option: (base, state) => ({ - ...base, - color: 'var(--N900)', - backgroundColor: state.isFocused ? 'var(--N100)' : 'white', - padding: '10px 12px', - cursor: 'pointer', - }), - dropdownIndicator: (base, state) => ({ - ...base, - color: 'var(--N400)', - padding: '0 8px', - transition: 'all .2s ease', - transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)', - }), - valueContainer: (base, state) => ({ - ...base, - padding: '0 8px', - fontWeight: '400', - color: state.selectProps.menuIsOpen ? 'var(--N500)' : base.color, - }), - loadingMessage: (base) => ({ - ...base, - color: 'var(--N600)', - }), - noOptionsMessage: (base) => ({ - ...base, - color: 'var(--N600)', - }), - multiValue: (base, state) => { - return { - ...base, - border: `1px solid var(--N200)`, - borderRadius: `4px`, - background: 'white', - height: '28px', - marginRight: '8px', - padding: '2px', - fontSize: '12px', - } - }, - ...styleOverrides, - } -} +export const getCommonSelectStyle = (styleOverrides = {}) => ({ + menuList: (base) => ({ + ...base, + paddingTop: 0, + paddingBottom: 0, + cursor: 'pointer', + }), + control: (base, state) => ({ + ...base, + minHeight: '32px', + boxShadow: 'none', + backgroundColor: 'var(--N50)', + border: state.isFocused ? '1px solid var(--B500)' : '1px solid var(--N200)', + cursor: 'pointer', + }), + option: (base, state) => ({ + ...base, + color: 'var(--N900)', + backgroundColor: state.isFocused ? 'var(--N100)' : 'white', + padding: '10px 12px', + cursor: 'pointer', + }), + dropdownIndicator: (base, state) => ({ + ...base, + color: 'var(--N400)', + padding: '0 8px', + transition: 'all .2s ease', + transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)', + }), + valueContainer: (base, state) => ({ + ...base, + padding: '0 8px', + fontWeight: '400', + color: state.selectProps.menuIsOpen ? 'var(--N500)' : base.color, + }), + loadingMessage: (base) => ({ + ...base, + color: 'var(--N600)', + }), + noOptionsMessage: (base) => ({ + ...base, + color: 'var(--N600)', + }), + multiValue: (base, state) => ({ + ...base, + border: `1px solid var(--N200)`, + borderRadius: `4px`, + background: 'white', + height: '28px', + marginRight: '8px', + padding: '2px', + fontSize: '12px', + }), + ...styleOverrides, +}) /** * Returns the redirection props for a url diff --git a/src/Common/Types.ts b/src/Common/Types.ts index 76445de65..0b665bed9 100644 --- a/src/Common/Types.ts +++ b/src/Common/Types.ts @@ -767,7 +767,7 @@ export interface EdgeEndNodeType extends EdgeNodeType { /** * Search params for sorting configuration - * + * * Note: Either both sortOrder and sortBy are required or none */ export type SortingParams =