diff --git a/api/api.swagger.json b/api/api.swagger.json index d63643b..3cc78e9 100644 --- a/api/api.swagger.json +++ b/api/api.swagger.json @@ -3,7 +3,7 @@ "info": { "title": "Onepanel", "description": "Onepanel API", - "version": "0.12.0", + "version": "0.12.0b3", "contact": { "name": "Onepanel project", "url": "https://github.com/onepanelio/core" @@ -3152,6 +3152,9 @@ "type": "boolean", "format": "boolean" }, + "visibility": { + "type": "string" + }, "options": { "type": "array", "items": { diff --git a/api/common.pb.go b/api/common.pb.go index c66aa9a..4959faf 100644 --- a/api/common.pb.go +++ b/api/common.pb.go @@ -36,7 +36,8 @@ type Parameter struct { DisplayName string `protobuf:"bytes,4,opt,name=displayName,proto3" json:"displayName,omitempty"` Hint string `protobuf:"bytes,5,opt,name=hint,proto3" json:"hint,omitempty"` Required bool `protobuf:"varint,6,opt,name=required,proto3" json:"required,omitempty"` - Options []*ParameterOption `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty"` + Visibility string `protobuf:"bytes,7,opt,name=visibility,proto3" json:"visibility,omitempty"` + Options []*ParameterOption `protobuf:"bytes,8,rep,name=options,proto3" json:"options,omitempty"` } func (x *Parameter) Reset() { @@ -113,6 +114,13 @@ func (x *Parameter) GetRequired() bool { return false } +func (x *Parameter) GetVisibility() string { + if x != nil { + return x.Visibility + } + return "" +} + func (x *Parameter) GetOptions() []*ParameterOption { if x != nil { return x.Options @@ -179,7 +187,7 @@ var File_common_proto protoreflect.FileDescriptor var file_common_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, - 0x61, 0x70, 0x69, 0x22, 0xcb, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x61, 0x70, 0x69, 0x22, 0xeb, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, @@ -189,7 +197,9 @@ var file_common_proto_rawDesc = []byte{ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x12, 0x2e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3b, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x70, diff --git a/api/common.proto b/api/common.proto index 20e103c..ee51926 100644 --- a/api/common.proto +++ b/api/common.proto @@ -9,8 +9,9 @@ message Parameter { string displayName = 4; string hint = 5; bool required = 6; + string visibility = 7; - repeated ParameterOption options = 7; + repeated ParameterOption options = 8; } message ParameterOption { diff --git a/pkg/common_types.go b/pkg/common_types.go index c906927..de4ce59 100644 --- a/pkg/common_types.go +++ b/pkg/common_types.go @@ -16,6 +16,7 @@ type ParameterOption struct { type Parameter struct { Name string `json:"name" protobuf:"bytes,1,opt,name=name"` Value *string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` + Visibility *string `json:"visibility,omitempty"` Type string `json:"type,omitempty" protobuf:"bytes,3,opt,name=type"` DisplayName *string `json:"displayName,omitempty" protobuf:"bytes,4,opt,name=displayName"` Hint *string `json:"hint,omitempty" protobuf:"bytes,5,opt,name=hint"` diff --git a/pkg/common_types_test.go b/pkg/common_types_test.go index 7c4822a..64a262a 100644 --- a/pkg/common_types_test.go +++ b/pkg/common_types_test.go @@ -13,6 +13,7 @@ func TestParseParametersFromManifest(t *testing.T) { value: https://github.com/onepanelio/Mask_RCNN.git - name: dataset-path value: datasets/test_05142020170720 + visibility: public - name: model-path value: models/rush/cvat6-20 - name: extras @@ -44,6 +45,12 @@ func TestParseParametersFromManifest(t *testing.T) { keyedParameters := MapParametersByName(parameters) + // Make sure visibility is set + assert.Equal(t, *keyedParameters["dataset-path"].Visibility, "public") + + // Make sure visibility is not set if omitted + assert.Nil(t, keyedParameters["tf-image"].Visibility) + // Make sure numbers, slashes, dashes, and letters are parsed correctly assert.Equal(t, *keyedParameters["tf-image"].Value, "tensorflow/tensorflow:1.13.1-py3") diff --git a/server/workflow_template_server.go b/server/workflow_template_server.go index ba29671..7d593b1 100644 --- a/server/workflow_template_server.go +++ b/server/workflow_template_server.go @@ -26,6 +26,9 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate { if p.Value != nil { ap.Value = *p.Value } + if p.Visibility != nil { + ap.Visibility = *p.Visibility + } aParams = append(aParams, &ap) }