Skip to content

Commit

Permalink
[frontend] fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Jan 3, 2025
1 parent dd07202 commit 70cf615
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import makeStyles from '@mui/styles/makeStyles';
import { emptyFilterGroup } from '../../../utils/filters/filtersUtils';
import { useFormatter } from '../../../components/i18n';
import type { Theme } from '../../../components/Theme';
// eslint-disable-next-line import/extensions
import { WidgetDataSelection, WidgetPerspective } from '../../../utils/widget/widget';
import { getCurrentCategory, getCurrentDataSelectionLimit } from './widgetUtils';
import type { WidgetDataSelection } from '../../../utils/widget/widget';
import { getCurrentCategory, getCurrentDataSelectionLimit, WidgetPerspective } from './widgetUtils';

interface WidgetCreationDataSelectionProps {
dataSelection: WidgetDataSelection[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ import Tooltip from '@mui/material/Tooltip';
import { InformationOutline } from 'mdi-material-ui';
import React, { FunctionComponent, useState } from 'react';
import { StixCyberObservablesLinesAttributesQuery$data } from '@components/observations/stix_cyber_observables/__generated__/StixCyberObservablesLinesAttributesQuery.graphql';
import { getCurrentAvailableParameters, getCurrentCategory, getCurrentIsRelationships, isWidgetListOrTimeline } from './widgetUtils';
import {
getCurrentAvailableParameters,
getCurrentCategory,
getCurrentIsRelationships,
isWidgetListOrTimeline,
WidgetPerspective
} from './widgetUtils';
import { QueryRenderer } from '../../../relay/environment';
import { isNotEmptyField } from '../../../utils/utils';
import { capitalizeFirstLetter } from '../../../utils/String';
import MarkdownDisplay from '../../../components/MarkdownDisplay';
import { useFormatter } from '../../../components/i18n';
import { findFiltersFromKeys } from '../../../utils/filters/filtersUtils';
import useAttributes from '../../../utils/hooks/useAttributes';
// eslint-disable-next-line import/extensions
import { WidgetDataSelection, WidgetParameters, WidgetPerspective } from '../../../utils/widget/widget';
import type { WidgetDataSelection, WidgetParameters } from '../../../utils/widget/widget';

interface WidgetCreationParametersProps {
dataSelection: WidgetDataSelection[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import Typography from '@mui/material/Typography';
import { LibraryBooksOutlined } from '@mui/icons-material';
import React, { FunctionComponent } from 'react';
import { useFormatter } from '../../../components/i18n';
import { indexedVisualizationTypes } from './widgetUtils';
// eslint-disable-next-line import/extensions
import { WidgetPerspective } from '../../../utils/widget/widget';
import { indexedVisualizationTypes, WidgetPerspective } from './widgetUtils';

interface WidgetCreationPerspectiveProps {
handleSelectPerspective: (perspective: WidgetPerspective) => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import useFiltersState from '../../../utils/filters/useFiltersState';
import { isFilterGroupNotEmpty, useAvailableFilterKeysForEntityTypes } from '../../../utils/filters/filtersUtils';
import FilterIconButton from '../../../components/FilterIconButton';
import { useFormatter } from '../../../components/i18n';
// eslint-disable-next-line import/extensions
import { WidgetDataSelection, WidgetPerspective } from '../../../utils/widget/widget';
import type { WidgetDataSelection } from '../../../utils/widget/widget';
import { WidgetPerspective } from './widgetUtils';

interface WidgetFiltersProps {
perspective: WidgetPerspective;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import {
} from 'mdi-material-ui';
import React from 'react';

export enum WidgetPerspective {
entities,
relationships,
audits,
}

export const widgetVisualizationTypes = [
{
key: 'text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import type { PublicManifest } from './dashboard/PublicManifest';
import usePublicDashboardWidgets from './dashboard/usePublicDashboardWidgets';
import PublicTopBar from './PublicTopBar';
import PublicDashboardHeader from './dashboard/PublicDashboardHeader';
// eslint-disable-next-line import/extensions
import { WidgetPerspective } from '../../utils/widget/widget';
import { WidgetPerspective } from '@components/widgets/widgetUtils';

const publicDashboardQuery = graphql`
query PublicDashboardQuery($uri_key: String!) {
Expand Down
7 changes: 1 addition & 6 deletions opencti-platform/opencti-front/src/utils/widget/widget.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FilterGroup } from '../filters/filtersHelpers-types';
import { WidgetPerspective } from '../../private/components/widgets/widgetUtils';

interface WidgetColumn {
attribute: string | null
Expand All @@ -7,12 +8,6 @@ interface WidgetColumn {
variableName?: string | null
}

export enum WidgetPerspective {
entities,
relationships,
audits,
}

export interface WidgetDataSelection {
label?: string | null
number?: number | null
Expand Down

0 comments on commit 70cf615

Please sign in to comment.