Skip to content

Commit 4977764

Browse files
committed
feat: add tooltip for paramName
1 parent 01e778f commit 4977764

File tree

8 files changed

+43
-15
lines changed

8 files changed

+43
-15
lines changed

web/app/components/memshell/shell-result.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function ShellResult({
2626
if (!generateResult) {
2727
return <QuickUsage />;
2828
}
29+
const height = 800;
2930
return (
3031
<Tabs defaultValue="packResult">
3132
<TabsList className="grid w-full grid-cols-3">
@@ -37,7 +38,7 @@ export default function ShellResult({
3738
{t("memshell:injectorClass")}
3839
</TabsTrigger>
3940
</TabsList>
40-
<TabsContent value="packResult" className="my-2 space-y-4">
41+
<TabsContent value="packResult" className="space-y-2">
4142
<BasicInfo generateResult={generateResult} />
4243
<ResultComponent
4344
packResult={packResult}
@@ -75,7 +76,7 @@ export default function ShellResult({
7576
</Button>
7677
}
7778
wrapLongLines={true}
78-
height={600}
79+
height={height}
7980
code={generateResult?.shellBytesBase64Str ?? ""}
8081
language="text"
8182
/>
@@ -107,7 +108,7 @@ export default function ShellResult({
107108
<DownloadIcon className="h-4 w-4" />
108109
</Button>
109110
}
110-
height={600}
111+
height={height}
111112
code={generateResult?.injectorBytesBase64Str ?? ""}
112113
language="text"
113114
/>

web/app/components/memshell/tabs/command-tab.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useQuery } from "@tanstack/react-query";
2-
import { ChevronDown, ChevronRight } from "lucide-react";
2+
import { ChevronDown, ChevronRight, InfoIcon } from "lucide-react";
33
import { useState } from "react";
44
import { FormProvider, type UseFormReturn } from "react-hook-form";
55
import { useTranslation } from "react-i18next";
@@ -24,6 +24,11 @@ import {
2424
SelectValue,
2525
} from "@/components/ui/select";
2626
import { TabsContent } from "@/components/ui/tabs";
27+
import {
28+
Tooltip,
29+
TooltipContent,
30+
TooltipTrigger,
31+
} from "@/components/ui/tooltip";
2732
import { env } from "@/config";
2833
import type { MemShellFormSchema } from "@/types/schema";
2934
import { OptionalClassFormField } from "./classname-field";
@@ -64,9 +69,19 @@ export function CommandTabContent({
6469
name="commandParamName"
6570
render={({ field }) => (
6671
<FormFieldItem>
67-
<FormFieldLabel>
68-
{t("common:paramName")} {t("common:optional")}
69-
</FormFieldLabel>
72+
<div className="flex items-center gap-1">
73+
<FormFieldLabel>
74+
{t("common:paramName")} {t("common:optional")}
75+
</FormFieldLabel>
76+
<Tooltip>
77+
<TooltipTrigger asChild>
78+
<InfoIcon className="h-3.5 w-3.5 text-muted-foreground cursor-help" />
79+
</TooltipTrigger>
80+
<TooltipContent>
81+
<p>{t("common:paramName.description")}</p>
82+
</TooltipContent>
83+
</Tooltip>
84+
</div>
7085
<FormControl>
7186
<Input
7287
{...field}

web/app/components/probeshell/main-config-card.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,19 @@ export default function MainConfigCard({ form, servers }: MainConfigCardProps) {
147147
name="reqParamName"
148148
render={({ field }) => (
149149
<FormFieldItem>
150-
<FormFieldLabel>
151-
{t("common:paramName")} {t("common:optional")}
152-
</FormFieldLabel>
150+
<div className="flex items-center gap-1">
151+
<FormFieldLabel>
152+
{t("common:paramName")} {t("common:optional")}
153+
</FormFieldLabel>
154+
<Tooltip>
155+
<TooltipTrigger asChild>
156+
<InfoIcon className="h-3.5 w-3.5 text-muted-foreground cursor-help" />
157+
</TooltipTrigger>
158+
<TooltipContent>
159+
<p>{t("common:paramName.description")}</p>
160+
</TooltipContent>
161+
</Tooltip>
162+
</div>
153163
<FormControl>
154164
<Input placeholder={t("placeholders.input")} {...field} />
155165
</FormControl>

web/app/components/probeshell/shell-result.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ export default function ShellResult({
2222
return <QuickUsage />;
2323
}
2424
const showCode = packMethod === "JSP";
25-
const height = 550;
25+
const height = 600;
2626
return (
2727
<Tabs defaultValue="packResult">
2828
<TabsList className="grid w-full grid-cols-1">
2929
<TabsTrigger value="packResult">
3030
{t("common:generateResult")}
3131
</TabsTrigger>
3232
</TabsList>
33-
<TabsContent value="packResult" className="my-2 space-y-4">
33+
<TabsContent value="packResult" className="space-y-2">
3434
<BasicInfo generateResult={generateResult} />
3535
{allPackResults && (
3636
<MultiPackResult

web/app/i18n/common/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"packerConfig.title": "Package Config",
2424
"packerMethod": "Package Method",
2525
"paramName": "ParamName",
26+
"paramName.description": "Supports passing values via request parameter (param) or request header (header)",
2627
"placeholders.input": "Please input",
2728
"placeholders.select": "Please select",
2829
"ProbeShellGenerator": "ProbeShellGenerator",

web/app/i18n/common/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"packerConfig.title": "打包配置",
2424
"packerMethod": "打包方式",
2525
"paramName": "参数名称",
26+
"paramName.description": "支持请求参数 param 或请求头 header 传值",
2627
"placeholders.input": "请输入",
2728
"placeholders.select": "请选择",
2829
"ProbeShellGenerator": "探测马生成器",

web/app/routes/memshell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export default function MemShellPage() {
150150
{t("memshell:buttons.generate")}
151151
</Button>
152152
</div>
153-
<div className="w-full xl:w-1/2 flex flex-col gap-4">
153+
<div className="w-full xl:w-1/2 flex flex-col gap-2">
154154
<ShellResult
155155
packMethod={packMethod}
156156
generateResult={generateResult}

web/app/routes/probeshell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function ProbeShellGenerator() {
110110
onSubmit={form.handleSubmit(onSubmit)}
111111
className="flex flex-col xl:flex-row gap-6"
112112
>
113-
<div className="w-full xl:w-1/2 flex flex-col gap-4">
113+
<div className="w-full xl:w-1/2 flex flex-col gap-2">
114114
<MainConfigCard form={form} servers={serverConfig} />
115115
<PackageConfigCard form={form} packerConfig={packerConfig} />
116116
<Button
@@ -126,7 +126,7 @@ export default function ProbeShellGenerator() {
126126
{t("probeshell:buttons.generate")}
127127
</Button>
128128
</div>
129-
<div className="w-full xl:w-1/2 flex flex-col gap-4">
129+
<div className="w-full xl:w-1/2 flex flex-col gap-2">
130130
<ShellResult
131131
packMethod={packMethod}
132132
generateResult={generateResult}

0 commit comments

Comments
 (0)