<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
    <h1>
        <span>{{:: 'user-federation' | translate}}</span>
    </h1>

    <table class="table table-striped table-bordered">
        <thead>
        <tr ng-show="providers.length > 0 && access.manageUsers">
            <th colspan="5" class="kc-table-actions">
                <div class="pull-right">
                    <div>
                        <select class="form-control" ng-model="selectedProvider"
                                ng-options="p.id for p in providers"
                                data-ng-change="addProvider(selectedProvider); selectedProvider = null">
                            <option value="" disabled selected>{{:: 'add-provider.placeholder' | translate}}</option>
                        </select>
                    </div>
                </div>
            </th>
        </tr>
        <tr data-ng-show="instances && instances.length > 0">
            <th>{{:: 'id' | translate}}</th>
            <th>{{:: 'provider-name' | translate}}</th>
            <th>{{:: 'priority' | translate}}</th>
            <th colspan="2">{{:: 'actions' | translate}}</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="instance in instances">
            <td><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">{{instance.displayName}}</a></td>
            <td>{{instance.providerName|capitalize}}</td>
            <td>{{instance.priority}}</td>
            <td class="kc-action-cell">
                <button class="btn btn-default btn-block btn-sm" kc-open="/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">{{:: 'edit' | translate}}</button>
            </td>
            <td class="kc-action-cell">
                <button class="btn btn-default btn-block btn-sm" data-ng-click="removeUserFederation(instance)">{{:: 'delete' | translate}}</button>
            </td>
         </tr>
        <tr data-ng-show="!instances || instances.length == 0">
            <td class="text-muted">{{:: 'no-user-federation-providers-configured' | translate}}</td>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>