mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
[ui] Update commands (#7073)
* [api] patch exec command * Common changes for all command types * [ui] edit exec command * [api] patch Apply Command * [ui] edit apply command * [ui] Update image command * [api] update composite command * [ui] Update composite command * [uui] Make select-container component not valid when (new ...) is selected * [ui] e2e tests * static ui files
This commit is contained in:
3
pkg/apiserver-gen/.openapi-generator/FILES
generated
3
pkg/apiserver-gen/.openapi-generator/FILES
generated
@@ -9,13 +9,16 @@ go/impl.go
|
||||
go/model__component_command_post_request.go
|
||||
go/model__component_get_200_response.go
|
||||
go/model__devfile_get_200_response.go
|
||||
go/model__devstate_apply_command__command_name__patch_request.go
|
||||
go/model__devstate_apply_command_post_request.go
|
||||
go/model__devstate_chart_get_200_response.go
|
||||
go/model__devstate_command__command_name__move_post_request.go
|
||||
go/model__devstate_command__command_name__set_default_post_request.go
|
||||
go/model__devstate_composite_command__command_name__patch_request.go
|
||||
go/model__devstate_composite_command_post_request.go
|
||||
go/model__devstate_container_post_request.go
|
||||
go/model__devstate_events_put_request.go
|
||||
go/model__devstate_exec_command__command_name__patch_request.go
|
||||
go/model__devstate_exec_command_post_request.go
|
||||
go/model__devstate_image__image_name__patch_request.go
|
||||
go/model__devstate_image_post_request.go
|
||||
|
||||
6
pkg/apiserver-gen/go/api.go
generated
6
pkg/apiserver-gen/go/api.go
generated
@@ -31,12 +31,14 @@ type DefaultApiRouter interface {
|
||||
// The DevstateApiRouter implementation should parse necessary information from the http request,
|
||||
// pass the data to a DevstateApiServicer to perform the required actions, then write the service results to the http response.
|
||||
type DevstateApiRouter interface {
|
||||
DevstateApplyCommandCommandNamePatch(http.ResponseWriter, *http.Request)
|
||||
DevstateApplyCommandPost(http.ResponseWriter, *http.Request)
|
||||
DevstateChartGet(http.ResponseWriter, *http.Request)
|
||||
DevstateCommandCommandNameDelete(http.ResponseWriter, *http.Request)
|
||||
DevstateCommandCommandNameMovePost(http.ResponseWriter, *http.Request)
|
||||
DevstateCommandCommandNameSetDefaultPost(http.ResponseWriter, *http.Request)
|
||||
DevstateCommandCommandNameUnsetDefaultPost(http.ResponseWriter, *http.Request)
|
||||
DevstateCompositeCommandCommandNamePatch(http.ResponseWriter, *http.Request)
|
||||
DevstateCompositeCommandPost(http.ResponseWriter, *http.Request)
|
||||
DevstateContainerContainerNameDelete(http.ResponseWriter, *http.Request)
|
||||
DevstateContainerPost(http.ResponseWriter, *http.Request)
|
||||
@@ -44,6 +46,7 @@ type DevstateApiRouter interface {
|
||||
DevstateDevfileGet(http.ResponseWriter, *http.Request)
|
||||
DevstateDevfilePut(http.ResponseWriter, *http.Request)
|
||||
DevstateEventsPut(http.ResponseWriter, *http.Request)
|
||||
DevstateExecCommandCommandNamePatch(http.ResponseWriter, *http.Request)
|
||||
DevstateExecCommandPost(http.ResponseWriter, *http.Request)
|
||||
DevstateImageImageNameDelete(http.ResponseWriter, *http.Request)
|
||||
DevstateImageImageNamePatch(http.ResponseWriter, *http.Request)
|
||||
@@ -77,12 +80,14 @@ type DefaultApiServicer interface {
|
||||
// while the service implementation can be ignored with the .openapi-generator-ignore file
|
||||
// and updated with the logic required for the API.
|
||||
type DevstateApiServicer interface {
|
||||
DevstateApplyCommandCommandNamePatch(context.Context, string, DevstateApplyCommandCommandNamePatchRequest) (ImplResponse, error)
|
||||
DevstateApplyCommandPost(context.Context, DevstateApplyCommandPostRequest) (ImplResponse, error)
|
||||
DevstateChartGet(context.Context) (ImplResponse, error)
|
||||
DevstateCommandCommandNameDelete(context.Context, string) (ImplResponse, error)
|
||||
DevstateCommandCommandNameMovePost(context.Context, string, DevstateCommandCommandNameMovePostRequest) (ImplResponse, error)
|
||||
DevstateCommandCommandNameSetDefaultPost(context.Context, string, DevstateCommandCommandNameSetDefaultPostRequest) (ImplResponse, error)
|
||||
DevstateCommandCommandNameUnsetDefaultPost(context.Context, string) (ImplResponse, error)
|
||||
DevstateCompositeCommandCommandNamePatch(context.Context, string, DevstateCompositeCommandCommandNamePatchRequest) (ImplResponse, error)
|
||||
DevstateCompositeCommandPost(context.Context, DevstateCompositeCommandPostRequest) (ImplResponse, error)
|
||||
DevstateContainerContainerNameDelete(context.Context, string) (ImplResponse, error)
|
||||
DevstateContainerPost(context.Context, DevstateContainerPostRequest) (ImplResponse, error)
|
||||
@@ -90,6 +95,7 @@ type DevstateApiServicer interface {
|
||||
DevstateDevfileGet(context.Context) (ImplResponse, error)
|
||||
DevstateDevfilePut(context.Context, DevstateDevfilePutRequest) (ImplResponse, error)
|
||||
DevstateEventsPut(context.Context, DevstateEventsPutRequest) (ImplResponse, error)
|
||||
DevstateExecCommandCommandNamePatch(context.Context, string, DevstateExecCommandCommandNamePatchRequest) (ImplResponse, error)
|
||||
DevstateExecCommandPost(context.Context, DevstateExecCommandPostRequest) (ImplResponse, error)
|
||||
DevstateImageImageNameDelete(context.Context, string) (ImplResponse, error)
|
||||
DevstateImageImageNamePatch(context.Context, string, DevstateImageImageNamePatchRequest) (ImplResponse, error)
|
||||
|
||||
96
pkg/apiserver-gen/go/api_devstate.go
generated
96
pkg/apiserver-gen/go/api_devstate.go
generated
@@ -50,6 +50,12 @@ func NewDevstateApiController(s DevstateApiServicer, opts ...DevstateApiOption)
|
||||
// Routes returns all the api routes for the DevstateApiController
|
||||
func (c *DevstateApiController) Routes() Routes {
|
||||
return Routes{
|
||||
{
|
||||
"DevstateApplyCommandCommandNamePatch",
|
||||
strings.ToUpper("Patch"),
|
||||
"/api/v1/devstate/applyCommand/{commandName}",
|
||||
c.DevstateApplyCommandCommandNamePatch,
|
||||
},
|
||||
{
|
||||
"DevstateApplyCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
@@ -86,6 +92,12 @@ func (c *DevstateApiController) Routes() Routes {
|
||||
"/api/v1/devstate/command/{commandName}/unsetDefault",
|
||||
c.DevstateCommandCommandNameUnsetDefaultPost,
|
||||
},
|
||||
{
|
||||
"DevstateCompositeCommandCommandNamePatch",
|
||||
strings.ToUpper("Patch"),
|
||||
"/api/v1/devstate/compositeCommand/{commandName}",
|
||||
c.DevstateCompositeCommandCommandNamePatch,
|
||||
},
|
||||
{
|
||||
"DevstateCompositeCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
@@ -128,6 +140,12 @@ func (c *DevstateApiController) Routes() Routes {
|
||||
"/api/v1/devstate/events",
|
||||
c.DevstateEventsPut,
|
||||
},
|
||||
{
|
||||
"DevstateExecCommandCommandNamePatch",
|
||||
strings.ToUpper("Patch"),
|
||||
"/api/v1/devstate/execCommand/{commandName}",
|
||||
c.DevstateExecCommandCommandNamePatch,
|
||||
},
|
||||
{
|
||||
"DevstateExecCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
@@ -203,6 +221,32 @@ func (c *DevstateApiController) Routes() Routes {
|
||||
}
|
||||
}
|
||||
|
||||
// DevstateApplyCommandCommandNamePatch -
|
||||
func (c *DevstateApiController) DevstateApplyCommandCommandNamePatch(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateApplyCommandCommandNamePatchRequestParam := DevstateApplyCommandCommandNamePatchRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateApplyCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateApplyCommandCommandNamePatchRequestRequired(devstateApplyCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateApplyCommandCommandNamePatch(r.Context(), commandNameParam, devstateApplyCommandCommandNamePatchRequestParam)
|
||||
// If an error occurred, encode the error with the status code
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, err, &result)
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, w)
|
||||
|
||||
}
|
||||
|
||||
// DevstateApplyCommandPost -
|
||||
func (c *DevstateApiController) DevstateApplyCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateApplyCommandPostRequestParam := DevstateApplyCommandPostRequest{}
|
||||
@@ -322,6 +366,32 @@ func (c *DevstateApiController) DevstateCommandCommandNameUnsetDefaultPost(w htt
|
||||
|
||||
}
|
||||
|
||||
// DevstateCompositeCommandCommandNamePatch -
|
||||
func (c *DevstateApiController) DevstateCompositeCommandCommandNamePatch(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateCompositeCommandCommandNamePatchRequestParam := DevstateCompositeCommandCommandNamePatchRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCompositeCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCompositeCommandCommandNamePatchRequestRequired(devstateCompositeCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCompositeCommandCommandNamePatch(r.Context(), commandNameParam, devstateCompositeCommandCommandNamePatchRequestParam)
|
||||
// If an error occurred, encode the error with the status code
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, err, &result)
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, w)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCompositeCommandPost -
|
||||
func (c *DevstateApiController) DevstateCompositeCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateCompositeCommandPostRequestParam := DevstateCompositeCommandPostRequest{}
|
||||
@@ -459,6 +529,32 @@ func (c *DevstateApiController) DevstateEventsPut(w http.ResponseWriter, r *http
|
||||
|
||||
}
|
||||
|
||||
// DevstateExecCommandCommandNamePatch -
|
||||
func (c *DevstateApiController) DevstateExecCommandCommandNamePatch(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateExecCommandCommandNamePatchRequestParam := DevstateExecCommandCommandNamePatchRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateExecCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateExecCommandCommandNamePatchRequestRequired(devstateExecCommandCommandNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateExecCommandCommandNamePatch(r.Context(), commandNameParam, devstateExecCommandCommandNamePatchRequestParam)
|
||||
// If an error occurred, encode the error with the status code
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, err, &result)
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, w)
|
||||
|
||||
}
|
||||
|
||||
// DevstateExecCommandPost -
|
||||
func (c *DevstateApiController) DevstateExecCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateExecCommandPostRequestParam := DevstateExecCommandPostRequest{}
|
||||
|
||||
31
pkg/apiserver-gen/go/model__devstate_apply_command__command_name__patch_request.go
generated
Normal file
31
pkg/apiserver-gen/go/model__devstate_apply_command__command_name__patch_request.go
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* odo dev
|
||||
*
|
||||
* API interface for 'odo dev'
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
type DevstateApplyCommandCommandNamePatchRequest struct {
|
||||
Component string `json:"component,omitempty"`
|
||||
}
|
||||
|
||||
// AssertDevstateApplyCommandCommandNamePatchRequestRequired checks if the required fields are not zero-ed
|
||||
func AssertDevstateApplyCommandCommandNamePatchRequestRequired(obj DevstateApplyCommandCommandNamePatchRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseDevstateApplyCommandCommandNamePatchRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of DevstateApplyCommandCommandNamePatchRequest (e.g. [][]DevstateApplyCommandCommandNamePatchRequest), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseDevstateApplyCommandCommandNamePatchRequestRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aDevstateApplyCommandCommandNamePatchRequest, ok := obj.(DevstateApplyCommandCommandNamePatchRequest)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertDevstateApplyCommandCommandNamePatchRequestRequired(aDevstateApplyCommandCommandNamePatchRequest)
|
||||
})
|
||||
}
|
||||
33
pkg/apiserver-gen/go/model__devstate_composite_command__command_name__patch_request.go
generated
Normal file
33
pkg/apiserver-gen/go/model__devstate_composite_command__command_name__patch_request.go
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* odo dev
|
||||
*
|
||||
* API interface for 'odo dev'
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
type DevstateCompositeCommandCommandNamePatchRequest struct {
|
||||
Parallel bool `json:"parallel,omitempty"`
|
||||
|
||||
Commands []string `json:"commands,omitempty"`
|
||||
}
|
||||
|
||||
// AssertDevstateCompositeCommandCommandNamePatchRequestRequired checks if the required fields are not zero-ed
|
||||
func AssertDevstateCompositeCommandCommandNamePatchRequestRequired(obj DevstateCompositeCommandCommandNamePatchRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseDevstateCompositeCommandCommandNamePatchRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of DevstateCompositeCommandCommandNamePatchRequest (e.g. [][]DevstateCompositeCommandCommandNamePatchRequest), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseDevstateCompositeCommandCommandNamePatchRequestRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aDevstateCompositeCommandCommandNamePatchRequest, ok := obj.(DevstateCompositeCommandCommandNamePatchRequest)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertDevstateCompositeCommandCommandNamePatchRequestRequired(aDevstateCompositeCommandCommandNamePatchRequest)
|
||||
})
|
||||
}
|
||||
37
pkg/apiserver-gen/go/model__devstate_exec_command__command_name__patch_request.go
generated
Normal file
37
pkg/apiserver-gen/go/model__devstate_exec_command__command_name__patch_request.go
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* odo dev
|
||||
*
|
||||
* API interface for 'odo dev'
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
type DevstateExecCommandCommandNamePatchRequest struct {
|
||||
Component string `json:"component,omitempty"`
|
||||
|
||||
CommandLine string `json:"commandLine,omitempty"`
|
||||
|
||||
WorkingDir string `json:"workingDir,omitempty"`
|
||||
|
||||
HotReloadCapable bool `json:"hotReloadCapable,omitempty"`
|
||||
}
|
||||
|
||||
// AssertDevstateExecCommandCommandNamePatchRequestRequired checks if the required fields are not zero-ed
|
||||
func AssertDevstateExecCommandCommandNamePatchRequestRequired(obj DevstateExecCommandCommandNamePatchRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseDevstateExecCommandCommandNamePatchRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of DevstateExecCommandCommandNamePatchRequest (e.g. [][]DevstateExecCommandCommandNamePatchRequest), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseDevstateExecCommandCommandNamePatchRequestRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aDevstateExecCommandCommandNamePatchRequest, ok := obj.(DevstateExecCommandCommandNamePatchRequest)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertDevstateExecCommandCommandNamePatchRequestRequired(aDevstateExecCommandCommandNamePatchRequest)
|
||||
})
|
||||
}
|
||||
@@ -345,5 +345,47 @@ func (s *DevstateApiService) DevstateImageImageNamePatch(ctx context.Context, na
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
|
||||
}
|
||||
|
||||
func (s *DevstateApiService) DevstateExecCommandCommandNamePatch(ctx context.Context, name string, patch openapi.DevstateExecCommandCommandNamePatchRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.PatchExecCommand(
|
||||
name,
|
||||
patch.Component,
|
||||
patch.CommandLine,
|
||||
patch.WorkingDir,
|
||||
patch.HotReloadCapable,
|
||||
)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
Message: fmt.Sprintf("Error updating the Exec Command: %s", err),
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DevstateApiService) DevstateApplyCommandCommandNamePatch(ctx context.Context, name string, patch openapi.DevstateApplyCommandCommandNamePatchRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.PatchApplyCommand(
|
||||
name,
|
||||
patch.Component,
|
||||
)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
Message: fmt.Sprintf("Error updating the Apply Command: %s", err),
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DevstateApiService) DevstateCompositeCommandCommandNamePatch(ctx context.Context, name string, patch openapi.DevstateCompositeCommandCommandNamePatchRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.PatchCompositeCommand(
|
||||
name,
|
||||
patch.Parallel,
|
||||
patch.Commands,
|
||||
)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
Message: fmt.Sprintf("Error updating the Image Command: %s", err),
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
@@ -27,6 +27,32 @@ func (o *DevfileState) AddExecCommand(name string, component string, commandLine
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) PatchExecCommand(name string, component string, commandLine string, workingDir string, hotReloadCapable bool) (DevfileContent, error) {
|
||||
found, err := o.Devfile.Data.GetCommands(common.DevfileOptions{
|
||||
CommandOptions: common.CommandOptions{
|
||||
CommandType: v1alpha2.ExecCommandType,
|
||||
},
|
||||
FilterByName: name,
|
||||
})
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
if len(found) != 1 {
|
||||
return DevfileContent{}, fmt.Errorf("%d Exec Command found with name %q", len(found), name)
|
||||
}
|
||||
|
||||
command := found[0]
|
||||
command.Exec.Component = component
|
||||
command.Exec.CommandLine = commandLine
|
||||
command.Exec.WorkingDir = workingDir
|
||||
command.Exec.HotReloadCapable = &hotReloadCapable
|
||||
err = o.Devfile.Data.UpdateCommand(command)
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) AddApplyCommand(name string, component string) (DevfileContent, error) {
|
||||
command := v1alpha2.Command{
|
||||
Id: name,
|
||||
@@ -43,6 +69,29 @@ func (o *DevfileState) AddApplyCommand(name string, component string) (DevfileCo
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) PatchApplyCommand(name string, component string) (DevfileContent, error) {
|
||||
found, err := o.Devfile.Data.GetCommands(common.DevfileOptions{
|
||||
CommandOptions: common.CommandOptions{
|
||||
CommandType: v1alpha2.ApplyCommandType,
|
||||
},
|
||||
FilterByName: name,
|
||||
})
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
if len(found) != 1 {
|
||||
return DevfileContent{}, fmt.Errorf("%d Apply Command found with name %q", len(found), name)
|
||||
}
|
||||
|
||||
command := found[0]
|
||||
command.Apply.Component = component
|
||||
err = o.Devfile.Data.UpdateCommand(command)
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) AddCompositeCommand(name string, parallel bool, commands []string) (DevfileContent, error) {
|
||||
command := v1alpha2.Command{
|
||||
Id: name,
|
||||
@@ -60,6 +109,30 @@ func (o *DevfileState) AddCompositeCommand(name string, parallel bool, commands
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) PatchCompositeCommand(name string, parallel bool, commands []string) (DevfileContent, error) {
|
||||
found, err := o.Devfile.Data.GetCommands(common.DevfileOptions{
|
||||
CommandOptions: common.CommandOptions{
|
||||
CommandType: v1alpha2.CompositeCommandType,
|
||||
},
|
||||
FilterByName: name,
|
||||
})
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
if len(found) != 1 {
|
||||
return DevfileContent{}, fmt.Errorf("%d Composite Command found with name %q", len(found), name)
|
||||
}
|
||||
|
||||
command := found[0]
|
||||
command.Composite.Parallel = ¶llel
|
||||
command.Composite.Commands = commands
|
||||
err = o.Devfile.Data.UpdateCommand(command)
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) DeleteCommand(name string) (DevfileContent, error) {
|
||||
err := o.checkCommandUsed(name)
|
||||
if err != nil {
|
||||
|
||||
@@ -1205,6 +1205,71 @@ paths:
|
||||
example:
|
||||
message: "Error adding the Apply command"
|
||||
|
||||
/devstate/applyCommand/{commandName}:
|
||||
patch:
|
||||
tags:
|
||||
- devstate
|
||||
description: Update an Apply Command
|
||||
parameters:
|
||||
- name: commandName
|
||||
in: path
|
||||
description: Command name to update
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
component:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Apply command was successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DevfileContent'
|
||||
example:
|
||||
{
|
||||
"content": "schemaVersion: 2.2.0\n",
|
||||
"commands": [],
|
||||
"containers": [],
|
||||
"images": [],
|
||||
"resources": [],
|
||||
"events": {
|
||||
"preStart": null,
|
||||
"postStart": null,
|
||||
"preStop": null,
|
||||
"postStop": null
|
||||
},
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"version": "",
|
||||
"displayName": "",
|
||||
description": "",
|
||||
"tags": "",
|
||||
"architectures": "",
|
||||
"icon": "",
|
||||
"globalMemoryLimit": "",
|
||||
"projectType": "",
|
||||
"language": "",
|
||||
"website": "",
|
||||
"provider": "",
|
||||
"supportUrl": ""
|
||||
}
|
||||
}
|
||||
'500':
|
||||
description: Error updating the Apply command
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GeneralError'
|
||||
example:
|
||||
message: "Error updating the Apply command"
|
||||
|
||||
/devstate/command/{commandName}:
|
||||
delete:
|
||||
tags:
|
||||
@@ -1418,6 +1483,76 @@ paths:
|
||||
example:
|
||||
message: "Error adding the Composite command"
|
||||
|
||||
/devstate/compositeCommand/{commandName}:
|
||||
patch:
|
||||
tags:
|
||||
- devstate
|
||||
description: Update a Composite Command
|
||||
parameters:
|
||||
- name: commandName
|
||||
in: path
|
||||
description: Command name to update
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
parallel:
|
||||
type: boolean
|
||||
commands:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Composite command was successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DevfileContent'
|
||||
example:
|
||||
{
|
||||
"content": "schemaVersion: 2.2.0\n",
|
||||
"commands": [],
|
||||
"containers": [],
|
||||
"images": [],
|
||||
"resources": [],
|
||||
"events": {
|
||||
"preStart": null,
|
||||
"postStart": null,
|
||||
"preStop": null,
|
||||
"postStop": null
|
||||
},
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"version": "",
|
||||
"displayName": "",
|
||||
description": "",
|
||||
"tags": "",
|
||||
"architectures": "",
|
||||
"icon": "",
|
||||
"globalMemoryLimit": "",
|
||||
"projectType": "",
|
||||
"language": "",
|
||||
"website": "",
|
||||
"provider": "",
|
||||
"supportUrl": ""
|
||||
}
|
||||
}
|
||||
'500':
|
||||
description: Error updating the Composite command
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GeneralError'
|
||||
example:
|
||||
message: "Error updating the Composite command"
|
||||
|
||||
/devstate/execCommand:
|
||||
post:
|
||||
tags:
|
||||
@@ -1485,6 +1620,77 @@ paths:
|
||||
example:
|
||||
message: "Error adding the Exec command"
|
||||
|
||||
/devstate/execCommand/{commandName}:
|
||||
patch:
|
||||
tags:
|
||||
- devstate
|
||||
description: Update an Exec Command
|
||||
parameters:
|
||||
- name: commandName
|
||||
in: path
|
||||
description: Command name to update
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
component:
|
||||
type: string
|
||||
commandLine:
|
||||
type: string
|
||||
workingDir:
|
||||
type: string
|
||||
hotReloadCapable:
|
||||
type: boolean
|
||||
responses:
|
||||
'200':
|
||||
description: Exec command was successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DevfileContent'
|
||||
example:
|
||||
{
|
||||
"content": "schemaVersion: 2.2.0\n",
|
||||
"commands": [],
|
||||
"containers": [],
|
||||
"images": [],
|
||||
"resources": [],
|
||||
"events": {
|
||||
"preStart": null,
|
||||
"postStart": null,
|
||||
"preStop": null,
|
||||
"postStop": null
|
||||
},
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"version": "",
|
||||
"displayName": "",
|
||||
description": "",
|
||||
"tags": "",
|
||||
"architectures": "",
|
||||
"icon": "",
|
||||
"globalMemoryLimit": "",
|
||||
"projectType": "",
|
||||
"language": "",
|
||||
"website": "",
|
||||
"provider": "",
|
||||
"supportUrl": ""
|
||||
}
|
||||
}
|
||||
'500':
|
||||
description: Error updating the Exec command
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GeneralError'
|
||||
example:
|
||||
message: "Error updating the Exec command"
|
||||
|
||||
/devstate/events:
|
||||
put:
|
||||
tags:
|
||||
|
||||
2
pkg/apiserver-impl/ui/index.html
generated
2
pkg/apiserver-impl/ui/index.html
generated
@@ -11,6 +11,6 @@
|
||||
<body class="mat-typography">
|
||||
<div id="loading">Loading, please wait...</div>
|
||||
<app-root></app-root>
|
||||
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.9400449aa2437590.js" type="module"></script>
|
||||
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.30e0dd4eb9375796.js" type="module"></script>
|
||||
|
||||
</body></html>
|
||||
1
pkg/apiserver-impl/ui/main.30e0dd4eb9375796.js
generated
Normal file
1
pkg/apiserver-impl/ui/main.30e0dd4eb9375796.js
generated
Normal file
File diff suppressed because one or more lines are too long
1
pkg/apiserver-impl/ui/main.9400449aa2437590.js
generated
1
pkg/apiserver-impl/ui/main.9400449aa2437590.js
generated
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user