Skip to content

Commit

Permalink
Merge pull request #4236 from owncloud/feature/auto-close-alerts
Browse files Browse the repository at this point in the history
Add auto-close capability to alerts
  • Loading branch information
kulmann authored Oct 26, 2020
2 parents f674f59 + c65841e commit 1ffc757
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 40 deletions.
5 changes: 4 additions & 1 deletion apps/draw-io/src/DrawIoEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export default {
this.showMessage({
title: this.$gettext('PDF could not be loaded…'),
desc: error,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
},
Expand Down
5 changes: 4 additions & 1 deletion apps/files/src/components/AllFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ export default {
this.showMessage({
title: this.$gettext('Loading folder failed…'),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand Down
35 changes: 28 additions & 7 deletions apps/files/src/components/FilesAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ export default {
this.showMessage({
title: this.$gettext('Loading folder failed…'),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand Down Expand Up @@ -465,7 +468,10 @@ export default {
this.showMessage({
title: this.$gettext('Creating folder failed…'),
desc: error,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
.finally(() => {
Expand Down Expand Up @@ -537,7 +543,10 @@ export default {
this.showMessage({
title: this.$gettext('Creating file failed…'),
desc: error,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
}
Expand Down Expand Up @@ -627,15 +636,21 @@ export default {
.clearTrashBin()
.then(() => {
this.showMessage({
title: this.$gettext('All deleted files were removed')
title: this.$gettext('All deleted files were removed'),
autoClose: {
enabled: true
}
})
this.removeFilesFromTrashbin(this.activeFiles)
})
.catch(error => {
this.showMessage({
title: this.$gettext('Could not delete files'),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand All @@ -647,7 +662,10 @@ export default {
.then(() => {
const translated = this.$gettext('%{file} was restored successfully')
this.showMessage({
title: this.$gettextInterpolate(translated, { file: file.name }, true)
title: this.$gettextInterpolate(translated, { file: file.name }, true),
autoClose: {
enabled: true
}
})
this.removeFilesFromTrashbin([file])
})
Expand All @@ -656,7 +674,10 @@ export default {
this.showMessage({
title: this.$gettextInterpolate(translated, { file: file.name }, true),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
}
Expand Down
10 changes: 8 additions & 2 deletions apps/files/src/components/LocationPicker/LocationPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ export default {
this.showMessage({
title: this.$gettextInterpolate(title, { resource: errors[0].resource }, true),
desc: errors[0].message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
return
Expand Down Expand Up @@ -420,7 +423,10 @@ export default {
this.showMessage({
title,
desc: this.$gettextInterpolate(desc, { count: errors.length }, false),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
console.error('Move / copy failed:', errors)
Expand Down
10 changes: 8 additions & 2 deletions apps/files/src/components/Trashbin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,21 @@ export default {
this.removeFilesFromTrashbin([file])
const translated = this.$gettext('%{file} was restored successfully')
this.showMessage({
title: this.$gettextInterpolate(translated, { file: file.name }, true)
title: this.$gettextInterpolate(translated, { file: file.name }, true),
autoClose: {
enabled: true
}
})
})
.catch(error => {
const translated = this.$gettext('Restoration of %{file} failed')
this.showMessage({
title: this.$gettextInterpolate(translated, { file: file.name }, true),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
this.resetFileSelection()
Expand Down
10 changes: 8 additions & 2 deletions apps/files/src/fileactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ export default {
const title = this.$gettextInterpolate(translated, { file: file.name }, true)
this.showMessage({
title: title,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand Down Expand Up @@ -236,7 +239,10 @@ export default {
)
this.showMessage({
title: title,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand Down
15 changes: 12 additions & 3 deletions apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ export default {
{ folder: item.name },
true
),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})

continue
Expand Down Expand Up @@ -301,7 +304,10 @@ export default {
this.showMessage({
title: this.$gettext('Upload failed'),
desc: this.$gettext('Upload of a folder is not supported in Internet Explorer.'),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
return
}
Expand All @@ -321,7 +327,10 @@ export default {
{ folder: directoryName },
true
),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
} else {
// Get folder structure
Expand Down
10 changes: 8 additions & 2 deletions apps/files/src/mixins/deleteResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export default {
this.removeFilesFromTrashbin([resource])
const translated = this.$gettext('%{file} was successfully deleted')
this.showMessage({
title: this.$gettextInterpolate(translated, { file: resource.name }, true)
title: this.$gettextInterpolate(translated, { file: resource.name }, true),
autoClose: {
enabled: true
}
})
})
.catch(error => {
Expand All @@ -126,7 +129,10 @@ export default {
this.showMessage({
title: this.$gettextInterpolate(translated, { file: resource.name }, true),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
},
Expand Down
5 changes: 4 additions & 1 deletion apps/files/src/quickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function createPublicLink(ctx) {
desc: $gettext(
'Public link has been successfully created and copied into your clipboard.'
),
status: 'success'
status: 'success',
autoClose: {
enabled: true
}
})
resolve()
})
Expand Down
50 changes: 40 additions & 10 deletions apps/files/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ export default {
'showMessage',
{
title: $gettext('Loading folder failed…'),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -441,7 +444,10 @@ export default {
'showMessage',
{
title: $gettext('Loading list of deleted files has failed…'),
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand All @@ -461,7 +467,10 @@ export default {
{
title: $gettext('Loading list of deleted files has failed…'),
desc: e.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -498,7 +507,10 @@ export default {
{
title: $gettext('Loading shared files failed…'),
desc: e.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -535,7 +547,10 @@ export default {
{
title: $gettext('Loading shared files failed…'),
desc: e.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -632,7 +647,10 @@ export default {
'showMessage',
{
title: title,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -685,7 +703,10 @@ export default {
{
title: this.$gettext('Error while searching.'),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -793,7 +814,10 @@ export default {
{
title: $gettext('Error while sharing.'),
desc: e,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -821,7 +845,10 @@ export default {
{
title: $gettext('Error while sharing.'),
desc: e,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down Expand Up @@ -998,7 +1025,10 @@ export default {
{
title: $gettext('Error while changing share state'),
desc: e.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
},
{ root: true }
)
Expand Down
5 changes: 4 additions & 1 deletion apps/media-viewer/src/mixins/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export default {
this.showMessage({
title: this.$gettext('Loading folder failed…'),
desc: error.message,
status: 'danger'
status: 'danger',
autoClose: {
enabled: true
}
})
})
}
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/autoclose-alerts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Auto-close alerts

We've added a property which enables alerts to be automatically closed.
When enabling the auto-close, it will get assigned timeout of 5 seconds.
Default timeout can be overwritten inside of the `autoClose` object.

https://github.com/owncloud/phoenix/pull/4236
Loading

0 comments on commit 1ffc757

Please sign in to comment.