summaryrefslogtreecommitdiff
path: root/app/views/shared/_namespace_storage_limit_alert.html.haml
blob: 95f27cde15b3dbc4b91d9dab15a842bda042dd74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- return unless current_user

- payload = namespace_storage_alert(namespace)
- return if payload.empty?

- alert_level = payload[:alert_level]
- root_namespace = payload[:root_namespace]

- style = namespace_storage_alert_style(alert_level)
- icon = namespace_storage_alert_icon(alert_level)
- link = namespace_storage_usage_link(root_namespace)

%div{ class: [classes, 'js-namespace-storage-alert'] }
  .gl-pt-5.gl-pb-3
    .gl-alert{ class: "gl-alert-#{style}", role: 'alert' }
      = sprite_icon(icon, css_class: "gl-icon gl-alert-icon")
      .gl-alert-title
        %h4.gl-alert-title= payload[:usage_message]
      - if alert_level != :error
        %button.js-namespace-storage-alert-dismiss.gl-alert-dismiss.gl-cursor-pointer{ type: 'button', 'aria-label' => _('Dismiss'), data: { id: root_namespace.id, level: alert_level } }
          = sprite_icon('close', size: 16, css_class: 'gl-icon')
      .gl-alert-body
        = payload[:explanation_message]
      - if link
        .gl-alert-actions
          = link_to(_('Manage storage usage'), link, class: "btn gl-alert-action btn-md gl-button btn-#{style}")