Skip to content

Commit

Permalink
[frontend] Added Create Relationship button to remaining applicable p…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
Bonsai8863 committed Sep 16, 2024
1 parent 30f1481 commit 12887bf
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { getCurrentTab, getPaddingRight } from '../../../../utils/utils';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import EventEdition from './EventEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootEventsSubscription($id: ID!) {
Expand Down Expand Up @@ -97,7 +99,7 @@ const RootEvent = ({ eventId, queryRef }: RootEventProps) => {
const link = `/dashboard/entities/events/${eventId}/knowledge`;
const paddingRight = getPaddingRight(location.pathname, eventId, '/dashboard/entities/events');
return (
<>
<CreateRelationshipContextProvider>
{event ? (
<>
<Routes>
Expand Down Expand Up @@ -140,6 +142,7 @@ const RootEvent = ({ eventId, queryRef }: RootEventProps) => {
<EventEdition eventId={event.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
/>
<Box
sx={{
Expand Down Expand Up @@ -281,7 +284,7 @@ const RootEvent = ({ eventId, queryRef }: RootEventProps) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};
const Root = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { getCurrentTab, getPaddingRight } from '../../../../utils/utils';
import IndividualEdition from './IndividualEdition';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootIndividualsSubscription($id: ID!) {
Expand Down Expand Up @@ -129,7 +131,7 @@ const RootIndividual = ({ individualId, queryRef }: RootIndividualProps) => {
}

return (
<>
<CreateRelationshipContextProvider>
{individual ? (
<>
<Routes>
Expand Down Expand Up @@ -174,6 +176,7 @@ const RootIndividual = ({ individualId, queryRef }: RootIndividualProps) => {
<IndividualEdition individualId={individual.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
onViewAs={handleChangeViewAs}
viewAs={viewAs}
/>
Expand Down Expand Up @@ -324,7 +327,7 @@ const RootIndividual = ({ individualId, queryRef }: RootIndividualProps) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};
const Root = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { getCurrentTab, getPaddingRight } from '../../../../utils/utils';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import OrganizationEdition from './OrganizationEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootOrganizationSubscription($id: ID!) {
Expand Down Expand Up @@ -124,7 +126,7 @@ const RootOrganization = ({ organizationId, queryRef }: RootOrganizationProps) =
const link = `/dashboard/entities/organizations/${organizationId}/knowledge`;
const paddingRight = getPaddingRight(location.pathname, organizationId, '/dashboard/entities/organizations', viewAs === 'knowledge');
return (
<>
<CreateRelationshipContextProvider>
{organization ? (
<>
<Routes>
Expand Down Expand Up @@ -174,6 +176,7 @@ const RootOrganization = ({ organizationId, queryRef }: RootOrganizationProps) =
<OrganizationEdition organizationId={organization.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
onViewAs={handleChangeViewAs}
viewAs={viewAs}
/>
Expand Down Expand Up @@ -325,7 +328,7 @@ const RootOrganization = ({ organizationId, queryRef }: RootOrganizationProps) =
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};
const Root = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { getCurrentTab, getPaddingRight } from '../../../../utils/utils';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import SectorEdition from './SectorEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootSectorSubscription($id: ID!) {
Expand Down Expand Up @@ -99,7 +101,7 @@ const RootSector = ({ sectorId, queryRef }: RootSectorProps) => {
const paddingRight = getPaddingRight(location.pathname, sectorId, '/dashboard/entities/sectors');
const link = `/dashboard/entities/sectors/${sectorId}/knowledge`;
return (
<>
<CreateRelationshipContextProvider>
{sector ? (
<>
<Routes>
Expand Down Expand Up @@ -144,6 +146,7 @@ const RootSector = ({ sectorId, queryRef }: RootSectorProps) => {
<SectorEdition sectorId={sector.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
/>
<Box
sx={{
Expand Down Expand Up @@ -285,7 +288,7 @@ const RootSector = ({ sectorId, queryRef }: RootSectorProps) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};
const Root = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { getCurrentTab, getPaddingRight } from '../../../../utils/utils';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import SystemEdition from './SystemEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootSystemsSubscription($id: ID!) {
Expand Down Expand Up @@ -122,7 +124,7 @@ const RootSystem = ({ systemId, queryRef }: RootSystemProps) => {
const link = `/dashboard/entities/systems/${systemId}/knowledge`;
const paddingRight = getPaddingRight(location.pathname, systemId, '/dashboard/entities/systems');
return (
<>
<CreateRelationshipContextProvider>
{system ? (
<>
<Routes>
Expand Down Expand Up @@ -167,6 +169,7 @@ const RootSystem = ({ systemId, queryRef }: RootSystemProps) => {
<SystemEdition systemId={system.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
onViewAs={handleChangeViewAs}
viewAs={viewAs}
/>
Expand Down Expand Up @@ -317,7 +320,7 @@ const RootSystem = ({ systemId, queryRef }: RootSystemProps) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};
const Root = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { useFormatter } from '../../../../components/i18n';
import Breadcrumbs from '../../../../components/Breadcrumbs';
import { getCurrentTab } from '../../../../utils/utils';
import IncidentEdition from './IncidentEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootIncidentSubscription($id: ID!) {
Expand Down Expand Up @@ -100,7 +102,7 @@ const RootIncidentComponent = ({ queryRef }) => {
return 0;
};
return (
<>
<CreateRelationshipContextProvider>
{incident ? (
<>
<Routes>
Expand Down Expand Up @@ -143,6 +145,7 @@ const RootIncidentComponent = ({ queryRef }) => {
<IncidentEdition incidentId={incident.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
enableQuickSubscription={true}
/>
<Box
Expand Down Expand Up @@ -262,7 +265,7 @@ const RootIncidentComponent = ({ queryRef }) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import useHelper from '../../../../utils/hooks/useHelper';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import CampaignEdition from './CampaignEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootCampaignSubscription($id: ID!) {
Expand Down Expand Up @@ -103,7 +105,7 @@ const RootCampaign = ({ campaignId, queryRef }: RootCampaignProps) => {
const isOverview = location.pathname === `/dashboard/threats/campaigns/${campaignId}`;
const paddingRight = getPaddingRight(location.pathname, campaignId, '/dashboard/threats/campaigns');
return (
<>
<CreateRelationshipContextProvider>
{campaign ? (
<>
<Routes>
Expand Down Expand Up @@ -149,6 +151,7 @@ const RootCampaign = ({ campaignId, queryRef }: RootCampaignProps) => {
<CampaignEdition campaignId={campaign.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
enableQuickSubscription={true}
/>
<Box
Expand Down Expand Up @@ -263,7 +266,7 @@ const RootCampaign = ({ campaignId, queryRef }: RootCampaignProps) => {
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import useHelper from '../../../../utils/hooks/useHelper';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import IntrusionSetEdition from './IntrusionSetEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootIntrusionSetSubscription($id: ID!) {
Expand Down Expand Up @@ -108,7 +110,7 @@ const RootIntrusionSet = ({ intrusionSetId, queryRef }: RootIntrusionSetProps) =
const paddingRight = getPaddingRight(location.pathname, intrusionSetId, '/dashboard/threats/intrusion_sets');
const link = `/dashboard/threats/intrusion_sets/${intrusionSetId}/knowledge`;
return (
<>
<CreateRelationshipContextProvider>
{intrusionSet ? (
<>
<Routes>
Expand Down Expand Up @@ -155,6 +157,7 @@ const RootIntrusionSet = ({ intrusionSetId, queryRef }: RootIntrusionSetProps) =
<IntrusionSetEdition intrusionSetId={intrusionSet.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
enableQuickSubscription={true}
enableAskAi={true}
/>
Expand Down Expand Up @@ -270,7 +273,7 @@ const RootIntrusionSet = ({ intrusionSetId, queryRef }: RootIntrusionSetProps) =
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import useHelper from '../../../../utils/hooks/useHelper';
import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import ThreatActorGroupEdition from './ThreatActorGroupEdition';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootThreatActorsGroupSubscription($id: ID!) {
Expand Down Expand Up @@ -105,7 +107,7 @@ const RootThreatActorGroup = ({ queryRef, threatActorGroupId }: RootThreatActorG
const paddingRight = getPaddingRight(location.pathname, threatActorGroupId, '/dashboard/threats/threat_actors_group');
const link = `/dashboard/threats/threat_actors_group/${threatActorGroupId}/knowledge`;
return (
<>
<CreateRelationshipContextProvider>
{threatActorGroup ? (
<>
<Routes>
Expand Down Expand Up @@ -152,6 +154,7 @@ const RootThreatActorGroup = ({ queryRef, threatActorGroupId }: RootThreatActorG
<ThreatActorGroupEdition threatActorGroupId={threatActorGroup.id} />
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
enableQuickSubscription={true}
/>
<Box
Expand Down Expand Up @@ -266,7 +269,7 @@ const RootThreatActorGroup = ({ queryRef, threatActorGroupId }: RootThreatActorG
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import Security from '../../../../utils/Security';
import { KNOWLEDGE_KNUPDATE } from '../../../../utils/hooks/useGranted';
import ThreatActorIndividualEdition from './ThreatActorIndividualEdition';
import useHelper from '../../../../utils/hooks/useHelper';
import CreateRelationshipContextProvider from '../../common/menus/CreateRelationshipContextProvider';
import CreateRelationshipButtonComponent from '../../common/menus/CreateRelationshipButtonComponent';

const subscription = graphql`
subscription RootThreatActorIndividualSubscription($id: ID!) {
Expand Down Expand Up @@ -116,7 +118,7 @@ const RootThreatActorIndividualComponent = ({
const paddingRight = getPaddingRight(location.pathname, threatActorIndividualId, '/dashboard/threats/threat_actors_individual');
const link = `/dashboard/threats/threat_actors_individual/${threatActorIndividualId}/knowledge`;
return (
<>
<CreateRelationshipContextProvider>
{threatActorIndividual ? (
<>
<Routes>
Expand Down Expand Up @@ -167,6 +169,7 @@ const RootThreatActorIndividualComponent = ({
/>
</Security>
)}
RelateComponent={CreateRelationshipButtonComponent}
enableQuickSubscription={true}
/>
<Box
Expand Down Expand Up @@ -281,7 +284,7 @@ const RootThreatActorIndividualComponent = ({
) : (
<ErrorNotFound />
)}
</>
</CreateRelationshipContextProvider>
);
};

Expand Down

0 comments on commit 12887bf

Please sign in to comment.