feat: menu item refresh enhanced mode

This commit is contained in:
GyDi 2022-03-06 15:46:16 +08:00
parent 7108d5f3ab
commit dad94edb20
No known key found for this signature in database
GPG key ID: 1C95E0D3467B3084
3 changed files with 9 additions and 4 deletions

View file

@ -36,6 +36,7 @@ interface Props {
onMoveTop: () => void; onMoveTop: () => void;
onMoveEnd: () => void; onMoveEnd: () => void;
onDelete: () => void; onDelete: () => void;
onEnhance: () => void;
} }
// profile enhanced item // profile enhanced item
@ -48,6 +49,7 @@ const ProfileMore = (props: Props) => {
onMoveTop, onMoveTop,
onMoveEnd, onMoveEnd,
onDelete, onDelete,
onEnhance,
} = props; } = props;
const { type } = itemData; const { type } = itemData;
@ -76,8 +78,9 @@ const ProfileMore = (props: Props) => {
const enableMenu = [ const enableMenu = [
{ label: "Disable", handler: closeWrapper(onDisable) }, { label: "Disable", handler: closeWrapper(onDisable) },
{ label: "Refresh", handler: closeWrapper(onEnhance) },
{ label: "Edit", handler: onEdit }, { label: "Edit", handler: onEdit },
{ label: "View File", handler: onView }, { label: "View", handler: onView },
{ label: "To Top", handler: closeWrapper(onMoveTop) }, { label: "To Top", handler: closeWrapper(onMoveTop) },
{ label: "To End", handler: closeWrapper(onMoveEnd) }, { label: "To End", handler: closeWrapper(onMoveEnd) },
{ label: "Delete", handler: closeWrapper(onDelete) }, { label: "Delete", handler: closeWrapper(onDelete) },
@ -86,7 +89,7 @@ const ProfileMore = (props: Props) => {
const disableMenu = [ const disableMenu = [
{ label: "Enable", handler: closeWrapper(onEnable) }, { label: "Enable", handler: closeWrapper(onEnable) },
{ label: "Edit", handler: onEdit }, { label: "Edit", handler: onEdit },
{ label: "View File", handler: onView }, { label: "View", handler: onView },
{ label: "Delete", handler: closeWrapper(onDelete) }, { label: "Delete", handler: closeWrapper(onDelete) },
]; ];

View file

@ -8,6 +8,7 @@ import {
deleteProfile, deleteProfile,
selectProfile, selectProfile,
importProfile, importProfile,
enhanceProfiles,
changeProfileChain, changeProfileChain,
} from "../services/cmds"; } from "../services/cmds";
import { getProxies, updateProxy } from "../services/api"; import { getProxies, updateProxy } from "../services/api";
@ -126,6 +127,8 @@ const ProfilePage = () => {
const chain = profiles.chain || []; const chain = profiles.chain || [];
const onEnhance = useLockFn(enhanceProfiles);
const onEnhanceEnable = useLockFn(async (uid: string) => { const onEnhanceEnable = useLockFn(async (uid: string) => {
if (chain.includes(uid)) return; if (chain.includes(uid)) return;
@ -217,6 +220,7 @@ const ProfilePage = () => {
onDelete={() => onEnhanceDelete(item.uid)} onDelete={() => onEnhanceDelete(item.uid)}
onMoveTop={() => onMoveTop(item.uid)} onMoveTop={() => onMoveTop(item.uid)}
onMoveEnd={() => onMoveEnd(item.uid)} onMoveEnd={() => onMoveEnd(item.uid)}
onEnhance={onEnhance}
/> />
</Grid> </Grid>
))} ))}

View file

@ -93,6 +93,4 @@ export default function setup() {
emit(payload.callback, JSON.stringify(result)).catch(console.error); emit(payload.callback, JSON.stringify(result)).catch(console.error);
}); });
// enhanceProfiles();
} }