-
Notifications
You must be signed in to change notification settings - Fork 158
/
index.js
128 lines (124 loc) · 3.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import App from './App.vue'
import Favorites from './views/Favorites.vue'
import FilesDrop from './views/FilesDrop.vue'
import LocationPicker from './views/LocationPicker.vue'
import PrivateLink from './views/PrivateLink.vue'
import PublicFiles from './views/PublicFiles.vue'
import PublicLink from './views/PublicLink.vue'
import Personal from './views/Personal.vue'
import SharedWithMe from './views/SharedWithMe.vue'
import SharedWithOthers from './views/SharedWithOthers.vue'
import SharedViaLink from './views/SharedViaLink.vue'
import Trashbin from './views/Trashbin.vue'
import translations from '../l10n/translations.json'
import quickActions from './quickActions'
import store from './store'
import { FilterSearch, SDKSearch } from './search'
import { bus } from 'web-pkg/src/instance'
import { archiverService, Registry } from './services'
import fileSideBars from './fileSideBars'
import { buildRoutes } from './router'
import get from 'lodash-es/get'
// just a dummy function to trick gettext tools
function $gettext(msg) {
return msg
}
const appInfo = {
name: $gettext('Files'),
id: 'files',
icon: 'folder',
isFileEditor: false,
extensions: [],
fileSideBars
}
const navItems = [
{
name: $gettext('All files'),
icon: appInfo.icon,
fillType: 'fill',
route: {
path: `/${appInfo.id}/spaces/`
}
},
{
name: $gettext('Favorites'),
icon: 'star',
fillType: 'fill',
route: {
path: `/${appInfo.id}/favorites`
},
enabled(capabilities) {
return capabilities.files && capabilities.files.favorites
}
},
{
name: $gettext('Shared with me'),
icon: 'share-forward',
fillType: 'fill',
route: {
path: `/${appInfo.id}/shares/with-me`
}
},
{
name: $gettext('Shared with others'),
icon: 'reply',
fillType: 'fill',
route: {
path: `/${appInfo.id}/shares/with-others`
}
},
{
name: $gettext('Shared via link'),
icon: 'link',
fillType: 'none',
route: {
path: `/${appInfo.id}/shares/via-link`
}
},
{
name: $gettext('Deleted files'),
icon: 'delete-bin-5',
fillType: 'fill',
route: {
path: `/${appInfo.id}/trash`
},
enabled(capabilities) {
return capabilities.dav && capabilities.dav.trashbin === '1.0'
}
}
]
export default {
appInfo,
store,
routes: buildRoutes({
App,
Favorites,
Personal,
FilesDrop,
LocationPicker,
PrivateLink,
PublicFiles,
PublicLink,
SharedViaLink,
SharedWithMe,
SharedWithOthers,
Trashbin
}),
navItems,
quickActions,
translations,
ready({ router, store }) {
Registry.filterSearch = new FilterSearch(store, router)
Registry.sdkSearch = new SDKSearch(store, router)
// when discussing the boot process of applications we need to implement a
// registry that does not rely on call order, aka first register "on" and only after emit.
bus.publish('app.search.register.provider', Registry.filterSearch)
bus.publish('app.search.register.provider', Registry.sdkSearch)
},
userReady({ store }) {
archiverService.initialize(
store.getters.configuration.server || window.location.origin,
get(store, 'getters.capabilities.files.archivers', [])
)
}
}