From 596f94c900ebbe41930472364e2b2298220e9ca7 Mon Sep 17 00:00:00 2001 From: Ken Kaizu Date: Tue, 25 Jan 2022 00:50:48 +0900 Subject: [PATCH] feat: customize nav bar background color (#7387) Signed-off-by: krrrr38 --- api/jsonschema/schema.json | 3 + api/openapi-spec/swagger.json | 3 + config/config.go | 3 + docs/workflow-controller-configmap.yaml | 5 +- pkg/apiclient/info/info.pb.go | 126 +++++++++++++----- pkg/apiclient/info/info.proto | 1 + .../IoArgoprojWorkflowV1alpha1InfoResponse.md | 1 + ...rgoproj_workflow_v1alpha1_info_response.py | 4 + .../IoArgoprojWorkflowV1alpha1InfoResponse.md | 1 + server/apiserver/argoserver.go | 6 +- server/info/info_server.go | 6 +- server/info/info_server_test.go | 29 ++++ ui/src/app/app-router.tsx | 3 + ui/src/models/info.ts | 1 + 14 files changed, 149 insertions(+), 43 deletions(-) diff --git a/api/jsonschema/schema.json b/api/jsonschema/schema.json index 88849e9f4527..664f5a2c5802 100644 --- a/api/jsonschema/schema.json +++ b/api/jsonschema/schema.json @@ -5454,6 +5454,9 @@ }, "title": "which modals to show", "type": "object" + }, + "navColor": { + "type": "string" } }, "type": "object" diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index ea1eb3c4ede9..4699cbb40171 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -9717,6 +9717,9 @@ "additionalProperties": { "type": "boolean" } + }, + "navColor": { + "type": "string" } } }, diff --git a/config/config.go b/config/config.go index 14764ef34b5b..b0b774324fd8 100644 --- a/config/config.go +++ b/config/config.go @@ -126,6 +126,9 @@ type Config struct { Images map[string]Image `json:"images,omitempty"` RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` + + // NavColor is an ui navigation bar background color + NavColor string `json:"navColor,omitempty"` } func (c Config) GetContainerRuntimeExecutor(labels labels.Labels) (string, error) { diff --git a/docs/workflow-controller-configmap.yaml b/docs/workflow-controller-configmap.yaml index 3db327bf7007..fb4750918211 100644 --- a/docs/workflow-controller-configmap.yaml +++ b/docs/workflow-controller-configmap.yaml @@ -38,7 +38,7 @@ data: nodeEvents: | enabled: true - # uncomment flowing lines if workflow controller runs in a different k8s cluster with the + # uncomment following lines if workflow controller runs in a different k8s cluster with the # workflow workloads, or needs to communicate with the k8s apiserver using an out-of-cluster # kubeconfig secret # kubeConfig: @@ -74,6 +74,9 @@ data: scope: chat url: http://my-chat + # uncomment following lines if you want to change navigation bar background color + # navColor: red + # artifactRepository defines the default location to be used as the artifact repository for # container artifacts. artifactRepository: | diff --git a/pkg/apiclient/info/info.pb.go b/pkg/apiclient/info/info.pb.go index 3c4588bdf134..3eef106b3ac9 100644 --- a/pkg/apiclient/info/info.pb.go +++ b/pkg/apiclient/info/info.pb.go @@ -72,6 +72,7 @@ type InfoResponse struct { Links []*v1alpha1.Link `protobuf:"bytes,2,rep,name=links,proto3" json:"links,omitempty"` // which modals to show Modals map[string]bool `protobuf:"bytes,3,rep,name=modals,proto3" json:"modals,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + NavColor string `protobuf:"bytes,4,opt,name=navColor,proto3" json:"navColor,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -131,6 +132,13 @@ func (m *InfoResponse) GetModals() map[string]bool { return nil } +func (m *InfoResponse) GetNavColor() string { + if m != nil { + return m.NavColor + } + return "" +} + type GetVersionRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -308,43 +316,44 @@ func init() { func init() { proto.RegisterFile("pkg/apiclient/info/info.proto", fileDescriptor_96940c93018255fa) } var fileDescriptor_96940c93018255fa = []byte{ - // 564 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0x13, 0x41, -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, 0xed, 0x39, 0xe5, 0x34, 0x84, 0xe9, 0x6b, 0x3a, - 0x07, 0x95, 0xd0, 0x00, 0x1c, 0xab, 0x67, 0x0d, 0x9a, 0xfe, 0xa5, 0x38, 0x3e, 0x46, 0xf5, 0x98, - 0xf1, 0x48, 0x39, 0x76, 0xaf, 0x36, 0x68, 0xed, 0xbf, 0x24, 0x17, 0x6c, 0x49, 0xc5, 0xd6, 0x18, - 0xef, 0x97, 0x6c, 0x49, 0x76, 0x40, 0x92, 0x28, 0x24, 0x39, 0x61, 0x52, 0x45, 0x49, 0x45, 0x98, - 0xbc, 0x62, 0x3c, 0xf2, 0x0b, 0x50, 0xfc, 0x10, 0x35, 0xe6, 0x62, 0x4a, 0x63, 0xe5, 0xd4, 0x0c, - 0x7c, 0x97, 0x18, 0xf1, 0x56, 0xd9, 0x92, 0x43, 0x53, 0xf0, 0x82, 0x6b, 0x79, 0xee, 0x97, 0xd5, - 0xee, 0x63, 0xd4, 0x5a, 0x09, 0xe3, 0x36, 0xaa, 0x45, 0x70, 0x5e, 0xce, 0x90, 0x9b, 0xb8, 0x83, - 0xea, 0x19, 0x8d, 0x53, 0x70, 0xec, 0x9e, 0x35, 0xb8, 0xe6, 0x17, 0xce, 0x13, 0xfb, 0x91, 0xd5, - 0xdf, 0x45, 0x3b, 0x23, 0xd0, 0x47, 0x20, 0x15, 0x13, 0xbc, 0x92, 0xa8, 0x83, 0xf0, 0x08, 0xf4, - 0x5b, 0x05, 0x72, 0x55, 0xb8, 0xef, 0x16, 0xda, 0x5d, 0x0b, 0x97, 0xfa, 0xdd, 0x44, 0x0d, 0xa6, - 0x54, 0x0a, 0xb2, 0xec, 0x58, 0x7a, 0xd8, 0x41, 0x9b, 0x2a, 0x9d, 0x9c, 0x42, 0xa0, 0x4d, 0xdb, - 0xa6, 0x5f, 0xb9, 0xf9, 0x3f, 0x42, 0x29, 0xd2, 0xa4, 0x98, 0xb3, 0xe9, 0x97, 0x5e, 0x4e, 0x13, - 0xe6, 0x94, 0xc5, 0xce, 0x86, 0xa9, 0x2f, 0x1c, 0x7c, 0x17, 0x5d, 0x37, 0xc6, 0x11, 0x48, 0x36, - 0x63, 0x30, 0x75, 0xea, 0x66, 0x88, 0xf5, 0x20, 0x26, 0x08, 0x2b, 0x90, 0x19, 0x0b, 0xe0, 0x69, - 0x10, 0x88, 0x94, 0xeb, 0x7c, 0x69, 0x4e, 0xc3, 0x00, 0x5d, 0x91, 0xd9, 0xff, 0x6a, 0xa3, 0x56, - 0x3e, 0xc6, 0x9b, 0x22, 0x85, 0xc7, 0x68, 0xb3, 0x3c, 0x14, 0xdc, 0x29, 0x64, 0x5f, 0xbf, 0x1b, - 0x17, 0x5f, 0x5e, 0x46, 0xbf, 0xf3, 0xf1, 0xe7, 0xef, 0x2f, 0xf6, 0x36, 0xde, 0x32, 0xc7, 0x9c, - 0x0d, 0xcd, 0xb1, 0xe3, 0x4f, 0x16, 0x42, 0x17, 0xa2, 0xe2, 0xbd, 0x25, 0xdc, 0xba, 0xcc, 0xee, - 0xf8, 0xff, 0xaf, 0xa7, 0x44, 0xec, 0xef, 0x19, 0x22, 0x3b, 0xf8, 0x46, 0x45, 0x24, 0x2b, 0x9b, - 0x1f, 0xa3, 0xd6, 0xca, 0xce, 0xb0, 0xb3, 0xe4, 0xf2, 0xd7, 0x76, 0xdd, 0x5b, 0x57, 0x64, 0xca, - 0x29, 0x1d, 0x03, 0x8e, 0x71, 0xbb, 0x02, 0x4f, 0x15, 0xc8, 0xbc, 0xfa, 0xd9, 0xf3, 0x6f, 0x8b, - 0xae, 0xf5, 0x63, 0xd1, 0xb5, 0x7e, 0x2d, 0xba, 0xd6, 0xbb, 0x07, 0xff, 0xfe, 0x74, 0x57, 0x3e, - 0x10, 0x93, 0x86, 0x79, 0xa9, 0x07, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x47, 0x0d, 0x37, 0xb2, - 0x3d, 0x04, 0x00, 0x00, + // 579 bytes of a gzipped FileDescriptorProto + 0x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x1d, 0xe7, 0xd7, 0xb4, 0xe3, 0xbc, 0x7b, 0xf8, 0xef, 0xcf, 0x7a, 0xee, 0xe7, + 0x31, 0x6c, 0x98, 0x57, 0x7c, 0xf0, 0x27, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xf1, 0xc6, 0xc3, 0x59, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -550,6 +559,13 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.NavColor) > 0 { + i -= len(m.NavColor) + copy(dAtA[i:], m.NavColor) + i = encodeVarintInfo(dAtA, i, uint64(len(m.NavColor))) + i-- + dAtA[i] = 0x22 + } if len(m.Modals) > 0 { for k := range m.Modals { v := m.Modals[k] @@ -771,6 +787,10 @@ func (m *InfoResponse) Size() (n int) { n += mapEntrySize + 1 + sovInfo(uint64(mapEntrySize)) } } + l = len(m.NavColor) + if l > 0 { + n += 1 + l + sovInfo(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1105,6 +1125,38 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { } m.Modals[mapkey] = mapvalue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NavColor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NavColor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipInfo(dAtA[iNdEx:]) diff --git a/pkg/apiclient/info/info.proto b/pkg/apiclient/info/info.proto index c558467a0b4d..b98f2e00b2a3 100644 --- a/pkg/apiclient/info/info.proto +++ b/pkg/apiclient/info/info.proto @@ -14,6 +14,7 @@ message InfoResponse { repeated github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Link links = 2; // which modals to show map modals = 3; + string navColor = 4; } message GetVersionRequest { diff --git a/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md b/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md index 7cf1328213c4..7fc838776a02 100644 --- a/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md +++ b/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **links** | [**List<IoArgoprojWorkflowV1alpha1Link>**](IoArgoprojWorkflowV1alpha1Link.md) | | [optional] **managedNamespace** | **String** | | [optional] **modals** | **Map<String, Boolean>** | | [optional] +**navColor** | **String** | | [optional] diff --git a/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_info_response.py b/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_info_response.py index 5cabe7c1043c..d363a6701d77 100644 --- a/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_info_response.py +++ b/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_info_response.py @@ -90,6 +90,7 @@ def openapi_types(): 'links': ([IoArgoprojWorkflowV1alpha1Link],), # noqa: E501 'managed_namespace': (str,), # noqa: E501 'modals': ({str: (bool,)},), # noqa: E501 + 'nav_color': (str,), # noqa: E501 } @cached_property @@ -101,6 +102,7 @@ def discriminator(): 'links': 'links', # noqa: E501 'managed_namespace': 'managedNamespace', # noqa: E501 'modals': 'modals', # noqa: E501 + 'nav_color': 'navColor', # noqa: E501 } read_only_vars = { @@ -147,6 +149,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 links ([IoArgoprojWorkflowV1alpha1Link]): [optional] # noqa: E501 managed_namespace (str): [optional] # noqa: E501 modals ({str: (bool,)}): [optional] # noqa: E501 + nav_color (str): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -231,6 +234,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 links ([IoArgoprojWorkflowV1alpha1Link]): [optional] # noqa: E501 managed_namespace (str): [optional] # noqa: E501 modals ({str: (bool,)}): [optional] # noqa: E501 + nav_color (str): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md b/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md index 3e6db51605c8..2a9cc31f0e6c 100644 --- a/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md +++ b/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1InfoResponse.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **links** | [**[IoArgoprojWorkflowV1alpha1Link]**](IoArgoprojWorkflowV1alpha1Link.md) | | [optional] **managed_namespace** | **str** | | [optional] **modals** | **{str: (bool,)}** | | [optional] +**nav_color** | **str** | | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index a3d8fb03fcd7..ac40768f28fb 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -200,7 +200,7 @@ func (as *argoServer) Run(ctx context.Context, port int, browserOpenFunc func(st artifactRepositories := artifactrepositories.New(as.clients.Kubernetes, as.managedNamespace, &config.ArtifactRepository) artifactServer := artifacts.NewArtifactServer(as.gatekeeper, hydrator.New(offloadRepo), wfArchive, instanceIDService, artifactRepositories) eventServer := event.NewController(instanceIDService, eventRecorderManager, as.eventQueueSize, as.eventWorkerCount, as.eventAsyncDispatch) - grpcServer := as.newGRPCServer(instanceIDService, offloadRepo, wfArchive, eventServer, config.Links) + grpcServer := as.newGRPCServer(instanceIDService, offloadRepo, wfArchive, eventServer, config.Links, config.NavColor) httpServer := as.newHTTPServer(ctx, port, artifactServer) // Start listener @@ -247,7 +247,7 @@ func (as *argoServer) Run(ctx context.Context, port int, browserOpenFunc func(st <-as.stopCh } -func (as *argoServer) newGRPCServer(instanceIDService instanceid.Service, offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo, wfArchive sqldb.WorkflowArchive, eventServer *event.Controller, links []*v1alpha1.Link) *grpc.Server { +func (as *argoServer) newGRPCServer(instanceIDService instanceid.Service, offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo, wfArchive sqldb.WorkflowArchive, eventServer *event.Controller, links []*v1alpha1.Link, navColor string) *grpc.Server { serverLog := log.NewEntry(log.StandardLogger()) // "Prometheus histograms are a great way to measure latency distributions of your RPCs. However, since it is bad practice to have metrics of high cardinality the latency monitoring metrics are disabled by default. To enable them please call the following in your server initialization code:" @@ -278,7 +278,7 @@ func (as *argoServer) newGRPCServer(instanceIDService instanceid.Service, offloa grpcServer := grpc.NewServer(sOpts...) - infopkg.RegisterInfoServiceServer(grpcServer, info.NewInfoServer(as.managedNamespace, links)) + infopkg.RegisterInfoServiceServer(grpcServer, info.NewInfoServer(as.managedNamespace, links, navColor)) eventpkg.RegisterEventServiceServer(grpcServer, eventServer) eventsourcepkg.RegisterEventSourceServiceServer(grpcServer, eventsource.NewEventSourceServer()) pipelinepkg.RegisterPipelineServiceServer(grpcServer, pipeline.NewPipelineServer()) diff --git a/server/info/info_server.go b/server/info/info_server.go index 0c208b5939e6..66c9671a5172 100644 --- a/server/info/info_server.go +++ b/server/info/info_server.go @@ -13,6 +13,7 @@ import ( type infoServer struct { managedNamespace string links []*wfv1.Link + navColor string } func (i *infoServer) GetUserInfo(ctx context.Context, _ *infopkg.GetUserInfoRequest) (*infopkg.GetUserInfoResponse, error) { @@ -40,6 +41,7 @@ func (i *infoServer) GetInfo(context.Context, *infopkg.GetInfoRequest) (*infopkg ManagedNamespace: i.managedNamespace, Links: i.links, Modals: modals, + NavColor: i.navColor, }, nil } @@ -48,6 +50,6 @@ func (i *infoServer) GetVersion(context.Context, *infopkg.GetVersionRequest) (*w return &version, nil } -func NewInfoServer(managedNamespace string, links []*wfv1.Link) infopkg.InfoServiceServer { - return &infoServer{managedNamespace, links} +func NewInfoServer(managedNamespace string, links []*wfv1.Link, navColor string) infopkg.InfoServiceServer { + return &infoServer{managedNamespace, links, navColor} } diff --git a/server/info/info_server_test.go b/server/info/info_server_test.go index eaa952c712df..b78b445f7126 100644 --- a/server/info/info_server_test.go +++ b/server/info/info_server_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/assert" "gopkg.in/square/go-jose.v2/jwt" + wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo-workflows/v3/server/auth" "github.com/argoproj/argo-workflows/v3/server/auth/types" ) @@ -24,3 +25,31 @@ func Test_infoServer_GetUserInfo(t *testing.T) { assert.Equal(t, "my-sa", info.ServiceAccountName) } } + +func Test_infoServer_GetInfo(t *testing.T) { + t.Run("Ful Fields", func(t *testing.T) { + i := &infoServer{ + managedNamespace: "argo", + links: []*wfv1.Link{ + {Name: "link-name", Scope: "scope", URL: "https://example.com"}, + }, + navColor: "red", + } + info, err := i.GetInfo(context.TODO(), nil) + if assert.NoError(t, err) { + assert.Equal(t, "argo", info.ManagedNamespace) + assert.Equal(t, "link-name", info.Links[0].Name) + assert.Equal(t, "red", info.NavColor) + } + }) + + t.Run("Min Fields", func(t *testing.T) { + i := &infoServer{} + info, err := i.GetInfo(context.TODO(), nil) + if assert.NoError(t, err) { + assert.Equal(t, "", info.ManagedNamespace) + assert.Equal(t, 0, len(info.Links)) + assert.Equal(t, "", info.NavColor) + } + }) +} diff --git a/ui/src/app/app-router.tsx b/ui/src/app/app-router.tsx index cb3b17f9eab7..90ecfb36b598 100644 --- a/ui/src/app/app-router.tsx +++ b/ui/src/app/app-router.tsx @@ -52,6 +52,7 @@ export const AppRouter = ({popupManager, history, notificationsManager}: {popupM const [modals, setModals] = useState<{string: boolean}>(); const [version, setVersion] = useState(); const [namespace, setNamespace] = useState(); + const [navBarBackgroundColor, setNavBarBackgroundColor] = useState(); const setError = (error: Error) => { notificationsManager.show({ content: 'Failed to load version/info ' + error, @@ -70,6 +71,7 @@ export const AppRouter = ({popupManager, history, notificationsManager}: {popupM Utils.managedNamespace = info.managedNamespace; setNamespace(Utils.currentNamespace); setModals(info.modals); + setNavBarBackgroundColor(info.navColor); }) .then(() => services.info.getVersion()) .then(setVersion) @@ -84,6 +86,7 @@ export const AppRouter = ({popupManager, history, notificationsManager}: {popupM