Skip to content

Commit

Permalink
Feature/401 meta data (#402)
Browse files Browse the repository at this point in the history
* meta with tag shows for TDIS & SIS;
* alias predecessor node ids; remove console logs;
* make enum type more clear;
  • Loading branch information
benjamineac authored Jul 26, 2022
1 parent 40514e7 commit c3a08c9
Show file tree
Hide file tree
Showing 9 changed files with 866 additions and 218 deletions.
25 changes: 24 additions & 1 deletion src/components/diagnosticReportView/DiagnosticReportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import NamedFaultsView from './NamedFaultsView';
import RegionalMfdView from './RegionalMfdView';
import InversionSolutionHazardCharts from '../inversionSolution/InversionSolutionHazardCharts';
import ParentFaultView from './ParentFaultViews';
import { SweepArguments, UnifiedInversionSolution, UnifiedInversionSolutionType } from '../../interfaces/generaltask';
import {
SweepArgument,
SweepArguments,
UnifiedInversionSolution,
UnifiedInversionSolutionType,
} from '../../interfaces/generaltask';
import { MetaArguments } from '../../interfaces/mySolutions';
import { filteredMetaGT, filterMetaArguments } from '../../service/diagnosticReports.service';
import SolutionAnalysisTab from '../inversionSolution/SolutionAnalysisTab';
Expand Down Expand Up @@ -152,11 +157,29 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
const hazardTableId = unifiedInversionSolutions[currentImage].solution.hazardId;
hazardTableId ? setHazardId(hazardTableId) : setHazardId('');
let metaList: MetaArguments = [];

if (sweepArgs) {
metaList = filteredMetaGT(unifiedInversionSolutions[currentImage].solution.meta, sweepArgs);
} else if (sweepList) {
metaList = filterMetaArguments(unifiedInversionSolutions[currentImage].solution.meta, sweepList);
}

if (
[
UnifiedInversionSolutionType.SCALED_INVERSION_SOLUTION,
UnifiedInversionSolutionType.TIME_DEPENDENT_SOLUTION,
].includes(unifiedInversionSolutions[currentImage].type) &&
unifiedInversionSolutions[currentImage]?.solution?.source_solution?.meta !== undefined
) {
const sourceMeta = unifiedInversionSolutions[currentImage]?.solution?.source_solution?.meta;
const sweepArgs: (SweepArgument | null)[] = [];
sourceMeta?.map((kv) => {
kv?.v && kv?.v.includes('tag') && sweepArgs.push(kv as SweepArgument);
});
if (sourceMeta !== undefined) {
metaList = filteredMetaGT(sourceMeta, sweepArgs as SweepArguments);
}
}
setFilteredMeta(metaList);
}
}, [currentImage, sweepList, sweepArgs, unifiedInversionSolutions]);
Expand Down
71 changes: 57 additions & 14 deletions src/components/generalTask/InversionSolutionDiagnosticContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,42 +110,81 @@ export const inversionSolutionDiagnosticContainerQuery = graphql`
edges {
node {
file {
#for ScaledInversionSolutions
__typename
... on ScaledInversionSolution {
id
meta {
k
v
}
source_solution {
id
meta {
k
v
predecessors {
__typename
pre_id: id
relationship
depth
node {
... on File {
file_meta: meta {
k
v
}
}
... on InversionSolution {
is_meta: meta {
k
v
}
}
... on TimeDependentInversionSolution {
td_meta: meta {
k
v
}
}
}
}
}
#for TimeDependent InversionSolutions
... on TimeDependentInversionSolution {
id
meta {
k
v
}
source_solution {
id
meta {
k
v
predecessors {
__typename
pre_id: id
relationship
depth
node {
... on File {
file_meta: meta {
k
v
}
}
... on InversionSolution {
is_meta: meta {
k
v
}
}
... on TimeDependentInversionSolution {
td_meta: meta {
k
v
}
}
}
}
}
... on Node {
__isNode: __typename
node_id: id
}
}
}
}
}
#for InversionSolutions
inversion_solution {
id
file_name
Expand All @@ -160,6 +199,10 @@ export const inversionSolutionDiagnosticContainerQuery = graphql`
}
}
}
... on Node {
__isNode: __typename
id
}
}
}
}
Expand Down
Loading

0 comments on commit c3a08c9

Please sign in to comment.