mirror of https://github.com/jetkvm/kvm.git
remove macro description
This commit is contained in:
parent
223558a6a0
commit
5c3424e89f
|
@ -44,11 +44,10 @@ func (s *KeyboardMacroStep) Validate() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyboardMacro struct {
|
type KeyboardMacro struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description,omitempty"`
|
Steps []KeyboardMacroStep `json:"steps"`
|
||||||
Steps []KeyboardMacroStep `json:"steps"`
|
SortOrder int `json:"sortOrder,omitempty"`
|
||||||
SortOrder int `json:"sortOrder,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *KeyboardMacro) Validate() error {
|
func (m *KeyboardMacro) Validate() error {
|
||||||
|
|
10
jsonrpc.go
10
jsonrpc.go
|
@ -822,7 +822,6 @@ func setKeyboardMacros(params KeyboardMacrosParams) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
name, _ := macroMap["name"].(string)
|
name, _ := macroMap["name"].(string)
|
||||||
description, _ := macroMap["description"].(string)
|
|
||||||
|
|
||||||
sortOrder := i + 1
|
sortOrder := i + 1
|
||||||
if sortOrderFloat, ok := macroMap["sortOrder"].(float64); ok {
|
if sortOrderFloat, ok := macroMap["sortOrder"].(float64); ok {
|
||||||
|
@ -864,11 +863,10 @@ func setKeyboardMacros(params KeyboardMacrosParams) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro := KeyboardMacro{
|
macro := KeyboardMacro{
|
||||||
ID: id,
|
ID: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
Description: description,
|
Steps: steps,
|
||||||
Steps: steps,
|
SortOrder: sortOrder,
|
||||||
SortOrder: sortOrder,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := macro.Validate(); err != nil {
|
if err := macro.Validate(); err != nil {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default function MacroBar() {
|
||||||
{macros.map(macro => (
|
{macros.map(macro => (
|
||||||
<Button
|
<Button
|
||||||
key={macro.id}
|
key={macro.id}
|
||||||
aria-label={macro.description || macro.name}
|
aria-label={macro.name}
|
||||||
size="XS"
|
size="XS"
|
||||||
theme="light"
|
theme="light"
|
||||||
text={macro.name}
|
text={macro.name}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import Fieldset from "@/components/Fieldset";
|
||||||
import { SelectMenuBasic } from "@/components/SelectMenuBasic";
|
import { SelectMenuBasic } from "@/components/SelectMenuBasic";
|
||||||
import EmptyCard from "@/components/EmptyCard";
|
import EmptyCard from "@/components/EmptyCard";
|
||||||
import { Combobox } from "@/components/Combobox";
|
import { Combobox } from "@/components/Combobox";
|
||||||
|
import { CardHeader } from "@/components/CardHeader";
|
||||||
|
import Card from "@/components/Card";
|
||||||
|
|
||||||
const DEFAULT_DELAY = 50;
|
const DEFAULT_DELAY = 50;
|
||||||
|
|
||||||
|
@ -921,43 +923,26 @@ export default function SettingsMacrosRoute() {
|
||||||
)}
|
)}
|
||||||
<div className={`space-y-4 ${loading ? 'hidden' : ''}`}>
|
<div className={`space-y-4 ${loading ? 'hidden' : ''}`}>
|
||||||
{showAddMacro && (
|
{showAddMacro && (
|
||||||
<div className="rounded-md border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-800">
|
<Card className="p-3">
|
||||||
<div className="flex items-center justify-between mb-2">
|
<CardHeader
|
||||||
<h3 className="text-sm font-semibold text-black dark:text-white">Add New Macro</h3>
|
headline="Add New Macro"
|
||||||
</div>
|
/>
|
||||||
<Fieldset>
|
<Fieldset className="mt-4">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
<InputFieldWithLabel
|
||||||
<InputFieldWithLabel
|
type="text"
|
||||||
type="text"
|
label="Macro Name"
|
||||||
label="Macro Name"
|
placeholder="Macro Name"
|
||||||
placeholder="Macro Name"
|
value={newMacro.name}
|
||||||
value={newMacro.name}
|
error={errors.name}
|
||||||
error={errors.name}
|
onChange={e => {
|
||||||
onChange={e => {
|
setNewMacro(prev => ({ ...prev, name: e.target.value }));
|
||||||
setNewMacro(prev => ({ ...prev, name: e.target.value }));
|
if (errors.name) {
|
||||||
if (errors.name) {
|
const newErrors = { ...errors };
|
||||||
const newErrors = { ...errors };
|
delete newErrors.name;
|
||||||
delete newErrors.name;
|
setErrors(newErrors);
|
||||||
setErrors(newErrors);
|
}
|
||||||
}
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
<InputFieldWithLabel
|
|
||||||
type="text"
|
|
||||||
label="Description"
|
|
||||||
placeholder="Description (optional)"
|
|
||||||
value={newMacro.description}
|
|
||||||
error={errors.description}
|
|
||||||
onChange={e => {
|
|
||||||
setNewMacro(prev => ({ ...prev, description: e.target.value }));
|
|
||||||
if (errors.description) {
|
|
||||||
const newErrors = { ...errors };
|
|
||||||
delete newErrors.description;
|
|
||||||
setErrors(newErrors);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
|
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
|
@ -1085,7 +1070,7 @@ export default function SettingsMacrosRoute() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Card>
|
||||||
)}
|
)}
|
||||||
{macros.length === 0 && !showAddMacro && (
|
{macros.length === 0 && !showAddMacro && (
|
||||||
<EmptyCard
|
<EmptyCard
|
||||||
|
@ -1105,40 +1090,26 @@ export default function SettingsMacrosRoute() {
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{macros.map((macro, index) =>
|
{macros.map((macro, index) =>
|
||||||
editingMacro && editingMacro.id === macro.id ? (
|
editingMacro && editingMacro.id === macro.id ? (
|
||||||
<div key={macro.id} className="rounded-md border border-blue-300 bg-blue-50 p-3 dark:border-blue-700 dark:bg-blue-900/20">
|
<Card key={macro.id} className="border-blue-300 bg-blue-50 p-3 dark:border-blue-700 dark:bg-blue-900/20">
|
||||||
<Fieldset>
|
<CardHeader
|
||||||
<div className="mb-2 grid grid-cols-1 md:grid-cols-2 gap-2">
|
headline="Edit Macro"
|
||||||
<InputFieldWithLabel
|
/>
|
||||||
type="text"
|
<Fieldset className="mt-4">
|
||||||
label="Macro Name"
|
<InputFieldWithLabel
|
||||||
placeholder="Macro Name"
|
type="text"
|
||||||
value={editingMacro.name}
|
label="Macro Name"
|
||||||
error={errors.name}
|
placeholder="Macro Name"
|
||||||
onChange={e => {
|
value={editingMacro.name}
|
||||||
setEditingMacro({ ...editingMacro, name: e.target.value });
|
error={errors.name}
|
||||||
if (errors.name) {
|
onChange={e => {
|
||||||
const newErrors = { ...errors };
|
setEditingMacro({ ...editingMacro, name: e.target.value });
|
||||||
delete newErrors.name;
|
if (errors.name) {
|
||||||
setErrors(newErrors);
|
const newErrors = { ...errors };
|
||||||
}
|
delete newErrors.name;
|
||||||
}}
|
setErrors(newErrors);
|
||||||
/>
|
}
|
||||||
<InputFieldWithLabel
|
}}
|
||||||
type="text"
|
/>
|
||||||
label="Description"
|
|
||||||
placeholder="Description (optional)"
|
|
||||||
value={editingMacro.description}
|
|
||||||
error={errors.description}
|
|
||||||
onChange={e => {
|
|
||||||
setEditingMacro({ ...editingMacro, description: e.target.value });
|
|
||||||
if (errors.description) {
|
|
||||||
const newErrors = { ...errors };
|
|
||||||
delete newErrors.description;
|
|
||||||
setErrors(newErrors);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
|
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
|
@ -1238,7 +1209,7 @@ export default function SettingsMacrosRoute() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
key={macro.id}
|
key={macro.id}
|
||||||
|
@ -1272,11 +1243,6 @@ export default function SettingsMacrosRoute() {
|
||||||
<h4 className="truncate text-sm font-medium text-black dark:text-white">
|
<h4 className="truncate text-sm font-medium text-black dark:text-white">
|
||||||
{macro.name}
|
{macro.name}
|
||||||
</h4>
|
</h4>
|
||||||
{macro.description && (
|
|
||||||
<p className="truncate text-xs text-slate-500 dark:text-slate-400">
|
|
||||||
{macro.description}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
<p className="mt-1 text-xs text-slate-500 dark:text-slate-400 overflow-hidden">
|
<p className="mt-1 text-xs text-slate-500 dark:text-slate-400 overflow-hidden">
|
||||||
<span className="flex flex-wrap items-center">
|
<span className="flex flex-wrap items-center">
|
||||||
{macro.steps.slice(0, 3).map((step, stepIndex) => {
|
{macro.steps.slice(0, 3).map((step, stepIndex) => {
|
||||||
|
|
Loading…
Reference in New Issue