Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-extension-img
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Show extension image

Allow extensions to set an image as its logo, instead of an icon.
If `img` is set, it will take precedence over `icon`.

https://github.com/owncloud/web/pull/5985
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-hide-files-by-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Hidden files hidden by default

Hide hidden files (files started with ".") by default, similar to oc10

https://github.com/owncloud/web/pull/5985
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-order-extensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Order extensions and default

Ensure the default extensions are displayed first.
Ensure that extensions can be set as default or not.

https://github.com/owncloud/web/pull/5985
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-build-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Build options

Configure the startup title (displayed before the configuration is loaded) via env variable TITLE.
Make the source map generation optional with the env variable SOURCE_MAP.

https://github.com/owncloud/web/pull/5985
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: MarkdownEditor and MediaViewer can be default

We have updated the extension handlers of two internal
apps to be able to be used as default actions.

https://github.com/owncloud/web/pull/6148
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-feedback-on-startup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Show feedback on startup

Instead of displaying an empty page while all components load, display a spiner.
Also show an error message if there was an error.

https://github.com/owncloud/web/pull/5985
9 changes: 7 additions & 2 deletions packages/web-app-files/src/components/ActionMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
data-testid="action-handler"
v-on="getComponentListeners(action, items)"
>
<oc-icon v-if="action.icon" data-testid="action-icon" :name="action.icon" size="medium" />
<oc-img
v-else-if="action.img"
v-if="action.img"
data-testid="action-img"
:src="action.img"
alt=""
class="oc-icon oc-icon-m"
/>
<oc-icon
v-else-if="action.icon"
data-testid="action-icon"
:name="action.icon"
size="medium"
/>
<span class="oc-files-context-action-label" data-testid="action-label">{{
action.label(filterParams)
}}</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default {

created() {
// Storage returns a string so we need to convert it into a boolean
const areHiddenFilesShown = window.localStorage.getItem('oc_hiddenFilesShown') || 'true'
const areHiddenFilesShown = window.localStorage.getItem('oc_hiddenFilesShown') || 'false'
const areHiddenFilesShownBoolean = areHiddenFilesShown === 'true'

if (areHiddenFilesShownBoolean !== this.areHiddenFilesShown) {
Expand Down
82 changes: 46 additions & 36 deletions packages/web-app-files/src/mixins/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,41 +62,50 @@ export default {
},

$_fileActions_editorActions() {
return this.apps.fileEditors.map((editor) => {
return {
label: () => {
const translated = this.$gettext('Open in %{app}')
return this.$gettextInterpolate(
translated,
{ app: this.apps.meta[editor.app].name },
true
)
},
icon: this.apps.meta[editor.app].icon,
handler: ({ resources }) =>
this.$_fileActions_openEditor(
editor,
resources[0].path,
resources[0].id,
EDITOR_MODE_EDIT
),
isEnabled: ({ resources }) => {
if (resources.length !== 1) {
return false
}
if (Array.isArray(editor.routes) && !checkRoute(editor.routes, this.$route.name)) {
return false
}

return resources[0].extension.toLowerCase() === editor.extension.toLowerCase()
},
canBeDefault: true,
componentType: 'oc-button',
class: `oc-files-actions-${kebabCase(
this.apps.meta[editor.app].name
).toLowerCase()}-trigger`
}
})
return this.apps.fileEditors
.map((editor) => {
return {
label: () => {
const translated = this.$gettext('Open in %{app}')
return this.$gettextInterpolate(
translated,
{ app: this.apps.meta[editor.app].name },
true
)
},
icon: this.apps.meta[editor.app].icon,
img: this.apps.meta[editor.app].img,
handler: ({ resources }) =>
this.$_fileActions_openEditor(
editor,
resources[0].path,
resources[0].id,
EDITOR_MODE_EDIT
),
isEnabled: ({ resources }) => {
if (resources.length !== 1) {
return false
}
if (Array.isArray(editor.routes) && !checkRoute(editor.routes, this.$route.name)) {
return false
}

return resources[0].extension.toLowerCase() === editor.extension.toLowerCase()
},
canBeDefault: editor.canBeDefault,
componentType: 'oc-button',
class: `oc-files-actions-${kebabCase(
this.apps.meta[editor.app].name
).toLowerCase()}-trigger`
}
})
.sort((first, second) => {
// Ensure default are listed first
if (second.canBeDefault !== first.canBeDefault && second.canBeDefault) {
return 1
}
return 0
})
}
},

Expand Down Expand Up @@ -214,7 +223,8 @@ export default {
const label = this.$gettext('Open in %{ appName }')
return {
name: app.name,
img: app.icon,
icon: app.icon,
img: app.img,
componentType: 'oc-button',
class: `oc-files-actions-${app.name}-trigger`,
isEnabled: () => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ describe('ActionMenuItem component', () => {
})
it('renders an image if there is one defined in the action', () => {
const action = { ...fileActions.download, img: 'https://owncloud.tld/img.png' }
const wrapper1 = getShallowWrapper(action)
expect(wrapper1.find(selectors.icon).exists()).toBeTruthy()
expect(wrapper1.find(selectors.icon).attributes().name).toBe(action.icon)
delete action.icon
const wrapper2 = getShallowWrapper(action)
expect(wrapper2.find(selectors.icon).exists()).toBeFalsy()
expect(wrapper2.find(selectors.img).exists()).toBeTruthy()
expect(wrapper2.find(selectors.img).attributes().src).toBe(action.img)
const wrapper = getShallowWrapper(action)
expect(wrapper.find(selectors.icon).exists()).toBeFalsy()
expect(wrapper.find(selectors.img).exists()).toBeTruthy()
expect(wrapper.find(selectors.img).attributes().src).toBe(action.img)
})
it('renders the action label', () => {
const action = fileActions.download
Expand Down
35 changes: 14 additions & 21 deletions packages/web-app-markdown-editor/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// --- Components --------------------------------------------------------------

import App from './App.vue'
import t from '../l10n/translations'

// --- Routing -----------------------------------------------------------------

import translations from '../l10n/translations'
import store from './store.js'

const routes = [
Expand All @@ -17,6 +12,17 @@ const routes = [
}
]

const fileExtensionConfig = {
canBeDefault: true,
routes: [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]
}

const appInfo = {
name: 'MarkdownEditor',
id: 'markdown-editor',
Expand All @@ -30,13 +36,7 @@ const appInfo = {
return $gettext('New plain text file…')
}
},
routes: [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]
...fileExtensionConfig
},
{
extension: 'md',
Expand All @@ -45,18 +45,11 @@ const appInfo = {
return $gettext('New mark-down file…')
}
},
routes: [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]
...fileExtensionConfig
}
]
}

const translations = t
export default {
appInfo,
routes,
Expand Down
28 changes: 13 additions & 15 deletions packages/web-app-media-viewer/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import translations from '../l10n/translations'

import App from './App.vue'

// just a dummy function to trick gettext tools
Expand Down Expand Up @@ -32,45 +31,44 @@ const routesForFileExtensions = [
'files-public-list'
]

const fileExtensionConfig = {
canBeDefault: true,
routeName,
routes: routesForFileExtensions
}

const appInfo = {
name: 'Mediaviewer',
id: 'mediaviewer',
icon: 'image',
extensions: [
{
extension: 'png',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'jpg',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'jpeg',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'gif',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'mp4',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'webm',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
},
{
extension: 'ogg',
routeName,
routes: routesForFileExtensions
...fileExtensionConfig
}
]
}
Expand Down
Loading