Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revision does not exit if you change project #1372

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
24 changes: 12 additions & 12 deletions backend/api/Features/Prosp/Services/ProspSharepointImportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ private async Task<List<DriveItemDto>> GetDeltaDriveItemCollectionFromSite(strin
}

return driveItemsDelta.Select(x => new DriveItemDto
{
Name = x.Name,
Id = x.Id,
SharepointFileUrl = null,
CreatedDateTime = x.CreatedDateTime,
Content = x.Content,
Size = x.Size,
SharepointIds = x.SharepointIds,
CreatedBy = x.CreatedBy,
LastModifiedBy = x.LastModifiedBy,
LastModifiedDateTime = x.LastModifiedDateTime
})
{
Name = x.Name,
Id = x.Id,
SharepointFileUrl = null,
CreatedDateTime = x.CreatedDateTime,
Content = x.Content,
Size = x.Size,
SharepointIds = x.SharepointIds,
CreatedBy = x.CreatedBy,
LastModifiedBy = x.LastModifiedBy,
LastModifiedDateTime = x.LastModifiedDateTime
})
.ToList();
}

Expand Down
28 changes: 26 additions & 2 deletions frontend/src/Hooks/useRevision.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useState } from "react"
import { useQueryClient } from "@tanstack/react-query"
import { useEffect, useState } from "react"
import { useQuery, useQueryClient } from "@tanstack/react-query"
import { useNavigate, useParams } from "react-router-dom"
import { useModuleCurrentContext } from "@equinor/fusion-framework-react-module-context"

import { GetProjectService } from "@/Services/ProjectService"
import { useProjectContext } from "@/Context/ProjectContext"
import { projectQueryFn } from "@/Services/QueryFunctions"

export const useRevisions = () => {
const { isRevision, setIsRevision, projectId } = useProjectContext()
Expand Down Expand Up @@ -54,6 +55,29 @@ export const useRevisions = () => {
currentRevisionId: string | undefined,
) => isRevision && currentRevisionId === revisionId

const externalId = currentContext?.externalId
const { data: projectApiData } = useQuery({
queryKey: ["projectApiData", externalId],
queryFn: () => projectQueryFn(externalId),
enabled: !!externalId,
})

useEffect(() => {
let timeoutId: NodeJS.Timeout | undefined

if (projectApiData && !projectApiData?.revisionsDetailsList.find((r: Components.Schemas.RevisionDetailsDto) => r.revisionId === revisionId)) {
timeoutId = setTimeout(() => {
exitRevisionView()
}, 150)
}

return () => {
if (timeoutId) {
clearTimeout(timeoutId)
}
}
}, [projectApiData])

return {
isRevisionsLoading,
navigateToRevision,
Expand Down
20 changes: 20 additions & 0 deletions frontend/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,13 @@ declare namespace Components {
sum?: number; // double
override: boolean;
}
export interface FusionPersonV1 {
azureUniqueId?: string | null;
mail?: string | null;
name?: string | null;
accountType?: string | null;
accountClassification?: string | null;
}
export interface GAndGAdminCostDto {
id: string; // uuid
startYear: number; // int32
Expand Down Expand Up @@ -1960,6 +1967,19 @@ declare namespace Components {
}
}
declare namespace Paths {
namespace Context$ContextId {
namespace Get {
namespace Parameters {
export type ContextId = string; // uuid
}
export interface PathParameters {
contextId: Parameters.ContextId /* uuid */;
}
namespace Responses {
export type $200 = Components.Schemas.FusionPersonV1[];
}
}
}
namespace Duplicate {
namespace Parameters {
export type CopyCaseId = string; // uuid
Expand Down
Loading