diff --git a/apps/files/docs/extensionpoints.adoc b/apps/files/docs/extensionpoints.adoc index 8745bdf8fd1..7d895060b96 100644 --- a/apps/files/docs/extensionpoints.adoc +++ b/apps/files/docs/extensionpoints.adoc @@ -1,4 +1,4 @@ -## Extensionpoints +## Extension points #### file-details-panel @@ -17,3 +17,74 @@ OC.$extend.request('files', 'file-details-panel', payload).then( response => {}); ---- + +### Files list status indicators + +An extension can extend status indicators in files list with custom component, properties and methods. +Extending this list can be done by creating a new object inside of appInfo called `filesListIndicators`. This object can contain keys `name` and `component`. + +#### Props + +Please see known issues before using props in custom indicators. + +- `item`: resource to which are indicators assigned +- `parentPath`: parent folder path of the item + +#### Example: + +##### App entry point +[source,js] +---- +const appInfo = { + name: 'ExampleIndicators', + id: 'ExampleIndicators', + icon: 'info', + isFileEditor: false, + extensions: [], + filesListIndicators: [{ + name: 'CustomIndicators', + component: Indicators + }] +} +---- + +##### Indicators component +[source,vue] +---- + + + +---- + +#### Known issues: + +Passing resource as a prop into the dynamic component causes Vuex mutation error. To avoid this, access resource direcly via parent component - `this.$parent.item` \ No newline at end of file diff --git a/apps/files/src/components/AllFilesList.vue b/apps/files/src/components/AllFilesList.vue index 0874d58ee1b..8023baf2362 100644 --- a/apps/files/src/components/AllFilesList.vue +++ b/apps/files/src/components/AllFilesList.vue @@ -29,14 +29,7 @@ class="uk-margin-small-left" /> -
- - - - - - -
+
{{ item.size | fileSize }}
@@ -75,18 +68,16 @@ diff --git a/apps/files/src/components/FilesLists/StatusIndicators/StatusIndicators.vue b/apps/files/src/components/FilesLists/StatusIndicators/StatusIndicators.vue new file mode 100644 index 00000000000..1d3719c159a --- /dev/null +++ b/apps/files/src/components/FilesLists/StatusIndicators/StatusIndicators.vue @@ -0,0 +1,63 @@ + + + diff --git a/changelog/unreleased/2895-1 b/changelog/unreleased/2895-1 new file mode 100644 index 00000000000..c5263b49791 --- /dev/null +++ b/changelog/unreleased/2895-1 @@ -0,0 +1,7 @@ +Enhancement: Add files list status indicators extension point + +We've added the ability for the extension to inject custom status indicator into files list. +New indicators will then appear next to the default one. + +https://github.com/owncloud/phoenix/issues/2895 +https://github.com/owncloud/phoenix/pull/2928 diff --git a/changelog/unreleased/2895-2 b/changelog/unreleased/2895-2 new file mode 100644 index 00000000000..31e34cb9b68 --- /dev/null +++ b/changelog/unreleased/2895-2 @@ -0,0 +1,6 @@ +Enhancement: Add theme option to disable default files list status indicators + +We've added the option into the theme to disable default files list status indicators. + +https://github.com/owncloud/phoenix/issues/2895 +https://github.com/owncloud/phoenix/pull/2928 diff --git a/src/store/apps.js b/src/store/apps.js index 311dc34e86f..ddba6dba3df 100644 --- a/src/store/apps.js +++ b/src/store/apps.js @@ -8,6 +8,7 @@ const state = { extensions: {}, newFileHandlers: [], fileSideBars: [], + customFilesListIndicators: [], meta: {} } @@ -118,6 +119,15 @@ const mutations = { }) state.fileSideBars = list } + + if (appInfo.filesListIndicators) { + const indicators = state.customFilesListIndicators + appInfo.filesListIndicators.forEach(indicator => { + indicators.push(indicator) + }) + state.customFilesListIndicators = indicators + } + if (!appInfo.id) return // name: use id as fallback display name // icon: use empty box as fallback icon @@ -164,7 +174,8 @@ const getters = { }, fileSideBars: state => { return state.fileSideBars - } + }, + customFilesListIndicators: state => state.customFilesListIndicators } export default { diff --git a/src/store/config.js b/src/store/config.js index 0ded00196cd..d9f6c8ccb50 100644 --- a/src/store/config.js +++ b/src/store/config.js @@ -23,6 +23,9 @@ const state = { }, logo: { favicon: '' + }, + filesList: { + hideDefaultStatusIndicators: false } } } diff --git a/themes/owncloud.json b/themes/owncloud.json index 37193e6592d..e097e5a49cf 100644 --- a/themes/owncloud.json +++ b/themes/owncloud.json @@ -5,5 +5,8 @@ }, "logo": { "favicon": "themes/owncloud/favicon.jpg" + }, + "filesList": { + "hideDefaultStatusIndicators": false } }