mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
misc v0.9.3 fixes -- numToString, block counts, fix docsite images/video (#1354)
This commit is contained in:
parent
4f809550b9
commit
b6ce2cd022
@ -87,7 +87,7 @@ tasks:
|
|||||||
- "dist/docsite/**/*"
|
- "dist/docsite/**/*"
|
||||||
cmds:
|
cmds:
|
||||||
- cd docs && yarn build-embedded
|
- cd docs && yarn build-embedded
|
||||||
- task: copyfiles:'docs/build':'dist/docsite'
|
- task: copyfiles:'docs/build/':'dist/docsite'
|
||||||
deps:
|
deps:
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ func beforeSendActivityUpdate(ctx context.Context) {
|
|||||||
activity := telemetry.ActivityUpdate{}
|
activity := telemetry.ActivityUpdate{}
|
||||||
activity.NumTabs, _ = wstore.DBGetCount[*waveobj.Tab](ctx)
|
activity.NumTabs, _ = wstore.DBGetCount[*waveobj.Tab](ctx)
|
||||||
activity.NumBlocks, _ = wstore.DBGetCount[*waveobj.Block](ctx)
|
activity.NumBlocks, _ = wstore.DBGetCount[*waveobj.Block](ctx)
|
||||||
|
activity.Blocks, _ = wstore.DBGetBlockViewCounts(ctx)
|
||||||
activity.NumWindows, _ = wstore.DBGetCount[*waveobj.Window](ctx)
|
activity.NumWindows, _ = wstore.DBGetCount[*waveobj.Window](ctx)
|
||||||
activity.NumSSHConn = conncontroller.GetNumSSHHasConnected()
|
activity.NumSSHConn = conncontroller.GetNumSSHHasConnected()
|
||||||
activity.NumWSLConn = wsl.GetNumWSLHasConnected()
|
activity.NumWSLConn = wsl.GetNumWSLHasConnected()
|
||||||
|
@ -9,7 +9,7 @@ title: "Customization"
|
|||||||
<img
|
<img
|
||||||
title="Tab Context Menu"
|
title="Tab Context Menu"
|
||||||
style={{ float: "right", margin: "0 0 10px 10px" }}
|
style={{ float: "right", margin: "0 0 10px 10px" }}
|
||||||
src="/img/tab-context-menu.png"
|
src="./img/tab-context-menu.png"
|
||||||
width="300"
|
width="300"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ It is also possible to create your own themes using custom colors, gradients, im
|
|||||||
<img
|
<img
|
||||||
title="Terminal Context Menu"
|
title="Terminal Context Menu"
|
||||||
style={{ float: "right", margin: "0 0 10px 10px" }}
|
style={{ float: "right", margin: "0 0 10px 10px" }}
|
||||||
src="/img/terminal-context-menu.png"
|
src="./img/terminal-context-menu.png"
|
||||||
width="300"
|
width="300"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ There is no UI to edit your default terminal font family. But, it _can_ be overr
|
|||||||
<img
|
<img
|
||||||
title="Terminal Context Menu"
|
title="Terminal Context Menu"
|
||||||
style={{ float: "right", margin: "0 0 10px 10px" }}
|
style={{ float: "right", margin: "0 0 10px 10px" }}
|
||||||
src="/img/custom-widgets.png"
|
src="./img/custom-widgets.png"
|
||||||
width="120"
|
width="120"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ You can move blocks by clicking on the block header and dragging the block aroun
|
|||||||
There are 7 different drop targets for any given block. A block is divided into quadrants along its diagonals. If the block is tiling as a row (left-to-right), dropping a block into the left or right quadrant will place the dropped block in the same level as the targeted block. This can be considered dropping the block inline. If you drop the block out of line (in quadrants corresponding to opposite tiling direction), the block will either be placed one level above or one level below the targeted block. Dropping the block towards the outside will place it in the same level as the target block's parent, while dropping it towards the center of the block will create a new level, where both the target block and the dropped block will be moved. The middle fifth of the block is reserved for the swap action. Dropping a block here will cause the target block and the dropped block to swap positions in the layout.
|
There are 7 different drop targets for any given block. A block is divided into quadrants along its diagonals. If the block is tiling as a row (left-to-right), dropping a block into the left or right quadrant will place the dropped block in the same level as the targeted block. This can be considered dropping the block inline. If you drop the block out of line (in quadrants corresponding to opposite tiling direction), the block will either be placed one level above or one level below the targeted block. Dropping the block towards the outside will place it in the same level as the target block's parent, while dropping it towards the center of the block will create a new level, where both the target block and the dropped block will be moved. The middle fifth of the block is reserved for the swap action. Dropping a block here will cause the target block and the dropped block to swap positions in the layout.
|
||||||
|
|
||||||
<video width="100%" height="100%" playsinline autoplay muted controls>
|
<video width="100%" height="100%" playsinline autoplay muted controls>
|
||||||
<source src="/img/drag-move-24fps-crf43.mp4" type="video/mp4" />
|
<source src="./img/drag-move-24fps-crf43.mp4" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
#### Possible block movements
|
#### Possible block movements
|
||||||
@ -72,7 +72,7 @@ All block movements except for Swap will cause the rest of the layout to shift t
|
|||||||
### Resize a block
|
### Resize a block
|
||||||
|
|
||||||
<video width="100%" height="100%" playsinline autoplay muted controls>
|
<video width="100%" height="100%" playsinline autoplay muted controls>
|
||||||
<source src="/img/resize-24fps-crf43.mp4" type="video/mp4" />
|
<source src="./img/resize-24fps-crf43.mp4" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
![screenshot showing the line that appears when the cursor hovers over the margin of a block, indicating which blocks
|
![screenshot showing the line that appears when the cursor hovers over the margin of a block, indicating which blocks
|
||||||
|
@ -50,7 +50,7 @@ When telemetry is active, we collect the following data. It is stored in the `te
|
|||||||
| NumBlocks | The number of existing blocks open on a given day |
|
| NumBlocks | The number of existing blocks open on a given day |
|
||||||
| NumTabs | The number of existing tabs open on a given day. |
|
| NumTabs | The number of existing tabs open on a given day. |
|
||||||
| NewTab | The number of new tabs created on a given day |
|
| NewTab | The number of new tabs created on a given day |
|
||||||
| NumWindows | The number of existing windows open on a give day. |
|
| NumWindows | The number of existing windows open on a given day. |
|
||||||
| NewTab | The number of new tabs opened on a given day. |
|
| NewTab | The number of new tabs opened on a given day. |
|
||||||
| NumStartup | The number of times waveterm has been started on a given day. |
|
| NumStartup | The number of times waveterm has been started on a given day. |
|
||||||
| NumShutdown | The number of times waveterm has been shut down on a given day. |
|
| NumShutdown | The number of times waveterm has been shut down on a given day. |
|
||||||
@ -61,6 +61,7 @@ When telemetry is active, we collect the following data. It is stored in the `te
|
|||||||
| NumWSLConns | The number of distinct WSL connections that have been made to distinct distros |
|
| NumWSLConns | The number of distinct WSL connections that have been made to distinct distros |
|
||||||
| Renderers | The number of new block views of each type are open on a given day. |
|
| Renderers | The number of new block views of each type are open on a given day. |
|
||||||
| WshCmds | The number of wsh commands of each type run on a given day |
|
| WshCmds | The number of wsh commands of each type run on a given day |
|
||||||
|
| Blocks | The number of blocks of different view types open on a given day |
|
||||||
| Conn | The number of successful remote connections made (and errors) on a given day |
|
| Conn | The number of successful remote connections made (and errors) on a given day |
|
||||||
|
|
||||||
## Associated Data
|
## Associated Data
|
||||||
|
@ -15,7 +15,6 @@ const baseUrlRegex = /http[s]?:\/\/([^:\/])+(:\d+)?/;
|
|||||||
class HelpViewModel extends WebViewModel {
|
class HelpViewModel extends WebViewModel {
|
||||||
constructor(blockId: string, nodeModel: BlockNodeModel) {
|
constructor(blockId: string, nodeModel: BlockNodeModel) {
|
||||||
super(blockId, nodeModel);
|
super(blockId, nodeModel);
|
||||||
this.getSettingsMenuItems = undefined;
|
|
||||||
this.viewText = atom((get) => {
|
this.viewText = atom((get) => {
|
||||||
// force a dependency on meta.url so we re-render the buttons when the url changes
|
// force a dependency on meta.url so we re-render the buttons when the url changes
|
||||||
get(this.blockAtom)?.meta?.url || get(this.homepageUrl);
|
get(this.blockAtom)?.meta?.url || get(this.homepageUrl);
|
||||||
@ -58,6 +57,23 @@ class HelpViewModel extends WebViewModel {
|
|||||||
return newUrl;
|
return newUrl;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSettingsMenuItems(): ContextMenuItem[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: this.webviewRef.current?.isDevToolsOpened() ? "Close DevTools" : "Open DevTools",
|
||||||
|
click: async () => {
|
||||||
|
if (this.webviewRef.current) {
|
||||||
|
if (this.webviewRef.current.isDevToolsOpened()) {
|
||||||
|
this.webviewRef.current.closeDevTools();
|
||||||
|
} else {
|
||||||
|
this.webviewRef.current.openDevTools();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeHelpViewModel(blockId: string, nodeModel: BlockNodeModel) {
|
function makeHelpViewModel(blockId: string, nodeModel: BlockNodeModel) {
|
||||||
|
1
frontend/types/gotypes.d.ts
vendored
1
frontend/types/gotypes.d.ts
vendored
@ -32,6 +32,7 @@ declare global {
|
|||||||
buildtime?: string;
|
buildtime?: string;
|
||||||
displays?: ActivityDisplayType[];
|
displays?: ActivityDisplayType[];
|
||||||
renderers?: {[key: string]: number};
|
renderers?: {[key: string]: number};
|
||||||
|
blocks?: {[key: string]: number};
|
||||||
wshcmds?: {[key: string]: number};
|
wshcmds?: {[key: string]: number};
|
||||||
conn?: {[key: string]: number};
|
conn?: {[key: string]: number};
|
||||||
};
|
};
|
||||||
|
@ -44,6 +44,7 @@ type ActivityUpdate struct {
|
|||||||
BuildTime string `json:"buildtime,omitempty"`
|
BuildTime string `json:"buildtime,omitempty"`
|
||||||
Displays []ActivityDisplayType `json:"displays,omitempty"`
|
Displays []ActivityDisplayType `json:"displays,omitempty"`
|
||||||
Renderers map[string]int `json:"renderers,omitempty"`
|
Renderers map[string]int `json:"renderers,omitempty"`
|
||||||
|
Blocks map[string]int `json:"blocks,omitempty"`
|
||||||
WshCmds map[string]int `json:"wshcmds,omitempty"`
|
WshCmds map[string]int `json:"wshcmds,omitempty"`
|
||||||
Conn map[string]int `json:"conn,omitempty"`
|
Conn map[string]int `json:"conn,omitempty"`
|
||||||
}
|
}
|
||||||
@ -77,6 +78,7 @@ type TelemetryData struct {
|
|||||||
SetTabTheme int `json:"settabtheme,omitempty"`
|
SetTabTheme int `json:"settabtheme,omitempty"`
|
||||||
Displays []ActivityDisplayType `json:"displays,omitempty"`
|
Displays []ActivityDisplayType `json:"displays,omitempty"`
|
||||||
Renderers map[string]int `json:"renderers,omitempty"`
|
Renderers map[string]int `json:"renderers,omitempty"`
|
||||||
|
Blocks map[string]int `json:"blocks,omitempty"`
|
||||||
WshCmds map[string]int `json:"wshcmds,omitempty"`
|
WshCmds map[string]int `json:"wshcmds,omitempty"`
|
||||||
Conn map[string]int `json:"conn,omitempty"`
|
Conn map[string]int `json:"conn,omitempty"`
|
||||||
}
|
}
|
||||||
@ -185,6 +187,9 @@ func UpdateActivity(ctx context.Context, update ActivityUpdate) error {
|
|||||||
if len(update.Displays) > 0 {
|
if len(update.Displays) > 0 {
|
||||||
tdata.Displays = update.Displays
|
tdata.Displays = update.Displays
|
||||||
}
|
}
|
||||||
|
if len(update.Blocks) > 0 {
|
||||||
|
tdata.Blocks = update.Blocks
|
||||||
|
}
|
||||||
query = `UPDATE db_activity
|
query = `UPDATE db_activity
|
||||||
SET tdata = ?,
|
SET tdata = ?,
|
||||||
clientversion = ?,
|
clientversion = ?,
|
||||||
|
@ -471,10 +471,26 @@ func UseEffect(ctx context.Context, fn func() func(), deps []any) {
|
|||||||
|
|
||||||
func numToString[T any](value T) (string, bool) {
|
func numToString[T any](value T) (string, bool) {
|
||||||
switch v := any(value).(type) {
|
switch v := any(value).(type) {
|
||||||
case int, int8, int16, int32, int64:
|
case int:
|
||||||
return strconv.FormatInt(v.(int64), 10), true
|
return strconv.FormatInt(int64(v), 10), true
|
||||||
case uint, uint8, uint16, uint32, uint64:
|
case int8:
|
||||||
return strconv.FormatUint(v.(uint64), 10), true
|
return strconv.FormatInt(int64(v), 10), true
|
||||||
|
case int16:
|
||||||
|
return strconv.FormatInt(int64(v), 10), true
|
||||||
|
case int32:
|
||||||
|
return strconv.FormatInt(int64(v), 10), true
|
||||||
|
case int64:
|
||||||
|
return strconv.FormatInt(v, 10), true
|
||||||
|
case uint:
|
||||||
|
return strconv.FormatUint(uint64(v), 10), true
|
||||||
|
case uint8:
|
||||||
|
return strconv.FormatUint(uint64(v), 10), true
|
||||||
|
case uint16:
|
||||||
|
return strconv.FormatUint(uint64(v), 10), true
|
||||||
|
case uint32:
|
||||||
|
return strconv.FormatUint(uint64(v), 10), true
|
||||||
|
case uint64:
|
||||||
|
return strconv.FormatUint(v, 10), true
|
||||||
case float32:
|
case float32:
|
||||||
return strconv.FormatFloat(float64(v), 'f', -1, 32), true
|
return strconv.FormatFloat(float64(v), 'f', -1, 32), true
|
||||||
case float64:
|
case float64:
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wavetermdev/waveterm/pkg/filestore"
|
"github.com/wavetermdev/waveterm/pkg/filestore"
|
||||||
@ -44,6 +45,26 @@ func DBGetCount[T waveobj.WaveObj](ctx context.Context) (int, error) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var viewRe = regexp.MustCompile(`^[a-z0-9]{1,20}$`)
|
||||||
|
|
||||||
|
func DBGetBlockViewCounts(ctx context.Context) (map[string]int, error) {
|
||||||
|
return WithTxRtn(ctx, func(tx *TxWrap) (map[string]int, error) {
|
||||||
|
query := `SELECT COALESCE(json_extract(data, '$.meta.view'), '') AS view FROM db_block`
|
||||||
|
views := tx.SelectStrings(query)
|
||||||
|
rtn := make(map[string]int)
|
||||||
|
for _, view := range views {
|
||||||
|
if view == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !viewRe.MatchString(view) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
rtn[view]++
|
||||||
|
}
|
||||||
|
return rtn, nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
type idDataType struct {
|
type idDataType struct {
|
||||||
OId string
|
OId string
|
||||||
Version int
|
Version int
|
||||||
|
Loading…
Reference in New Issue
Block a user