diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
index f61f99004..4a94a6df5 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
@@ -12,6 +12,7 @@ class App.ControllerGenericNew extends App.ControllerModal
params: @item
screen: @screen || 'edit'
autofocus: true
+ handlers: @handlers
)
@controller.form
@@ -57,10 +58,11 @@ class App.ControllerGenericEdit extends App.ControllerModal
@head = @pageData.head || @pageData.object
@controller = new App.ControllerForm(
- model: App[ @genericObject ]
- params: @item
- screen: @screen || 'edit'
- autofocus: true
+ model: App[ @genericObject ]
+ params: @item
+ screen: @screen || 'edit'
+ autofocus: true
+ handlers: @handlers
)
@controller.form
diff --git a/app/assets/javascripts/app/controllers/data_privacy.coffee b/app/assets/javascripts/app/controllers/data_privacy.coffee
new file mode 100644
index 000000000..3976f3db7
--- /dev/null
+++ b/app/assets/javascripts/app/controllers/data_privacy.coffee
@@ -0,0 +1,267 @@
+class Index extends App.ControllerSubContent
+ requiredPermission: 'admin.data_privacy'
+ header: 'Data Privacy'
+ events:
+ 'click .js-new': 'new'
+ 'click .js-description': 'description'
+ 'click .js-toggle-tickets': 'toggleTickets'
+
+ constructor: ->
+ super
+ @load()
+ @subscribeDataPrivacyTaskId = App.DataPrivacyTask.subscribe(@render)
+
+ load: =>
+ callback = =>
+ @stopLoading()
+ @render()
+ @startLoading()
+ App.DataPrivacyTask.fetchFull(
+ callback
+ clear: true
+ )
+
+ show: (params) =>
+ for key, value of params
+ if key isnt 'el' && key isnt 'shown' && key isnt 'match'
+ @[key] = value
+
+ if params.integration
+
+ # we reuse the integration parameter
+ # because there is no own route possible
+ # (see manage.coffee)
+ @user_id = params.integration
+ @navigate '#system/data_privacy'
+ return
+
+ if @user_id
+ @new(false, @user_id)
+ @user_id = undefined
+
+ render: =>
+ runningTasks = App.DataPrivacyTask.search(
+ filter:
+ state: 'in process'
+ order: 'DESC'
+ )
+ runningTasksHTML = App.view('data_privacy/tasks')(
+ tasks: runningTasks
+ )
+
+ failedTasks = App.DataPrivacyTask.search(
+ filter:
+ state: 'failed'
+ order: 'DESC'
+ )
+ failedTasksHTML = App.view('data_privacy/tasks')(
+ tasks: failedTasks
+ )
+
+ completedTasks = App.DataPrivacyTask.search(
+ filter:
+ state: 'completed'
+ order: 'DESC'
+ )
+ completedTasksHTML = App.view('data_privacy/tasks')(
+ tasks: completedTasks
+ )
+
+ # show description button, only if content exists
+ description = marked(App.DataPrivacyTask.description)
+
+ @html App.view('data_privacy/index')(
+ taskCount: ( runningTasks.length + failedTasks.length + completedTasks.length )
+ runningTaskCount: runningTasks.length
+ failedTaskCount: failedTasks.length
+ completedTaskCount: completedTasks.length
+ runningTasksHTML: runningTasksHTML
+ failedTasksHTML: failedTasksHTML
+ completedTasksHTML: completedTasksHTML
+ description: description
+ )
+
+ release: =>
+ if @subscribeDataPrivacyTaskId
+ App.DataPrivacyTask.unsubscribe(@subscribeDataPrivacyTaskId)
+
+ new: (e, user_id = undefined) ->
+ if e
+ e.preventDefault()
+
+ new TaskNew(
+ pageData:
+ head: 'Deletion Task'
+ title: 'Deletion Task'
+ object: 'DataPrivacyTask'
+ objects: 'DataPrivacyTasks'
+ genericObject: 'DataPrivacyTask'
+ container: @el.closest('.content')
+ callback: @load
+ large: true
+ handlers: [@formHandler]
+ item:
+ 'deletable_id': user_id
+ )
+
+ toggleTickets: (e) ->
+ e.preventDefault()
+
+ id = $(e.target).data('id')
+ type = $(e.target).data('type')
+ expanded = $(e.target).hasClass('expanded')
+ return if !id
+
+ new_expanded = ''
+ text = 'See more'
+ if !expanded
+ new_expanded = ' expanded'
+ text = 'See less'
+
+ task = App.DataPrivacyTask.find(id)
+
+ list = clone(task.preferences[type])
+ if expanded
+ list = list.slice(0, 50)
+ list.push('...')
+ list = list.join(', ')
+
+ $(e.target).closest('div.ticket-list').html(list + '
<%- @T('Customer tickets of the user will get deleted on execution of the task. No rollback possible.') %>
+ + <% if @owner_count > 0: %> +<%- @T('Owner tickets of the user will not get deleted. The owner will be mapped to the system user (ID 1).') %>
+ + <% end %> +<%- @T('There is no rollback of this deletion possible. If you are absolutely sure to do this, then type in "%s" into the input.', App.i18n.translateInline('delete').toUpperCase()) %>
+ <%- @sure_html %> +