feat(GUI): add descriptive name to modals (#2036)

We add a descriptive name to modals for analytics and debugging.

Change-Type: patch
Changelog-Entry: Add descriptive name to modals for analytics and
debugging.
This commit is contained in:
Benedict Aas 2018-02-13 11:13:48 +00:00 committed by GitHub
parent 2e1764af82
commit bb5efb3450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,7 @@ module.exports = function (ModalService, $q) {
*/
this.open = () => {
modal = ModalService.open({
name: 'drive-selector',
template: './components/drive-selector/templates/drive-selector-modal.tpl.html',
controller: 'DriveSelectorController as modal',
size: 'drive-selector-modal'

View File

@ -34,6 +34,7 @@ module.exports = function ($uibModal, $q) {
*
* @example
* ModalService.open({
* name: 'my modal',
* template: './path/to/modal.tpl.html',
* controller: 'DriveSelectorController as modal',
* });
@ -44,7 +45,7 @@ module.exports = function ($uibModal, $q) {
})
analytics.logEvent('Open modal', {
template: options.template
name: options.name
})
const modal = $uibModal.open({
@ -60,6 +61,7 @@ module.exports = function ($uibModal, $q) {
result: $q((resolve, reject) => {
modal.result.then((value) => {
analytics.logEvent('Modal accepted', {
name: options.name,
value
})
@ -68,6 +70,7 @@ module.exports = function ($uibModal, $q) {
// Bootstrap doesn't 'resolve' these but cancels the dialog
if (error === 'escape key press' || error === 'backdrop click') {
analytics.logEvent('Modal rejected', {
name: options.name,
method: error
})
@ -75,6 +78,7 @@ module.exports = function ($uibModal, $q) {
}
analytics.logEvent('Modal rejected', {
name: options.name,
value: error
})

View File

@ -37,6 +37,7 @@ module.exports = function (ModalService) {
*/
this.show = (options) => {
return ModalService.open({
name: 'tooltip',
template: './components/tooltip-modal/templates/tooltip-modal.tpl.html',
controller: 'TooltipModalController as modal',
size: 'tooltip-modal',

View File

@ -40,6 +40,7 @@ module.exports = function ($sce, ModalService) {
this.display = (options = {}) => {
options.description = $sce.trustAsHtml(options.description)
return ModalService.open({
name: 'warning',
template: './components/warning-modal/templates/warning-modal.tpl.html',
controller: 'WarningModalController as modal',
size: 'warning-modal',