{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div class="alert alert-info margin-bottom-5">{{t alerts.actions.manage_alert_groups_popup.notice}}</div>
{{#if controller.isLoaded}}
  <div class="row-fluid  manage-configuration-group-content">
    <div class="span12">
      <div class="row-fluid">
        <div class="span4">
          <span>&nbsp;</span>
          {{view Em.Select
          contentBinding="alertGroups"
          optionLabelPath="content.label"
          selectionBinding="view.selectedAlertGroup"
          multiple="multiple"
          class="group-select select-group-box"
          }}
          <div class="btn-toolbar pull-right">
            <button rel="button-info" class="btn add-group-button" {{bindAttr data-original-title="view.addButtonTooltip"}}
              {{action addAlertGroup target="controller"}}><i class="icon-plus"></i></button>
            <a rel="button-info" class="btn remove-group-button" {{bindAttr data-original-title="view.removeButtonTooltip" disabled="controller.isRemoveButtonDisabled"}}
              {{action confirmDelete target="controller"}}><i class="icon-minus"></i></a>
            <div class="btn-group">
              <button class="btn dropdown-toggle actions-group-button" data-toggle="dropdown">
                <i class="icon-cog"></i>&nbsp;<span class="caret"></span>
              </button>
              <ul class="dropdown-menu">
                <li {{bindAttr class="controller.isRenameButtonDisabled:disabled"}}>
                  <a href="" rel="button-info-dropdown" {{bindAttr data-original-title="view.renameButtonTooltip"}} {{action renameAlertGroup target="controller"}}>{{t alerts.actions.manage_alert_groups_popup.rename}}</a>
                </li>
                <li {{bindAttr class="controller.isDuplicateButtonDisabled:disabled"}}>
                  <a href="" rel="button-info-dropdown" {{bindAttr data-original-title="view.duplicateButtonTooltip"}} {{action duplicateAlertGroup target="controller"}}>{{t alerts.actions.manage_alert_groups_popup.duplicate}}</a>
                </li>
              </ul>
            </div>
          </div>
        </div>
          <div class="span8">
            <span>&nbsp;</span>
            <div class="row-fluid">
              <div class="span12 pull-right">
                {{view Em.Select
                contentBinding="selectedAlertGroup.definitions"
                optionLabelPath="content.label"
                multiple="multiple"
                class="group-select select-definiton-box"
                selectionBinding="selectedDefinitions"
                }}
              </div>
              <div class="button-group pull-right">
                  <a rel="button-info" {{bindAttr data-original-title="view.addDefinitionTooltip" class=":btn selectedAlertGroup.isAddDefinitionsDisabled:disabled :add-definition"}} {{action addDefinitions target="controller"}} ><i class="icon-plus"></i></a>
                  <a rel="button-info" {{bindAttr data-original-title="view.removeDefinitionTooltip" class=":btn isDeleteDefinitionsDisabled:disabled :remove-definition"}} {{action deleteDefinitions target="controller"}} ><i class="icon-minus"></i></a>
              </div>
            </div>

            <div class="clearfix"></div>
            <div class="row-fluid notification-editable-list">
              <div class="span4 title"><span class="icon-envelope-alt"></span>&nbsp;{{t alerts.actions.manage_alert_groups_popup.notifications}}</div>
            </div>
            <div class="row-fluid notification-editable-list">
              <div class="span11">
                {{view App.EditableList itemsBinding="selectedAlertGroup.notifications" resourcesBinding="controller.alertNotifications" nameBinding="selectedAlertGroup.displayName"}}
              </div>
            </div>

          </div>
          <div class="clearfix"></div>
          <div class="row-fluid">
            <div class="span12 text-error" id="manage-config-group-error-div">
              {{#if controller.errorMessage}}
                {{controller.errorMessage}}
              {{else}}
                 &nbsp;
              {{/if}}
            </div>
          </div>
      </div>
    </div>
  </div>
{{else}}
  <div class="spinner"></div>
{{/if}}
