-
Notifications
You must be signed in to change notification settings - Fork 157
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
Make fileActions mixin standalone again. #6453
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './useActiveLocation' | ||
export * from './useIsFilesAppActive' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ import Rename from './actions/rename' | |
import Restore from './actions/restore' | ||
import kebabCase from 'lodash-es/kebabCase' | ||
|
||
import { activeApp } from 'web-pkg/src/composables' | ||
import { isFilesAppActive } from '../composables' | ||
|
||
const actionsMixins = [ | ||
'fetch', | ||
'navigate', | ||
|
@@ -55,6 +58,12 @@ export default { | |
...mapGetters('Files', ['highlightedFile', 'currentFolder']), | ||
...mapGetters(['capabilities', 'configuration']), | ||
|
||
// TODO: Replace this with the useIsFilesAppActive composable | ||
// once we port this mixin to something using the composition api | ||
isFilesAppActive() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wow, is it really sufficient to provide the function here? Are we using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why the composable is still used in BatchActions ... ... but that's a very good point, this has become hard to reason about. I will add this to all the mixins :( |
||
return isFilesAppActive(activeApp(this.$route)) | ||
}, | ||
|
||
$_fileActions_systemActions() { | ||
return actionsMixins.flatMap((actionMixin) => { | ||
return this[`$_${actionMixin}_items`] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import { computed, ComputedRef, unref } from '@vue/composition-api' | ||
import { useRoute } from './useRoute' | ||
import { Route } from 'vue-router' | ||
|
||
export const activeApp = (route: Route): string => { | ||
return route.path.split('/')[1] | ||
} | ||
|
||
export const useActiveApp = (): ComputedRef<string> => { | ||
const route = useRoute() | ||
return computed(() => { | ||
return unref(route).path.split('/')[1] | ||
return activeApp(unref(route)) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, can't you delete this again with the helper function now being used in the mixins?