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

Integrate file editors application menu #9809

Merged
merged 48 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
79ff4e0
Integrate file editors in application menu, WIP texteditor
lookacat Oct 16, 2023
c2d9468
Text editor now working
lookacat Oct 16, 2023
d3a3506
Make apps work in general
lookacat Oct 16, 2023
ebba683
Fix unittests
lookacat Oct 16, 2023
9d59467
Add e2e test
AlexAndBear Oct 16, 2023
3087003
Add e2e test
AlexAndBear Oct 16, 2023
7e5d001
Implement temp files
lookacat Oct 16, 2023
0d0641e
Fix local storage not updating
lookacat Oct 17, 2023
4364b09
clean code a bit
lookacat Oct 17, 2023
1933b92
Remove deleting empty file
lookacat Oct 17, 2023
b8ce200
Implement useFolderLink composable
lookacat Oct 17, 2023
28f1ad9
Lint
AlexAndBear Oct 17, 2023
eeec37e
Add priority ordering to app menu items
AlexAndBear Oct 17, 2023
6a6c6a9
Adjust colors
AlexAndBear Oct 17, 2023
a940746
WIP
lookacat Oct 18, 2023
f196dc7
Set destination for new file
AlexAndBear Oct 18, 2023
d59dd8d
add writable check
AlexAndBear Oct 18, 2023
c5d4520
remove unneccersary double check
AlexAndBear Oct 18, 2023
6a3665c
Fix permission error for app menu entries
AlexAndBear Oct 18, 2023
7dc7924
Git says modiefied.. I have no clue, but ill push it anyway
AlexAndBear Oct 18, 2023
5f5a89d
Add shareId on openEditor
lookacat Oct 18, 2023
a75ddc5
Fix unittests
lookacat Oct 18, 2023
663f26d
make use of useFolerLink in ResourceTable
AlexAndBear Oct 19, 2023
c77cf2e
Rm console.log
AlexAndBear Oct 19, 2023
5def28e
Fix class
AlexAndBear Oct 19, 2023
386a5db
Fix AppTopBar unittest
lookacat Oct 19, 2023
00a1e2d
Remove old unittests
lookacat Oct 19, 2023
7b9fff1
WIP add useFolderLink unittests
lookacat Oct 19, 2023
f9f85d2
Fix tests
AlexAndBear Oct 19, 2023
8f49c36
Add more tests
AlexAndBear Oct 19, 2023
926846b
Refactor
AlexAndBear Oct 19, 2023
9109fcf
Rm unused code
AlexAndBear Oct 19, 2023
9097560
Rm unused code
AlexAndBear Oct 19, 2023
842f3cf
Dont autoformat code that we don't touch
AlexAndBear Oct 19, 2023
1d53a12
Dont destruct clientService and make use of appInfo type
AlexAndBear Oct 20, 2023
1c4ab82
Make set_current_folder more bullet proof
AlexAndBear Oct 20, 2023
1c3ff73
Fix open preview app run into errors
AlexAndBear Oct 20, 2023
aa59e58
Fix wrong path displayed in AppTopBar
AlexAndBear Oct 20, 2023
77c7585
Fix trashbin bug
lookacat Oct 20, 2023
00d4761
Lint
AlexAndBear Oct 20, 2023
843faf8
Fix types
AlexAndBear Oct 20, 2023
acd50e1
Lint
AlexAndBear Oct 20, 2023
53300d2
Update snapshots
AlexAndBear Oct 20, 2023
6daa77e
rm unnecessary type
AlexAndBear Oct 23, 2023
7409fe7
Lint
AlexAndBear Oct 23, 2023
a14cdea
Fix acceptance tests
AlexAndBear Oct 23, 2023
2e78207
Dont show parent folder in apptopbar if resource is public shared
AlexAndBear Oct 23, 2023
992a9d8
Fix general resource path
AlexAndBear Oct 23, 2023
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
Prev Previous commit
Next Next commit
Text editor now working
lookacat authored and AlexAndBear committed Oct 23, 2023
commit c2d9468ab1af875659f247364a8e58be34c1d2bb
2 changes: 1 addition & 1 deletion packages/web-app-text-editor/src/index.ts
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ const appInfo = {
name: $gettext('Text Editor'),
id: appId,
icon: 'file-text',
color: '#2b2b2b',
color: '#EF6C00',
isFileEditor: true,
showInApplicationMenu: true,
extensions: fileExtensions().map((extensionItem) => {
32 changes: 27 additions & 5 deletions packages/web-runtime/src/components/Topbar/ApplicationsMenu.vue
Original file line number Diff line number Diff line change
@@ -55,7 +55,12 @@ import { OcDrop } from 'design-system/src/components'
import OcApplicationIcon from 'design-system/src/components/OcApplicationIcon/OcApplicationIcon.vue'
import { useGettext } from 'vue3-gettext'
import * as uuid from 'uuid'
import { useClientService, useStore } from '@ownclouders/web-pkg'
import {
useClientService,
useFileActions,
useGetMatchingSpace,
useStore
} from '@ownclouders/web-pkg'
import { Resource, SpaceResource } from '@ownclouders/web-client'

export default defineComponent({
@@ -69,12 +74,16 @@ export default defineComponent({
default: () => []
}
},
setup() {
setup(props) {
const store = useStore()
const { openEditor, getDefaultEditorAction } = useFileActions()
const clientService = useClientService()
const { webdav } = clientService
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
const { $gettext } = useGettext()
const appIconKey = ref('')
const { getMatchingSpace } = useGetMatchingSpace()

console.log('registered', props.applicationsList)

const applicationSwitcherLabel = computed(() => {
return $gettext('Application Switcher')
@@ -89,10 +98,20 @@ export default defineComponent({
if (item.path == '/text-editor') {
return {
click: async () => {
const test = await webdav.putFileContents(unref(currentFolder), {
path: new Date().getTime() + '.txt',
content: $gettext('If this works very nice.')
const emptyResource = await webdav.putFileContents(unref(currentFolder), {
path: new Date().getTime() + 'empty.txt'
})
const space = getMatchingSpace(emptyResource)
const fileActionsOptions = {
resources: [emptyResource],
space
}

const defaultEditorAction = getDefaultEditorAction(fileActionsOptions)

if (defaultEditorAction) {
defaultEditorAction.handler({ ...fileActionsOptions })
}
}
}
}
@@ -186,3 +205,6 @@ export default defineComponent({
}
}
</style>

function openEditor(editor: any, arg1: any, webDavPath: any, fileId: any, EDITOR_MODE_EDIT: any,
shareId: any) { throw new Error('Function not implemented.') }
3 changes: 2 additions & 1 deletion packages/web-runtime/src/components/Topbar/TopBar.vue
Original file line number Diff line number Diff line change
@@ -109,7 +109,8 @@ export default {
return (
store.getters
.getNavItemsByExtension(app.id)
.filter((navItem) => isNavItemPermitted(permittedMenus, navItem)).length > 0
.filter((navItem) => isNavItemPermitted(permittedMenus, navItem)).length > 0 ||
app.showInApplicationMenu
)
}
return isNavItemPermitted(permittedMenus, app)
12 changes: 11 additions & 1 deletion packages/web-runtime/src/layouts/Application.vue
Original file line number Diff line number Diff line change
@@ -197,14 +197,24 @@ export default defineComponent({
})
})

// Add extensions with showInApplicationMenu
Object.values(this.apps).forEach((app: any) => {
if (app.showInApplicationMenu) {
list.push({
...app,
type: 'extension'
})
}
})

// Get extensions manually added into config
this.configuration.applications.forEach((application) => {
list.push({
...application,
type: 'link'
})
})
console.log(this.configuration.applications)
console.log('apps', list)

return list
}
3 changes: 2 additions & 1 deletion packages/web-runtime/src/store/apps.ts
Original file line number Diff line number Diff line change
@@ -86,7 +86,8 @@ const mutations = {
...(appInfo.iconColor && { iconColor: appInfo.iconColor }),
img: appInfo.img || null,
config: (state.fileEditorConfigs || {})[appInfo.id],
color: appInfo.color || ''
color: appInfo.color || '',
showInApplicationMenu: appInfo.showInApplicationMenu || false
}
state.meta[app.id] = app
},