<!--
  #%L
  thinkbig-ui-feed-manager
  %%
  Copyright (C) 2017 ThinkBig Analytics
  %%
  Licensed 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.
  #L%
  -->
<md-dialog aria-label="Connection"  ng-cloak>
    <form>
        <md-toolbar>
            <div  class="md-toolbar-tools">
                <h4 class="md-title">Connection Details for {{source.data.name}} to {{dest.data.name}}</h4>
                <span flex></span>
                <md-button class="md-icon-button" ng-click="cancel()">
                    <ng-md-icon md-icon icon="close" aria-label="Close dialog"></ng-md-icon>
                </md-button>
            </div>
        </md-toolbar>
        <md-dialog-content layout="column" layout-padding flex style="min-width:500px;" layout="column">
                <div>
                <md-input-container class="md-block condensed">
                    <label>Connection Name</label>
                    <input name="connectionName"
                           placeholder="Enter a Name"
                           type="text"
                           ng-change="validate()"
                           ng-model="connectionDataModel.name" size="100"/>
                </md-input-container>
                </div>
                 <div>
                    <md-input-container flex="30" class="md-block condensed">
                        <label>Join Type</label>
                        <md-select required ng-model="connectionDataModel.joinType" ng-change="validate()"  >
                            <md-option ng-repeat="joinType in joinTypes" value="{{::joinType.value}}">
                                {{::joinType.name}}
                            </md-option>
                        </md-select>
                    </md-input-container>
                    <span flex></span>
                </div>
            <div layout="row" class="layout-padding-top-bottom">
                <md-input-container flex="30" class="md-block condensed">
                    <label>Source Key</label>
                    <md-select required ng-model="connectionDataModel.joinKeys.sourceKey" ng-change="validate()">
                        <md-option ng-repeat="attr in source.data.nodeAttributes.attributes" value="{{::attr.name}}">
                            {{::attr.name}}
                        </md-option>
                    </md-select>
                </md-input-container>
                <md-input-container flex="30" class="md-block condensed">
                    <label>Destination Key</label>
                    <md-select required ng-model="connectionDataModel.joinKeys.destKey" ng-change="validate()">
                        <md-option ng-repeat="attr in dest.data.nodeAttributes.attributes" value="{{::attr.name}}">
                            {{::attr.name}}
                        </md-option>
                    </md-select>
                </md-input-container>

            </div>

        </md-dialog-content>
        <md-dialog-actions layout="row">
            <md-button ng-click="cancel()">Cancel</md-button>
            <span flex></span>
            <md-button class="md-raised md-warn" ng-if="isNew == false" ng-click="delete()">Delete</md-button>
            <md-button class="md-primary md-raised" ng-disabled="isValid == false" ng-click="save()">Save</md-button>
        </md-dialog-actions>
    </form>
</md-dialog>
