From dacc1adfe173dae9ab564f61c06c38cc9b7fd911 Mon Sep 17 00:00:00 2001 From: truthhun <1272881215@qq.com> Date: Mon, 3 Apr 2023 11:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=A1=AC=E4=BB=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/config.pb.go | 1485 +++++++++++++++++++++++++++++---- api/v1/config.pb.gw.go | 65 ++ api/v1/config.proto | 41 + biz/config.go | 36 + go.mod | 10 +- go.sum | 38 +- util/device/device.go | 82 ++ web/api/config.js | 7 + web/nuxt.config.js | 1 + web/package-lock.json | 121 +++ web/package.json | 3 + web/pages/admin/dashboard.vue | 272 +++++- 12 files changed, 2011 insertions(+), 150 deletions(-) create mode 100644 util/device/device.go diff --git a/api/v1/config.pb.go b/api/v1/config.pb.go index 62f6684..10f6b06 100644 --- a/api/v1/config.pb.go +++ b/api/v1/config.pb.go @@ -5,6 +5,7 @@ package v1 import ( context "context" + encoding_binary "encoding/binary" fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -1092,6 +1093,286 @@ func (m *Stats) GetReportCount() int64 { return 0 } +type CPUInfo struct { + Cores int32 `protobuf:"varint,1,opt,name=cores,proto3" json:"cores,omitempty"` + ModelName string `protobuf:"bytes,2,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + Mhz float32 `protobuf:"fixed32,3,opt,name=mhz,proto3" json:"mhz,omitempty"` + Percent float32 `protobuf:"fixed32,4,opt,name=percent,proto3" json:"percent,omitempty"` +} + +func (m *CPUInfo) Reset() { *m = CPUInfo{} } +func (m *CPUInfo) String() string { return proto.CompactTextString(m) } +func (*CPUInfo) ProtoMessage() {} +func (*CPUInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_321614cd6c9c1b8a, []int{12} +} +func (m *CPUInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CPUInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CPUInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CPUInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CPUInfo.Merge(m, src) +} +func (m *CPUInfo) XXX_Size() int { + return m.Size() +} +func (m *CPUInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CPUInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CPUInfo proto.InternalMessageInfo + +func (m *CPUInfo) GetCores() int32 { + if m != nil { + return m.Cores + } + return 0 +} + +func (m *CPUInfo) GetModelName() string { + if m != nil { + return m.ModelName + } + return "" +} + +func (m *CPUInfo) GetMhz() float32 { + if m != nil { + return m.Mhz + } + return 0 +} + +func (m *CPUInfo) GetPercent() float32 { + if m != nil { + return m.Percent + } + return 0 +} + +type MemoryInfo struct { + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Available int64 `protobuf:"varint,2,opt,name=available,proto3" json:"available,omitempty"` + Used int64 `protobuf:"varint,3,opt,name=used,proto3" json:"used,omitempty"` + Free int64 `protobuf:"varint,4,opt,name=free,proto3" json:"free,omitempty"` + Percent float32 `protobuf:"fixed32,5,opt,name=percent,proto3" json:"percent,omitempty"` +} + +func (m *MemoryInfo) Reset() { *m = MemoryInfo{} } +func (m *MemoryInfo) String() string { return proto.CompactTextString(m) } +func (*MemoryInfo) ProtoMessage() {} +func (*MemoryInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_321614cd6c9c1b8a, []int{13} +} +func (m *MemoryInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemoryInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemoryInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemoryInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemoryInfo.Merge(m, src) +} +func (m *MemoryInfo) XXX_Size() int { + return m.Size() +} +func (m *MemoryInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MemoryInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_MemoryInfo proto.InternalMessageInfo + +func (m *MemoryInfo) GetTotal() int64 { + if m != nil { + return m.Total + } + return 0 +} + +func (m *MemoryInfo) GetAvailable() int64 { + if m != nil { + return m.Available + } + return 0 +} + +func (m *MemoryInfo) GetUsed() int64 { + if m != nil { + return m.Used + } + return 0 +} + +func (m *MemoryInfo) GetFree() int64 { + if m != nil { + return m.Free + } + return 0 +} + +func (m *MemoryInfo) GetPercent() float32 { + if m != nil { + return m.Percent + } + return 0 +} + +type DiskInfo struct { + DiskName string `protobuf:"bytes,1,opt,name=disk_name,json=diskName,proto3" json:"disk_name,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + Used int64 `protobuf:"varint,3,opt,name=used,proto3" json:"used,omitempty"` + Free int64 `protobuf:"varint,4,opt,name=free,proto3" json:"free,omitempty"` + Percent float32 `protobuf:"fixed32,5,opt,name=percent,proto3" json:"percent,omitempty"` +} + +func (m *DiskInfo) Reset() { *m = DiskInfo{} } +func (m *DiskInfo) String() string { return proto.CompactTextString(m) } +func (*DiskInfo) ProtoMessage() {} +func (*DiskInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_321614cd6c9c1b8a, []int{14} +} +func (m *DiskInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DiskInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DiskInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DiskInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DiskInfo.Merge(m, src) +} +func (m *DiskInfo) XXX_Size() int { + return m.Size() +} +func (m *DiskInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DiskInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DiskInfo proto.InternalMessageInfo + +func (m *DiskInfo) GetDiskName() string { + if m != nil { + return m.DiskName + } + return "" +} + +func (m *DiskInfo) GetTotal() int64 { + if m != nil { + return m.Total + } + return 0 +} + +func (m *DiskInfo) GetUsed() int64 { + if m != nil { + return m.Used + } + return 0 +} + +func (m *DiskInfo) GetFree() int64 { + if m != nil { + return m.Free + } + return 0 +} + +func (m *DiskInfo) GetPercent() float32 { + if m != nil { + return m.Percent + } + return 0 +} + +type DeviceInfo struct { + Cpu *CPUInfo `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu,omitempty"` + Memory *MemoryInfo `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory,omitempty"` + Disk []*DiskInfo `protobuf:"bytes,3,rep,name=disk,proto3" json:"disk,omitempty"` +} + +func (m *DeviceInfo) Reset() { *m = DeviceInfo{} } +func (m *DeviceInfo) String() string { return proto.CompactTextString(m) } +func (*DeviceInfo) ProtoMessage() {} +func (*DeviceInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_321614cd6c9c1b8a, []int{15} +} +func (m *DeviceInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeviceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeviceInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeviceInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeviceInfo.Merge(m, src) +} +func (m *DeviceInfo) XXX_Size() int { + return m.Size() +} +func (m *DeviceInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DeviceInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DeviceInfo proto.InternalMessageInfo + +func (m *DeviceInfo) GetCpu() *CPUInfo { + if m != nil { + return m.Cpu + } + return nil +} + +func (m *DeviceInfo) GetMemory() *MemoryInfo { + if m != nil { + return m.Memory + } + return nil +} + +func (m *DeviceInfo) GetDisk() []*DiskInfo { + if m != nil { + return m.Disk + } + return nil +} + func init() { proto.RegisterType((*Config)(nil), "api.v1.Config") proto.RegisterType((*ListConfigRequest)(nil), "api.v1.ListConfigRequest") @@ -1105,114 +1386,132 @@ func init() { proto.RegisterType((*EnvDependent)(nil), "api.v1.EnvDependent") proto.RegisterType((*Envs)(nil), "api.v1.Envs") proto.RegisterType((*Stats)(nil), "api.v1.Stats") + proto.RegisterType((*CPUInfo)(nil), "api.v1.CPUInfo") + proto.RegisterType((*MemoryInfo)(nil), "api.v1.MemoryInfo") + proto.RegisterType((*DiskInfo)(nil), "api.v1.DiskInfo") + proto.RegisterType((*DeviceInfo)(nil), "api.v1.DeviceInfo") } func init() { proto.RegisterFile("api/v1/config.proto", fileDescriptor_321614cd6c9c1b8a) } var fileDescriptor_321614cd6c9c1b8a = []byte{ - // 1629 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4b, 0x6f, 0x1b, 0xc9, - 0x11, 0xf6, 0xf0, 0x21, 0x92, 0x45, 0x8a, 0x92, 0x5b, 0xb2, 0x4d, 0x73, 0x1d, 0x59, 0x3b, 0xc9, - 0x26, 0xda, 0x45, 0x20, 0xae, 0x95, 0x17, 0x90, 0x1c, 0x16, 0xb2, 0xac, 0xdd, 0x18, 0x58, 0x04, - 0xce, 0x68, 0x8d, 0x3c, 0x2e, 0x83, 0xe6, 0x4c, 0x89, 0x6c, 0x78, 0x38, 0x3d, 0xdb, 0xdd, 0xa4, - 0xc5, 0x3d, 0xe6, 0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31, 0x99, 0x1a, 0xaa, 0x6d, 0x33, 0xf2, 0x92, 0x4d, 0x35, 0xd5, 0xc7, 0x15, 0x97, 0xbe, - 0xc3, 0xff, 0xd5, 0xa1, 0xe7, 0xd6, 0xba, 0x58, 0x6a, 0x83, 0x33, 0xeb, 0x9c, 0xca, 0x19, 0x17, - 0x39, 0x2d, 0xd5, 0x89, 0xbc, 0x64, 0x97, 0x32, 0xc2, 0x64, 0x58, 0x92, 0x88, 0x04, 0x7b, 0xf0, - 0x57, 0xb8, 0x7c, 0x2d, 0x55, 0xaa, 0x3d, 0x91, 0x2a, 0xd9, 0xd2, 0x26, 0x45, 0x9d, 0x28, 0x41, - 0xb5, 0xf3, 0xab, 0xae, 0xaa, 0xec, 0x86, 0x32, 0x39, 0x91, 0x9e, 0x51, 0xf4, 0x6d, 0x6b, 0x7f, - 0xc9, 0x17, 0x22, 0x91, 0xb9, 0xe7, 0x51, 0x29, 0xb2, 0x5d, 0xa8, 0x8b, 0xa4, 0xf0, 0x04, 0xb2, - 0x9f, 0xec, 0x11, 0x74, 0x78, 0xce, 0xb3, 0xa5, 0x11, 0x89, 0x26, 0x02, 0x75, 0xa2, 0x6b, 0x85, - 0xdd, 0x9b, 0x16, 0x06, 0x89, 0xe4, 0x8e, 0x46, 0x95, 0xcc, 0x3e, 0x86, 0xfd, 0x44, 0x16, 0x4b, - 0x65, 0xf3, 0x12, 0x6b, 0xc3, 0x95, 0x89, 0x97, 0xc8, 0x15, 0x31, 0xaa, 0x13, 0xb1, 0xca, 0x76, - 0x61, 0x4d, 0xbf, 0x43, 0xae, 0xd8, 0x08, 0xf6, 0x14, 0x4e, 0x84, 0x36, 0xa8, 0xe2, 0x31, 0x4f, - 0x5e, 0x4d, 0x94, 0x9c, 0xe7, 0x29, 0x31, 0xa8, 0x13, 0xb1, 0xd2, 0xf4, 0xb4, 0xb2, 0xb0, 0x0f, - 0x61, 0x37, 0x93, 0x13, 0x91, 0xaf, 0xa2, 0x7b, 0x84, 0xde,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2b, 0xfd, 0xa1, 0xc3, 0x7d, 0x8a, 0xd3, 0x67, 0xbd, 0x32, - 0x8e, 0xed, 0x13, 0xf6, 0x5b, 0xd8, 0x76, 0xb9, 0xbb, 0x10, 0x06, 0x67, 0xbc, 0xb8, 0x35, 0xd8, - 0x6d, 0x39, 0x7c, 0x40, 0x61, 0xef, 0x0e, 0x77, 0xaa, 0xed, 0xb9, 0x40, 0x4f, 0x7f, 0xf2, 0xd7, - 0x37, 0x07, 0xc1, 0x37, 0x6f, 0x0e, 0x82, 0x7f, 0xbe, 0x39, 0x08, 0xbe, 0x7e, 0x7b, 0x70, 0xe7, - 0x9b, 0xb7, 0x07, 0x77, 0xfe, 0xfe, 0xf6, 0xe0, 0x0e, 0xf8, 0x7f, 0xb9, 0x17, 0xc1, 0xef, 0xef, - 0xce, 0xa4, 0xc2, 0x54, 0x26, 0xde, 0xf7, 0x17, 0x8b, 0x27, 0xe3, 0x2d, 0x8a, 0xff, 0xa3, 0xff, - 0x07, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x52, 0x34, 0x52, 0x06, 0x0e, 0x00, 0x00, + // 1846 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9, + 0x11, 0x36, 0xff, 0x44, 0xb2, 0x48, 0x51, 0x72, 0x4b, 0x96, 0x69, 0xd9, 0x91, 0xe5, 0xc9, 0x6e, + 0xa2, 0x35, 0x02, 0x71, 0xad, 0xfc, 0x01, 0xc9, 0x61, 0x21, 0x4b, 0x5a, 0x47, 0xc0, 0x66, 0xa1, + 0x8c, 0x56, 0xc8, 0xcf, 0x65, 0xd0, 0x9a, 0x29, 0x91, 0x1d, 0x0d, 0xa7, 0x67, 0xbb, 0x9b, 0xb4, + 0xe8, 0x4b, 0x90, 0x3d, 0xe5, 0xb8, 0x40, 0x80, 0xe4, 0x95, 0x12, 0xe4, 0x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0xef, 0x72, 0xd4, 0x9d, 0x9b, 0x8a, 0x3a, 0x58, 0x27, 0x3f, 0x3d, 0xd6, + 0x2d, 0xfc, 0xd8, 0xe9, 0xc8, 0x7e, 0x05, 0xcb, 0x2e, 0x77, 0xa7, 0xc2, 0xe0, 0x98, 0xe7, 0x77, + 0x3a, 0xbb, 0x2b, 0x87, 0x0f, 0xc9, 0xed, 0xfd, 0xcd, 0x95, 0x32, 0x3c, 0xef, 0xe8, 0x14, 0x96, + 0x5f, 0xa1, 0x99, 0x23, 0xdf, 0x5d, 0x9e, 0x4b, 0x86, 0x5d, 0x63, 0x83, 0x0d, 0xf2, 0xba, 0xca, + 0xca, 0xca, 0x24, 0x64, 0x7b, 0xf9, 0xc3, 0xbf, 0xbc, 0xdd, 0xaa, 0x7c, 0xf5, 0x76, 0xab, 0xf2, + 0xcf, 0xb7, 0x5b, 0x95, 0x2f, 0xdf, 0x6d, 0xdd, 0xfb, 0xea, 0xdd, 0xd6, 0xbd, 0xbf, 0xbf, 0xdb, + 0xba, 0x07, 0xfe, 0x6f, 0x81, 0x93, 0xca, 0x6f, 0xee, 0x8f, 0xa5, 0xc2, 0x44, 0xc6, 0x7e, 0xeb, + 0x4f, 0xa7, 0x2f, 0xce, 0x97, 0xe8, 0xc8, 0xef, 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x15, + 0x06, 0x24, 0x51, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1239,6 +1538,8 @@ type ConfigAPIClient interface { GetEnvs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Envs, error) // 更新站点地图 UpdateSitemap(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取设备信息 + GetDeviceInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DeviceInfo, error) } type configAPIClient struct { @@ -1303,6 +1604,15 @@ func (c *configAPIClient) UpdateSitemap(ctx context.Context, in *emptypb.Empty, return out, nil } +func (c *configAPIClient) GetDeviceInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DeviceInfo, error) { + out := new(DeviceInfo) + err := c.cc.Invoke(ctx, "/api.v1.ConfigAPI/GetDeviceInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ConfigAPIServer is the server API for ConfigAPI service. type ConfigAPIServer interface { // 获取系统配置(针对所有用户,只读) @@ -1317,6 +1627,8 @@ type ConfigAPIServer interface { GetEnvs(context.Context, *emptypb.Empty) (*Envs, error) // 更新站点地图 UpdateSitemap(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + // 获取设备信息 + GetDeviceInfo(context.Context, *emptypb.Empty) (*DeviceInfo, error) } // UnimplementedConfigAPIServer can be embedded to have forward compatible implementations. @@ -1341,6 +1653,9 @@ func (*UnimplementedConfigAPIServer) GetEnvs(ctx context.Context, req *emptypb.E func (*UnimplementedConfigAPIServer) UpdateSitemap(ctx context.Context, req *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateSitemap not implemented") } +func (*UnimplementedConfigAPIServer) GetDeviceInfo(ctx context.Context, req *emptypb.Empty) (*DeviceInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDeviceInfo not implemented") +} func RegisterConfigAPIServer(s *grpc.Server, srv ConfigAPIServer) { s.RegisterService(&_ConfigAPI_serviceDesc, srv) @@ -1454,6 +1769,24 @@ func _ConfigAPI_UpdateSitemap_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _ConfigAPI_GetDeviceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ConfigAPIServer).GetDeviceInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.v1.ConfigAPI/GetDeviceInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ConfigAPIServer).GetDeviceInfo(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + var _ConfigAPI_serviceDesc = grpc.ServiceDesc{ ServiceName: "api.v1.ConfigAPI", HandlerType: (*ConfigAPIServer)(nil), @@ -1482,6 +1815,10 @@ var _ConfigAPI_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateSitemap", Handler: _ConfigAPI_UpdateSitemap_Handler, }, + { + MethodName: "GetDeviceInfo", + Handler: _ConfigAPI_GetDeviceInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/v1/config.proto", @@ -2359,52 +2696,260 @@ func (m *Stats) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintConfig(dAtA []byte, offset int, v uint64) int { - offset -= sovConfig(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *CPUInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *Config) Size() (n int) { - if m == nil { - return 0 - } + +func (m *CPUInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CPUInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Id != 0 { - n += 1 + sovConfig(uint64(m.Id)) - } - l = len(m.Label) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) + if m.Percent != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Percent)))) + i-- + dAtA[i] = 0x25 } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) + if m.Mhz != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Mhz)))) + i-- + dAtA[i] = 0x1d } - l = len(m.Placeholder) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) + if len(m.ModelName) > 0 { + i -= len(m.ModelName) + copy(dAtA[i:], m.ModelName) + i = encodeVarintConfig(dAtA, i, uint64(len(m.ModelName))) + i-- + dAtA[i] = 0x12 } - l = len(m.InputType) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) + if m.Cores != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Cores)) + i-- + dAtA[i] = 0x8 } - l = len(m.Category) - if l > 0 { - n += 1 + l + sovConfig(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *MemoryInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - if m.Sort != 0 { - n += 1 + sovConfig(uint64(m.Sort)) + return dAtA[:n], nil +} + +func (m *MemoryInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemoryInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Percent != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Percent)))) + i-- + dAtA[i] = 0x2d + } + if m.Free != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Free)) + i-- + dAtA[i] = 0x20 + } + if m.Used != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Used)) + i-- + dAtA[i] = 0x18 + } + if m.Available != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Available)) + i-- + dAtA[i] = 0x10 + } + if m.Total != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DiskInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DiskInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DiskInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Percent != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Percent)))) + i-- + dAtA[i] = 0x2d + } + if m.Free != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Free)) + i-- + dAtA[i] = 0x20 + } + if m.Used != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Used)) + i-- + dAtA[i] = 0x18 + } + if m.Total != 0 { + i = encodeVarintConfig(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x10 + } + if len(m.DiskName) > 0 { + i -= len(m.DiskName) + copy(dAtA[i:], m.DiskName) + i = encodeVarintConfig(dAtA, i, uint64(len(m.DiskName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeviceInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Disk) > 0 { + for iNdEx := len(m.Disk) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Disk[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConfig(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.Memory != nil { + { + size, err := m.Memory.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConfig(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Cpu != nil { + { + size, err := m.Cpu.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConfig(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintConfig(dAtA []byte, offset int, v uint64) int { + offset -= sovConfig(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Config) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovConfig(uint64(m.Id)) + } + l = len(m.Label) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + l = len(m.Placeholder) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + l = len(m.InputType) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + l = len(m.Category) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + if m.Sort != 0 { + n += 1 + sovConfig(uint64(m.Sort)) } l = len(m.Options) if l > 0 { @@ -2769,6 +3314,100 @@ func (m *Stats) Size() (n int) { return n } +func (m *CPUInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Cores != 0 { + n += 1 + sovConfig(uint64(m.Cores)) + } + l = len(m.ModelName) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + if m.Mhz != 0 { + n += 5 + } + if m.Percent != 0 { + n += 5 + } + return n +} + +func (m *MemoryInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Total != 0 { + n += 1 + sovConfig(uint64(m.Total)) + } + if m.Available != 0 { + n += 1 + sovConfig(uint64(m.Available)) + } + if m.Used != 0 { + n += 1 + sovConfig(uint64(m.Used)) + } + if m.Free != 0 { + n += 1 + sovConfig(uint64(m.Free)) + } + if m.Percent != 0 { + n += 5 + } + return n +} + +func (m *DiskInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DiskName) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) + } + if m.Total != 0 { + n += 1 + sovConfig(uint64(m.Total)) + } + if m.Used != 0 { + n += 1 + sovConfig(uint64(m.Used)) + } + if m.Free != 0 { + n += 1 + sovConfig(uint64(m.Free)) + } + if m.Percent != 0 { + n += 5 + } + return n +} + +func (m *DeviceInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Cpu != nil { + l = m.Cpu.Size() + n += 1 + l + sovConfig(uint64(l)) + } + if m.Memory != nil { + l = m.Memory.Size() + n += 1 + l + sovConfig(uint64(l)) + } + if len(m.Disk) > 0 { + for _, e := range m.Disk { + l = e.Size() + n += 1 + l + sovConfig(uint64(l)) + } + } + return n +} + func sovConfig(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5532,6 +6171,572 @@ func (m *Stats) Unmarshal(dAtA []byte) error { } return nil } +func (m *CPUInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CPUInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CPUInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cores", wireType) + } + m.Cores = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Cores |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModelName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + 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 ErrInvalidLengthConfig + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModelName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Mhz", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Mhz = float32(math.Float32frombits(v)) + case 4: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Percent", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Percent = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipConfig(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConfig + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MemoryInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MemoryInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MemoryInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + m.Total = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Total |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Available", wireType) + } + m.Available = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Available |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Used", wireType) + } + m.Used = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Used |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Free", wireType) + } + m.Free = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Free |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Percent", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Percent = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipConfig(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConfig + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DiskInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DiskInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DiskInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DiskName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + 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 ErrInvalidLengthConfig + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DiskName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + m.Total = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Total |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Used", wireType) + } + m.Used = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Used |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Free", wireType) + } + m.Free = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Free |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Percent", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Percent = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipConfig(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConfig + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cpu", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfig + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Cpu == nil { + m.Cpu = &CPUInfo{} + } + if err := m.Cpu.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Memory", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfig + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Memory == nil { + m.Memory = &MemoryInfo{} + } + if err := m.Memory.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Disk", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfig + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Disk = append(m.Disk, &DiskInfo{}) + if err := m.Disk[len(m.Disk)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConfig(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConfig + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipConfig(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/api/v1/config.pb.gw.go b/api/v1/config.pb.gw.go index ed9f5f4..41db982 100644 --- a/api/v1/config.pb.gw.go +++ b/api/v1/config.pb.gw.go @@ -176,6 +176,24 @@ func local_request_ConfigAPI_UpdateSitemap_0(ctx context.Context, marshaler runt } +func request_ConfigAPI_GetDeviceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := client.GetDeviceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ConfigAPI_GetDeviceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.GetDeviceInfo(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterConfigAPIHandlerServer registers the http handlers for service ConfigAPI to "mux". // UnaryRPC :call ConfigAPIServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -320,6 +338,29 @@ func RegisterConfigAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ConfigAPI_GetDeviceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ConfigAPI_GetDeviceInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ConfigAPI_GetDeviceInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -481,6 +522,26 @@ func RegisterConfigAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ConfigAPI_GetDeviceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ConfigAPI_GetDeviceInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ConfigAPI_GetDeviceInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -496,6 +557,8 @@ var ( pattern_ConfigAPI_GetEnvs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "envs"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ConfigAPI_UpdateSitemap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "sitemap"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ConfigAPI_GetDeviceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "device"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -510,4 +573,6 @@ var ( forward_ConfigAPI_GetEnvs_0 = runtime.ForwardResponseMessage forward_ConfigAPI_UpdateSitemap_0 = runtime.ForwardResponseMessage + + forward_ConfigAPI_GetDeviceInfo_0 = runtime.ForwardResponseMessage ) diff --git a/api/v1/config.proto b/api/v1/config.proto index 53d7747..5851042 100644 --- a/api/v1/config.proto +++ b/api/v1/config.proto @@ -136,6 +136,40 @@ message Stats { int64 report_count = 12; // 举报数量 } +message CPUInfo { + int32 cores = 1; // CPU核心数 + string model_name = 2; // CPU型号 + float mhz = 3; // CPU主频 + float percent = 4; // CPU使用率 +} + +message MemoryInfo { + int64 total = 1; // 总内存 + int64 available = 2; // 可用内存 + int64 used = 3; // 已用内存 + int64 free = 4; // 空闲内存 + float percent = 5; // 内存使用率 +} + +message DiskInfo { + string disk_name = 1; // 磁盘名称 + int64 total = 2; // 总空间 + int64 used = 3; // 已用空间 + int64 free = 4; // 空闲空间 + float percent = 5; // 磁盘使用率 +} + +message DeviceInfo { + CPUInfo cpu = 1; // CPU信息 + MemoryInfo memory = 2; // 内存信息 + repeated DiskInfo disk = 3; // 磁盘信息 + // string os = 4; // 操作系统 + // string os_version = 5; // 操作系统版本 + // string kernel = 6; // 内核版本 + // string hostname = 7; // 主机名 + // string architecture = 8; // 架构 +} + // 配置服务 service ConfigAPI { @@ -181,4 +215,11 @@ service ConfigAPI { put : "/api/v1/sitemap" }; } + + // 获取设备信息 + rpc GetDeviceInfo(google.protobuf.Empty) returns (DeviceInfo) { + option (google.api.http) = { + get : "/api/v1/device" + }; + } } \ No newline at end of file diff --git a/biz/config.go b/biz/config.go index 6a112a9..1dcc442 100644 --- a/biz/config.go +++ b/biz/config.go @@ -11,6 +11,7 @@ import ( "moredoc/middleware/auth" "moredoc/model" "moredoc/util" + "moredoc/util/device" "github.com/PuerkitoBio/goquery" "go.uber.org/zap" @@ -266,3 +267,38 @@ func (s *ConfigAPIService) GetEnvs(ctx context.Context, req *emptypb.Empty) (res res.Envs = envs return } + +func (s *ConfigAPIService) GetDeviceInfo(ctx context.Context, req *emptypb.Empty) (res *pb.DeviceInfo, err error) { + res = &pb.DeviceInfo{ + Cpu: &pb.CPUInfo{}, + Memory: &pb.MemoryInfo{}, + } + cpu := device.GetCPU() + + err = util.CopyStruct(&cpu, res.Cpu) + if err != nil { + s.logger.Error("util.CopyStruct", zap.Any("cpu", cpu), zap.Any("res.Cpu", res.Cpu), zap.Error(err)) + return + } + + mem := device.GetMemory() + err = util.CopyStruct(&mem, res.Memory) + if err != nil { + s.logger.Error("util.CopyStruct", zap.Any("mem", mem), zap.Any("res.Memory", res.Memory), zap.Error(err)) + return + } + + disks := device.GetDisk() + if len(disks) > 0 { + for _, disk := range disks { + pbDisk := &pb.DiskInfo{} + err = util.CopyStruct(&disk, pbDisk) + if err != nil { + s.logger.Error("util.CopyStruct", zap.Any("disk", disk), zap.Any("res.Disk", res.Disk), zap.Error(err)) + return + } + res.Disk = append(res.Disk, pbDisk) + } + } + return res, nil +} diff --git a/go.mod b/go.mod index 69ff682..bafc36a 100644 --- a/go.mod +++ b/go.mod @@ -28,9 +28,16 @@ require ( require ( github.com/andybalholm/cascadia v1.3.1 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/goccy/go-json v0.9.7 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/pelletier/go-toml/v2 v2.0.1 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/shoenig/go-m1cpu v0.1.4 // indirect + github.com/tklauser/go-sysconf v0.3.11 // indirect + github.com/tklauser/numcpus v0.6.0 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect ) @@ -60,6 +67,7 @@ require ( github.com/mojocn/base64Captcha v1.3.5 github.com/pelletier/go-toml v1.9.4 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/shirou/gopsutil/v3 v3.23.3 github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -70,7 +78,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect - golang.org/x/sys v0.1.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.4.0 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 7e5426b..e7b4865 100644 --- a/go.sum +++ b/go.sum @@ -140,6 +140,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= @@ -215,8 +217,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -313,6 +316,8 @@ github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdA github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -368,6 +373,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= @@ -389,6 +396,12 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shirou/gopsutil/v3 v3.23.3 h1:Syt5vVZXUDXPEXpIBt5ziWsJ4LdSAAxF4l/xZeQgSEE= +github.com/shirou/gopsutil/v3 v3.23.3/go.mod h1:lSBNN6t3+D6W5e5nXTxc8KIMMVxAcS+6IJlffjRRlMU= +github.com/shoenig/go-m1cpu v0.1.4 h1:SZPIgRM2sEF9NJy50mRHu9PKGwxyyTTJIWvCtgVbozs= +github.com/shoenig/go-m1cpu v0.1.4/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= +github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= +github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -408,16 +421,24 @@ github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= +github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= +github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= +github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= @@ -431,6 +452,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= @@ -596,6 +619,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -623,6 +647,7 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -647,8 +672,9 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -721,7 +747,6 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -900,8 +925,9 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.3.2 h1:QJryWiqQ91EvZ0jZL48NOpdlPdMjdip1hQ8bTgo4H7I= gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= diff --git a/util/device/device.go b/util/device/device.go new file mode 100644 index 0000000..101016a --- /dev/null +++ b/util/device/device.go @@ -0,0 +1,82 @@ +package device + +import ( + "fmt" + "time" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/disk" + "github.com/shirou/gopsutil/v3/mem" +) + +type CPUInfo struct { + Cores int32 `json:"cores"` + ModelName string `json:"model_name"` + Mhz float64 `json:"mhz"` + Percent float64 `json:"percent"` +} + +type MemInfo struct { + Total uint64 `json:"total"` + Available uint64 `json:"available"` + Used uint64 `json:"used"` + UsedPercent float64 `json:"used_percent"` + Free uint64 `json:"free"` +} + +type DiskInfo struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + Percent float64 `json:"percent"` + DiskName string `json:"disk_name"` +} + +// GetMemory returns memory information +func GetMemory() (memInfo MemInfo) { + v, err := mem.VirtualMemory() + if err != nil { + fmt.Printf("mem.VirtualMemory() failed with %s", err) + return + } + + memInfo.Total = v.Total + memInfo.Available = v.Available + memInfo.Used = v.Used + memInfo.UsedPercent = v.UsedPercent + memInfo.Free = v.Free + return +} + +func GetDisk() (diskInfos []DiskInfo) { + states, _ := disk.IOCounters() + for key := range states { + usage, _ := disk.Usage(key) + if usage != nil { + diskInfos = append(diskInfos, DiskInfo{ + DiskName: key, + Total: usage.Total, + Used: usage.Used, + Free: usage.Free, + Percent: usage.UsedPercent, + }) + } + } + return +} + +// GetCPU returns CPU information +func GetCPU() (cpuInfo CPUInfo) { + cpuInfos, _ := cpu.Info() + for _, c := range cpuInfos { + cpuInfo.Cores = c.Cores + cpuInfo.ModelName = c.ModelName + cpuInfo.Mhz = c.Mhz + } + + percents, _ := cpu.Percent(time.Second, false) + for _, p := range percents { + cpuInfo.Percent = p + } + return +} diff --git a/web/api/config.js b/web/api/config.js index 8ed805a..6d5d9b9 100644 --- a/web/api/config.js +++ b/web/api/config.js @@ -44,3 +44,10 @@ export const getEnvs = () => { method: 'get', }) } + +export const getDevice = () => { + return service({ + url: '/api/v1/device', + method: 'get', + }) +} diff --git a/web/nuxt.config.js b/web/nuxt.config.js index 5ba0cdf..4f92cf1 100644 --- a/web/nuxt.config.js +++ b/web/nuxt.config.js @@ -45,6 +45,7 @@ export default { // https://go.nuxtjs.dev/eslint // '@nuxtjs/eslint-module', '@nuxtjs/style-resources', + '@nuxtjs/composition-api/module', ], // Modules: https://go.nuxtjs.dev/config-modules diff --git a/web/package-lock.json b/web/package-lock.json index 2b19daf..da3b0d3 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -2120,6 +2120,34 @@ "defu": "^5.0.0" } }, + "@nuxtjs/composition-api": { + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/@nuxtjs/composition-api/-/composition-api-0.33.1.tgz", + "integrity": "sha512-dI0c5atKDsEIVycrsKw9T+aaos2VggscSJBPZpC1BXKzHR7+9Ilor+SHvnAEb5j2E2v+8x407Uo339oJzhlD1A==", + "dev": true, + "requires": { + "defu": "^6.0.0", + "estree-walker": "^2.0.2", + "fs-extra": "^9.1.0", + "magic-string": "^0.26.2", + "pathe": "^0.3.3", + "ufo": "^0.8.5" + }, + "dependencies": { + "defu": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.2.tgz", + "integrity": "sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==", + "dev": true + }, + "ufo": { + "version": "0.8.6", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-0.8.6.tgz", + "integrity": "sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==", + "dev": true + } + } + }, "@nuxtjs/eslint-config": { "version": "8.0.0", "resolved": "https://registry.npmmirror.com/@nuxtjs/eslint-config/-/eslint-config-8.0.0.tgz", @@ -3548,6 +3576,15 @@ "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz", @@ -5151,6 +5188,22 @@ "safer-buffer": "^2.1.0" } }, + "echarts": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.2.tgz", + "integrity": "sha512-2W3vw3oI2tWJdyAz+b8DuWS0nfXtSDqlDmqgin/lfzbkB01cuMEN66KWBlmur3YMp5nEDEEt5s23pllnAzB4EA==", + "requires": { + "tslib": "2.3.0", + "zrender": "5.4.3" + }, + "dependencies": { + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + } + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz", @@ -6028,6 +6081,12 @@ "resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmmirror.com/esutils/-/esutils-2.0.3.tgz", @@ -6367,6 +6426,12 @@ } } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz", @@ -8405,6 +8470,15 @@ "yallist": "^4.0.0" } }, + "magic-string": { + "version": "0.26.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz", + "integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz", @@ -9774,6 +9848,12 @@ "resolved": "https://registry.npmmirror.com/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, + "pathe": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-0.3.9.tgz", + "integrity": "sha512-6Y6s0vT112P3jD8dGfuS6r+lpa0qqNrLyHPOwvXMnyNTQaYiwgau2DP3aNDsR13xqtGj7rrPo+jFUATpU6/s+g==", + "dev": true + }, "pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmmirror.com/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -12524,6 +12604,11 @@ "resolved": "https://registry.npmmirror.com/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, + "resize-detector": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/resize-detector/-/resize-detector-0.3.0.tgz", + "integrity": "sha512-R/tCuvuOHQ8o2boRP6vgx8hXCCy87H1eY9V5imBYeVNyNVpuL9ciReSccLj2gDcax9+2weXy3bc8Vv+NRXeEvQ==" + }, "resize-observer-polyfill": { "version": "1.5.1", "resolved": "https://registry.npmmirror.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", @@ -13354,6 +13439,12 @@ "resolved": "https://registry.npmmirror.com/source-map-url/-/source-map-url-0.4.1.tgz", "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==" }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, "spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmmirror.com/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -14814,6 +14905,20 @@ "tinycolor2": "^1.1.2" } }, + "vue-demi": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.13.11.tgz", + "integrity": "sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==" + }, + "vue-echarts": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/vue-echarts/-/vue-echarts-6.5.4.tgz", + "integrity": "sha512-pLJTk2hfhauoWdmiZGXByAtcO6bpfnAS+jkJqKimSBSV5I5ckh2nka9duLlIVbTvQOEb2tFa0XiXjACQNcEfpA==", + "requires": { + "resize-detector": "^0.3.0", + "vue-demi": "^0.13.2" + } + }, "vue-eslint-parser": { "version": "8.3.0", "resolved": "https://registry.npmmirror.com/vue-eslint-parser/-/vue-eslint-parser-8.3.0.tgz", @@ -15230,6 +15335,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -16022,6 +16128,21 @@ "resolved": "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, + "zrender": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.3.tgz", + "integrity": "sha512-DRUM4ZLnoaT0PBVvGBDO9oWIDBKFdAVieNWxWwK0niYzJCMwGchRk21/hsE+RKkIveH3XHCyvXcJDkgLVvfizQ==", + "requires": { + "tslib": "2.3.0" + }, + "dependencies": { + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + } + } + }, "zwitch": { "version": "1.0.5", "resolved": "https://registry.npmmirror.com/zwitch/-/zwitch-1.0.5.tgz", diff --git a/web/package.json b/web/package.json index d85fc5a..060dde1 100644 --- a/web/package.json +++ b/web/package.json @@ -19,6 +19,7 @@ "@wangeditor/editor-for-vue": "^1.0.2", "@wangeditor/plugin-md": "^1.0.0", "core-js": "^3.19.3", + "echarts": "^5.4.2", "element-ui": "^2.15.10", "hotkeys-js": "^3.10.0", "nuxt": "^2.15.8", @@ -27,6 +28,7 @@ "v-viewer": "^1.6.4", "vue": "^2.6.14", "vue-color": "^2.8.1", + "vue-echarts": "^6.5.4", "vue-lazyload": "^3.0.0-rc.2", "vue-marquee-text-component": "^1.2.0", "vue-server-renderer": "^2.6.14", @@ -37,6 +39,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.16.3", + "@nuxtjs/composition-api": "^0.33.1", "@nuxtjs/eslint-config": "^8.0.0", "@nuxtjs/eslint-module": "^3.0.2", "@nuxtjs/style-resources": "^1.2.1", diff --git a/web/pages/admin/dashboard.vue b/web/pages/admin/dashboard.vue index e4e8cd1..281e58a 100644 --- a/web/pages/admin/dashboard.vue +++ b/web/pages/admin/dashboard.vue @@ -1,6 +1,30 @@ @@ -350,5 +595,26 @@ export default { .opensource .el-link { margin-top: -3px; } + .chart { + height: 234px; + } + .gauges { + min-height: 294px; + font-size: 14px; + ul, + li { + list-style: none; + padding: 0; + margin: 0; + } + small { + color: #999; + } + li { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } }