mirror of
https://github.com/oxynote/oxynote.git
synced 2026-10-17 02:49:18 +02:00
hide search and url tracking hook when their deps are missing
This commit is contained in:
parent
05f07d82e8
commit
480edcd89e
|
|
@ -325,6 +325,20 @@ describe("<AppSidebar>", { concurrent: false }, () => {
|
|||
).not.toBeNull()
|
||||
})
|
||||
|
||||
it("leaves the search row out when the server has no search", async ({
|
||||
expect,
|
||||
}) => {
|
||||
stubQueries()
|
||||
seedCapabilities({ search: false })
|
||||
|
||||
const wrapper = await mountSidebar()
|
||||
|
||||
expect(wrapper.text()).not.toContain(
|
||||
t("sidebar.sections.top.search-button"),
|
||||
)
|
||||
expect(wrapper.text()).toContain(t("sidebar.sections.top.inbox"))
|
||||
})
|
||||
|
||||
it("asks to toggle the notification sidebar from the inbox row", async ({
|
||||
expect,
|
||||
}) => {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ const { fetchGitHubConnectionStatus, gitHubConfigured, fetchGitHubInstallURL } =
|
|||
useGitHubAPI()
|
||||
const { fetchSlackConnectionStatus, slackConfigured, fetchSlackInstallURL } =
|
||||
useSlackAPI()
|
||||
const { isSearchEnabled } = useCapabilitiesAPI()
|
||||
const { useFetchNotificationCount } = useNotificationAPI()
|
||||
const fetchNotificationCount = useFetchNotificationCount({ read: false })
|
||||
const editorStore = useEditorStore()
|
||||
|
|
@ -57,6 +58,10 @@ useShortcut(SHORTCUT_ACTIONS.toggleSidebar.keyboardKey, () => {
|
|||
toggleSidebar()
|
||||
})
|
||||
useShortcut(SHORTCUT_ACTIONS.searchForDocuments.keyboardKey, () => {
|
||||
if (!isSearchEnabled.value) {
|
||||
return
|
||||
}
|
||||
|
||||
isSearchModalOpen.value = !isSearchModalOpen.value
|
||||
})
|
||||
useShortcut(SHORTCUT_ACTIONS.toggleInbox.keyboardKey, () => {
|
||||
|
|
@ -148,20 +153,6 @@ const sections = computed<Section[]>(() => {
|
|||
}
|
||||
|
||||
const topSectionItems: SidebarItem[] = [
|
||||
{
|
||||
id: "search-button",
|
||||
name: t("sidebar.sections.top.search-button"),
|
||||
icon: "lucide:search",
|
||||
onClick: () => {
|
||||
isSearchModalOpen.value = true
|
||||
},
|
||||
acceptsChildren: false,
|
||||
active: false,
|
||||
draggable: false,
|
||||
actions: [],
|
||||
shortcutTooltip: SHORTCUT_ACTIONS.searchForDocuments,
|
||||
children: null,
|
||||
},
|
||||
{
|
||||
id: "inbox",
|
||||
name: t("sidebar.sections.top.inbox"),
|
||||
|
|
@ -179,6 +170,23 @@ const sections = computed<Section[]>(() => {
|
|||
},
|
||||
]
|
||||
|
||||
if (isSearchEnabled.value) {
|
||||
topSectionItems.unshift({
|
||||
id: "search-button",
|
||||
name: t("sidebar.sections.top.search-button"),
|
||||
icon: "lucide:search",
|
||||
onClick: () => {
|
||||
isSearchModalOpen.value = true
|
||||
},
|
||||
acceptsChildren: false,
|
||||
active: false,
|
||||
draggable: false,
|
||||
actions: [],
|
||||
shortcutTooltip: SHORTCUT_ACTIONS.searchForDocuments,
|
||||
children: null,
|
||||
})
|
||||
}
|
||||
|
||||
topSection.items = topSectionItems
|
||||
const nextStepsItems: SidebarItem[] = []
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,22 @@ describe("<HookMenuContent>", { concurrent: false }, () => {
|
|||
expect(menuText()).toContain(t("editor.hooks.time-expiration.title"))
|
||||
})
|
||||
|
||||
it("leaves website changes out when the server has no changedetection", async ({
|
||||
expect,
|
||||
}) => {
|
||||
mockGitHub(true)
|
||||
seedCapabilities({ changeDetection: false })
|
||||
await mountContent()
|
||||
|
||||
await openHookSubMenu(t(ADD_NEW))
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(menuText()).toContain(t("editor.hooks.github-tracking.title"))
|
||||
}, WAIT_FOR_OPTIONS)
|
||||
expect(menuText()).not.toContain(t("editor.hooks.url-watcher.title"))
|
||||
expect(menuText()).toContain(t("editor.hooks.time-expiration.title"))
|
||||
})
|
||||
|
||||
it("lists the hooks already on the block", async ({ expect }) => {
|
||||
mockGitHub(true)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ const emit = defineEmits<{
|
|||
}>()
|
||||
|
||||
const { gitHubConfigured } = useGitHubAPI()
|
||||
const { isChangeDetectionEnabled } = useCapabilitiesAPI()
|
||||
|
||||
const isSubOpen = ref(false)
|
||||
|
||||
|
|
@ -142,6 +143,7 @@ function hookProps(
|
|||
@open-settings="(target: 'github') => emit('open-settings', target)"
|
||||
/>
|
||||
<URLWatcherConfigMenu
|
||||
v-if="isChangeDetectionEnabled"
|
||||
:node-id="nodeId"
|
||||
@force-close="isSubOpen = false"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user