feat: rename edit as view
This commit is contained in:
parent
4f02c373c2
commit
0d5bfc0997
@ -146,7 +146,7 @@ pub fn patch_profile(
|
||||
|
||||
/// run vscode command to edit the profile
|
||||
#[tauri::command]
|
||||
pub fn edit_profile(index: usize, profiles_state: State<'_, ProfilesState>) -> Result<(), String> {
|
||||
pub fn view_profile(index: usize, profiles_state: State<'_, ProfilesState>) -> Result<(), String> {
|
||||
let mut profiles = profiles_state.0.lock().unwrap();
|
||||
let items = profiles.items.take().unwrap_or(vec![]);
|
||||
|
||||
|
@ -80,7 +80,7 @@ fn main() -> std::io::Result<()> {
|
||||
cmds::get_verge_config,
|
||||
cmds::patch_verge_config,
|
||||
// profile
|
||||
cmds::edit_profile,
|
||||
cmds::view_profile,
|
||||
cmds::patch_profile,
|
||||
cmds::import_profile,
|
||||
cmds::update_profile,
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
import { useSWRConfig } from "swr";
|
||||
import { RefreshRounded } from "@mui/icons-material";
|
||||
import { CmdType } from "../services/types";
|
||||
import { updateProfile, deleteProfile, editProfile } from "../services/cmds";
|
||||
import { updateProfile, deleteProfile, viewProfile } from "../services/cmds";
|
||||
import Notice from "./notice";
|
||||
import parseTraffic from "../utils/parse-traffic";
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
@ -59,10 +59,10 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
const progress = Math.round(((download + upload) * 100) / (total + 0.1));
|
||||
const fromnow = updated > 0 ? dayjs(updated * 1000).fromNow() : "";
|
||||
|
||||
const onEdit = async () => {
|
||||
const onView = async () => {
|
||||
setAnchorEl(null);
|
||||
try {
|
||||
await editProfile(index);
|
||||
await viewProfile(index);
|
||||
} catch (err: any) {
|
||||
Notice.error(err.toString());
|
||||
}
|
||||
@ -217,7 +217,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
anchorReference="anchorPosition"
|
||||
>
|
||||
<MenuItem onClick={onForceSelect}>Select</MenuItem>
|
||||
<MenuItem onClick={onEdit}>Edit(VScode)</MenuItem>
|
||||
<MenuItem onClick={onView}>View</MenuItem>
|
||||
<MenuItem onClick={onUpdateWrapper(false)}>Update</MenuItem>
|
||||
<MenuItem onClick={onUpdateWrapper(true)}>Update(Proxy)</MenuItem>
|
||||
<MenuItem onClick={onDelete}>Delete</MenuItem>
|
||||
|
@ -9,8 +9,8 @@ export async function syncProfiles() {
|
||||
return invoke<void>("sync_profiles");
|
||||
}
|
||||
|
||||
export async function editProfile(index: number) {
|
||||
return invoke<void>("edit_profile", { index });
|
||||
export async function viewProfile(index: number) {
|
||||
return invoke<void>("view_profile", { index });
|
||||
}
|
||||
|
||||
export async function importProfile(url: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user