Skip to content

Commit

Permalink
done all tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
LiaSolo committed May 13, 2024
1 parent cbee8cd commit 9076b76
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 50 deletions.
8 changes: 6 additions & 2 deletions web-app/client/src/components/Filters/FilteringWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { FC, useState } from 'react';
import React, { Dispatch, FC, SetStateAction, useState } from 'react';
import { useFormContext } from 'react-hook-form';
import { Checkbox } from '@components/Inputs';
import ListPropertiesModal from '@components/ListPropertiesModal';

type FilteringProps = {
setIsFilteringShown: (arg: boolean) => void;
isFilteringShown: boolean;
setIsFilteringShown: Dispatch<SetStateAction<boolean>>;
};

export const FilteringWindow: FC<FilteringProps> = ({
isFilteringShown,
setIsFilteringShown,
}) => {
const { watch, setValue } = useFormContext();
Expand All @@ -16,6 +18,8 @@ export const FilteringWindow: FC<FilteringProps> = ({

return (
<ListPropertiesModal
isOpen={isFilteringShown}
setIsOpen={setIsFilteringShown}
name="Filters"
onClose={() => {
setShowKeys(initialShowKeys);
Expand Down
8 changes: 6 additions & 2 deletions web-app/client/src/components/Filters/OrderingWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import React, { FC } from 'react';
import React, { Dispatch, FC, SetStateAction } from 'react';
import { useForm, useFormContext } from 'react-hook-form';
import { ControlledSelect } from '@components/Inputs/Select';
import ListPropertiesModal from '@components/ListPropertiesModal';
Expand All @@ -8,11 +8,13 @@ import { OrderDirection, PrimitiveType } from 'types/globalTypes';
import { FiltersFields } from './Filters';

type OrderingProps = {
setIsOrderingShown: (arg: boolean) => void;
isOrderingShown: boolean;
setIsOrderingShown: Dispatch<SetStateAction<boolean>>;
primitive: PrimitiveType;
};

export const OrderingWindow: FC<OrderingProps> = ({
isOrderingShown,
setIsOrderingShown,
primitive,
}) => {
Expand Down Expand Up @@ -42,6 +44,8 @@ export const OrderingWindow: FC<OrderingProps> = ({

return (
<ListPropertiesModal
isOpen={isOrderingShown}
setIsOpen={setIsOrderingShown}
name="Ordering"
onClose={() => {
reset();
Expand Down
1 change: 1 addition & 0 deletions web-app/client/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useAuthContext } from '@hooks/useAuthContext';
import classNames from 'classnames';
import { useEffect, useState } from 'react';
import styles from './Header.module.scss';
import Link from 'next/link';

const Header = () => {
const { user, signOut } = useAuthContext();
Expand Down
1 change: 0 additions & 1 deletion web-app/client/src/components/Inputs/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const Select: ForwardRefRenderFunction<RefElement, Props> = (
ref={ref}
styles={{
menuPortal: (base) => {
console.log(base);
return { ...base, zIndex: 9999999 };
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,11 @@ const IndicatorsContainer: ComponentType<

const Menu: ComponentType<MenuProps<OptionType, false> & InputPropsBase> = (
innerProps,
) => {
console.log(innerProps);
return (
) => (
<FloatingPortal>
<components.Menu {...innerProps}></components.Menu>
</FloatingPortal>
);
};

export const Option: ComponentType<
OptionProps<OptionType, false> & InputPropsBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@ import Button from '@components/Button';
import ModalContainer, { ModalProps } from '@components/ModalContainer';
import { FCWithChildren } from 'types/react';
import styles from './ListPropertiesModal.module.scss';
import { Dispatch, SetStateAction } from 'react';

interface Props extends ModalProps {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
name: string;
onApply: () => void;
}

const ListPropertiesModal: FCWithChildren<Props> = ({
isOpen,
setIsOpen,
name,
onClose,
onApply,
children,
}) => {
return (
<ModalContainer onClose={onClose}>
<ModalContainer
isOpen={isOpen}
setIsOpen={setIsOpen}
onClose={onClose}
>
<h4 className={styles.title}>{name}</h4>
<div className={styles.inputs}>{children}</div>
<div className={styles.buttons}>
Expand Down
1 change: 0 additions & 1 deletion web-app/client/src/components/LogInModal/steps/LogIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ const LogIn: FC<Props> = ({ onSuccess, onRecovery }) => {
placeholder="admin1234"
{...register('password', {
required: 'Required',
validate: (value) => isStrongPassword(value) || 'Weak password',
})}
error={errors.password?.message}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
background: $black-50;
display: grid;
place-items: center;
z-index: 99999;
z-index: 9999;
}

.dialog {
Expand Down
1 change: 0 additions & 1 deletion web-app/client/src/components/SignUpModal/SignUpModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const SignUpModal: FC<ModalProps> = ({ isOpen, setIsOpen }) => {
};
const onCloseSignUp = () => setIsOpen(false);
const onCloseSuccessVerified = () => setIsOpenSuccessVerified(false);
console.log(stage, isOpen);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const CoreInfo: FC<Props> = ({ onSuccess }) => {
{...register('password', {
required: 'Required',
validate: (value) => {
console.log(isStrongPassword(value));
return (
isStrongPassword(value) ||
'The password does not match the pattern (see tooltip)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const EmailVerification: FC<Props> = ({ onSuccess }) => {

const onSubmit = handleSubmit(async (values) => {
onSuccess();
return;
try {
const response = await verifyEmail({
variables: {
Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/constants/primitiveReportPathnames.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PrimitiveType } from 'types/globalTypes';

export const primitivePathnames: Record<PrimitiveType, string> = {
AR: 'reports/test',
AR: 'reports/dependencies',
CFD: 'reports/dependencies',
FD: 'reports/dependencies',
MFD: 'reports/metric-dependencies',
Expand Down
2 changes: 0 additions & 2 deletions web-app/client/src/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ const client = new ApolloClient({
]),
});

console.log(pathnameToLocalURL(serverProxyURL), serverProxyURL);

export default client;
1 change: 0 additions & 1 deletion web-app/client/src/hooks/useModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const defaultOpenModalOptions: OpenModalOptions = {
const useModal = <T extends ModalName>(name: T) => {
const [visibleModals, setVisibleModals] = useAtom(visibleModalsAtom);
const [isOpen, setIsOpen] = useState(true);
console.log(visibleModals);
const callerId = useId();
const Modal = useMemo(() => modals[name], [name]);

Expand Down
2 changes: 2 additions & 0 deletions web-app/client/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import client from '@graphql/client';
import '@styles/globals.scss';
import { AppPropsWithLayout } from 'types/pageWithLayout';
import 'react-toastify/dist/ReactToastify.css';
import Portals from './portals';

function MyApp({ Component, pageProps }: AppPropsWithLayout) {
const getLayout = Component.getLayout ?? ((page) => page);
Expand All @@ -16,6 +17,7 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
<ErrorContextProvider>
<AuthContextProvider>
<Layout>{getLayout(<Component {...pageProps} />)}</Layout>
<Portals />
<ToastContainer />
</AuthContextProvider>
</ErrorContextProvider>
Expand Down
2 changes: 0 additions & 2 deletions web-app/client/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import GoogleAnalytics from '@components/GoogleAnalytics';
import { isGoogleAnalyticsEnabled } from '@utils/env';
import { Html, Head, Main, NextScript } from 'next/document';
import Portals from './portals';

const MyDocument = () => {
return (
Expand All @@ -26,7 +25,6 @@ const MyDocument = () => {
<body>
<Main />
<NextScript />
<Portals />
</body>
</Html>
);
Expand Down
17 changes: 10 additions & 7 deletions web-app/client/src/pages/reports/dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@components/Filters';
import { Icon } from '@components/IconComponent';
import { Text } from '@components/Inputs';
import ModalContainer from '@components/ModalContainer';
import Pagination from '@components/Pagination/Pagination';
import ReportsLayout from '@components/ReportsLayout';
import { TaskContextProvider, useTaskContext } from '@components/TaskContext';
Expand All @@ -26,7 +27,7 @@ import { convertDependencies } from '@utils/convertDependencies';
import type { GetServerSideProps } from 'next';
import { ReactElement, useEffect, useMemo, useState } from 'react';
import { FormProvider } from 'react-hook-form';
import { IntersectionFilter, OrderBy, PrimitiveType } from 'types/globalTypes';
import { IntersectionFilter, OrderBy, OrderDirection, PrimitiveType } from 'types/globalTypes';
import { NextPageWithLayout } from 'types/pageWithLayout';

type Props = {
Expand Down Expand Up @@ -111,17 +112,19 @@ const ReportsDependencies: NextPageWithLayout<Props> = ({ defaultData }) => {
<>
<FormProvider {...methods}>
{isOrderingShown && (
<OrderingWindow
{...{
setIsOrderingShown,
primitive: primitive || PrimitiveType.FD,
}}
/>
<OrderingWindow
{...{
isOrderingShown,
setIsOrderingShown,
primitive: primitive || PrimitiveType.FD,
}}
/>
)}

{isFilteringShown && (
<FilteringWindow
{...{
isFilteringShown,
setIsFilteringShown,
}}
/>
Expand Down
36 changes: 14 additions & 22 deletions web-app/client/src/pages/reports/metric-dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ import ListPropertiesModal from '@components/ListPropertiesModal';
import Pagination from '@components/Pagination/Pagination';
import ReportsLayout from '@components/ReportsLayout';

import { ScrollDirection } from '@components/ScrollableNodeTable';
import { MFDTable } from '@components/ScrollableNodeTable/implementations/MFDTable';
import useMFDHighlight from '@hooks/useMFDHighlight';
import useMFDTask from '@hooks/useMFDTask';
import styles from '@styles/MetricDependencies.module.scss';
import { MFDHighlight } from '@atoms/MFDTaskAtom';
import Button from '@components/Button';
import { Icon } from '@components/IconComponent';
import { ControlledSelect } from '@components/Inputs/Select';

import ListPropertiesModal from '@components/ListPropertiesModal';
import Pagination from '@components/Pagination/Pagination';
import ReportsLayout from '@components/ReportsLayout';

import { ScrollDirection } from '@components/ScrollableNodeTable';
import { MFDTable } from '@components/ScrollableNodeTable/implementations/MFDTable';
import useMFDHighlight from '@hooks/useMFDHighlight';
Expand All @@ -29,17 +15,24 @@ import styles from '@styles/MetricDependencies.module.scss';
import _ from 'lodash';
import { useRouter } from 'next/router';
import React, {
Dispatch,
FC,
ReactElement,
ReactNode,
SetStateAction,
useCallback,
useEffect,
useRef,
useState,
} from 'react';
import { useForm } from 'react-hook-form';

import { MFDSortBy, OrderBy } from 'types/globalTypes';
import {
MFDOrderingParameter,
MFDSortBy,
OrderBy,
OrderDirection,
} from 'types/globalTypes';

import { NextPageWithLayout } from 'types/pageWithLayout';

Expand Down Expand Up @@ -144,7 +137,6 @@ const ReportsMFD: NextPageWithLayout = () => {
});
},
[loadMFDHighlight, taskID, clusterIndex],
[loadMFDHighlight, taskID, clusterIndex],
);

const closeInsertedRow = useCallback(() => {
Expand All @@ -164,13 +156,13 @@ const ReportsMFD: NextPageWithLayout = () => {
}
},
[data.cluster.highlightsTotalCount, limit],
[data.cluster.highlightsTotalCount, limit],
);

return (
<>
{isOrderingShown && (
<OrderingWindow
isOrderingShown={isOrderingShown}
setIsOrderingShown={setIsOrderingShown}
setOrderingParameter={setOrderingParameter}
setOrderDirection={setOrderDirection}
Expand All @@ -186,7 +178,6 @@ const ReportsMFD: NextPageWithLayout = () => {
}
description={'Try restarting the task with different parameters'}
icon={<Icon name="lineArrowRight" />}
icon={<Icon name="lineArrowRight" />}
/>
)}
{!data.clustersTotalCount && !data.result && (
Expand All @@ -196,7 +187,6 @@ const ReportsMFD: NextPageWithLayout = () => {
}
description={'Try restarting the task with different parameters'}
icon={<Icon name="lineArrowRightCrossed" />}
icon={<Icon name="lineArrowRightCrossed" />}
/>
)}
{data.clustersTotalCount !== 0 && !data.result && (
Expand All @@ -209,7 +199,6 @@ const ReportsMFD: NextPageWithLayout = () => {
variant="secondary"
size="md"
icon={<Icon name="ordering" />}
icon={<Icon name="ordering" />}
onClick={() => setIsOrderingShown(true)}
>
Ordering
Expand All @@ -218,7 +207,6 @@ const ReportsMFD: NextPageWithLayout = () => {
variant="secondary"
size="md"
icon={<Icon name="eye" />}
icon={<Icon name="eye" />}
onClick={() => setShowFullValue((e) => !e)}
>
{showFullValue ? 'Hide' : 'Show'} full value
Expand Down Expand Up @@ -282,7 +270,8 @@ const ReportFiller: FC<ReportFillerProps> = ({ title, description, icon }) => {
};

type OrderingProps = {
setIsOrderingShown: (arg: boolean) => void;
isOrderingShown: boolean;
setIsOrderingShown: Dispatch<SetStateAction<boolean>>;
setOrderingParameter: (arg: MFDOrderingParameter) => void;
setOrderDirection: (arg: OrderDirection) => void;
};
Expand All @@ -293,6 +282,7 @@ type SortingProps = {
};

const OrderingWindow: FC<OrderingProps> = ({
isOrderingShown,
setIsOrderingShown,
setOrderingParameter,
setOrderDirection,
Expand Down Expand Up @@ -323,6 +313,8 @@ const OrderingWindow: FC<OrderingProps> = ({
// TODO: Fix "value.match..." error when changing form parameter (this error is present on deployed version, btw)
return (
<ListPropertiesModal
isOpen={isOrderingShown}
setIsOpen={setIsOrderingShown}
name="Ordering"
onClose={() => {
reset();
Expand Down

0 comments on commit 9076b76

Please sign in to comment.