-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: search provider registration
- Loading branch information
1 parent
923d73b
commit fd1a21d
Showing
28 changed files
with
271 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
ApplicationSetupOptions, | ||
Extension, | ||
useStore, | ||
useRouter, | ||
useClientService, | ||
useConfigurationManager | ||
} from '@ownclouders/web-pkg' | ||
import { computed } from 'vue' | ||
import { SDKSearch } from './search' | ||
|
||
export const extensions = ({ applicationConfig }: ApplicationSetupOptions) => { | ||
const store = useStore() | ||
const router = useRouter() | ||
const clientService = useClientService() | ||
const configurationManager = useConfigurationManager() | ||
|
||
return computed( | ||
() => | ||
[ | ||
{ | ||
id: 'com.github.owncloud.web.files.search', | ||
type: 'search', | ||
searchProvider: new SDKSearch(store, router, clientService, configurationManager) | ||
} | ||
] satisfies Extension[] | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './useAvailableProviders' |
14 changes: 14 additions & 0 deletions
14
packages/web-app-search/src/composables/useAvailableProviders.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { SearchExtension, SearchProvider, useExtensionRegistry } from '@ownclouders/web-pkg' | ||
import { computed, Ref } from 'vue' | ||
|
||
export const useAvailableProviders = (): Ref<SearchProvider[]> => { | ||
const extensionRegistry = useExtensionRegistry() | ||
|
||
const availableProviders = computed(() => { | ||
return extensionRegistry | ||
.requestExtensions<SearchExtension>('search') | ||
.map(({ searchProvider }) => searchProvider) | ||
}) | ||
|
||
return availableProviders | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.