Small style fixes (#7117)

* small style fixes

* fix typescript:S1854

* remove unused function handleCellClick

* disable cov
This commit is contained in:
Matthias Mair 2024-04-29 00:19:05 +02:00 committed by GitHub
parent b711291beb
commit d728b11655
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 40 additions and 92 deletions

View File

@ -1090,19 +1090,21 @@ if SITE_URL and SITE_URL not in CSRF_TRUSTED_ORIGINS:
if DEBUG:
for origin in [
'http://localhost',
'http://*.localhost' 'http://*localhost:8000',
'http://*.localhost',
'http://*localhost:8000',
'http://*localhost:5173',
]:
if origin not in CSRF_TRUSTED_ORIGINS:
CSRF_TRUSTED_ORIGINS.append(origin)
if not TESTING and len(CSRF_TRUSTED_ORIGINS) == 0:
if isInMainThread():
# Server thread cannot run without CSRF_TRUSTED_ORIGINS
logger.error(
'No CSRF_TRUSTED_ORIGINS specified. Please provide a list of trusted origins, or specify INVENTREE_SITE_URL'
)
sys.exit(-1)
if (
not TESTING and len(CSRF_TRUSTED_ORIGINS) == 0 and isInMainThread()
): # pragma: no cover
# Server thread cannot run without CSRF_TRUSTED_ORIGINS
logger.error(
'No CSRF_TRUSTED_ORIGINS specified. Please provide a list of trusted origins, or specify INVENTREE_SITE_URL'
)
sys.exit(-1)
# Additional CSRF settings
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'

View File

@ -1,10 +1,9 @@
import { Trans, t } from '@lingui/macro';
import { t } from '@lingui/macro';
import {
ActionIcon,
Anchor,
Badge,
CopyButton,
Group,
Paper,
Skeleton,
Stack,

View File

@ -1,8 +1,6 @@
import { Paper, SimpleGrid } from '@mantine/core';
import React from 'react';
import { DetailImageButtonProps } from './DetailsImage';
export function ItemDetailsGrid(props: React.PropsWithChildren<{}>) {
return (
<Paper p="xs">

View File

@ -14,7 +14,6 @@ import {
IconAlertTriangle,
IconDeviceFloppy,
IconExclamationCircle,
IconProps,
IconRefresh
} from '@tabler/icons-react';
import Split from '@uiw/react-split';

View File

@ -1,17 +1,19 @@
import { t } from '@lingui/macro';
import {
Alert,
Button,
DefaultMantineColor,
Divider,
Group,
LoadingOverlay,
Paper,
Stack,
Text
} from '@mantine/core';
import { Button, Divider, Group, Stack } from '@mantine/core';
import { useId } from '@mantine/hooks';
import { notifications } from '@mantine/notifications';
import { useQuery } from '@tanstack/react-query';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import { useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import {
FieldValues,
FormProvider,

View File

@ -30,7 +30,6 @@ export default function DateField({
// Convert the returned date object to a string
if (value) {
value = value.toString();
let date = new Date(value);
value = dayjs(value).format(valueFormat);
}

View File

@ -78,7 +78,7 @@ export function RelatedModelField({
// Search input query
const [value, setValue] = useState<string>('');
const [searchText, cancelSearchText] = useDebouncedValue(value, 250);
const [searchText] = useDebouncedValue(value, 250);
const [filters, setFilters] = useState<any>({});

View File

@ -1,12 +1,13 @@
import { Anchor, Group, Text } from '@mantine/core';
import { IconLink, IconPhoto } from '@tabler/icons-react';
import { Anchor, Group } from '@mantine/core';
import {
IconFile,
IconFileTypeCsv,
IconFileTypeDoc,
IconFileTypePdf,
IconFileTypeXls,
IconFileTypeZip
IconFileTypeZip,
IconLink,
IconPhoto
} from '@tabler/icons-react';
import { ReactNode, useMemo } from 'react';

View File

@ -3,7 +3,7 @@ import { useDisclosure } from '@mantine/hooks';
import { IconBell, IconSearch } from '@tabler/icons-react';
import { useQuery } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import { useMatch, useNavigate, useParams } from 'react-router-dom';
import { useMatch, useNavigate } from 'react-router-dom';
import { api } from '../../App';
import { navTabs as mainNavTabs } from '../../defaults/links';

View File

@ -8,7 +8,7 @@ import {
IconPackage,
IconPhone
} from '@tabler/icons-react';
import { useEffect, useMemo, useState } from 'react';
import { useMemo } from 'react';
import {
ApiFormAdjustFilterType,

View File

@ -19,8 +19,7 @@ import { InvenTreeIcon } from '../functions/icons';
import {
ApiFormModalProps,
useCreateApiFormModal,
useDeleteApiFormModal,
useEditApiFormModal
useDeleteApiFormModal
} from '../hooks/UseForm';
import { apiUrl } from '../states/ApiState';

View File

@ -1,5 +1,7 @@
import {
Icon,
Icon123,
IconArrowBigDownLineFilled,
IconArrowMerge,
IconBinaryTree2,
IconBookmarks,
@ -10,7 +12,7 @@ import {
IconBusinessplan,
IconCalendar,
IconCalendarStats,
IconCategory,
IconCalendarTime,
IconCheck,
IconCircleCheck,
IconCircleMinus,
@ -23,13 +25,14 @@ import {
IconCornerUpRightDouble,
IconCurrencyDollar,
IconDots,
IconDotsCircleHorizontal,
IconExternalLink,
IconFileUpload,
IconFlag,
IconFlagShare,
IconGitBranch,
IconGridDots,
IconHash,
IconInfoCircle,
IconLayersLinked,
IconLink,
IconList,
@ -48,12 +51,15 @@ import {
IconPhoto,
IconPrinter,
IconProgressCheck,
IconProps,
IconQrcode,
IconQuestionMark,
IconRulerMeasure,
IconShoppingCart,
IconShoppingCartHeart,
IconShoppingCartPlus,
IconSitemap,
IconSquareXFilled,
IconStack2,
IconStatusChange,
IconTag,
@ -65,6 +71,7 @@ import {
IconTrash,
IconTruck,
IconTruckDelivery,
IconTruckReturn,
IconUnlink,
IconUser,
IconUserStar,
@ -74,14 +81,6 @@ import {
IconWorldCode,
IconX
} from '@tabler/icons-react';
import { IconFlag } from '@tabler/icons-react';
import { IconSquareXFilled } from '@tabler/icons-react';
import { IconShoppingCartPlus } from '@tabler/icons-react';
import { IconArrowBigDownLineFilled } from '@tabler/icons-react';
import { IconTruckReturn } from '@tabler/icons-react';
import { IconInfoCircle } from '@tabler/icons-react';
import { IconCalendarTime } from '@tabler/icons-react';
import { Icon, IconProps } from '@tabler/icons-react';
import React from 'react';
const icons = {

View File

@ -399,7 +399,6 @@ function HistoryTable({
);
const rows = data.map((item) => {
const selected = selection.includes(item.id);
return (
<tr key={item.id}>
<td>

View File

@ -19,7 +19,6 @@ import {
} from '@tabler/icons-react';
import { useMemo } from 'react';
import { StylishText } from '../../../components/items/StylishText';
import { PanelGroup, PanelType } from '../../../components/nav/PanelGroup';
import { SettingsHeader } from '../../../components/nav/SettingsHeader';
import { GlobalSettingList } from '../../../components/settings/SettingList';

View File

@ -25,7 +25,6 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { ModelType } from '../../enums/ModelType';
import { UserRoles } from '../../enums/Roles';
import { useManufacturerPartFields } from '../../forms/CompanyForms';
import { getDetailUrl } from '../../functions/urls';
import {
useCreateApiFormModal,
useEditApiFormModal

View File

@ -1,5 +1,5 @@
import { t } from '@lingui/macro';
import { Grid, Group, LoadingOverlay, Skeleton, Stack } from '@mantine/core';
import { Grid, LoadingOverlay, Skeleton, Stack } from '@mantine/core';
import {
IconDots,
IconInfoCircle,
@ -32,7 +32,6 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { ModelType } from '../../enums/ModelType';
import { UserRoles } from '../../enums/Roles';
import { usePurchaseOrderFields } from '../../forms/PurchaseOrderForms';
import { getDetailUrl } from '../../functions/urls';
import {
useCreateApiFormModal,
useEditApiFormModal
@ -51,7 +50,6 @@ export default function PurchaseOrderDetail() {
const { id } = useParams();
const user = useUserState();
const navigate = useNavigate();
const {
instance: order,

View File

@ -16,7 +16,6 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import {
ActionDropdown,
CancelItemAction,
DeleteItemAction,
DuplicateItemAction,
EditItemAction
} from '../../components/items/ActionDropdown';
@ -44,7 +43,6 @@ export default function ReturnOrderDetail() {
const { id } = useParams();
const user = useUserState();
const navigate = useNavigate();
const {
instance: order,

View File

@ -19,7 +19,6 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import {
ActionDropdown,
CancelItemAction,
DeleteItemAction,
DuplicateItemAction,
EditItemAction
} from '../../components/items/ActionDropdown';
@ -31,7 +30,6 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { ModelType } from '../../enums/ModelType';
import { UserRoles } from '../../enums/Roles';
import { useSalesOrderFields } from '../../forms/SalesOrderForms';
import { getDetailUrl } from '../../functions/urls';
import {
useCreateApiFormModal,
useEditApiFormModal
@ -49,7 +47,6 @@ export default function SalesOrderDetail() {
const { id } = useParams();
const user = useUserState();
const navigate = useNavigate();
const {
instance: order,

View File

@ -15,7 +15,6 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import {
ActionDropdown,
BarcodeActionDropdown,
DeleteItemAction,
EditItemAction,
LinkBarcodeAction,
UnlinkBarcodeAction,

View File

@ -1,10 +1,6 @@
import { t } from '@lingui/macro';
import { Group, Text } from '@mantine/core';
import {
IconCircleCheck,
IconCircleX,
IconExclamationCircle
} from '@tabler/icons-react';
import { IconCircleCheck, IconCircleX } from '@tabler/icons-react';
import { useQuery } from '@tanstack/react-query';
import { useCallback, useMemo } from 'react';

View File

@ -1,6 +1,5 @@
import { t } from '@lingui/macro';
import { Group, Text } from '@mantine/core';
import { access } from 'fs';
import { useCallback, useMemo, useState } from 'react';
import { useNavigate } from 'react-router-dom';

View File

@ -1,5 +1,5 @@
import { t } from '@lingui/macro';
import { ActionIcon, Group, Text, Tooltip } from '@mantine/core';
import { ActionIcon, Group, Tooltip } from '@mantine/core';
import { useHover } from '@mantine/hooks';
import { IconEdit } from '@tabler/icons-react';
import { useQuery } from '@tanstack/react-query';
@ -246,35 +246,6 @@ export default function ParametricPartTable({
return [...partColumns, ...parameterColumns];
}, [parameterColumns]);
// Callback when a parameter cell is clicked - either edit or add a new parameter
const handleCellClick = useCallback(
(record: any, column: any) => {
let template_id = column?.extra?.template;
if (!template_id) {
return;
}
setSelectedPart(record.pk);
setSelectedTemplate(template_id);
// Find the associated parameter
let parameter = record?.parameters?.find(
(p: any) => p.template == template_id
);
if (parameter) {
// Parameter exists - open edit dialog
setSelectedParameter(parameter.pk);
editParameter.open();
} else {
// Parameter does not exist - create it!
addParameter.open();
}
},
[user]
);
return (
<>
{addParameter.modal}

View File

@ -1,7 +1,6 @@
import { t } from '@lingui/macro';
import { Group, Text } from '@mantine/core';
import { useCallback, useMemo, useState } from 'react';
import { set } from 'react-hook-form';
import { AddItemButton } from '../../components/buttons/AddItemButton';
import { ApiFormFieldSet } from '../../components/forms/fields/ApiFormField';

View File

@ -10,7 +10,6 @@ import { ModelType } from '../../enums/ModelType';
import { UserRoles } from '../../enums/Roles';
import { usePartFields } from '../../forms/PartForms';
import { shortenString } from '../../functions/tables';
import { getDetailUrl } from '../../functions/urls';
import { useCreateApiFormModal } from '../../hooks/UseForm';
import { useTable } from '../../hooks/UseTable';
import { apiUrl } from '../../states/ApiState';
@ -269,7 +268,6 @@ export function PartListTable({ props }: { props: InvenTreeTableProps }) {
const table = useTable('part-list');
const user = useUserState();
const navigate = useNavigate();
const newPart = useCreateApiFormModal({
url: ApiEndpoints.part_list,

View File

@ -8,7 +8,6 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { ModelType } from '../../enums/ModelType';
import { UserRoles } from '../../enums/Roles';
import { useSupplierPartFields } from '../../forms/CompanyForms';
import { openDeleteApiForm, openEditApiForm } from '../../functions/forms';
import {
useCreateApiFormModal,
useDeleteApiFormModal,

View File

@ -1,5 +1,4 @@
import { test } from '../baseFixtures.js';
import { baseUrl } from '../defaults.js';
import { doQuickLogin } from '../login.js';
const newPartName = 'UITESTIN123';

View File

@ -1,5 +1,5 @@
import { expect, test } from './baseFixtures.js';
import { baseUrl, loginUrl, logoutUrl, user } from './defaults.js';
import { baseUrl, user } from './defaults.js';
import { doLogin, doQuickLogin } from './login.js';
test('PUI - Basic Login Test', async ({ page }) => {

View File

@ -1,4 +1,4 @@
import { expect, test } from './baseFixtures.js';
import { test } from './baseFixtures.js';
import { baseUrl } from './defaults.js';
import { doQuickLogin } from './login.js';

View File

@ -1,5 +1,5 @@
import { expect, test } from './baseFixtures.js';
import { baseUrl, user } from './defaults.js';
import { test } from './baseFixtures.js';
import { baseUrl } from './defaults.js';
import { doQuickLogin } from './login.js';
test('PUI - Stock', async ({ page }) => {