Sha256: 4b6ecddfd04e051dfcc693714ac417a218fc8b106da24f9bb908382e54f85b76

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

module UINotifications
  module Tasks
    class TasksRunningLong < Tasks::Base
      include Rails.application.routes.url_helpers

      def deliver!
        notification = ::Notification.new(
          :audience => Notification::AUDIENCE_GLOBAL,
          :notification_blueprint => blueprint,
          :initiator => initiator,
          :message => message,
          :subject => nil,
          :notification_recipients => [NotificationRecipient.create(:user => User.current)]
        )
        notification.actions['links'] ||= []
        notification.actions['links'] << {
          href: foreman_tasks_tasks_path(search: subject.query),
          title: N_('Long running tasks'),
        }
        notification.save!
        notification
      end

      def blueprint
        @blueprint ||= NotificationBlueprint.unscoped.find_by(:name => 'tasks_running_long')
      end

      def message
        _("%{count} tasks are in running or paused state for more than a day") % { count: subject.task_uuids.count }
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
foreman-tasks-10.0.2 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-10.0.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-10.0.0 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.2.3 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.2.2 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.2.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.2.0 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.1.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.0.4 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.1.0 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.0.2 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.0.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.3.3 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-9.0.0 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.2.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.1.4 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.3.2 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.3.1 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.1.3 app/services/ui_notifications/tasks/tasks_running_long.rb
foreman-tasks-8.3.0 app/services/ui_notifications/tasks/tasks_running_long.rb