Commit c648acc3 authored by Jochen Kressin's avatar Jochen Kressin
Browse files

added some styling

parent 3bb0dfeb
<div class="container">
<div class="row">
<div class="col-12-sm">
<h1 class="text-center">Available tenants</h1>
<p class="error-message" ng-if="ctrl.errorMessage">{{ ctrl.errorMessage }}</p>
<h4 class="text-center" ng-bind="ctrl.tenantLabel" style="margin-bottom:15px;"></h4>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Permissions</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-class="{'active': ctrl.currentTenant == ''}" ng-show="ctrl.globalEnabled">
<td>
{{ctrl.GLOBAL_USER_LABEL}}
</td>
<td>
<div>read/write</div>
</td>
<td class="actions">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == ''" ng-show="ctrl.currentTenant != ctrl.GLOBAL_USER_VALUE" ng-click="ctrl.selectTenant(ctrl.GLOBAL_USER_LABEL, ctrl.GLOBAL_USER_VALUE)">Choose</button>
</td>
</tr>
<tr ng-class="{'active': ctrl.currentTenant == ctrl.PRIVATE_USER_VALUE}" ng-show="ctrl.privateEnabled">
<td>
{{ctrl.PRIVATE_USER_LABEL}}
</td>
<td>
<div>read/write</div>
</td>
<td class="actions">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == ctrl.PRIVATE_USER_VALUE" ng-click="ctrl.selectTenant(ctrl.PRIVATE_USER_LABEL, ctrl.PRIVATE_USER_VALUE)">Choose</button>
</td>
</tr>
<div class="row">
<div class="col-xs-12">
<h3 class="text-center">Available tenants</h3>
<p class="error-message" ng-if="ctrl.errorMessage">{{ ctrl.errorMessage }}</p>
<h4 class="text-center" ng-bind="ctrl.tenantLabel" style="margin-bottom:30px;"></h4>
</div>
</div>
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Permissions</th>
<th style="text-align: right">Action</th>
</tr>
</thead>
<tbody>
<tr ng-class="{'selected': ctrl.currentTenant == ''}" ng-show="ctrl.globalEnabled">
<td>
{{ctrl.GLOBAL_USER_LABEL}}
</td>
<td>
<div>read/write</div>
</td>
<td class="actions" style="text-align: right">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == ''"
ng-show="ctrl.currentTenant != ctrl.GLOBAL_USER_VALUE"
ng-click="ctrl.selectTenant(ctrl.GLOBAL_USER_LABEL, ctrl.GLOBAL_USER_VALUE)">Select
</button>
</td>
</tr>
<tr ng-class="{'selected': ctrl.currentTenant == ctrl.PRIVATE_USER_VALUE}" ng-show="ctrl.privateEnabled">
<td>
{{ctrl.PRIVATE_USER_LABEL}}
</td>
<td>
<div>read/write</div>
</td>
<td class="actions" style="text-align: right">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == ctrl.PRIVATE_USER_VALUE"
ng-click="ctrl.selectTenant(ctrl.PRIVATE_USER_LABEL, ctrl.PRIVATE_USER_VALUE)">Select
</button>
</td>
</tr>
<tr ng-repeat="tenantkey in ctrl.tenantkeys" ng-class="{'active': tenantkey == ctrl.currentTenant}">
<td>
{{tenantkey}}
</td>
<td>
<div ng-if="ctrl.alltenants[tenantkey] == 'rw'">read/write</div>
<div ng-if="ctrl.alltenants[tenantkey] == 'ro'">read only</div>
</td>
<td class="actions">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == tenantkey" ng-click="ctrl.selectTenant(tenantkey, tenantkey)">Choose</button>
</td>
</tr>
</tbody>
</table>
<tr ng-repeat="tenantkey in ctrl.tenantkeys" ng-class="{'selected': tenantkey == ctrl.currentTenant}">
<td>
{{tenantkey}}
</td>
<td>
<div ng-if="ctrl.allTenants[tenantkey] == 'rw'">read/write</div>
<div ng-if="ctrl.allTenants[tenantkey] == 'ro'">read only</div>
</td>
<td class="actions" style="text-align: right">
<button class="btn-primary" ng-disabled="ctrl.currentTenant == tenantkey"
ng-click="ctrl.selectTenant(tenantkey, tenantkey)">Select
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
......@@ -74,7 +74,7 @@ uiModules
.then(
(response) => {
this.currentTenant = response.data;
this.tenantLabel = "Current tenant: " + resolveTenantName(this.currentTenant, this.username);
this.tenantLabel = "Selected tenant: " + resolveTenantName(this.currentTenant, this.username);
},
(error) => notify.error(error)
);
......@@ -84,10 +84,10 @@ uiModules
this.selectTenant = function (tenantLabel, tenant) {
$http.post(`${API_ROOT}/tenant`, {tenant: tenant})
$http.post(`${API_ROOT}/tenant`, {tenant: tenant, username: this.username})
.then(
(response) => {
this.tenantLabel = "Tenant switched to: " + resolveTenantName(response.data, this.username);
this.tenantLabel = "Selected tenant: " + resolveTenantName(response.data, this.username);
this.currentTenant = response.data;
// clear lastUrls from nav links to avoid not found errors
chrome.getNavLinkById("kibana:visualize").lastSubUrl = chrome.getNavLinkById("kibana:visualize").url;
......@@ -100,13 +100,6 @@ uiModules
);
};
this.getClass = function(tenant) {
if (tenant == this.currentTenant) {
return "active";
}
return "";
}
function resolveTenantName(tenant, username) {
if (!tenant || tenant == "undefined") {
return "Global";
......
......@@ -2,6 +2,9 @@
@import "~ui/styles/variables/bootstrap-mods.less";
.selected {
background-color: #eee;
}
.btn-default {
background-color: #73b626;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment