diff --git a/app/data/jsonSchemaForm/projectRevisionSchema.ts b/app/data/jsonSchemaForm/projectRevisionSchema.ts index f5d199396b..187674cfba 100644 --- a/app/data/jsonSchemaForm/projectRevisionSchema.ts +++ b/app/data/jsonSchemaForm/projectRevisionSchema.ts @@ -46,15 +46,7 @@ export const createProjectRevisionSchema = { export const viewProjectRevisionSchema = { $schema: "http://json-schema.org/draft-07/schema", type: "object", - required: ["revisionType"], properties: { - revisionType: { - type: "string", - title: "Revision Type", - default: undefined, - anyOf: undefined, - enum: undefined, - }, changeReason: { type: "string", title: "General Comments", @@ -106,36 +98,6 @@ export const viewProjectRevisionSchema = { uniqueItems: true, }, }, - dependencies: { - revisionType: { - oneOf: [ - { - properties: { - revisionType: { - const: !"Amendment", - }, - }, - }, - { - properties: { - revisionType: { - const: "Amendment", - }, - amendmentTypes: { - type: "array", - title: "Amendment Types", - items: { - type: "string", - enum: [], - }, - uniqueItems: true, - }, - }, - required: ["amendmentTypes"], - }, - ], - }, - }, }; export const projectRevisionUISchema = { diff --git a/app/pages/cif/project-revision/[projectRevision]/edit.tsx b/app/pages/cif/project-revision/[projectRevision]/edit.tsx index 5207264cba..9b6b0d1a28 100644 --- a/app/pages/cif/project-revision/[projectRevision]/edit.tsx +++ b/app/pages/cif/project-revision/[projectRevision]/edit.tsx @@ -15,10 +15,7 @@ import { useState } from "react"; import { graphql, usePreloadedQuery } from "react-relay/hooks"; import { RelayProps, withRelay } from "relay-nextjs"; import { editProjectRevisionQuery } from "__generated__/editProjectRevisionQuery.graphql"; -import { - buildProjectRevisionSchema, - createProjectRevisionUISchema, -} from "./view"; +import { buildProjectRevisionSchema } from "./view"; import DangerAlert from "lib/theme/ConfirmationAlert"; import { Button } from "@button-inc/bcgov-theme"; import { useDeleteProjectRevisionMutation } from "mutations/ProjectRevision/deleteProjectRevision"; @@ -83,8 +80,7 @@ export function ProjectRevisionEdit({ }: RelayProps<{}, editProjectRevisionQuery>) { const router = useRouter(); const query = usePreloadedQuery(EditProjectRevisionQuery, preloadedQuery); - const { session, projectRevision, allRevisionTypes, allRevisionStatuses } = - query; + const { session, projectRevision, allRevisionStatuses } = query; const { id, revisionType, rowId, typeRowNumber, projectByProjectId } = projectRevision; @@ -143,11 +139,10 @@ export function ProjectRevisionEdit({ id={`form-${id}`} className="project-revision-edit-form" schema={buildProjectRevisionSchema( - allRevisionTypes.edges, filteredRevisionStatuses, revisionType )} - uiSchema={createProjectRevisionUISchema(projectRevisionUISchema)} + uiSchema={projectRevisionUISchema} ObjectFieldTemplate={EmptyObjectFieldTemplate} theme={readOnlyTheme} onChange={onChange} diff --git a/app/pages/cif/project-revision/[projectRevision]/view.tsx b/app/pages/cif/project-revision/[projectRevision]/view.tsx index 4f7cb5552e..b3cb2d048a 100644 --- a/app/pages/cif/project-revision/[projectRevision]/view.tsx +++ b/app/pages/cif/project-revision/[projectRevision]/view.tsx @@ -48,15 +48,6 @@ export const ViewProjectRevisionQuery = graphql` ...ChangeReasonWidget_projectRevision ...RevisionRecordHistory_projectRevision } - allRevisionTypes { - # type is passed to the helper function that builds the schema - # eslint-disable-next-line relay/unused-fields - edges { - node { - type - } - } - } allRevisionStatuses(orderBy: SORTING_ORDER_ASC) { # node is passed to the helper function that builds the schema # eslint-disable-next-line relay/unused-fields @@ -73,23 +64,10 @@ export const ViewProjectRevisionQuery = graphql` `; export const buildProjectRevisionSchema = ( - allRevisionTypesEdges: viewProjectRevisionQuery$data["allRevisionTypes"]["edges"], allRevisionStatusesEdges: viewProjectRevisionQuery$data["allRevisionStatuses"]["edges"], revisionType: string ): JSONSchema7 => { const schema = viewProjectRevisionSchema; - schema.properties.revisionType = { - ...schema.properties.revisionType, - anyOf: allRevisionTypesEdges.map(({ node }) => { - return { - type: "string", - title: node.type, - enum: [node.type], - value: node.type, - } as JSONSchema7Definition; - }), - }; - schema.properties.revisionStatus = { ...schema.properties.revisionStatus, anyOf: allRevisionStatusesEdges.map(({ node }) => { @@ -109,18 +87,11 @@ export const buildProjectRevisionSchema = ( return schema as JSONSchema7; }; -export const createProjectRevisionUISchema = (uiSchema) => { - const localUiSchema = JSON.parse(JSON.stringify(uiSchema)); - localUiSchema.revisionType["ui:readonly"] = true; - return localUiSchema; -}; - export function ProjectRevisionView({ preloadedQuery, }: RelayProps<{}, viewProjectRevisionQuery>) { const query = usePreloadedQuery(ViewProjectRevisionQuery, preloadedQuery); - const { session, projectRevision, allRevisionTypes, allRevisionStatuses } = - query; + const { session, projectRevision, allRevisionStatuses } = query; const taskList = (