Skip to content

Commit

Permalink
updated schema; typing fixes for new InversionSolutionUnion; legacy S…
Browse files Browse the repository at this point in the history
…SL support;
  • Loading branch information
chrisbc committed Jul 1, 2024
1 parent f4593e4 commit 651ff9a
Show file tree
Hide file tree
Showing 14 changed files with 351 additions and 190 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts test --watchAll=false --coverage",
"eject": "react-scripts eject",
"relay": "relay-compiler --src ./src --schema ./schema.graphql --language typescript",
Expand Down
9 changes: 7 additions & 2 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ type AutomationTask implements Node & Thing & AutomationTaskInterface {
model_type: ModelType
task_type: TaskSubType

"""the primary result of this task (only for task_type == INVERSION."""
inversion_solution: InversionSolution
"""
the result of this task. NB only available for task_types:INVERSION,
SCALE_SOLUTION, AGGREGATE_SOLUTION, TIME_DEPENDENT_SOLUTION.
"""
inversion_solution: InversionSolutionUnion
}

input AutomationTaskInput {
Expand Down Expand Up @@ -846,6 +849,8 @@ type InversionSolutionNrml implements Node & FileInterface & PredecessorsInterfa
source_solution: SourceSolutionUnion
}

union InversionSolutionUnion = InversionSolution | ScaledInversionSolution | AggregateInversionSolution | TimeDependentInversionSolution

"""Simple container for KVL lists of strings"""
type KeyValueListPair {
"""key"""
Expand Down
15 changes: 9 additions & 6 deletions src/components/common/MetaToolTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Info = styled(Typography)(() => ({
alignContent: 'space-between',
}));

export const tagToolTip = (v: string | null): JSX.Element | undefined => {
export const tagToolTip = (v: string | null | undefined): JSX.Element | undefined => {
if (v) {
try {
const cleanedJson = JSON.parse(v?.replaceAll("'", '"').replaceAll('False', 'false').replaceAll('True', 'true'));
Expand Down Expand Up @@ -41,11 +41,14 @@ interface MetaToolTipProps {
export const MetaToolTip: React.FC<MetaToolTipProps> = ({ meta }: MetaToolTipProps) => {
return (
<Info>
{meta.map((kv) => (
<p style={{ padding: 0, margin: 0 }} key={kv?.k}>
<strong>{kv?.k}:</strong> {tagToolTip(kv?.v)} &nbsp;
</p>
))}
{meta.map(
(kv) =>
kv && (
<p style={{ padding: 0, margin: 0 }} key={kv?.k}>
<strong>{kv?.k}:</strong> {tagToolTip(kv?.v)} &nbsp;
</p>
),
)}
</Info>
);
};
20 changes: 10 additions & 10 deletions src/components/diagnosticReportView/DiagnosticReportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const Root = styled('div')(() => ({
interface DiagnosticReportCardProps {
unifiedInversionSolutions: UnifiedInversionSolution[];
sweepArgs?: SweepArguments;
sweepList?: string[];
modelType: string;
sweepList?: readonly (string | null)[] | null | undefined;
modelType: string | null | undefined;
generalViews: string[];
setGeneralViews: (selection: string[]) => void;
namedFaultsView: string;
Expand Down Expand Up @@ -215,7 +215,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return () => window.removeEventListener('keyup', hotkeyHandler);
});

if (!unifiedInversionSolutions[currentImage]) {
if (!unifiedInversionSolutions[currentImage] || !unifiedInversionSolutions[currentImage].solution.id) {
return <Typography> There are no valid reports to show. </Typography>;
}

Expand All @@ -225,7 +225,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return (
<DiagnosticReportTabPanel value={currentTab} index={0}>
<GeneralView
id={unifiedInversionSolutions[currentImage].solution.id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
mfdTableId={unifiedInversionSolutions[currentImage].solution.mfdTableId as string}
meta={unifiedInversionSolutions[currentImage].solution.meta}
filteredMeta={filteredMeta}
Expand All @@ -241,7 +241,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return (
<DiagnosticReportTabPanel value={currentTab} index={1}>
<RegionalMfdView
id={unifiedInversionSolutions[currentImage].solution.id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
regionalViews={regionalViews}
setRegionalViews={setRegionalViews}
nonRegionalViews={nonRegionalViews}
Expand All @@ -254,7 +254,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return (
<DiagnosticReportTabPanel value={currentTab} index={2}>
<NamedFaultsView
id={unifiedInversionSolutions[currentImage].solution.id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
namedFaultsView={namedFaultsView}
setNamedFaultsView={setNamedFaultsView}
namedFaultsLocations={namedFaultsLocations}
Expand All @@ -267,7 +267,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return (
<DiagnosticReportTabPanel value={currentTab} index={3}>
<ParentFaultView
id={unifiedInversionSolutions[currentImage].solution.id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
parentFaultViews={parentFaultViews}
setParentFaultViews={setParentFaultViews}
parentFault={parentFault}
Expand All @@ -292,7 +292,7 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
return (
<DiagnosticReportTabPanel value={currentTab} index={5}>
<SolutionAnalysisTab
id={unifiedInversionSolutions[currentImage].solution.id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
setDisableHotkey={setDisableHotkey}
/>
</DiagnosticReportTabPanel>
Expand Down Expand Up @@ -326,8 +326,8 @@ const DiagnosticReportCard: React.FC<DiagnosticReportCardProps> = ({
</h4>
<MetaToolTip meta={filteredMeta} />
<FlipChartControls
id={unifiedInversionSolutions[currentImage].solution.id}
producedBy={unifiedInversionSolutions[currentImage].id}
id={unifiedInversionSolutions[currentImage].solution.id || ''}
producedBy={unifiedInversionSolutions[currentImage].id || ''}
currentImage={currentImage}
handlePrev={prevImage}
handleNext={nextImage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,22 @@ export const inversionSolutionDiagnosticContainerQuery = graphql`
}
}
inversion_solution {
id
file_name
mfd_table_id
meta {
k
v
... on Node {
id
}
tables {
table_id
table_type
... on FileInterface {
file_name
meta {
k
v
}
}
... on InversionSolutionInterface {
mfd_table_id
tables {
table_id
table_type
}
}
}
}
Expand Down
Loading

0 comments on commit 651ff9a

Please sign in to comment.