handleWidgetSelect(data.blockdef)} key={`widget-${idx}`}>
-
+
handleWidgetSelect(data.blockdef)}
+ key={`widget-${idx}`}
+ title={data.description || data.label}
+ >
+
+
+
+ {!util.isBlank(data.label) ?
{data.label}
: null}
))}
diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts
index d862ed946..ba826528b 100644
--- a/frontend/types/gotypes.d.ts
+++ b/frontend/types/gotypes.d.ts
@@ -31,7 +31,7 @@ declare global {
type BlockCommand = {
command: string;
- } & ( BlockSetMetaCommand | BlockGetMetaCommand | BlockMessageCommand | BlockAppendFileCommand | BlockAppendIJsonCommand | ResolveIdsCommand | BlockInputCommand | BlockSetViewCommand );
+ } & ( ResolveIdsCommand | BlockSetViewCommand | BlockSetMetaCommand | BlockGetMetaCommand | BlockMessageCommand | BlockInputCommand | BlockAppendFileCommand | BlockAppendIJsonCommand | CreateBlockCommand );
// wstore.BlockDef
type BlockDef = {
@@ -88,6 +88,13 @@ declare global {
meta: MetaType;
};
+ // wshutil.CreateBlockCommand
+ type CreateBlockCommand = {
+ command: "createblock";
+ blockdef: BlockDef;
+ rtopts?: RuntimeOpts;
+ };
+
// wstore.FileDef
type FileDef = {
filetype?: string;
@@ -168,6 +175,11 @@ declare global {
termsize: TermSize;
};
+ // wconfig.SettingsConfigType
+ type SettingsConfigType = {
+ widgets: WidgetsConfigType[];
+ };
+
// wstore.StickerClickOptsType
type StickerClickOptsType = {
sendinput?: string;
@@ -228,6 +240,13 @@ declare global {
data64: string;
};
+ // wconfig.WatcherUpdate
+ type WatcherUpdate = {
+ file: string;
+ update: SettingsConfigType;
+ error: string;
+ };
+
// filestore.WaveFile
type WaveFile = {
zoneid: string;
@@ -285,6 +304,9 @@ declare global {
// wconfig.WidgetsConfigType
type WidgetsConfigType = {
icon: string;
+ color?: string;
+ label?: string;
+ description?: string;
blockdef: BlockDef;
};
diff --git a/pkg/tsgen/tsgen.go b/pkg/tsgen/tsgen.go
index ae1313efd..c46845372 100644
--- a/pkg/tsgen/tsgen.go
+++ b/pkg/tsgen/tsgen.go
@@ -15,11 +15,33 @@ import (
"github.com/wavetermdev/thenextwave/pkg/service"
"github.com/wavetermdev/thenextwave/pkg/tsgen/tsgenmeta"
"github.com/wavetermdev/thenextwave/pkg/waveobj"
+ "github.com/wavetermdev/thenextwave/pkg/wconfig"
"github.com/wavetermdev/thenextwave/pkg/web/webcmd"
"github.com/wavetermdev/thenextwave/pkg/wshutil"
"github.com/wavetermdev/thenextwave/pkg/wstore"
)
+// add extra types to generate here
+var ExtraTypes = []any{
+ waveobj.ORef{},
+ (*waveobj.WaveObj)(nil),
+ map[string]any{},
+ service.WebCallType{},
+ service.WebReturnType{},
+ wstore.UIContext{},
+ eventbus.WSEventType{},
+ eventbus.WSFileEventData{},
+ filestore.WaveFile{},
+ wconfig.SettingsConfigType{},
+ wconfig.WatcherUpdate{},
+}
+
+// add extra type unions to generate here
+var TypeUnions = []tsgenmeta.TypeUnionMeta{
+ wshutil.CommandTypeUnionMeta(),
+ webcmd.WSCommandTypeUnionMeta(),
+}
+
var contextRType = reflect.TypeOf((*context.Context)(nil)).Elem()
var errorRType = reflect.TypeOf((*error)(nil)).Elem()
var anyRType = reflect.TypeOf((*interface{})(nil)).Elem()
@@ -359,17 +381,12 @@ func GenerateServiceClass(serviceName string, serviceObj any, tsTypesMap map[ref
}
func GenerateWaveObjTypes(tsTypesMap map[reflect.Type]string) {
- GenerateTSTypeUnion(wshutil.CommandTypeUnionMeta(), tsTypesMap)
- GenerateTSTypeUnion(webcmd.WSCommandTypeUnionMeta(), tsTypesMap)
- GenerateTSType(reflect.TypeOf(waveobj.ORef{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf((*waveobj.WaveObj)(nil)).Elem(), tsTypesMap)
- GenerateTSType(reflect.TypeOf(map[string]any{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(service.WebCallType{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(service.WebReturnType{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(wstore.UIContext{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(eventbus.WSEventType{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(eventbus.WSFileEventData{}), tsTypesMap)
- GenerateTSType(reflect.TypeOf(filestore.WaveFile{}), tsTypesMap)
+ for _, typeUnion := range TypeUnions {
+ GenerateTSTypeUnion(typeUnion, tsTypesMap)
+ }
+ for _, extraType := range ExtraTypes {
+ GenerateTSType(reflect.TypeOf(extraType), tsTypesMap)
+ }
for _, rtype := range wstore.AllWaveObjTypes() {
GenerateTSType(rtype, tsTypesMap)
}
diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go
index 895ff9bc5..9a1e5040c 100644
--- a/pkg/wconfig/settingsconfig.go
+++ b/pkg/wconfig/settingsconfig.go
@@ -12,8 +12,11 @@ const settingsFile = "settings.json"
var settingsAbsPath = filepath.Join(configDirAbsPath, settingsFile)
type WidgetsConfigType struct {
- Icon string `json:"icon"`
- BlockDef wstore.BlockDef `json:"blockdef"`
+ Icon string `json:"icon"`
+ Color string `json:"color,omitempty"`
+ Label string `json:"label,omitempty"`
+ Description string `json:"description,omitempty"`
+ BlockDef wstore.BlockDef `json:"blockdef"`
}
type SettingsConfigType struct {