From 0b32635a5e9302a41362ff95e98e4a735a952d51 Mon Sep 17 00:00:00 2001 From: MaMe82 Date: Thu, 11 Oct 2018 21:32:06 +0200 Subject: [PATCH] Minor fix, server build with latest grpcweb --- proto/gopherjs/grpc.pb.gopherjs.go | 6 ++--- proto/grpc.pb.go | 36 +++++++++++++++--------------- proto/grpc.proto | 2 +- service/rpc_server.go | 2 +- web_client/jsDataHandling.go | 8 ++++++- web_client/rpcClient.go | 2 +- 6 files changed, 31 insertions(+), 25 deletions(-) diff --git a/proto/gopherjs/grpc.pb.gopherjs.go b/proto/gopherjs/grpc.pb.gopherjs.go index 5bf53c1..33c218f 100644 --- a/proto/gopherjs/grpc.pb.gopherjs.go +++ b/proto/gopherjs/grpc.pb.gopherjs.go @@ -5142,7 +5142,7 @@ type P4WNP1Client interface { ListStoredWifiSettings(ctx context.Context, in *Empty, opts ...grpcweb.CallOption) (*StringMessageArray, error) // TriggerActions ListStoredTriggerActionSets(ctx context.Context, in *Empty, opts ...grpcweb.CallOption) (*StringMessageArray, error) - StoreTriggerActionSets(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*Empty, error) + StoreTriggerActionSet(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*Empty, error) GetTriggerActionsState(ctx context.Context, in *Empty, opts ...grpcweb.CallOption) (*TriggerActionSet, error) DeployTriggerActionSetReplace(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*TriggerActionSet, error) DeployTriggerActionSetAdd(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*TriggerActionSet, error) @@ -5470,8 +5470,8 @@ func (c *p4WNP1Client) ListStoredTriggerActionSets(ctx context.Context, in *Empt return new(StringMessageArray).Unmarshal(resp) } -func (c *p4WNP1Client) StoreTriggerActionSets(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*Empty, error) { - resp, err := c.client.RPCCall(ctx, "StoreTriggerActionSets", in.Marshal(), opts...) +func (c *p4WNP1Client) StoreTriggerActionSet(ctx context.Context, in *TriggerActionSet, opts ...grpcweb.CallOption) (*Empty, error) { + resp, err := c.client.RPCCall(ctx, "StoreTriggerActionSet", in.Marshal(), opts...) if err != nil { return nil, err } diff --git a/proto/grpc.pb.go b/proto/grpc.pb.go index 39ff8af..43a851e 100644 --- a/proto/grpc.pb.go +++ b/proto/grpc.pb.go @@ -2524,7 +2524,7 @@ type P4WNP1Client interface { ListStoredWifiSettings(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StringMessageArray, error) // TriggerActions ListStoredTriggerActionSets(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StringMessageArray, error) - StoreTriggerActionSets(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*Empty, error) + StoreTriggerActionSet(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*Empty, error) GetTriggerActionsState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TriggerActionSet, error) DeployTriggerActionSetReplace(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*TriggerActionSet, error) DeployTriggerActionSetAdd(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*TriggerActionSet, error) @@ -2849,9 +2849,9 @@ func (c *p4WNP1Client) ListStoredTriggerActionSets(ctx context.Context, in *Empt return out, nil } -func (c *p4WNP1Client) StoreTriggerActionSets(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*Empty, error) { +func (c *p4WNP1Client) StoreTriggerActionSet(ctx context.Context, in *TriggerActionSet, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/StoreTriggerActionSets", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/StoreTriggerActionSet", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -2929,7 +2929,7 @@ type P4WNP1Server interface { ListStoredWifiSettings(context.Context, *Empty) (*StringMessageArray, error) // TriggerActions ListStoredTriggerActionSets(context.Context, *Empty) (*StringMessageArray, error) - StoreTriggerActionSets(context.Context, *TriggerActionSet) (*Empty, error) + StoreTriggerActionSet(context.Context, *TriggerActionSet) (*Empty, error) GetTriggerActionsState(context.Context, *Empty) (*TriggerActionSet, error) DeployTriggerActionSetReplace(context.Context, *TriggerActionSet) (*TriggerActionSet, error) DeployTriggerActionSetAdd(context.Context, *TriggerActionSet) (*TriggerActionSet, error) @@ -3518,20 +3518,20 @@ func _P4WNP1_ListStoredTriggerActionSets_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } -func _P4WNP1_StoreTriggerActionSets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _P4WNP1_StoreTriggerActionSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TriggerActionSet) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(P4WNP1Server).StoreTriggerActionSets(ctx, in) + return srv.(P4WNP1Server).StoreTriggerActionSet(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/P4wnP1_grpc.P4WNP1/StoreTriggerActionSets", + FullMethod: "/P4wnP1_grpc.P4WNP1/StoreTriggerActionSet", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(P4WNP1Server).StoreTriggerActionSets(ctx, req.(*TriggerActionSet)) + return srv.(P4WNP1Server).StoreTriggerActionSet(ctx, req.(*TriggerActionSet)) } return interceptor(ctx, in, info, handler) } @@ -3719,8 +3719,8 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{ Handler: _P4WNP1_ListStoredTriggerActionSets_Handler, }, { - MethodName: "StoreTriggerActionSets", - Handler: _P4WNP1_StoreTriggerActionSets_Handler, + MethodName: "StoreTriggerActionSet", + Handler: _P4WNP1_StoreTriggerActionSet_Handler, }, { MethodName: "GetTriggerActionsState", @@ -3748,12 +3748,12 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("grpc.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 3462 bytes of a gzipped FileDescriptorProto + // 3463 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x5a, 0x5b, 0x77, 0xe3, 0x46, 0x72, 0xe6, 0x45, 0x12, 0xc9, 0xe2, 0x0d, 0xea, 0x99, 0xd1, 0x70, 0x34, 0x17, 0x8f, 0x11, 0xaf, 0x77, 0xa2, 0xcd, 0xca, 0x63, 0x59, 0x1e, 0x7b, 0x7d, 0x76, 0x8f, 0x97, 0x77, 0x72, 0x86, 0xb7, 0xd3, 0x20, 0xad, 0x24, 0x7b, 0x4e, 0xb8, 0x10, 0xd0, 0xa2, 0xb0, 0x43, 0x02, 0x0c, 0xd0, 0xd0, - 0x58, 0x79, 0xd8, 0x9c, 0x93, 0x3f, 0x91, 0x7f, 0x91, 0xc7, 0xe4, 0xa7, 0xe4, 0x17, 0xe4, 0x3d, + 0x58, 0x79, 0xd8, 0x9c, 0x93, 0x3f, 0x91, 0x7f, 0x91, 0xc7, 0xe4, 0x9f, 0xe4, 0x1f, 0xe4, 0x3d, 0x2f, 0x79, 0xce, 0x9e, 0xee, 0x06, 0x40, 0x00, 0x02, 0xa9, 0xb1, 0xf7, 0xad, 0xba, 0xba, 0xea, 0xeb, 0x46, 0x75, 0x55, 0x75, 0x75, 0x91, 0x00, 0x0b, 0x7b, 0xad, 0x9d, 0xae, 0x6d, 0x8b, 0x5a, 0xa8, 0x38, 0x39, 0xff, 0x60, 0x4e, 0xbe, 0x9c, 0x33, 0x96, 0xfc, 0x27, 0x90, 0xa6, 0xb6, 0xb1, @@ -3960,10 +3960,10 @@ var fileDescriptor0 = []byte{ 0x83, 0xd5, 0x23, 0xb8, 0xbb, 0xec, 0xbe, 0xdd, 0x86, 0x1c, 0xb1, 0xe6, 0x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40, 0x5d, 0xd7, + 0xff, 0x5a, 0xf0, 0xcb, 0x03, 0xfe, 0xef, 0xbb, 0xaf, 0xfe, 0x12, 0x00, 0x00, 0xff, 0xff, 0x2c, + 0xc4, 0x91, 0xab, 0x8b, 0x27, 0x00, 0x00, } diff --git a/proto/grpc.proto b/proto/grpc.proto index 5ae7d89..db995bb 100644 --- a/proto/grpc.proto +++ b/proto/grpc.proto @@ -51,7 +51,7 @@ service P4WNP1 { // TriggerActions rpc ListStoredTriggerActionSets(Empty) returns (StringMessageArray) {} - rpc StoreTriggerActionSets(TriggerActionSet) returns (Empty) {} + rpc StoreTriggerActionSet(TriggerActionSet) returns (Empty) {} rpc GetTriggerActionsState(Empty) returns (TriggerActionSet) {} rpc DeployTriggerActionSetReplace(TriggerActionSet) returns (TriggerActionSet) {} // Adds a set of additional TriggerActions, returns a set of all Triggeractions registered afterwards rpc DeployTriggerActionSetAdd(TriggerActionSet) returns (TriggerActionSet) {} // Replaces registered TriggerActions with given set, returns a set ONLY OF ADDED TriggerActions (with assigned IDs) diff --git a/service/rpc_server.go b/service/rpc_server.go index 4932c1a..d7527b3 100644 --- a/service/rpc_server.go +++ b/service/rpc_server.go @@ -39,7 +39,7 @@ type server struct { listenAddrWeb string } -func (s *server) StoreTriggerActionSets(ctx context.Context, set *pb.TriggerActionSet) (e *pb.Empty, err error) { +func (s *server) StoreTriggerActionSet(ctx context.Context, set *pb.TriggerActionSet) (e *pb.Empty, err error) { e = &pb.Empty{} err = s.rootSvc.SubSysDataStore.Put(cSTORE_PREFIX_TRIGGER_ACTION_SET+ set.Name, set, true) return diff --git a/web_client/jsDataHandling.go b/web_client/jsDataHandling.go index b293fb8..98b8c8d 100644 --- a/web_client/jsDataHandling.go +++ b/web_client/jsDataHandling.go @@ -881,6 +881,8 @@ func (data *jsEventReceiver) handleHidEvent(hEv *jsHidEvent) { case common_web.HidEventType_JOB_FAILED: data.JobList.UpdateEntry(hEv.JobId, hEv.VMId, hEv.HasError, false, hEv.Message, hEv.Error, hEv.EvLogTime, "") + QuasarNotifyError("HIDScript job " + strconv.Itoa(int(hEv.JobId)) + " failed", hEv.Error, QUASAR_NOTIFICATION_POSITION_TOP) + /* notification := &QuasarNotification{Object: O()} notification.Message = "HIDScript job " + strconv.Itoa(int(hEv.JobId)) + " failed" notification.Detail = hEv.Error @@ -888,9 +890,13 @@ func (data *jsEventReceiver) handleHidEvent(hEv *jsHidEvent) { notification.Type = QUASAR_NOTIFICATION_TYPE_NEGATIVE notification.Timeout = 5000 QuasarNotify(notification) + */ case common_web.HidEventType_JOB_SUCCEEDED: data.JobList.UpdateEntry(hEv.JobId, hEv.VMId, hEv.HasError, true, hEv.Message, hEv.Result, hEv.EvLogTime, "") + QuasarNotifySuccess("HIDScript job " + strconv.Itoa(int(hEv.JobId)) + " succeeded", hEv.Result, QUASAR_NOTIFICATION_POSITION_TOP) + + /* notification := &QuasarNotification{Object: O()} notification.Message = "HIDScript job " + strconv.Itoa(int(hEv.JobId)) + " succeeded" notification.Detail = hEv.Result @@ -898,7 +904,7 @@ func (data *jsEventReceiver) handleHidEvent(hEv *jsHidEvent) { notification.Type = QUASAR_NOTIFICATION_TYPE_POSITIVE notification.Timeout = 5000 QuasarNotify(notification) - + */ case common_web.HidEventType_JOB_CANCELLED: data.JobList.UpdateEntry(hEv.JobId, hEv.VMId, true, false, hEv.Message, hEv.Message, hEv.EvLogTime, "") default: diff --git a/web_client/rpcClient.go b/web_client/rpcClient.go index b9d0267..6c49835 100644 --- a/web_client/rpcClient.go +++ b/web_client/rpcClient.go @@ -154,7 +154,7 @@ func (rpc *Rpc) StoreTriggerActionSet(timeout time.Duration, set *pb.TriggerActi ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - _,err = rpc.Client.StoreTriggerActionSets(ctx, set) + _,err = rpc.Client.StoreTriggerActionSet(ctx, set) return err }