Skip to content

Commit

Permalink
[backend/frontend] wip (#5548-support-logs)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBocognano committed May 2, 2024
1 parent eff621a commit 30beba5
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 50 deletions.
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "Herunterladen als SVG",
"Download in pdf": "Herunterladen im pdf-Format",
"Download this file": "Herunterladen dieser Datei",
"Download this support package": "Laden Sie dieses Support-Paket herunter",
"Due Date": "Fälligkeitsdatum",
"Duplicate": "Duplizieren",
"Duplicate the dashboard": "Duplizieren Sie das Dashboard",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "Diagramm an Leinwand anpassen",
"Fix spelling & grammar": "Rechtschreibung & Grammatik korrigieren",
"For all other usages, you (and your organization) should have entered in a": "Für alle anderen Verwendungen sollten Sie (und Ihre Organisation) eine",
"Force Download on this file": "Download für diese Datei erzwingen",
"Force download on this support package": "Erzwingen Sie den Download für dieses Support-Paket",
"Force now": "Kraft jetzt",
"Format": "Formatieren",
"Free rectangle select": "Freies Rechteck auswählen",
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "Download as SVG",
"Download in pdf": "Download in pdf",
"Download this file": "Download this file",
"Download this support package": "Download this support package",
"Due Date": "Due Date",
"Duplicate": "Duplicate",
"Duplicate the dashboard": "Duplicate the dashboard",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "Fit graph to canvas",
"Fix spelling & grammar": "Fix spelling & grammar",
"For all other usages, you (and your organization) should have entered in a": "For all other usages, you (and your organization) should have entered in a",
"Force Download on this file": "Force Download on this file",
"Force download on this support package": "Force download on this support package",
"Force now": "Force now",
"Format": "Format",
"Free rectangle select": "Free rectangle select",
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "Descargar como SVG",
"Download in pdf": "Descargar en pdf",
"Download this file": "Descargar este fichero",
"Download this support package": "Descargar este paquete de soporte",
"Due Date": "Fecha de vencimiento",
"Duplicate": "Duplicar",
"Duplicate the dashboard": "Duplicar el salpicadero",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "Ajustar el grafo al espacio disponible",
"Fix spelling & grammar": "Corregir ortografía y gramática",
"For all other usages, you (and your organization) should have entered in a": "Para todos los demás usos, usted (y su organización) deben haber introducido un",
"Force Download on this file": "Forzar descarga de este archivo",
"Force download on this support package": "Forzar la descarga de este paquete de soporte",
"Force now": "Forzar ahora",
"Format": "Formatear",
"Free rectangle select": "Seleccionar rectángulo libre",
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "Télécharger en tant que SVG",
"Download in pdf": "Télécharger en pdf",
"Download this file": "Télécharger ce fichier",
"Download this support package": "Télécharger ce paquet d'assistance",
"Due Date": "Date d'échéance",
"Duplicate": "Dupliquer",
"Duplicate the dashboard": "Dupliquer le tableau de bord",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "Dimensionner le graphe à l'espace",
"Fix spelling & grammar": "Corriger l'orthographe et la grammaire",
"For all other usages, you (and your organization) should have entered in a": "Pour toutes les autres utilisations, vous (et votre organisation) devez avoir conclu un accord de licence avec Filigran",
"Force Download on this file": "Forcer le téléchargement de ce fichier",
"Force download on this support package": "Forcer le téléchargement de ce support",
"Force now": "Forcer maintenant",
"Format": "Format",
"Free rectangle select": "Sélection du rectangle libre",
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "SVGとしてダウンロード",
"Download in pdf": "PDFでダウンロード",
"Download this file": "ファイルのダウンロード",
"Download this support package": "このサポートパッケージをダウンロードする",
"Due Date": "期日",
"Duplicate": "重複",
"Duplicate the dashboard": "ダッシュボードの複製",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "グラフを画面内に収める",
"Fix spelling & grammar": "スペルや文法を修正する",
"For all other usages, you (and your organization) should have entered in a": "その他のすべての使用については、お客様(およびお客様の組織)が",
"Force Download on this file": "このファイルを強制ダウンロードする",
"Force download on this support package": "このサポートパッケージを強制ダウンロードする",
"Force now": "即時適用",
"Format": "フォーマット",
"Free rectangle select": "自由長方形選択",
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Download as SVG": "下载为SVG",
"Download in pdf": "以pdf格式下载",
"Download this file": "下载此文件",
"Download this support package": "下载此支持软件包",
"Due Date": "到期日",
"Duplicate": "复制",
"Duplicate the dashboard": "复制仪表板",
Expand Down Expand Up @@ -1076,7 +1077,7 @@
"Fit graph to canvas": "将图表适配到画布",
"Fix spelling & grammar": "修正拼写和语法",
"For all other usages, you (and your organization) should have entered in a": "对于所有其他用途,您(和您的组织)应在 \"OpenCTI EE \"网站上注册。",
"Force Download on this file": "强制下载该文件",
"Force download on this support package": "强制下载该支持软件包",
"Force now": "立即生效",
"Format": "格式",
"Free rectangle select": "自由矩形选择",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import ListItemText from '@mui/material/ListItemText';
import makeStyles from '@mui/styles/makeStyles';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import { FileOutline, ProgressUpload } from 'mdi-material-ui';
import { FileOutline } from 'mdi-material-ui';
import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
import IconButton from '@mui/material/IconButton';
import { DeleteOutlined, GetAppOutlined } from '@mui/icons-material';
import { DeleteOutlined, DownloadingOutlined, GetAppOutlined } from '@mui/icons-material';
import Tooltip from '@mui/material/Tooltip';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
Expand Down Expand Up @@ -194,7 +194,7 @@ const SupportPackageLine: FunctionComponent<SupportPackageLineProps> = ({
</Tooltip>
<div
className={classes.bodyItem}
style={{ width: dataColumns.packageStatus.width }}
style={{ width: dataColumns.package_status.width }}
>
<Chip
classes={{ root: classes.chipInList, label: classes.label }}
Expand All @@ -216,16 +216,16 @@ const SupportPackageLine: FunctionComponent<SupportPackageLineProps> = ({
}
/>
<ListItemSecondaryAction>
<Tooltip title={t_i18n('Force Download on this file')}>
<Tooltip title={t_i18n('Force download on this support package')}>
<span>
<IconButton
onClick={handleForceZip}
>
<ProgressUpload fontSize="small" />
<DownloadingOutlined fontSize="small" />
</IconButton>
</span>
</Tooltip>
<Tooltip title={t_i18n('Download this file')}>
<Tooltip title={t_i18n('Download this support package')}>
<span>
<IconButton
disabled={isProgress || !data.package_url}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { graphql, PreloadedQuery } from 'react-relay';
import React, { FunctionComponent } from 'react';
import { graphql, PreloadedQuery, usePreloadedQuery, useRefetchableFragment } from 'react-relay';
import React, { FunctionComponent, useEffect } from 'react';
import {
SupportPackageLinesPaginationQuery,
SupportPackageLinesPaginationQuery$variables,
Expand Down Expand Up @@ -57,6 +57,7 @@ const supportPackageLinesFragment = graphql`
) @connection(key: "Pagination_supportPackages") {
edges {
node {
id
...SupportPackageLine_node
}
}
Expand Down Expand Up @@ -85,6 +86,22 @@ const SupportPackageLines: FunctionComponent<SupportPackageLinesProps> = ({
nodePath: ['supportPackages', 'edges'],
setNumberOfElements,
});

const queryData = usePreloadedQuery(supportPackageLinesQuery, queryRef);

const [_, refetch] = useRefetchableFragment<
SupportPackageLinesPaginationQuery,
SupportPackageLines_data$key
>(supportPackageLinesFragment, queryData);

useEffect(() => {
const intervalId = setInterval(() => {
refetch({}, { fetchPolicy: 'store-and-network' });
}, 5000);

return () => clearInterval(intervalId);
}, [refetch]);

return (
<>
<ListLinesContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const SupportPackages = () => {
LOCAL_STORAGE_KEY,
{
searchTerm: '',
sortBy: '',
orderAsc: false,
sortBy: 'name',
orderAsc: true,
},
);

Expand All @@ -89,7 +89,7 @@ const SupportPackages = () => {
`Support package request send for ${supportPackageName}.`,
);
},
onError: (error) => {
onError: (error: Error) => {
handleError(error);
},
});
Expand All @@ -107,7 +107,7 @@ const SupportPackages = () => {
width: '25%',
isSortable: true,
},
packageStatus: {
package_status: {
label: 'Status',
width: '25%',
isSortable: true,
Expand All @@ -125,6 +125,7 @@ const SupportPackages = () => {
sortBy={sortBy}
orderAsc={orderAsc}
keyword={searchTerm}
handleSort={helpers.handleSort}
>
{queryRef && (
<React.Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7591,7 +7591,6 @@ type Subscription {
workspace(id: ID!): Workspace
managerConfiguration(id: ID!): ManagerConfiguration
aiBus(id: ID!): AIBus
supportPackage(id: ID!): SupportPackage
}

type WorkEditMutations {
Expand Down Expand Up @@ -11538,7 +11537,7 @@ enum PackageStatus {
enum SupportPackageOrdering {
name
created_at
creators
created
package_status
}

Expand Down
9 changes: 1 addition & 8 deletions opencti-platform/opencti-graphql/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24117,7 +24117,6 @@ export type Subscription = {
stixDomainObject?: Maybe<StixDomainObject>;
stixRefRelationship?: Maybe<StixRefRelationship>;
stixSightingRelationship?: Maybe<StixSightingRelationship>;
supportPackage?: Maybe<SupportPackage>;
user?: Maybe<User>;
workspace?: Maybe<Workspace>;
};
Expand Down Expand Up @@ -24213,11 +24212,6 @@ export type SubscriptionStixSightingRelationshipArgs = {
};


export type SubscriptionSupportPackageArgs = {
id: Scalars['ID']['input'];
};


export type SubscriptionUserArgs = {
id: Scalars['ID']['input'];
};
Expand Down Expand Up @@ -24271,8 +24265,8 @@ export type SupportPackageForceZipInput = {
};

export enum SupportPackageOrdering {
Created = 'created',
CreatedAt = 'created_at',
Creators = 'creators',
Name = 'name',
PackageStatus = 'package_status'
}
Expand Down Expand Up @@ -37311,7 +37305,6 @@ export type SubscriptionResolvers<ContextType = any, ParentType extends Resolver
stixDomainObject?: SubscriptionResolver<Maybe<ResolversTypes['StixDomainObject']>, "stixDomainObject", ParentType, ContextType, RequireFields<SubscriptionStixDomainObjectArgs, 'id'>>;
stixRefRelationship?: SubscriptionResolver<Maybe<ResolversTypes['StixRefRelationship']>, "stixRefRelationship", ParentType, ContextType, RequireFields<SubscriptionStixRefRelationshipArgs, 'id'>>;
stixSightingRelationship?: SubscriptionResolver<Maybe<ResolversTypes['StixSightingRelationship']>, "stixSightingRelationship", ParentType, ContextType, RequireFields<SubscriptionStixSightingRelationshipArgs, 'id'>>;
supportPackage?: SubscriptionResolver<Maybe<ResolversTypes['SupportPackage']>, "supportPackage", ParentType, ContextType, RequireFields<SubscriptionSupportPackageArgs, 'id'>>;
user?: SubscriptionResolver<Maybe<ResolversTypes['User']>, "user", ParentType, ContextType, RequireFields<SubscriptionUserArgs, 'id'>>;
workspace?: SubscriptionResolver<Maybe<ResolversTypes['Workspace']>, "workspace", ParentType, ContextType, RequireFields<SubscriptionWorkspaceArgs, 'id'>>;
}>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { withFilter } from 'graphql-subscriptions';
import type { Resolvers } from '../../generated/graphql';
import { addSupportPackage, deleteSupportPackage, findAll, findById, requestZipPackage } from './support-domain';
import { pubSubAsyncIterator } from '../../database/redis';
import { BUS_TOPICS } from '../../config/conf';
import { SUPPORT_BUS } from './support-types';

const supportResolvers: Resolvers = {
Query: {
Expand All @@ -21,18 +17,6 @@ const supportResolvers: Resolvers = {
return deleteSupportPackage(context, context.user, id);
},
},
Subscription: {
supportPackage: {
resolve: /* v8 ignore next */ (payload: any) => payload.instance,
subscribe: /* v8 ignore next */ (_, __, context) => {
const asyncIterator = pubSubAsyncIterator(BUS_TOPICS[SUPPORT_BUS].EDIT_TOPIC);
const filtering = withFilter(() => asyncIterator, (payload) => {
return payload && payload.instance.user_id === context.user.id;
})();
return { [Symbol.asyncIterator]() { return filtering; } };
},
}
}
};

export default supportResolvers;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ enum PackageStatus {
enum SupportPackageOrdering {
name
created_at
creators
created
package_status
}

Expand Down Expand Up @@ -66,9 +66,4 @@ type Mutation {
supportPackageAdd(input: SupportPackageAddInput!): SupportPackage @auth(for: [SETTINGS])
supportPackageForceZip(input: SupportPackageForceZipInput!): SupportPackage @auth(for: [SETTINGS])
supportPackageDelete(id: ID!): ID @auth(for: [SETTINGS])
}

# Subscriptions
type Subscription {
supportPackage(id: ID!): SupportPackage @auth(for: [EXPLORE])
}

0 comments on commit 30beba5

Please sign in to comment.