Plug framework export
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
d47cac911d
commit
9a3c4d3965
@@ -27,6 +27,7 @@ import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import type { FrameworkGraphNodeQuery } from "/hooks/graph/__generated__/FrameworkGraphNodeQuery.graphql";
|
||||
import type { FrameworkDetailPageFragment$key } from "./__generated__/FrameworkDetailPageFragment.graphql";
|
||||
import type { FrameworkDetailPageGenerateFrameworkStateOfApplicabilityMutation } from "./__generated__/FrameworkDetailPageGenerateFrameworkStateOfApplicabilityMutation.graphql";
|
||||
import type { FrameworkDetailPageExportFrameworkMutation } from "./__generated__/FrameworkDetailPageExportFrameworkMutation.graphql";
|
||||
import { FrameworkFormDialog } from "./dialogs/FrameworkFormDialog";
|
||||
import { FrameworkControlDialog } from "./dialogs/FrameworkControlDialog";
|
||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||
@@ -66,6 +67,18 @@ const generateFrameworkStateOfApplicabilityMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
const exportFrameworkMutation = graphql`
|
||||
mutation FrameworkDetailPageExportFrameworkMutation(
|
||||
$frameworkId: ID!
|
||||
) {
|
||||
exportFramework(
|
||||
input: { frameworkId: $frameworkId }
|
||||
) {
|
||||
exportJobId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
type Props = {
|
||||
queryRef: PreloadedQuery<FrameworkGraphNodeQuery>;
|
||||
};
|
||||
@@ -100,6 +113,15 @@ export default function FrameworkDetailPage(props: Props) {
|
||||
}
|
||||
);
|
||||
|
||||
const [exportFramework] =
|
||||
useMutationWithToasts<FrameworkDetailPageExportFrameworkMutation>(
|
||||
exportFrameworkMutation,
|
||||
{
|
||||
errorMessage: "Failed to export framework",
|
||||
successMessage: "Framework export started successfully",
|
||||
}
|
||||
);
|
||||
|
||||
usePageTitle(`${framework.name} | ${selectedControl?.sectionTitle}`);
|
||||
const onDelete = () => {
|
||||
deleteFramework({
|
||||
@@ -156,6 +178,16 @@ export default function FrameworkDetailPage(props: Props) {
|
||||
>
|
||||
{__("Download SOA")}
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
variant="primary"
|
||||
onClick={() => {
|
||||
exportFramework({
|
||||
variables: { frameworkId: framework.id },
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Export Framework")}
|
||||
</DropdownItem>
|
||||
<DropdownItem icon={IconTrashCan} variant="danger" onClick={onDelete}>
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @generated SignedSource<<05766c7969f5e78f91ca5121d2c30db8>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type FrameworkDetailPageExportFrameworkMutation$variables = {
|
||||
frameworkId: string;
|
||||
};
|
||||
export type FrameworkDetailPageExportFrameworkMutation$data = {
|
||||
readonly exportFramework: {
|
||||
readonly exportJobId: string;
|
||||
};
|
||||
};
|
||||
export type FrameworkDetailPageExportFrameworkMutation = {
|
||||
response: FrameworkDetailPageExportFrameworkMutation$data;
|
||||
variables: FrameworkDetailPageExportFrameworkMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "frameworkId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"fields": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "frameworkId",
|
||||
"variableName": "frameworkId"
|
||||
}
|
||||
],
|
||||
"kind": "ObjectValue",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "ExportFrameworkPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "exportFramework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "exportJobId",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "FrameworkDetailPageExportFrameworkMutation",
|
||||
"selections": (v1/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "FrameworkDetailPageExportFrameworkMutation",
|
||||
"selections": (v1/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "d6fdd2bb2dacfc88248ccfc6f671eb4a",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "FrameworkDetailPageExportFrameworkMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation FrameworkDetailPageExportFrameworkMutation(\n $frameworkId: ID!\n) {\n exportFramework(input: {frameworkId: $frameworkId}) {\n exportJobId\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "3866a75fb0aeaaa6cdf97934508116c1";
|
||||
|
||||
export default node;
|
||||
Reference in New Issue
Block a user