mirror of
https://github.com/wavetermdev/backup.git
synced 2026-04-22 15:26:58 -07:00
Merge branch 'main' into evan/inshellisense
This commit is contained in:
@@ -12,6 +12,7 @@ import * as constants from "@/app/appconst";
|
||||
import { Reorder } from "framer-motion";
|
||||
import { MagicLayout } from "@/app/magiclayout";
|
||||
import { TabIcon } from "@/elements/tabicon";
|
||||
import * as appconst from "@/app/appconst";
|
||||
|
||||
@mobxReact.observer
|
||||
class ScreenTab extends React.Component<
|
||||
@@ -62,6 +63,59 @@ class ScreenTab extends React.Component<
|
||||
})();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
onContextMenu(e: React.MouseEvent) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let { screen, activeScreenId } = this.props;
|
||||
if (activeScreenId != screen.screenId) {
|
||||
// only show context menu for active tab
|
||||
GlobalCommandRunner.switchScreen(screen.screenId);
|
||||
return;
|
||||
}
|
||||
let colorSubMenu: ContextMenuItem[] = [];
|
||||
for (let color of appconst.TabColors) {
|
||||
colorSubMenu.push({
|
||||
label: color,
|
||||
click: () => {
|
||||
GlobalCommandRunner.screenSetSettings(screen.screenId, { tabcolor: color }, false);
|
||||
},
|
||||
});
|
||||
}
|
||||
let menu: ContextMenuItem[] = [
|
||||
{
|
||||
label: "New Tab",
|
||||
click: () => {
|
||||
GlobalCommandRunner.createNewScreen();
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "separator",
|
||||
},
|
||||
{
|
||||
label: "Set Tab Color",
|
||||
submenu: colorSubMenu,
|
||||
},
|
||||
{
|
||||
label: "All Tab Settings",
|
||||
click: () => {
|
||||
GlobalModel.tabSettingsOpen.set(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "separator",
|
||||
},
|
||||
{
|
||||
label: "Close Tab",
|
||||
click: () => {
|
||||
GlobalModel.onCloseCurrentTab();
|
||||
},
|
||||
},
|
||||
];
|
||||
GlobalModel.contextMenuModel.showContextMenu(menu, { x: e.clientX, y: e.clientY });
|
||||
return;
|
||||
}
|
||||
|
||||
render() {
|
||||
let { screen, activeScreenId, index, onSwitchScreen } = this.props;
|
||||
let archived = screen.archived.get() ? (
|
||||
@@ -83,7 +137,7 @@ class ScreenTab extends React.Component<
|
||||
"color-" + screen.getTabColor()
|
||||
)}
|
||||
onPointerDown={() => onSwitchScreen(screen.screenId)}
|
||||
onContextMenu={(event) => this.openScreenSettings(event, screen)}
|
||||
onContextMenu={this.onContextMenu}
|
||||
onDragEnd={this.handleDragEnd}
|
||||
>
|
||||
<div className="background"></div>
|
||||
|
||||
@@ -121,7 +121,8 @@ class TabSettings extends React.Component<{ screen: Screen }, {}> {
|
||||
if (screen == null) {
|
||||
return;
|
||||
}
|
||||
if (screen.getScreenLines().lines.length == 0) {
|
||||
let numLines = screen.getScreenLines().lines.length;
|
||||
if (numLines < 10) {
|
||||
GlobalCommandRunner.screenDelete(screen.screenId, false);
|
||||
GlobalModel.modalsModel.popModal();
|
||||
return;
|
||||
|
||||
+6
-1
@@ -609,6 +609,11 @@ class Model {
|
||||
if (activeScreen == null) {
|
||||
return;
|
||||
}
|
||||
let numLines = activeScreen.getScreenLines().lines.length;
|
||||
if (numLines < 10) {
|
||||
GlobalCommandRunner.screenDelete(activeScreen.screenId, false);
|
||||
return;
|
||||
}
|
||||
const rtnp = this.showAlert({
|
||||
message: "Are you sure you want to delete this tab?",
|
||||
confirm: true,
|
||||
@@ -617,7 +622,7 @@ class Model {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
GlobalCommandRunner.screenDelete(activeScreen.screenId, true);
|
||||
GlobalCommandRunner.screenDelete(activeScreen.screenId, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ const WSStateReconnectTime = 30 * time.Second
|
||||
const WSStatePacketChSize = 20
|
||||
|
||||
const InitialTelemetryWait = 30 * time.Second
|
||||
const TelemetryTick = 30 * time.Minute
|
||||
const TelemetryInterval = 8 * time.Hour
|
||||
const TelemetryTick = 10 * time.Minute
|
||||
const TelemetryInterval = 4 * time.Hour
|
||||
|
||||
const MaxWriteFileMemSize = 20 * (1024 * 1024) // 20M
|
||||
|
||||
@@ -930,12 +930,11 @@ func checkNewReleaseWrapper() {
|
||||
}
|
||||
|
||||
func telemetryLoop() {
|
||||
var lastSent time.Time
|
||||
var nextSend int64
|
||||
time.Sleep(InitialTelemetryWait)
|
||||
for {
|
||||
dur := time.Since(lastSent)
|
||||
if lastSent.IsZero() || dur >= TelemetryInterval {
|
||||
lastSent = time.Now()
|
||||
if time.Now().Unix() > nextSend {
|
||||
nextSend = time.Now().Add(TelemetryInterval).Unix()
|
||||
sendTelemetryWrapper()
|
||||
checkNewReleaseWrapper()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user