@@ -22,7 +22,7 @@ import { CenterLoader } from "../components/CenterLoader";
22
22
import { ApplicationCard } from "../components/executionsCards/ApplicationCard" ;
23
23
import { JobCard } from "../components/executionsCards/JobCard" ;
24
24
import { SearchTextField } from "../components/SearchTextField" ;
25
- import { useCurrentProject } from "../hooks/projectHooks" ;
25
+ import { useCurrentProject , useIsEditorOfCurrentProject } from "../hooks/projectHooks" ;
26
26
import Layout from "../layouts/Layout" ;
27
27
import { dmOptions } from "../utils/api/ssrQueryOptions" ;
28
28
import { search } from "../utils/app/searches" ;
@@ -75,6 +75,7 @@ const Executions = () => {
75
75
76
76
const currentProject = useCurrentProject ( ) ;
77
77
78
+ const isEditor = useIsEditorOfCurrentProject ( ) ;
78
79
// Needs to assert some types here as Orval still doesn't get this right
79
80
const {
80
81
data : applicationsData ,
@@ -113,7 +114,7 @@ const Executions = () => {
113
114
// Then create a card for each
114
115
?. map ( ( job ) => (
115
116
< Grid item key = { job . id } md = { 3 } sm = { 6 } xs = { 12 } >
116
- < JobCard job = { job } projectId = { currentProject ?. project_id } />
117
+ < JobCard disabled = { ! isEditor } job = { job } projectId = { currentProject ?. project_id } />
117
118
</ Grid >
118
119
) ) ?? [ ] ;
119
120
@@ -126,7 +127,7 @@ const Executions = () => {
126
127
return applicationCards ;
127
128
}
128
129
return jobCards ;
129
- } , [ applications , currentProject ?. project_id , executionTypes , jobs , searchValue ] ) ;
130
+ } , [ applications , currentProject ?. project_id , executionTypes , jobs , searchValue , isEditor ] ) ;
130
131
131
132
return (
132
133
< >
@@ -185,7 +186,15 @@ const Executions = () => {
185
186
{ ! currentProject && (
186
187
< Grid item xs = { 12 } >
187
188
< Alert severity = "warning" >
188
- Select a project from the settings to launch apps and run jobs
189
+ Select a project from the settings to launch apps and run jobs.
190
+ </ Alert >
191
+ </ Grid >
192
+ ) }
193
+
194
+ { ! isEditor && (
195
+ < Grid item xs = { 12 } >
196
+ < Alert severity = "warning" >
197
+ You must be a project editor to run jobs in this project.
189
198
</ Alert >
190
199
</ Grid >
191
200
) }
0 commit comments