<link href="css/jdbc-create.css?v=3.4.0-RC3" rel="stylesheet">

<div class="container-fluid" data-test="jdbc-page">
    <h1>
        {{title}}
        <page-info-tooltip></page-info-tooltip>
    </h1>
    <div core-errors ontop fedx></div>
    <div class="jdbc-list-configurations card mb-2"
         ng-if="getActiveRepository() && !isActiveRepoOntopType() && !isActiveRepoFedXType()">
        <div class="card-block" ng-init="getSqlConfigurations();" data-test="jdbc-configurations">
            <div class="clearfix">
                <a ng-href="jdbc/configuration/create"
                   ng-if="canWriteActiveRepo()"
                   data-test="create-sql-table-configuration"
                   class="btn btn-link pull-right d-flex">
                    <span class="ri-add-circle-line create-sql-table-configuration"></span>{{'jdbc.create.new.configuration' | translate}}
                </a>
                <h3 class="mb-0"><span class="collapsible-heading" data-toggle="collapse"
                                       data-target="#configurations-table"><em class="ri-arrow-down-s-line text-muted"></em> {{'jdbc.sql.configurations.list' | translate}}</span>
                </h3>
            </div>

            <div class="collapse in mt-1" id="configurations-table">
                <div class="no-indexes"
                     data-test="no-sql-configurations-message"
                     ng-if="jdbcConfigurations.length == 0"><em>{{'jdbc.no.tables.defined' | translate}}</em></div>
                <table class="table table-hover mb-0" aria-describedby="JDBC configurations table">
                    <tbody>
                    <tr ng-repeat="index in jdbcConfigurations track by $index"
                        class="configuration-row">
                        <td>
                            <a class="lead configuration-name" ng-href="jdbc/configuration/create?name={{index}}">{{index}}</a>
                        </td>

                        <td class="text-xs-right">
                            <span class="actions-bar hovered-item">
                                    <a class="btn btn-link edit-query-btn"
                                       ng-if="canWriteActiveRepo()" href="jdbc/configuration/create?name={{index}}"
                                       gdb-tooltip="{{'jdbc.edit.configuration' | translate}}">
                                        <em class="ri-edit-line"></em>
                                    </a>
                                </span>
                            <button type="button" ng-if="canWriteActiveRepo()" ng-click="deleteConfiguration(index)"
                                    class="btn btn-link delete-configuration-btn" gdb-tooltip="{{'jdbc.delete.configuration' | translate}}"><span
                                class="ri-delete-bin-6-line"></span>
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
