@@ -25,7 +25,7 @@ import {
|
||||
SidebarMenuSubButton,
|
||||
SidebarMenuSubItem,
|
||||
} from "@/components/ui/sidebar";
|
||||
import { BookOpen, FileText, Settings, ToyBrick, Users } from "lucide-react";
|
||||
import { BookOpen, FileText, Settings, Users, Box } from "lucide-react";
|
||||
|
||||
interface NavItem {
|
||||
title: string;
|
||||
@@ -180,6 +180,13 @@ function getNavItems(organizationId?: string): NavItem[] {
|
||||
: undefined,
|
||||
icon: FileText,
|
||||
},
|
||||
{
|
||||
title: "Assets",
|
||||
url: organizationId
|
||||
? `/organizations/${organizationId}/assets`
|
||||
: undefined,
|
||||
icon: Box,
|
||||
},
|
||||
{
|
||||
title: "Settings",
|
||||
url: organizationId
|
||||
|
||||
@@ -19,6 +19,7 @@ import { OrganizationBreadcrumbOrganizationQuery } from "./__generated__/Organiz
|
||||
import { OrganizationBreadcrumbBreadcrumbMeasureViewQuery } from "./__generated__/OrganizationBreadcrumbBreadcrumbMeasureViewQuery.graphql";
|
||||
import { OrganizationBreadcrumbBreadcrumbControlQuery } from "./__generated__/OrganizationBreadcrumbBreadcrumbControlQuery.graphql";
|
||||
import { OrganizationBreadcrumbBreadcrumbRiskShowQuery } from "./__generated__/OrganizationBreadcrumbBreadcrumbRiskShowQuery.graphql";
|
||||
import { OrganizationBreadcrumbBreadcrumbAssetOverviewQuery } from "./__generated__/OrganizationBreadcrumbBreadcrumbAssetOverviewQuery.graphql";
|
||||
import ErrorBoundary from "@/components/ErrorBoundary";
|
||||
|
||||
const New = () => {
|
||||
@@ -451,6 +452,53 @@ function BreadcrumbRiskShow() {
|
||||
);
|
||||
}
|
||||
|
||||
function BreadcrumbAssetList() {
|
||||
const { organizationId } = useParams();
|
||||
return (
|
||||
<>
|
||||
<BreadcrumbSeparator />
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbNavLink to={`/organizations/${organizationId}/assets`}>
|
||||
Assets
|
||||
</BreadcrumbNavLink>
|
||||
</BreadcrumbItem>
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function BreadcrumbAssetOverview() {
|
||||
const { organizationId, assetId } = useParams();
|
||||
const data = useLazyLoadQuery<OrganizationBreadcrumbBreadcrumbAssetOverviewQuery>(
|
||||
graphql`
|
||||
query OrganizationBreadcrumbBreadcrumbAssetOverviewQuery($assetId: ID!) {
|
||||
asset: node(id: $assetId) {
|
||||
id
|
||||
... on Asset {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ assetId: assetId! },
|
||||
{ fetchPolicy: "store-or-network" },
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<BreadcrumbSeparator />
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbNavLink
|
||||
to={`/organizations/${organizationId}/assets/${assetId}`}
|
||||
>
|
||||
{data.asset?.name}
|
||||
</BreadcrumbNavLink>
|
||||
</BreadcrumbItem>
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function BreadCrumb() {
|
||||
return (
|
||||
<Routes>
|
||||
@@ -544,6 +592,19 @@ export function BreadCrumb() {
|
||||
</Route>
|
||||
<Route path="new" element={<New />} />
|
||||
</Route>
|
||||
<Route path="assets" element={<BreadcrumbAssetList />}>
|
||||
<Route path="new" element={<New />} />
|
||||
<Route
|
||||
path=":assetId"
|
||||
element={
|
||||
<Suspense>
|
||||
<BreadcrumbAssetOverview />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route path="edit" element={<Edit />} />
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
path="settings"
|
||||
element={
|
||||
|
||||
@@ -28,6 +28,9 @@ import ShowRiskView from "./risks/ShowRiskView";
|
||||
import { ListVendorPage } from "./vendors/ListVendorPage";
|
||||
import { VendorPage } from "./vendors/VendorPage";
|
||||
import { ListTaskPage } from "./tasks/ListTaskPage";
|
||||
import { AssetsListPage } from "./assets/AssetsListPage";
|
||||
import { NewAssetPage } from "./assets/NewAssetPage";
|
||||
import { AssetPage } from "./assets/AssetPage";
|
||||
|
||||
export function OrganizationsRoutes() {
|
||||
return (
|
||||
@@ -64,6 +67,9 @@ export function OrganizationsRoutes() {
|
||||
<Route path="risks/new" element={<NewRiskPage />} />
|
||||
<Route path="risks/:riskId" element={<ShowRiskView />} />
|
||||
<Route path="risks/:riskId/edit" element={<EditRiskPage />} />
|
||||
<Route path="assets" element={<AssetsListPage />} />
|
||||
<Route path="assets/new" element={<NewAssetPage />} />
|
||||
<Route path="assets/:assetId" element={<AssetPage />} />
|
||||
<Route path="settings" element={<SettingsPage />} />
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Route>
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* @generated SignedSource<<7ee0fb485c12093374bdcbdf43d0a2df>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type OrganizationBreadcrumbBreadcrumbAssetOverviewQuery$variables = {
|
||||
assetId: string;
|
||||
};
|
||||
export type OrganizationBreadcrumbBreadcrumbAssetOverviewQuery$data = {
|
||||
readonly asset: {
|
||||
readonly id: string;
|
||||
readonly name?: string;
|
||||
};
|
||||
};
|
||||
export type OrganizationBreadcrumbBreadcrumbAssetOverviewQuery = {
|
||||
response: OrganizationBreadcrumbBreadcrumbAssetOverviewQuery$data;
|
||||
variables: OrganizationBreadcrumbBreadcrumbAssetOverviewQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "assetId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "assetId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Asset",
|
||||
"abstractKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "OrganizationBreadcrumbBreadcrumbAssetOverviewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "asset",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "OrganizationBreadcrumbBreadcrumbAssetOverviewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "asset",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "41b1d32aad685d08edfdbf989207e758",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "OrganizationBreadcrumbBreadcrumbAssetOverviewQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query OrganizationBreadcrumbBreadcrumbAssetOverviewQuery(\n $assetId: ID!\n) {\n asset: node(id: $assetId) {\n __typename\n id\n ... on Asset {\n name\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "4c3d736cb93af42b7dcb88cdcb293e8f";
|
||||
|
||||
export default node;
|
||||
40
apps/console/src/pages/organizations/assets/AssetPage.tsx
Normal file
40
apps/console/src/pages/organizations/assets/AssetPage.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { PageTemplateSkeleton } from "@/components/PageTemplate";
|
||||
import { Suspense } from "react";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
import { useLocation } from "react-router";
|
||||
import { ErrorBoundaryWithLocation } from "../ErrorBoundary";
|
||||
|
||||
const AssetView = lazy(() => import("./AssetView"));
|
||||
|
||||
export function AssetViewSkeleton() {
|
||||
return (
|
||||
<PageTemplateSkeleton>
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-1">
|
||||
<div className="h-8 w-48 bg-subtle-bg animate-pulse rounded" />
|
||||
<div className="h-4 w-96 bg-subtle-bg animate-pulse rounded" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
{[1, 2].map((i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="h-20 bg-subtle-bg animate-pulse rounded-lg"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</PageTemplateSkeleton>
|
||||
);
|
||||
}
|
||||
|
||||
export function AssetPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<Suspense key={location.pathname} fallback={<AssetViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<AssetView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
445
apps/console/src/pages/organizations/assets/AssetView.tsx
Normal file
445
apps/console/src/pages/organizations/assets/AssetView.tsx
Normal file
@@ -0,0 +1,445 @@
|
||||
"use client";
|
||||
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import {
|
||||
graphql,
|
||||
PreloadedQuery,
|
||||
usePreloadedQuery,
|
||||
useQueryLoader,
|
||||
useMutation,
|
||||
} from "react-relay";
|
||||
import { Suspense, useEffect, useState, useCallback } from "react";
|
||||
import type { AssetViewQuery as AssetViewQueryType } from "./__generated__/AssetViewQuery.graphql";
|
||||
import { useParams } from "react-router";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { AssetViewSkeleton } from "./AssetPage";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import PeopleSelector from "@/components/PeopleSelector";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { X } from "lucide-react";
|
||||
|
||||
const assetViewQuery = graphql`
|
||||
query AssetViewQuery($assetId: ID!, $organizationId: ID!) {
|
||||
node(id: $assetId) {
|
||||
... on Asset {
|
||||
id
|
||||
name
|
||||
amount
|
||||
criticity
|
||||
assetType
|
||||
dataTypesStored
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
vendors {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
organization: node(id: $organizationId) {
|
||||
...PeopleSelector_organization
|
||||
... on Organization {
|
||||
vendors(first: 100, orderBy: { direction: ASC, field: NAME }) @connection(key: "AssetView_vendors") {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const updateAssetMutation = graphql`
|
||||
mutation AssetViewUpdateAssetMutation($input: UpdateAssetInput!) {
|
||||
updateAsset(input: $input) {
|
||||
asset {
|
||||
id
|
||||
name
|
||||
amount
|
||||
criticity
|
||||
assetType
|
||||
dataTypesStored
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
vendors {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
type AssetType = "PHYSICAL" | "VIRTUAL";
|
||||
type CriticityLevel = "LOW" | "MEDIUM" | "HIGH";
|
||||
|
||||
interface Vendor {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
interface Organization {
|
||||
readonly id?: string;
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: Vendor;
|
||||
} | null> | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
interface Asset {
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
readonly amount?: number;
|
||||
readonly criticity?: CriticityLevel;
|
||||
readonly assetType?: AssetType;
|
||||
readonly dataTypesStored?: string;
|
||||
readonly owner?: {
|
||||
readonly id: string;
|
||||
readonly fullName: string;
|
||||
} | null;
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
} | null> | null;
|
||||
} | null;
|
||||
readonly createdAt?: string;
|
||||
readonly updatedAt?: string;
|
||||
}
|
||||
|
||||
function EditableField({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
type = "text",
|
||||
helpText,
|
||||
}: {
|
||||
label: string;
|
||||
value: string | number;
|
||||
onChange: (value: string | number) => void;
|
||||
type?: string;
|
||||
helpText?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">{label}</Label>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
type={type}
|
||||
value={value}
|
||||
onChange={(e) => onChange(type === "number" ? parseInt(e.target.value, 10) || 0 : e.target.value)}
|
||||
/>
|
||||
{helpText && <p className="text-sm text-secondary">{helpText}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AssetViewContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<AssetViewQueryType>;
|
||||
}) {
|
||||
const data = usePreloadedQuery(assetViewQuery, queryRef);
|
||||
const { organizationId } = useParams();
|
||||
const [editedFields, setEditedFields] = useState<Set<string>>(new Set());
|
||||
const asset = data.node as Asset | null;
|
||||
const [formData, setFormData] = useState({
|
||||
name: asset?.name || "",
|
||||
amount: asset?.amount || 0,
|
||||
criticity: asset?.criticity || "LOW",
|
||||
assetType: asset?.assetType || "VIRTUAL",
|
||||
dataTypesStored: asset?.dataTypesStored || "",
|
||||
ownerId: asset?.owner?.id || "",
|
||||
selectedVendorIds: (asset?.vendors?.edges || [])
|
||||
.map(edge => edge?.node?.id)
|
||||
.filter((id): id is string => id != null) || [],
|
||||
});
|
||||
const [commit] = useMutation(updateAssetMutation);
|
||||
const [, loadQuery] = useQueryLoader<AssetViewQueryType>(assetViewQuery);
|
||||
const { toast } = useToast();
|
||||
const hasChanges = editedFields.size > 0;
|
||||
|
||||
const handleSave = useCallback(() => {
|
||||
const nodeId = data.node?.id;
|
||||
if (!nodeId) return;
|
||||
|
||||
commit({
|
||||
variables: {
|
||||
input: {
|
||||
id: nodeId,
|
||||
name: formData.name,
|
||||
amount: formData.amount,
|
||||
criticity: formData.criticity,
|
||||
assetType: formData.assetType,
|
||||
dataTypesStored: formData.dataTypesStored,
|
||||
ownerId: formData.ownerId,
|
||||
vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined,
|
||||
},
|
||||
},
|
||||
onCompleted: () => {
|
||||
toast({
|
||||
title: "Success",
|
||||
description: "Changes saved successfully",
|
||||
variant: "default",
|
||||
});
|
||||
setEditedFields(new Set());
|
||||
},
|
||||
onError: (error) => {
|
||||
const defaultErrorValues = {
|
||||
title: "Error",
|
||||
description: error.message || "Failed to save changes",
|
||||
variant: "destructive" as const
|
||||
};
|
||||
|
||||
if (error.message?.includes("concurrent modification")) {
|
||||
toast({
|
||||
...defaultErrorValues,
|
||||
description: "Someone else modified this asset. Reloading latest data.",
|
||||
});
|
||||
loadQuery({ assetId: nodeId, organizationId: organizationId! });
|
||||
} else {
|
||||
toast(defaultErrorValues);
|
||||
}
|
||||
},
|
||||
});
|
||||
}, [commit, data.node?.id, formData, loadQuery, toast, organizationId]);
|
||||
|
||||
const handleFieldChange = (field: keyof typeof formData, value: unknown) => {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
[field]: value,
|
||||
}));
|
||||
setEditedFields((prev) => new Set(prev).add(field));
|
||||
};
|
||||
|
||||
const handleVendorSelect = (vendorId: string) => {
|
||||
handleFieldChange(
|
||||
"selectedVendorIds",
|
||||
formData.selectedVendorIds.includes(vendorId)
|
||||
? formData.selectedVendorIds.filter((id) => id !== vendorId)
|
||||
: [...formData.selectedVendorIds, vendorId]
|
||||
);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
const asset = data.node as Asset | null;
|
||||
setFormData({
|
||||
name: asset?.name || "",
|
||||
amount: asset?.amount || 0,
|
||||
criticity: asset?.criticity || "LOW",
|
||||
assetType: asset?.assetType || "VIRTUAL",
|
||||
dataTypesStored: asset?.dataTypesStored || "",
|
||||
ownerId: asset?.owner?.id || "",
|
||||
selectedVendorIds: (asset?.vendors?.edges || [])
|
||||
.map((edge) => edge?.node?.id)
|
||||
.filter((id): id is string => id != null) || [],
|
||||
});
|
||||
setEditedFields(new Set());
|
||||
};
|
||||
|
||||
const organization = data.organization as Organization;
|
||||
const vendors = (organization.vendors?.edges || [])
|
||||
.map((edge) => edge?.node)
|
||||
.filter((node): node is Vendor => node != null);
|
||||
|
||||
return (
|
||||
<PageTemplate title={formData.name || "Asset Details"}>
|
||||
<div className="space-y-6">
|
||||
<div className="max-w-4xl space-y-6">
|
||||
<EditableField
|
||||
label="Name"
|
||||
value={formData.name}
|
||||
onChange={(value) => handleFieldChange("name", value)}
|
||||
helpText="Enter the name of the asset"
|
||||
/>
|
||||
|
||||
<EditableField
|
||||
label="Amount"
|
||||
value={formData.amount}
|
||||
type="number"
|
||||
onChange={(value) => handleFieldChange("amount", value)}
|
||||
helpText="Enter the amount of the asset"
|
||||
/>
|
||||
|
||||
<Card className="p-6">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-lg font-medium">Asset Details</h2>
|
||||
<p className="text-sm text-secondary">
|
||||
Additional details about the asset
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Owner</Label>
|
||||
</div>
|
||||
<PeopleSelector
|
||||
organizationRef={data.organization}
|
||||
selectedPersonId={formData.ownerId}
|
||||
onSelect={(value) => handleFieldChange("ownerId", value)}
|
||||
placeholder="Select asset owner"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Vendors</Label>
|
||||
<Select
|
||||
value=""
|
||||
onValueChange={handleVendorSelect}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select vendors" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{vendors.map((vendor) => (
|
||||
<SelectItem key={vendor.id} value={vendor.id}>
|
||||
{vendor.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex flex-wrap gap-2 mt-2">
|
||||
{formData.selectedVendorIds.map((vendorId) => {
|
||||
const vendor = vendors.find((v) => v.id === vendorId);
|
||||
if (!vendor) return null;
|
||||
return (
|
||||
<Badge key={vendorId} variant="secondary" className="flex items-center gap-1">
|
||||
{vendor.name}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleVendorSelect(vendorId)}
|
||||
className="hover:bg-secondary-hover rounded-full p-0.5"
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Criticity Level</Label>
|
||||
</div>
|
||||
<Select
|
||||
value={formData.criticity}
|
||||
onValueChange={(value) => handleFieldChange("criticity", value)}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Select criticity level" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="HIGH">High</SelectItem>
|
||||
<SelectItem value="MEDIUM">Medium</SelectItem>
|
||||
<SelectItem value="LOW">Low</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Asset Type</Label>
|
||||
</div>
|
||||
<Select
|
||||
value={formData.assetType}
|
||||
onValueChange={(value) => handleFieldChange("assetType", value)}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Select asset type" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="PHYSICAL">Physical</SelectItem>
|
||||
<SelectItem value="VIRTUAL">Virtual</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Data Types Stored</Label>
|
||||
</div>
|
||||
<Textarea
|
||||
value={formData.dataTypesStored}
|
||||
onChange={(e) => handleFieldChange("dataTypesStored", e.target.value)}
|
||||
placeholder="Enter the types of data stored in this asset..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<div className="mt-6 flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={handleCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
className="bg-primary text-invert hover:bg-primary/90"
|
||||
disabled={!hasChanges}
|
||||
>
|
||||
Save Changes
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AssetView() {
|
||||
const { assetId, organizationId } = useParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<AssetViewQueryType>(assetViewQuery);
|
||||
|
||||
useEffect(() => {
|
||||
loadQuery({ assetId: assetId!, organizationId: organizationId! });
|
||||
}, [loadQuery, assetId, organizationId]);
|
||||
|
||||
if (!queryRef) {
|
||||
return <AssetViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<AssetViewSkeleton />}>
|
||||
<AssetViewContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { useLocation } from "react-router";
|
||||
import { Suspense } from "react";
|
||||
import { ErrorBoundaryWithLocation } from "../ErrorBoundary";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
|
||||
|
||||
const AssetsListView = lazy(() => import("./AssetsListView"));
|
||||
|
||||
export function AssetsListViewSkeleton() {
|
||||
return (
|
||||
<PageTemplate
|
||||
title="Assets"
|
||||
description="Keep track of your organization's assets and their criticality levels."
|
||||
>
|
||||
<div className="space-y-2">
|
||||
{Array.from({ length: 5 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="flex items-center justify-between p-4 rounded-xl border bg-level-1"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<Skeleton className="h-8 w-8 rounded-full" />
|
||||
<div className="space-y-1">
|
||||
<Skeleton className="h-4 w-48" />
|
||||
<Skeleton className="h-3 w-32" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-8 w-8" />
|
||||
<Skeleton className="h-4 w-4" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export function AssetsListPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<Suspense key={location.pathname} fallback={<AssetsListViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<AssetsListView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
367
apps/console/src/pages/organizations/assets/AssetsListView.tsx
Normal file
367
apps/console/src/pages/organizations/assets/AssetsListView.tsx
Normal file
@@ -0,0 +1,367 @@
|
||||
import { Suspense, useEffect, useTransition, useRef } from "react";
|
||||
import {
|
||||
graphql,
|
||||
PreloadedQuery,
|
||||
usePreloadedQuery,
|
||||
useQueryLoader,
|
||||
useMutation,
|
||||
usePaginationFragment,
|
||||
} from "react-relay";
|
||||
import { useSearchParams, useParams } from "react-router";
|
||||
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Box, Plus, Trash2, ChevronRight } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Link } from "react-router";
|
||||
import type { AssetsListViewQuery as AssetsListViewQueryType } from "./__generated__/AssetsListViewQuery.graphql";
|
||||
import type { AssetsListViewDeleteAssetMutation } from "./__generated__/AssetsListViewDeleteAssetMutation.graphql";
|
||||
import { AssetsListViewPaginationQuery } from "./__generated__/AssetsListViewPaginationQuery.graphql";
|
||||
import { AssetsListView_assets$key } from "./__generated__/AssetsListView_assets.graphql";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { AssetsListViewSkeleton } from "./AssetsListViewSkeleton";
|
||||
import { BreadCrumb } from "../OrganizationBreadcrumb";
|
||||
|
||||
const ITEMS_PER_PAGE = 25;
|
||||
|
||||
const assetsListViewQuery = graphql`
|
||||
query AssetsListViewQuery(
|
||||
$organizationId: ID!
|
||||
$first: Int
|
||||
$after: CursorKey
|
||||
$last: Int
|
||||
$before: CursorKey
|
||||
) {
|
||||
organization: node(id: $organizationId) {
|
||||
...AssetsListView_assets
|
||||
@arguments(first: $first, after: $after, last: $last, before: $before)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const assetsListFragment = graphql`
|
||||
fragment AssetsListView_assets on Organization
|
||||
@refetchable(queryName: "AssetsListViewPaginationQuery")
|
||||
@argumentDefinitions(
|
||||
first: { type: "Int" }
|
||||
after: { type: "CursorKey" }
|
||||
last: { type: "Int" }
|
||||
before: { type: "CursorKey" }
|
||||
) {
|
||||
id
|
||||
assets(
|
||||
first: $first
|
||||
after: $after
|
||||
last: $last
|
||||
before: $before
|
||||
orderBy: { direction: ASC, field: AMOUNT }
|
||||
) @connection(key: "AssetsListView_assets") {
|
||||
__id
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
amount
|
||||
criticity
|
||||
assetType
|
||||
dataTypesStored
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
vendors {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const deleteAssetMutation = graphql`
|
||||
mutation AssetsListViewDeleteAssetMutation(
|
||||
$input: DeleteAssetInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
deleteAsset(input: $input) {
|
||||
deletedAssetId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
function LoadAboveButton({
|
||||
isLoading,
|
||||
hasMore,
|
||||
onLoadMore,
|
||||
}: {
|
||||
isLoading: boolean;
|
||||
hasMore: boolean;
|
||||
onLoadMore: () => void;
|
||||
}) {
|
||||
if (!hasMore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={onLoadMore}
|
||||
disabled={isLoading}
|
||||
className="w-full"
|
||||
>
|
||||
{isLoading ? "Loading..." : "Load above"}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LoadBelowButton({
|
||||
isLoading,
|
||||
hasMore,
|
||||
onLoadMore,
|
||||
}: {
|
||||
isLoading: boolean;
|
||||
hasMore: boolean;
|
||||
onLoadMore: () => void;
|
||||
}) {
|
||||
if (!hasMore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={onLoadMore}
|
||||
disabled={isLoading || !hasMore}
|
||||
className="w-full"
|
||||
>
|
||||
{isLoading ? "Loading..." : "Load below"}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AssetsListContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<AssetsListViewQueryType>;
|
||||
}) {
|
||||
const data = usePreloadedQuery<AssetsListViewQueryType>(
|
||||
assetsListViewQuery,
|
||||
queryRef,
|
||||
);
|
||||
const [, setSearchParams] = useSearchParams();
|
||||
const [, startTransition] = useTransition();
|
||||
const [deleteAsset] =
|
||||
useMutation<AssetsListViewDeleteAssetMutation>(deleteAssetMutation);
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
const {
|
||||
data: assetsConnection,
|
||||
loadNext,
|
||||
loadPrevious,
|
||||
hasNext,
|
||||
hasPrevious,
|
||||
isLoadingNext,
|
||||
isLoadingPrevious,
|
||||
} = usePaginationFragment<
|
||||
AssetsListViewPaginationQuery,
|
||||
AssetsListView_assets$key
|
||||
>(assetsListFragment, data.organization);
|
||||
|
||||
const assets = assetsConnection.assets.edges.map((edge) => edge.node) ?? [];
|
||||
const pageInfo = assetsConnection.assets.pageInfo;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageTemplate
|
||||
title="Assets"
|
||||
description="Keep track of your organization's assets and their criticality levels."
|
||||
actions={
|
||||
<Button asChild variant="secondary" className="gap-2">
|
||||
<Link to={`/organizations/${organizationId}/assets/new`}>
|
||||
<Plus className="h-4 w-4" />
|
||||
Add an asset
|
||||
</Link>
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
{assets.map((asset) => (
|
||||
<Link
|
||||
key={asset?.id}
|
||||
to={`/organizations/${organizationId}/assets/${asset?.id}`}
|
||||
className="block"
|
||||
>
|
||||
<div className="flex items-center justify-between p-4 rounded-xl border bg-level-1 hover:bg-accent-bg/5 transition-colors">
|
||||
<div className="flex items-center gap-3">
|
||||
<Avatar className="h-8 w-8">
|
||||
<AvatarFallback>
|
||||
<Box className="h-4 w-4" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="font-medium">
|
||||
{asset?.name} ({asset?.amount})
|
||||
</p>
|
||||
{asset?.owner?.fullName && (
|
||||
<>
|
||||
<span className="text-tertiary">•</span>
|
||||
<p className="text-sm text-tertiary">
|
||||
Owned by {asset.owner.fullName}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-sm text-tertiary">
|
||||
Data types: {asset?.dataTypesStored}
|
||||
</div>
|
||||
<div className="text-sm text-tertiary">
|
||||
{asset?.vendors?.edges?.length > 0 && (
|
||||
<>
|
||||
<p className="text-sm text-tertiary">
|
||||
Vendors: {asset.vendors.edges.map(edge => edge?.node?.name).join(", ")}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge className="px-3 py-0.5 text-xs font-medium">
|
||||
{asset?.assetType === "PHYSICAL" ? "Physical" : "Virtual"}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant={
|
||||
asset?.criticity === "HIGH"
|
||||
? "destructive"
|
||||
: asset?.criticity === "MEDIUM"
|
||||
? "warning"
|
||||
: asset?.criticity === "LOW"
|
||||
? "success"
|
||||
: "default"
|
||||
}
|
||||
className="px-3 py-0.5 text-xs font-medium"
|
||||
>
|
||||
{asset?.criticity}
|
||||
</Badge>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8 text-tertiary hover:bg-transparent hover:[&>svg]:text-danger"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
if (
|
||||
window.confirm(
|
||||
"Are you sure you want to delete this asset?",
|
||||
)
|
||||
) {
|
||||
deleteAsset({
|
||||
variables: {
|
||||
connections: [assetsConnection.assets.__id],
|
||||
input: {
|
||||
assetId: asset.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Trash2 className="h-4 w-4 transition-colors" />
|
||||
</Button>
|
||||
<ChevronRight className="h-4 w-4 text-tertiary" />
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<LoadAboveButton
|
||||
isLoading={isLoadingPrevious}
|
||||
hasMore={hasPrevious}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("before", pageInfo?.startCursor || "");
|
||||
prev.delete("after");
|
||||
return prev;
|
||||
});
|
||||
loadPrevious(ITEMS_PER_PAGE);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<LoadBelowButton
|
||||
isLoading={isLoadingNext}
|
||||
hasMore={hasNext}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("after", pageInfo?.endCursor || "");
|
||||
prev.delete("before");
|
||||
return prev;
|
||||
});
|
||||
loadNext(ITEMS_PER_PAGE);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</PageTemplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AssetsListView() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<AssetsListViewQueryType>(assetsListViewQuery);
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const after = searchParams.get("after");
|
||||
const before = searchParams.get("before");
|
||||
|
||||
// Skip the query if this was triggered by pagination
|
||||
if (isPaginationUpdate.current) {
|
||||
isPaginationUpdate.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loadQuery({
|
||||
organizationId: organizationId!,
|
||||
first: before ? undefined : ITEMS_PER_PAGE,
|
||||
after: after || undefined,
|
||||
last: before ? ITEMS_PER_PAGE : undefined,
|
||||
before: before || undefined,
|
||||
});
|
||||
}, [loadQuery, organizationId, searchParams]);
|
||||
|
||||
if (!queryRef) {
|
||||
return <AssetsListViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<AssetsListViewSkeleton />}>
|
||||
<AssetsListContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
|
||||
export function AssetsListViewSkeleton() {
|
||||
return (
|
||||
<PageTemplate
|
||||
title="Assets"
|
||||
description="Keep track of your organization's assets and their criticality levels."
|
||||
>
|
||||
<div className="space-y-2">
|
||||
{Array.from({ length: 5 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="flex items-center justify-between p-4 rounded-xl border bg-level-1"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<Skeleton className="h-8 w-8 rounded-full" />
|
||||
<div className="space-y-1">
|
||||
<Skeleton className="h-4 w-48" />
|
||||
<Skeleton className="h-3 w-32" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-8 w-8" />
|
||||
<Skeleton className="h-4 w-4" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
42
apps/console/src/pages/organizations/assets/NewAssetPage.tsx
Normal file
42
apps/console/src/pages/organizations/assets/NewAssetPage.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Suspense } from "react";
|
||||
import { ErrorBoundaryWithLocation } from "../ErrorBoundary";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
|
||||
const NewAssetView = lazy(() => import("./NewAssetView"));
|
||||
|
||||
export function NewAssetViewSkeleton() {
|
||||
return (
|
||||
<PageTemplate
|
||||
title="New Asset"
|
||||
description="Add a new asset to your organization."
|
||||
>
|
||||
<div className="space-y-6 max-w-2xl">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-64" />
|
||||
<Skeleton className="h-20 w-full" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-10 w-full" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-10 w-full" />
|
||||
</div>
|
||||
<Skeleton className="h-10 w-32" />
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export function NewAssetPage() {
|
||||
return (
|
||||
<Suspense fallback={<NewAssetViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<NewAssetView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
363
apps/console/src/pages/organizations/assets/NewAssetView.tsx
Normal file
363
apps/console/src/pages/organizations/assets/NewAssetView.tsx
Normal file
@@ -0,0 +1,363 @@
|
||||
import { useState, Suspense, useEffect } from "react";
|
||||
import { useNavigate, useParams } from "react-router";
|
||||
import { graphql, useMutation, ConnectionHandler, useQueryLoader, PreloadedQuery, usePreloadedQuery } from "react-relay";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { NewAssetViewCreateAssetMutation } from "./__generated__/NewAssetViewCreateAssetMutation.graphql";
|
||||
import { NewAssetViewQuery } from "./__generated__/NewAssetViewQuery.graphql";
|
||||
import PeopleSelector from "@/components/PeopleSelector";
|
||||
import { NewAssetViewSkeleton } from "./NewAssetPage";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { X } from "lucide-react";
|
||||
|
||||
const newAssetViewQuery = graphql`
|
||||
query NewAssetViewQuery($organizationId: ID!) {
|
||||
organization: node(id: $organizationId) {
|
||||
... on Organization {
|
||||
id
|
||||
...PeopleSelector_organization
|
||||
vendors(first: 100, orderBy: { direction: ASC, field: NAME }) @connection(key: "NewAssetView_vendors") {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const createAssetMutation = graphql`
|
||||
mutation NewAssetViewCreateAssetMutation(
|
||||
$input: CreateAssetInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
createAsset(input: $input) {
|
||||
assetEdge @prependEdge(connections: $connections) {
|
||||
node {
|
||||
id
|
||||
amount
|
||||
criticity
|
||||
assetType
|
||||
dataTypesStored
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
vendors {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
interface Vendor {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
interface Organization {
|
||||
readonly id?: string;
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: Vendor;
|
||||
} | null> | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
function EditableField({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
type = "text",
|
||||
helpText,
|
||||
required,
|
||||
min,
|
||||
}: {
|
||||
label: string;
|
||||
value: string | number;
|
||||
onChange: (value: string) => void;
|
||||
type?: string;
|
||||
helpText?: string;
|
||||
required?: boolean;
|
||||
min?: number;
|
||||
}) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">{label}</Label>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
type={type}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
min={min}
|
||||
/>
|
||||
{helpText && <p className="text-sm text-secondary">{helpText}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function NewAssetViewContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<NewAssetViewQuery>;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const { organizationId } = useParams();
|
||||
const [createAsset] = useMutation<NewAssetViewCreateAssetMutation>(createAssetMutation);
|
||||
const { toast } = useToast();
|
||||
const data = usePreloadedQuery(newAssetViewQuery, queryRef);
|
||||
|
||||
if (!data.organization) {
|
||||
return <div>Organization not found</div>;
|
||||
}
|
||||
|
||||
const organization = data.organization as Organization;
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
name: "",
|
||||
amount: 1,
|
||||
criticity: "MEDIUM" as "LOW" | "MEDIUM" | "HIGH",
|
||||
assetType: "VIRTUAL" as "PHYSICAL" | "VIRTUAL",
|
||||
dataTypesStored: "",
|
||||
ownerId: "",
|
||||
selectedVendorIds: [] as string[],
|
||||
});
|
||||
|
||||
type FormData = typeof formData;
|
||||
|
||||
const handleFieldChange = <K extends keyof FormData>(
|
||||
field: K,
|
||||
value: FormData[K]
|
||||
) => {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
[field]: value,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleVendorSelect = (vendorId: string) => {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
selectedVendorIds: prev.selectedVendorIds.includes(vendorId)
|
||||
? prev.selectedVendorIds.filter((id) => id !== vendorId)
|
||||
: [...prev.selectedVendorIds, vendorId],
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (!formData.ownerId) {
|
||||
toast({
|
||||
title: "Error",
|
||||
description: "Please select an owner",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
createAsset({
|
||||
variables: {
|
||||
connections: [
|
||||
ConnectionHandler.getConnectionID(
|
||||
organizationId!,
|
||||
"AssetsListView_assets",
|
||||
{
|
||||
orderBy: {
|
||||
direction: "ASC",
|
||||
field: "AMOUNT",
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
input: {
|
||||
organizationId: organizationId!,
|
||||
name: formData.name,
|
||||
amount: Number(formData.amount),
|
||||
criticity: formData.criticity,
|
||||
assetType: formData.assetType,
|
||||
dataTypesStored: formData.dataTypesStored,
|
||||
ownerId: formData.ownerId,
|
||||
vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined,
|
||||
},
|
||||
},
|
||||
onCompleted: () => {
|
||||
toast({
|
||||
title: "Success",
|
||||
description: "Asset created successfully",
|
||||
variant: "default",
|
||||
});
|
||||
navigate(`/organizations/${organizationId}/assets`);
|
||||
},
|
||||
onError: (error) => {
|
||||
toast({
|
||||
title: "Error",
|
||||
description: error.message || "Failed to create asset",
|
||||
variant: "destructive",
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const vendors = (organization.vendors?.edges || [])
|
||||
.map((edge) => edge?.node)
|
||||
.filter((node): node is Vendor => node != null);
|
||||
|
||||
return (
|
||||
<PageTemplate
|
||||
title="Create Asset"
|
||||
description="Add a new asset to your organization"
|
||||
>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="max-w-2xl space-y-6">
|
||||
<EditableField
|
||||
label="Name"
|
||||
value={formData.name}
|
||||
onChange={(value) => handleFieldChange("name", value)}
|
||||
required
|
||||
/>
|
||||
<EditableField
|
||||
label="Amount"
|
||||
value={formData.amount}
|
||||
onChange={(value) => handleFieldChange("amount", Number(value))}
|
||||
type="number"
|
||||
min={1}
|
||||
required
|
||||
/>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Owner</Label>
|
||||
<PeopleSelector
|
||||
organizationRef={data.organization}
|
||||
selectedPersonId={formData.ownerId}
|
||||
onSelect={(value) => handleFieldChange("ownerId", value)}
|
||||
placeholder="Select asset owner"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Vendors</Label>
|
||||
<Select
|
||||
value=""
|
||||
onValueChange={handleVendorSelect}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select vendors" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{vendors.map((vendor) => (
|
||||
<SelectItem key={vendor.id} value={vendor.id}>
|
||||
{vendor.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex flex-wrap gap-2 mt-2">
|
||||
{formData.selectedVendorIds.map((vendorId) => {
|
||||
const vendor = vendors.find((v) => v.id === vendorId);
|
||||
if (!vendor) return null;
|
||||
return (
|
||||
<Badge key={vendorId} variant="secondary" className="flex items-center gap-1">
|
||||
{vendor.name}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleVendorSelect(vendorId)}
|
||||
className="hover:bg-secondary-hover rounded-full p-0.5"
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Criticity Level</Label>
|
||||
<Select
|
||||
value={formData.criticity}
|
||||
onValueChange={(value: string) =>
|
||||
handleFieldChange("criticity", value as "LOW" | "MEDIUM" | "HIGH")}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select criticity level" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="LOW">Low</SelectItem>
|
||||
<SelectItem value="MEDIUM">Medium</SelectItem>
|
||||
<SelectItem value="HIGH">High</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Asset Type</Label>
|
||||
<Select
|
||||
value={formData.assetType}
|
||||
onValueChange={(value: string) =>
|
||||
handleFieldChange("assetType", value as "PHYSICAL" | "VIRTUAL")}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select asset type" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="PHYSICAL">Physical</SelectItem>
|
||||
<SelectItem value="VIRTUAL">Virtual</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Data Types Stored</Label>
|
||||
<Textarea
|
||||
value={formData.dataTypesStored}
|
||||
onChange={(e) => handleFieldChange("dataTypesStored", e.target.value)}
|
||||
placeholder="Enter the types of data stored in this asset..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button type="submit">Create Asset</Button>
|
||||
</div>
|
||||
</form>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export default function NewAssetView() {
|
||||
const { organizationId } = useParams();
|
||||
const [queryRef, loadQuery] = useQueryLoader<NewAssetViewQuery>(newAssetViewQuery);
|
||||
|
||||
useEffect(() => {
|
||||
loadQuery({ organizationId: organizationId! });
|
||||
}, [loadQuery, organizationId]);
|
||||
|
||||
if (!queryRef) {
|
||||
return <NewAssetViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<NewAssetViewSkeleton />}>
|
||||
<NewAssetViewContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
525
apps/console/src/pages/organizations/assets/__generated__/AssetViewQuery.graphql.ts
generated
Normal file
525
apps/console/src/pages/organizations/assets/__generated__/AssetViewQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,525 @@
|
||||
/**
|
||||
* @generated SignedSource<<d65c60ca11d871511fd92f55e8aa321d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type AssetType = "PHYSICAL" | "VIRTUAL";
|
||||
export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type AssetViewQuery$variables = {
|
||||
assetId: string;
|
||||
organizationId: string;
|
||||
};
|
||||
export type AssetViewQuery$data = {
|
||||
readonly node: {
|
||||
readonly amount?: number;
|
||||
readonly assetType?: AssetType;
|
||||
readonly createdAt?: string;
|
||||
readonly criticity?: CriticityLevel;
|
||||
readonly dataTypesStored?: string;
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
readonly owner?: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly updatedAt?: string;
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
readonly organization: {
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
|
||||
};
|
||||
};
|
||||
export type AssetViewQuery = {
|
||||
response: AssetViewQuery$data;
|
||||
variables: AssetViewQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "assetId"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "assetId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
v9 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v8/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
v13 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v14 = {
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "NAME"
|
||||
}
|
||||
},
|
||||
v15 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v16 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
},
|
||||
v17 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v18 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v15/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v16/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v17/*: any*/)
|
||||
],
|
||||
v19 = {
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
},
|
||||
v20 = [
|
||||
(v19/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "FULL_NAME"
|
||||
}
|
||||
}
|
||||
],
|
||||
v21 = [
|
||||
"orderBy"
|
||||
],
|
||||
v22 = [
|
||||
(v19/*: any*/),
|
||||
(v14/*: any*/)
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "AssetViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
],
|
||||
"type": "Asset",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v13/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "PeopleSelector_organization"
|
||||
},
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "vendors",
|
||||
"args": [
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__AssetView_vendors_connection",
|
||||
"plural": false,
|
||||
"selections": (v18/*: any*/),
|
||||
"storageKey": "__AssetView_vendors_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "AssetViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v15/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
],
|
||||
"type": "Asset",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v13/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v15/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v20/*: any*/),
|
||||
"concreteType": "PeopleConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "peoples",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PeopleEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
},
|
||||
(v15/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v16/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v17/*: any*/)
|
||||
],
|
||||
"storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v20/*: any*/),
|
||||
"filters": (v21/*: any*/),
|
||||
"handle": "connection",
|
||||
"key": "PeopleSelector_organization_peoples",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "peoples"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v22/*: any*/),
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": (v18/*: any*/),
|
||||
"storageKey": "vendors(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v22/*: any*/),
|
||||
"filters": (v21/*: any*/),
|
||||
"handle": "connection",
|
||||
"key": "AssetView_vendors",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "vendors"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "90ae7758672dc097178bd9ab462b91fa",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
{
|
||||
"count": null,
|
||||
"cursor": null,
|
||||
"direction": "forward",
|
||||
"path": [
|
||||
"organization",
|
||||
"vendors"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "AssetViewQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query AssetViewQuery(\n $assetId: ID!\n $organizationId: ID!\n) {\n node(id: $assetId) {\n __typename\n ... on Asset {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n ... on Organization {\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "e2b32fe12d61063010d5a3b0a818331b";
|
||||
|
||||
export default node;
|
||||
230
apps/console/src/pages/organizations/assets/__generated__/AssetViewUpdateAssetMutation.graphql.ts
generated
Normal file
230
apps/console/src/pages/organizations/assets/__generated__/AssetViewUpdateAssetMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,230 @@
|
||||
/**
|
||||
* @generated SignedSource<<78e1b25933acfc51a857df68fe5a595c>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type AssetType = "PHYSICAL" | "VIRTUAL";
|
||||
export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type UpdateAssetInput = {
|
||||
amount?: number | null | undefined;
|
||||
assetType?: AssetType | null | undefined;
|
||||
criticity?: CriticityLevel | null | undefined;
|
||||
dataTypesStored?: string | null | undefined;
|
||||
id: string;
|
||||
name?: string | null | undefined;
|
||||
ownerId?: string | null | undefined;
|
||||
vendorIds?: ReadonlyArray<string> | null | undefined;
|
||||
};
|
||||
export type AssetViewUpdateAssetMutation$variables = {
|
||||
input: UpdateAssetInput;
|
||||
};
|
||||
export type AssetViewUpdateAssetMutation$data = {
|
||||
readonly updateAsset: {
|
||||
readonly asset: {
|
||||
readonly amount: number;
|
||||
readonly assetType: AssetType;
|
||||
readonly criticity: CriticityLevel;
|
||||
readonly dataTypesStored: string;
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly updatedAt: string;
|
||||
readonly vendors: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type AssetViewUpdateAssetMutation = {
|
||||
response: AssetViewUpdateAssetMutation$data;
|
||||
variables: AssetViewUpdateAssetMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "UpdateAssetPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "updateAsset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "asset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "AssetViewUpdateAssetMutation",
|
||||
"selections": (v3/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "AssetViewUpdateAssetMutation",
|
||||
"selections": (v3/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "7a2a8504da4e44785e141f7118760c26",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "AssetViewUpdateAssetMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation AssetViewUpdateAssetMutation(\n $input: UpdateAssetInput!\n) {\n updateAsset(input: $input) {\n asset {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n updatedAt\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "c57436cc8a742b3b48987bc702a2fa0e";
|
||||
|
||||
export default node;
|
||||
132
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewDeleteAssetMutation.graphql.ts
generated
Normal file
132
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewDeleteAssetMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* @generated SignedSource<<e56af42bed63f99011e9565c0364ea0c>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type DeleteAssetInput = {
|
||||
assetId: string;
|
||||
};
|
||||
export type AssetsListViewDeleteAssetMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: DeleteAssetInput;
|
||||
};
|
||||
export type AssetsListViewDeleteAssetMutation$data = {
|
||||
readonly deleteAsset: {
|
||||
readonly deletedAssetId: string;
|
||||
};
|
||||
};
|
||||
export type AssetsListViewDeleteAssetMutation = {
|
||||
response: AssetsListViewDeleteAssetMutation$data;
|
||||
variables: AssetsListViewDeleteAssetMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "deletedAssetId",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "AssetsListViewDeleteAssetMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "DeleteAssetPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "deleteAsset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "AssetsListViewDeleteAssetMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "DeleteAssetPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "deleteAsset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "deleteEdge",
|
||||
"key": "",
|
||||
"kind": "ScalarHandle",
|
||||
"name": "deletedAssetId",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "d7987550f982b36de3911f3e7c8e9677",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "AssetsListViewDeleteAssetMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation AssetsListViewDeleteAssetMutation(\n $input: DeleteAssetInput!\n) {\n deleteAsset(input: $input) {\n deletedAssetId\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "3f576871aa0d4495afcca5ecaf1aefca";
|
||||
|
||||
export default node;
|
||||
404
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewPaginationQuery.graphql.ts
generated
Normal file
404
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewPaginationQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,404 @@
|
||||
/**
|
||||
* @generated SignedSource<<80b2431e63ecff11f93733ef7b235bb8>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type AssetsListViewPaginationQuery$variables = {
|
||||
after?: string | null | undefined;
|
||||
before?: string | null | undefined;
|
||||
first?: number | null | undefined;
|
||||
id: string;
|
||||
last?: number | null | undefined;
|
||||
};
|
||||
export type AssetsListViewPaginationQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"AssetsListView_assets">;
|
||||
};
|
||||
};
|
||||
export type AssetsListViewPaginationQuery = {
|
||||
response: AssetsListViewPaginationQuery$data;
|
||||
variables: AssetsListViewPaginationQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "after"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "before"
|
||||
},
|
||||
v2 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "first"
|
||||
},
|
||||
v3 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "id"
|
||||
},
|
||||
v4 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "last"
|
||||
},
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "id"
|
||||
}
|
||||
],
|
||||
v6 = {
|
||||
"kind": "Variable",
|
||||
"name": "after",
|
||||
"variableName": "after"
|
||||
},
|
||||
v7 = {
|
||||
"kind": "Variable",
|
||||
"name": "before",
|
||||
"variableName": "before"
|
||||
},
|
||||
v8 = {
|
||||
"kind": "Variable",
|
||||
"name": "first",
|
||||
"variableName": "first"
|
||||
},
|
||||
v9 = {
|
||||
"kind": "Variable",
|
||||
"name": "last",
|
||||
"variableName": "last"
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = [
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "AMOUNT"
|
||||
}
|
||||
}
|
||||
],
|
||||
v13 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "AssetsListViewPaginationQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"args": [
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/)
|
||||
],
|
||||
"kind": "FragmentSpread",
|
||||
"name": "AssetsListView_assets"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "AssetsListViewPaginationQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"concreteType": "AssetConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "assets",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "AssetEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasPreviousPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "startCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
"handle": "connection",
|
||||
"key": "AssetsListView_assets",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "assets"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "52c46484b71323276f81a31b48987698",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "AssetsListViewPaginationQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query AssetsListViewPaginationQuery(\n $after: CursorKey\n $before: CursorKey\n $first: Int\n $last: Int\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...AssetsListView_assets_pbnwq\n id\n }\n}\n\nfragment AssetsListView_assets_pbnwq on Organization {\n id\n assets(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: AMOUNT}) {\n edges {\n node {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "b7ef7bd1063b9a578b82124ebbdbbbd2";
|
||||
|
||||
export default node;
|
||||
404
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewQuery.graphql.ts
generated
Normal file
404
apps/console/src/pages/organizations/assets/__generated__/AssetsListViewQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,404 @@
|
||||
/**
|
||||
* @generated SignedSource<<e4043a80f688b96635dde8a9cff9f7e7>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type AssetsListViewQuery$variables = {
|
||||
after?: string | null | undefined;
|
||||
before?: string | null | undefined;
|
||||
first?: number | null | undefined;
|
||||
last?: number | null | undefined;
|
||||
organizationId: string;
|
||||
};
|
||||
export type AssetsListViewQuery$data = {
|
||||
readonly organization: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"AssetsListView_assets">;
|
||||
};
|
||||
};
|
||||
export type AssetsListViewQuery = {
|
||||
response: AssetsListViewQuery$data;
|
||||
variables: AssetsListViewQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "after"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "before"
|
||||
},
|
||||
v2 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "first"
|
||||
},
|
||||
v3 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "last"
|
||||
},
|
||||
v4 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
},
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v6 = {
|
||||
"kind": "Variable",
|
||||
"name": "after",
|
||||
"variableName": "after"
|
||||
},
|
||||
v7 = {
|
||||
"kind": "Variable",
|
||||
"name": "before",
|
||||
"variableName": "before"
|
||||
},
|
||||
v8 = {
|
||||
"kind": "Variable",
|
||||
"name": "first",
|
||||
"variableName": "first"
|
||||
},
|
||||
v9 = {
|
||||
"kind": "Variable",
|
||||
"name": "last",
|
||||
"variableName": "last"
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = [
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "AMOUNT"
|
||||
}
|
||||
}
|
||||
],
|
||||
v13 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "AssetsListViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"args": [
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/)
|
||||
],
|
||||
"kind": "FragmentSpread",
|
||||
"name": "AssetsListView_assets"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v4/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v0/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "AssetsListViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"concreteType": "AssetConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "assets",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "AssetEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasPreviousPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "startCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
"handle": "connection",
|
||||
"key": "AssetsListView_assets",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "assets"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "dd13d90d325e9f1eaa4d7be061c5a242",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "AssetsListViewQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query AssetsListViewQuery(\n $organizationId: ID!\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n organization: node(id: $organizationId) {\n __typename\n ...AssetsListView_assets_pbnwq\n id\n }\n}\n\nfragment AssetsListView_assets_pbnwq on Organization {\n id\n assets(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: AMOUNT}) {\n edges {\n node {\n id\n name\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "ce9a262aef17deeb6a9ca87b35014fb6";
|
||||
|
||||
export default node;
|
||||
346
apps/console/src/pages/organizations/assets/__generated__/AssetsListView_assets.graphql.ts
generated
Normal file
346
apps/console/src/pages/organizations/assets/__generated__/AssetsListView_assets.graphql.ts
generated
Normal file
@@ -0,0 +1,346 @@
|
||||
/**
|
||||
* @generated SignedSource<<2ddf214d0baa06962b8ffde078089c42>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type AssetType = "PHYSICAL" | "VIRTUAL";
|
||||
export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type AssetsListView_assets$data = {
|
||||
readonly assets: {
|
||||
readonly __id: string;
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly amount: number;
|
||||
readonly assetType: AssetType;
|
||||
readonly createdAt: string;
|
||||
readonly criticity: CriticityLevel;
|
||||
readonly dataTypesStored: string;
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly updatedAt: string;
|
||||
readonly vendors: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
}>;
|
||||
readonly pageInfo: {
|
||||
readonly endCursor: string | null | undefined;
|
||||
readonly hasNextPage: boolean;
|
||||
readonly hasPreviousPage: boolean;
|
||||
readonly startCursor: string | null | undefined;
|
||||
};
|
||||
};
|
||||
readonly id: string;
|
||||
readonly " $fragmentType": "AssetsListView_assets";
|
||||
};
|
||||
export type AssetsListView_assets$key = {
|
||||
readonly " $data"?: AssetsListView_assets$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"AssetsListView_assets">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = [
|
||||
"assets"
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"argumentDefinitions": [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "after"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "before"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "first"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "last"
|
||||
}
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": {
|
||||
"connection": [
|
||||
{
|
||||
"count": null,
|
||||
"cursor": null,
|
||||
"direction": "bidirectional",
|
||||
"path": (v0/*: any*/)
|
||||
}
|
||||
],
|
||||
"refetch": {
|
||||
"connection": {
|
||||
"forward": {
|
||||
"count": "first",
|
||||
"cursor": "after"
|
||||
},
|
||||
"backward": {
|
||||
"count": "last",
|
||||
"cursor": "before"
|
||||
},
|
||||
"path": (v0/*: any*/)
|
||||
},
|
||||
"fragmentPathInResult": [
|
||||
"node"
|
||||
],
|
||||
"operation": require('./AssetsListViewPaginationQuery.graphql'),
|
||||
"identifierInfo": {
|
||||
"identifierField": "id",
|
||||
"identifierQueryVariableName": "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "AssetsListView_assets",
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": "assets",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "AMOUNT"
|
||||
}
|
||||
}
|
||||
],
|
||||
"concreteType": "AssetConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__AssetsListView_assets_connection",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "AssetEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasPreviousPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "startCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "__AssetsListView_assets_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"AMOUNT\"})"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "b7ef7bd1063b9a578b82124ebbdbbbd2";
|
||||
|
||||
export default node;
|
||||
156
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewAddAssetVendorMutation.graphql.ts
generated
Normal file
156
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewAddAssetVendorMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* @generated SignedSource<<29c3688b6280f97bc3713b4e107f012a>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type AddAssetVendorInput = {
|
||||
assetId: string;
|
||||
vendorId: string;
|
||||
};
|
||||
export type NewAssetViewAddAssetVendorMutation$variables = {
|
||||
input: AddAssetVendorInput;
|
||||
};
|
||||
export type NewAssetViewAddAssetVendorMutation$data = {
|
||||
readonly addAssetVendor: {
|
||||
readonly asset: {
|
||||
readonly id: string;
|
||||
readonly vendors: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type NewAssetViewAddAssetVendorMutation = {
|
||||
response: NewAssetViewAddAssetVendorMutation$data;
|
||||
variables: NewAssetViewAddAssetVendorMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "AddAssetVendorPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "addAssetVendor",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "asset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "NewAssetViewAddAssetVendorMutation",
|
||||
"selections": (v2/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "NewAssetViewAddAssetVendorMutation",
|
||||
"selections": (v2/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "5e1ee36fdf08abfcfc75ffe7e9f6f81f",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "NewAssetViewAddAssetVendorMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation NewAssetViewAddAssetVendorMutation(\n $input: AddAssetVendorInput!\n) {\n addAssetVendor(input: $input) {\n asset {\n id\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "856e34e5fb3ca94b3cc38fe7edca156d";
|
||||
|
||||
export default node;
|
||||
272
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewCreateAssetMutation.graphql.ts
generated
Normal file
272
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewCreateAssetMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* @generated SignedSource<<d3201cc709c2b7c947f4875520fb8960>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type AssetType = "PHYSICAL" | "VIRTUAL";
|
||||
export type CriticityLevel = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type CreateAssetInput = {
|
||||
amount: number;
|
||||
assetType: AssetType;
|
||||
criticity?: CriticityLevel;
|
||||
dataTypesStored: string;
|
||||
name: string;
|
||||
organizationId: string;
|
||||
ownerId: string;
|
||||
vendorIds?: ReadonlyArray<string> | null | undefined;
|
||||
};
|
||||
export type NewAssetViewCreateAssetMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: CreateAssetInput;
|
||||
};
|
||||
export type NewAssetViewCreateAssetMutation$data = {
|
||||
readonly createAsset: {
|
||||
readonly assetEdge: {
|
||||
readonly node: {
|
||||
readonly amount: number;
|
||||
readonly assetType: AssetType;
|
||||
readonly criticity: CriticityLevel;
|
||||
readonly dataTypesStored: string;
|
||||
readonly id: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly vendors: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type NewAssetViewCreateAssetMutation = {
|
||||
response: NewAssetViewCreateAssetMutation$data;
|
||||
variables: NewAssetViewCreateAssetMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "AssetEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "assetEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Asset",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "criticity",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "assetType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "dataTypesStored",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "NewAssetViewCreateAssetMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "CreateAssetPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "createAsset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "NewAssetViewCreateAssetMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "CreateAssetPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "createAsset",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "prependEdge",
|
||||
"key": "",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "assetEdge",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "2c2aaa87fd4a17b47fb6207c9be861b5",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "NewAssetViewCreateAssetMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation NewAssetViewCreateAssetMutation(\n $input: CreateAssetInput!\n) {\n createAsset(input: $input) {\n assetEdge {\n node {\n id\n amount\n criticity\n assetType\n dataTypesStored\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "56f34aeeaca0d8165b8145c83b30fe67";
|
||||
|
||||
export default node;
|
||||
341
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewQuery.graphql.ts
generated
Normal file
341
apps/console/src/pages/organizations/assets/__generated__/NewAssetViewQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,341 @@
|
||||
/**
|
||||
* @generated SignedSource<<166441573cdbf7c3c7aaccc74eb2edc7>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type NewAssetViewQuery$variables = {
|
||||
organizationId: string;
|
||||
};
|
||||
export type NewAssetViewQuery$data = {
|
||||
readonly organization: {
|
||||
readonly id?: string;
|
||||
readonly vendors?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
|
||||
};
|
||||
};
|
||||
export type NewAssetViewQuery = {
|
||||
response: NewAssetViewQuery$data;
|
||||
variables: NewAssetViewQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "NAME"
|
||||
}
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
},
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "VendorEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Vendor",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v6/*: any*/)
|
||||
],
|
||||
v8 = {
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
},
|
||||
v9 = [
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "FULL_NAME"
|
||||
}
|
||||
}
|
||||
],
|
||||
v10 = [
|
||||
"orderBy"
|
||||
],
|
||||
v11 = [
|
||||
(v8/*: any*/),
|
||||
(v3/*: any*/)
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "NewAssetViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "PeopleSelector_organization"
|
||||
},
|
||||
{
|
||||
"alias": "vendors",
|
||||
"args": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__NewAssetView_vendors_connection",
|
||||
"plural": false,
|
||||
"selections": (v7/*: any*/),
|
||||
"storageKey": "__NewAssetView_vendors_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "NewAssetViewQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "PeopleConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "peoples",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PeopleEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
},
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v6/*: any*/)
|
||||
],
|
||||
"storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v9/*: any*/),
|
||||
"filters": (v10/*: any*/),
|
||||
"handle": "connection",
|
||||
"key": "PeopleSelector_organization_peoples",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "peoples"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
"plural": false,
|
||||
"selections": (v7/*: any*/),
|
||||
"storageKey": "vendors(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"filters": (v10/*: any*/),
|
||||
"handle": "connection",
|
||||
"key": "NewAssetView_vendors",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "vendors"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "feaf4563ef8c073edbbbfbb935b1a802",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
{
|
||||
"count": null,
|
||||
"cursor": null,
|
||||
"direction": "forward",
|
||||
"path": [
|
||||
"organization",
|
||||
"vendors"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "NewAssetViewQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query NewAssetViewQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9f48276b2f88367acfd95b4d95167e73";
|
||||
|
||||
export default node;
|
||||
40
apps/console/src/pages/organizations/assets/__generated__/NewAssetView_organization.graphql.ts
generated
Normal file
40
apps/console/src/pages/organizations/assets/__generated__/NewAssetView_organization.graphql.ts
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @generated SignedSource<<cbf5b6ff35e9f54f26becd5378ccb4cd>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type NewAssetView_organization$data = {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
|
||||
readonly " $fragmentType": "NewAssetView_organization";
|
||||
};
|
||||
export type NewAssetView_organization$key = {
|
||||
readonly " $data"?: NewAssetView_organization$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"NewAssetView_organization">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "NewAssetView_organization",
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "PeopleSelector_organization"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "96eb63be6b58e29a7bd3dafaaa07d5a4";
|
||||
|
||||
export default node;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Suspense, useEffect, useTransition } from "react";
|
||||
import { Suspense, useEffect, useTransition, useRef } from "react";
|
||||
import {
|
||||
graphql,
|
||||
PreloadedQuery,
|
||||
@@ -155,6 +155,7 @@ function PeopleListContent({
|
||||
const [deletePeople] =
|
||||
useMutation<PeopleListViewDeletePeopleMutation>(deletePeopleMutation);
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
const {
|
||||
data: peoplesConnection,
|
||||
@@ -258,6 +259,7 @@ function PeopleListContent({
|
||||
hasMore={hasPrevious}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("before", pageInfo?.startCursor || "");
|
||||
prev.delete("after");
|
||||
@@ -272,6 +274,7 @@ function PeopleListContent({
|
||||
hasMore={hasNext}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("after", pageInfo?.endCursor || "");
|
||||
prev.delete("before");
|
||||
@@ -290,13 +293,19 @@ export default function PeopleListView() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<PeopleListViewQueryType>(peopleListViewQuery);
|
||||
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const after = searchParams.get("after");
|
||||
const before = searchParams.get("before");
|
||||
|
||||
// Skip the query if this was triggered by pagination
|
||||
if (isPaginationUpdate.current) {
|
||||
isPaginationUpdate.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loadQuery({
|
||||
organizationId: organizationId!,
|
||||
first: before ? undefined : ITEMS_PER_PAGE,
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
useEffect,
|
||||
useState,
|
||||
useTransition,
|
||||
useRef,
|
||||
} from "react";
|
||||
import type { ListRiskViewQuery } from "./__generated__/ListRiskViewQuery.graphql";
|
||||
import { useParams, useSearchParams } from "react-router";
|
||||
@@ -532,6 +533,7 @@ function ListRiskViewContent({
|
||||
const [, startTransition] = useTransition();
|
||||
const { organizationId } = useParams<{ organizationId: string }>();
|
||||
const { toast } = useToast();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
// State for delete confirmation dialog
|
||||
const [riskToDelete, setRiskToDelete] = useState<{
|
||||
@@ -656,6 +658,7 @@ function ListRiskViewContent({
|
||||
hasMore={hasPrevious}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("before", pageInfo?.startCursor || "");
|
||||
prev.delete("after");
|
||||
@@ -923,6 +926,7 @@ function ListRiskViewContent({
|
||||
hasMore={hasNext}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("after", pageInfo?.endCursor || "");
|
||||
prev.delete("before");
|
||||
@@ -941,13 +945,19 @@ export default function ListRiskView() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<ListRiskViewQuery>(listRiskViewQuery);
|
||||
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const after = searchParams.get("after");
|
||||
const before = searchParams.get("before");
|
||||
|
||||
// Skip the query if this was triggered by pagination
|
||||
if (isPaginationUpdate.current) {
|
||||
isPaginationUpdate.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loadQuery({
|
||||
organizationId: organizationId!,
|
||||
first: before ? undefined : defaultPageSize,
|
||||
|
||||
@@ -209,6 +209,7 @@ function ListVendorContent({
|
||||
useMutation<ListVendorViewDeleteVendorMutation>(deleteVendorMutation);
|
||||
const { organizationId } = useParams();
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const loadVendorsData = async () => {
|
||||
@@ -698,6 +699,7 @@ function ListVendorContent({
|
||||
hasMore={hasPrevious}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("before", pageInfo?.startCursor || "");
|
||||
prev.delete("after");
|
||||
@@ -712,6 +714,7 @@ function ListVendorContent({
|
||||
hasMore={hasNext}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("after", pageInfo?.endCursor || "");
|
||||
prev.delete("before");
|
||||
@@ -729,13 +732,19 @@ export default function ListVendorView() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<ListVendorViewQuery>(listVendorViewQuery);
|
||||
|
||||
const { organizationId } = useParams();
|
||||
const isPaginationUpdate = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const after = searchParams.get("after");
|
||||
const before = searchParams.get("before");
|
||||
|
||||
// Skip the query if this was triggered by pagination
|
||||
if (isPaginationUpdate.current) {
|
||||
isPaginationUpdate.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loadQuery({
|
||||
organizationId: organizationId!,
|
||||
first: before ? undefined : ITEMS_PER_PAGE,
|
||||
@@ -743,7 +752,7 @@ export default function ListVendorView() {
|
||||
last: before ? ITEMS_PER_PAGE : undefined,
|
||||
before: before || undefined,
|
||||
});
|
||||
}, [loadQuery, organizationId]);
|
||||
}, [loadQuery, organizationId, searchParams]);
|
||||
|
||||
if (!queryRef) {
|
||||
return <ListVendorViewSkeleton />;
|
||||
|
||||
Reference in New Issue
Block a user