Skip to content

Commit

Permalink
add not found component
Browse files Browse the repository at this point in the history
  • Loading branch information
lastminutediorama committed Dec 22, 2024
1 parent 525ba4a commit 5e0cd78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/interface/src/app/plan/plan.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { TreatmentCardComponent } from '../../styleguide/treatment-card/treatmen
import { TreatmentsTabComponent } from './create-scenarios/treatments-tab/treatments-tab.component';
import { OpacityControlComponent } from './plan-map/opacity-control/opacity-control.component';
import { UploadedScenarioViewComponent } from './uploaded-scenario-view/uploaded-scenario-view.component';

import { ScenarioRoutePlaceholderComponent } from './scenario-route-placeholder/scenario-route-placeholder';
/** Components used in the plan flow. */
@NgModule({
declarations: [
Expand All @@ -75,6 +75,7 @@ import { UploadedScenarioViewComponent } from './uploaded-scenario-view/uploaded
ScenarioNotStartedComponent,
ScenarioPendingComponent,
ScenarioResultsComponent,
ScenarioRoutePlaceholderComponent,
ScenarioTooltipComponent,
ScenariosTableListComponent,
SetPrioritiesComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<app-resource-unavailable
resource="scenario"
*ngIf="scenarioNotFound"></app-resource-unavailable>
<ng-container #container></ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PlanStateService } from '@services';

@Component({
selector: 'app-scenario-route-placeholder',
template: '<ng-container #container></ng-container>',
templateUrl: './scenario-route-placeholder.component.html',
styleUrl: './scenario-route-placeholder.component.scss',
})
export class ScenarioRoutePlaceholderComponent implements OnInit {
Expand All @@ -20,6 +20,7 @@ export class ScenarioRoutePlaceholderComponent implements OnInit {
) {}

scenario?: Scenario;
scenarioNotFound = false;

ngOnInit() {
const id = this.route.snapshot.paramMap.get('id');
Expand All @@ -36,6 +37,9 @@ export class ScenarioRoutePlaceholderComponent implements OnInit {
this.container.createComponent(CreateScenariosComponent);
}
},
error: () => {
this.scenarioNotFound = true;
},
});
}
}
Expand Down

0 comments on commit 5e0cd78

Please sign in to comment.