@@ -14,8 +14,12 @@ import useToastNotification from "@/hooks/useToastNotification";
1414import { cn } from "@/lib/utils" ;
1515import { useBackend } from "@/providers/BackendProvider" ;
1616import { APP_ROUTES } from "@/routes/router" ;
17+ import { updateRunNotes } from "@/services/pipelineRunService" ;
1718import type { PipelineRun } from "@/types/pipelineRun" ;
18- import type { ComponentSpec } from "@/utils/componentSpec" ;
19+ import {
20+ type ComponentSpec ,
21+ isGraphImplementation ,
22+ } from "@/utils/componentSpec" ;
1923import { submitPipelineRun } from "@/utils/submitPipeline" ;
2024
2125import { isAuthorizationRequired } from "../../Authentication/helpers" ;
@@ -89,7 +93,7 @@ const OasisSubmitter = ({
8993 isComponentTreeValid = true ,
9094} : OasisSubmitterProps ) => {
9195 const { isAuthorized } = useAwaitAuthorization ( ) ;
92- const { configured, available } = useBackend ( ) ;
96+ const { backendUrl , configured, available } = useBackend ( ) ;
9397 const { mutate : submit , isPending : isSubmitting } = useSubmitPipeline ( ) ;
9498 const isAutoRedirect = useFlagValue ( "redirect-on-new-pipeline-run" ) ;
9599
@@ -99,6 +103,13 @@ const OasisSubmitter = ({
99103 const notify = useToastNotification ( ) ;
100104 const navigate = useNavigate ( ) ;
101105
106+ const runNotes = useRef < string > ( "" ) ;
107+
108+ const { mutate : saveNotes } = useMutation ( {
109+ mutationFn : ( runId : string ) =>
110+ updateRunNotes ( runId , backendUrl , runNotes . current ) ,
111+ } ) ;
112+
102113 const handleError = ( message : string ) => {
103114 notify ( message , "error" ) ;
104115 } ;
@@ -130,6 +141,9 @@ const OasisSubmitter = ({
130141 } ;
131142
132143 const onSuccess = ( response : PipelineRun ) => {
144+ if ( runNotes . current . trim ( ) !== "" ) {
145+ saveNotes ( response . id . toString ( ) ) ;
146+ }
133147 setSubmitSuccess ( true ) ;
134148 setCooldownTime ( 3 ) ;
135149 onSubmitComplete ?.( ) ;
@@ -173,7 +187,11 @@ const OasisSubmitter = ({
173187 } ) ;
174188 } ;
175189
176- const handleSubmitWithArguments = ( args : Record < string , string > ) => {
190+ const handleSubmitWithArguments = (
191+ args : Record < string , string > ,
192+ notes : string ,
193+ ) => {
194+ runNotes . current = notes ;
177195 setIsArgumentsDialogOpen ( false ) ;
178196 handleSubmit ( args ) ;
179197 } ;
@@ -197,7 +215,7 @@ const OasisSubmitter = ({
197215 ! isAuthorized ||
198216 ! isComponentTreeValid ||
199217 cooldownTime > 0 ||
200- ( "graph" in componentSpec . implementation &&
218+ ( isGraphImplementation ( componentSpec . implementation ) &&
201219 Object . keys ( componentSpec . implementation . graph . tasks ) . length === 0 ) ;
202220
203221 const isArgumentsButtonVisible = hasConfigurableInputs && ! isButtonDisabled ;
@@ -230,7 +248,7 @@ const OasisSubmitter = ({
230248 < div
231249 className = { cn (
232250 "text-xs font-light -ml-1" ,
233- configured ? "text-red-700 " : "text-yellow-700 " ,
251+ configured ? "text-destructive " : "text-warning " ,
234252 ) }
235253 >
236254 (has validation issues)
@@ -240,7 +258,7 @@ const OasisSubmitter = ({
240258 < div
241259 className = { cn (
242260 "text-xs font-light -ml-1" ,
243- configured ? "text-red-700 " : "text-yellow-700 " ,
261+ configured ? "text-destructive " : "text-warning " ,
244262 ) }
245263 >
246264 { `(backend ${ configured ? "unavailable" : "unconfigured" } )` }
0 commit comments