Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复hosts.on状态下删除记录造成删除失败 #743

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"espower-typescript": "^10.0.0",
"execa": "^6.1.0",
"fork-ts-checker-webpack-plugin": "^7.2.11",
"framer-motion": "^7.2.0",
"fs-extra": "^10.1.0",
"mocha": "^10.0.0",
"power-assert": "^1.6.1",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/EditHostsInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ const EditHostsInfo = () => {
const footer_buttons = (
<Grid templateColumns="1fr 1fr" style={{ width: '100%' }}>
<Box>
{is_add ? null : (
{is_add ? null :hosts?.on?null: (
<Button
leftIcon={<BiTrash />}
mr={3}
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ const ListItem = (props: Props) => {
})
},
},
{
!is_on ? {
type: 'separator',
},
{
} : {},
!is_on ? {
label:
deal_count === 1
? lang.move_to_trashcan
Expand All @@ -155,14 +155,14 @@ const ListItem = (props: Props) => {
let ids = deal_count === 1 ? [data.id] : selected_ids
agent.broadcast(events.move_to_trashcan, ids)
},
},
} : {},
]

if (data.type !== 'remote') {
menu_items = menu_items.filter((i) => i.label !== lang.refresh)
}

const menu = new PopupMenu(menu_items)
const menu = new PopupMenu(menu_items.filter(item => Object.keys(item).length))

!data.is_sys && !is_tray && menu.show()
e.preventDefault()
Expand Down