Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

39.10.3. 系统状态 Badge

顶部导航栏也可以包括一个可选的系统状态徽标,以告知用户系统范围的事件,如维护窗口。要使用一个黄色警告图标使用 existing 风格,请按照以下示例操作。

'use strict';

angular
  .module('mysystemstatusbadgeextension', ['openshiftConsole'])
  .run([
    'extensionRegistry',
    function(extensionRegistry) {
      // Replace http://status.example.com/ with your domain
      var system_status_elem = $('<a href="http://status.example.com/"' +
      'target="_blank" class="nav-item-iconic system-status"><span title="' +
      'System Status" class="fa status-icon pficon-warning-triangle-o">' +
      '</span></a>');

      // Add the extension point to the registry so the badge appears
      // To disable the badge, comment this block out
      extensionRegistry
        .add('nav-system-status', function() {
          return [{
            type: 'dom',
            node: system_status_elem
          }];
        });
    }
  ]);

hawtioPluginLoader.addModule('mysystemstatusbadgeextension');

添加脚本,如 Loading Extension Scripts 和 Stylesheets 所述。