diff --git a/src/components/activity/ActivityAnchorForm.svelte b/src/components/activity/ActivityAnchorForm.svelte index 91a506934f..a67c3b3836 100644 --- a/src/components/activity/ActivityAnchorForm.svelte +++ b/src/components/activity/ActivityAnchorForm.svelte @@ -2,6 +2,8 @@
diff --git a/src/components/scheduling/goals/SchedulingGoal.svelte b/src/components/scheduling/goals/SchedulingGoal.svelte index 9dce1543d2..cdcbe2b7c3 100644 --- a/src/components/scheduling/goals/SchedulingGoal.svelte +++ b/src/components/scheduling/goals/SchedulingGoal.svelte @@ -25,14 +25,13 @@ export let hasGoalEditPermission: boolean = false; export let hasSpecEditPermission: boolean = false; export let hasDeletePermission: boolean = false; + export let permissionError: string = ''; $: upButtonHidden = priority <= 0; $: simulateGoal = simulateAfter; // Copied to local var to reflect changed values immediately in the UI let schedulingGoalInput: HTMLInputElement; - const permissionError = 'You do not have permission to edit scheduling goals for this plan.'; - function focusInput() { if (document.activeElement !== schedulingGoalInput) { schedulingGoalInput.focus(); diff --git a/src/components/simulation/SimulationPanel.svelte b/src/components/simulation/SimulationPanel.svelte index b675dd08a9..e997c89b7f 100644 --- a/src/components/simulation/SimulationPanel.svelte +++ b/src/components/simulation/SimulationPanel.svelte @@ -4,9 +4,10 @@ import PlanLeftArrow from '@nasa-jpl/stellar/icons/plan_with_left_arrow.svg?component'; import PlanRightArrow from '@nasa-jpl/stellar/icons/plan_with_right_arrow.svg?component'; import { SearchParameters } from '../../enums/searchParameters'; - import { field } from '../../stores/form'; - import { plan, planEndTimeMs, planStartTimeMs } from '../../stores/plan'; import { planSnapshot } from '../../stores/planSnapshots'; + import { PlanStatusMessages } from '../../enums/planStatusMessages'; + import { field } from '../../stores/form'; + import { plan, planEndTimeMs, planReadOnly, planStartTimeMs } from '../../stores/plan'; import { enableSimulation, simulation, @@ -65,8 +66,8 @@ let filteredSimulationDatasets: SimulationDataset[] = []; $: if (user !== null && $plan !== null) { - hasRunPermission = featurePermissions.simulation.canRun(user, $plan); - hasUpdatePermission = featurePermissions.simulation.canUpdate(user, $plan); + hasRunPermission = featurePermissions.simulation.canRun(user, $plan) && !$planReadOnly; + hasUpdatePermission = featurePermissions.simulation.canUpdate(user, $plan) && !$planReadOnly; } $: if ($plan) { startTimeDoy = @@ -279,7 +280,9 @@ permissionHandler, { hasPermission: hasRunPermission, - permissionError: 'You do not have permission to run a simulation', + permissionError: $planReadOnly + ? PlanStatusMessages.READ_ONLY + : 'You do not have permission to run a simulation', }, ], ]} @@ -301,7 +304,7 @@ permissionHandler, { hasPermission: hasUpdatePermission, - permissionError: updatePermissionError, + permissionError: $planReadOnly ? PlanStatusMessages.READ_ONLY : updatePermissionError, }, ], ]} @@ -322,7 +325,7 @@ permissionHandler, { hasPermission: hasUpdatePermission, - permissionError: updatePermissionError, + permissionError: $planReadOnly ? PlanStatusMessages.READ_ONLY : updatePermissionError, }, ], ]} @@ -359,7 +362,7 @@ permissionHandler, { hasPermission: hasUpdatePermission, - permissionError: updatePermissionError, + permissionError: $planReadOnly ? PlanStatusMessages.READ_ONLY : updatePermissionError, }, ], ]} diff --git a/src/components/simulation/SimulationTemplateInput.svelte b/src/components/simulation/SimulationTemplateInput.svelte index 95900e3676..cd83cc5a9f 100644 --- a/src/components/simulation/SimulationTemplateInput.svelte +++ b/src/components/simulation/SimulationTemplateInput.svelte @@ -2,6 +2,7 @@