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 Apr 25, 2024
1 parent 5d7dd30 commit 9e7c0a9
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "Kraft jetzt",
"Format": "Formatieren",
"Free rectangle select": "Freies Rechteck auswählen",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "Force now",
"Format": "Format",
"Free rectangle select": "Free rectangle select",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "Forzar ahora",
"Format": "Formatear",
"Free rectangle select": "Seleccionar rectángulo libre",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "Forcer maintenant",
"Format": "Format",
"Free rectangle select": "Sélection du rectangle libre",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "即時適用",
"Format": "フォーマット",
"Free rectangle select": "自由長方形選択",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,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 now": "立即生效",
"Format": "格式",
"Free rectangle select": "自由矩形选择",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,6 @@ const SupportPackageLine: FunctionComponent<SupportPackageLineProps> = ({
label={data.package_status}
/>
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.creators.width }}
>
{(data.creators ?? []).map((c) => c?.name).join(', ')}
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.created.width }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ const SupportPackages = () => {
width: '25%',
isSortable: true,
},
creators: {
label: 'Creator',
width: '25%',
isSortable: true,
},
created: {
label: 'Date',
width: '25%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7607,6 +7607,7 @@ type Subscription {
workspace(id: ID!): Workspace
managerConfiguration(id: ID!): ManagerConfiguration
aiBus(id: ID!): AIBus
supportPackage(id: ID!): SupportPackage
}

type WorkEditMutations {
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-graphql/src/config/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const BUS_TOPICS = {
EDIT_TOPIC: `${TOPIC_PREFIX}ENTITY_TYPE_AI_BUS_EDIT_TOPIC`,
},
[SUPPORT_BUS]: {
ADDED_TOPIC: `${TOPIC_PREFIX}ENTITY_TYPE_SUPPORT_PACKAGE_ADDED_TOPIC`,
EDIT_TOPIC: `${TOPIC_PREFIX}ENTITY_TYPE_SUPPORT_PACKAGE_EDIT_TOPIC`,
},
};
Expand Down
7 changes: 7 additions & 0 deletions opencti-platform/opencti-graphql/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24057,6 +24057,7 @@ 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 @@ -24152,6 +24153,11 @@ export type SubscriptionStixSightingRelationshipArgs = {
};


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


export type SubscriptionUserArgs = {
id: Scalars['ID']['input'];
};
Expand Down Expand Up @@ -37222,6 +37228,7 @@ 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,5 +1,9 @@
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 @@ -16,6 +20,18 @@ const supportResolvers: Resolvers = {
supportPackageDelete: (_, { id }, context) => {
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; } };
},
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ 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 9e7c0a9

Please sign in to comment.