Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Sep 13, 2024
1 parent 5bd7d3f commit aa58479
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class LayerDelegate<TSettings extends Settings, TData>
private _cancellationPending: boolean = false;
private _publishSubscribeHandler = new PublishSubscribeHandler<LayerDelegateTopic>();
private _queryKeys: unknown[][] = [];
private _refetchRequested: boolean = false;
private _status: LayerStatus = LayerStatus.IDLE;
private _data: TData | null = null;
private _error: StatusMessage | string | null = null;
Expand All @@ -47,7 +46,7 @@ export class LayerDelegate<TSettings extends Settings, TData>

handleSettingsChange(): void {
this._cancellationPending = true;
if (this._settingsContext.isValid()) {
if (this._settingsContext.areCurrentSettingsValid()) {
this.maybeCancelQuery().then(() => {
this.maybeRefetchData();
});
Expand Down Expand Up @@ -207,7 +206,6 @@ export class LayerDelegate<TSettings extends Settings, TData>
}

if (this._cancellationPending) {
this._refetchRequested = true;
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ export class DrilledWellTrajectoriesContext implements SettingsContext<DrilledWe
this.setAvailableSettingsValues();
}

isValid(): boolean {
areCurrentSettingsValid(): boolean {
const settings = this.getDelegate().getSettings();
return settings[SettingType.ENSEMBLE].getDelegate().getValue() !== null;
return (
settings[SettingType.ENSEMBLE].getDelegate().getValue() !== null &&
settings[SettingType.SMDA_WELLBORE_HEADERS].getDelegate().getValue().length > 0
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class ObservedSurfaceContext implements SettingsContext<ObservedSurfaceSe
this.setAvailableSettingsValues();
}

isValid(): boolean {
areCurrentSettingsValid(): boolean {
const settings = this.getDelegate().getSettings();
return (
settings[SettingType.SURFACE_ATTRIBUTE].getDelegate().getValue() !== null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class RealizationFaultPolygonsContext implements SettingsContext<Realizat
this.setAvailableSettingsValues();
}

isValid(): boolean {
areCurrentSettingsValid(): boolean {
const settings = this.getDelegate().getSettings();
return (
settings[SettingType.FAULT_POLYGONS_ATTRIBUTE].getDelegate().getValue() !== null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class RealizationSurfaceContext implements SettingsContext<RealizationSur
this.setAvailableSettingsValues();
}

isValid(): boolean {
areCurrentSettingsValid(): boolean {
const settings = this.getDelegate().getSettings();
return (
settings[SettingType.SURFACE_ATTRIBUTE].getDelegate().getValue() !== null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class StatisticalSurfaceContext implements SettingsContext<StatisticalSur
this.setAvailableSettingsValues();
}

isValid(): boolean {
areCurrentSettingsValid(): boolean {
const settings = this.getDelegate().getSettings();
return (
settings[SettingType.SURFACE_ATTRIBUTE].getDelegate().getValue() !== null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ export class DrilledWellbores implements Setting<WellboreHeader_api[]> {

return (
<Select
filter
options={options}
value={selectedValues}
onChange={handleChange}
disabled={props.isOverridden}
multiple={true}
size={10}
size={5}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/LayerSpike/layers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function instanceofLayer(item: Item): item is Layer<Settings, any> {
export interface SettingsContext<TSettings extends Settings, TKey extends keyof TSettings = keyof TSettings> {
getDelegate(): SettingsContextDelegate<TSettings, TKey>;
fetchData: FetchDataFunction<TSettings, TKey>;
isValid(): boolean;
areCurrentSettingsValid(): boolean;
}

export type AvailableValuesType<TValue> = TValue extends Array<unknown> ? TValue : Array<TValue>;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/modules/LayerSpike/view/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function View(props: ModuleViewProps<Interfaces>): React.ReactNode {
layerManager?.getGroupDelegate() || new GroupDelegate(null),
GroupBaseTopic.CHILDREN
);

usePublishSubscribeTopicValue(
layerManager ?? new LayerManager(props.workbenchSession, props.workbenchSettings, queryClient),
LayerManagerTopic.LAYER_DATA_REVISION
Expand Down

0 comments on commit aa58479

Please sign in to comment.