mirror of https://github.com/rancher/ui.git
Fix a bunch of issues found during QA
This commit is contained in:
parent
facdeeac4a
commit
4b100c0912
|
|
@ -1,6 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import Sortable from 'ui/mixins/sortable';
|
||||
import { debouncedObserver } from 'ui/utils/debounce';
|
||||
import C from 'ui/utils/constants';
|
||||
|
||||
export default Ember.Controller.extend(Sortable, {
|
||||
application: Ember.inject.controller(),
|
||||
|
|
@ -13,12 +14,13 @@ export default Ember.Controller.extend(Sortable, {
|
|||
updateResourceType: function(type) {
|
||||
this.set('filters.resourceType', type);
|
||||
},
|
||||
updateAuthType: function(type) {
|
||||
this.set('filters.authType', type.name);
|
||||
this.set('authTypeReadable', type.value);
|
||||
},
|
||||
changeSort: function(name) {
|
||||
this._super(name);
|
||||
},
|
||||
toggleFilter: function() {
|
||||
this.toggleProperty('showFilter');
|
||||
},
|
||||
showResponseObjects: function(request, response) {
|
||||
this.get('application').setProperties({
|
||||
showAuditLogResponses: true,
|
||||
|
|
@ -46,18 +48,19 @@ export default Ember.Controller.extend(Sortable, {
|
|||
sortBy: 'created',
|
||||
sortOrder: 'desc',
|
||||
});
|
||||
this.set('filters.resourceType', null);
|
||||
this.set('authTypeReadable', null);
|
||||
this.send('filterLogs');
|
||||
},
|
||||
},
|
||||
|
||||
showFilter: false,
|
||||
sortBy: 'created',
|
||||
sortOrder: 'desc',
|
||||
descending: true,
|
||||
limit: 100,
|
||||
forceReload: true,
|
||||
depaginate: false,
|
||||
authTypes: null,
|
||||
authTypeReadable: null,
|
||||
filters: {
|
||||
accountId: null,
|
||||
authType: null,
|
||||
|
|
@ -73,6 +76,19 @@ export default Ember.Controller.extend(Sortable, {
|
|||
runtime: null,
|
||||
},
|
||||
|
||||
setup: function() {
|
||||
// @@TODO@@ - This is only here becuase i have to use the auth type map in an handlebars each
|
||||
// once we upgrade to 2.10.0 we can use the @key handlebar helper
|
||||
var authOut = [];
|
||||
|
||||
for (var i in C.AUTH_TYPES) {
|
||||
authOut.push({name: i, value: C.AUTH_TYPES[i]});
|
||||
}
|
||||
|
||||
this.set('authTypes', authOut);
|
||||
|
||||
}.on('init'),
|
||||
|
||||
filtersHaveChanged: debouncedObserver('filters.accountId','filters.authType','filters.authenticatedAsAccountId','filters.authenticatedAsIdentityId','filters.created','filters.description','filters.eventType','filters.id','filters.kind','filters.resourceId','filters.resourceType','filters.runtime', function() {
|
||||
this.send('filterLogs');
|
||||
}, 500),
|
||||
|
|
@ -85,6 +101,7 @@ export default Ember.Controller.extend(Sortable, {
|
|||
}
|
||||
|
||||
this.set('sortOrder', out);
|
||||
this.send('logsSorted');
|
||||
|
||||
}.observes('descending'),
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,15 @@ export default Ember.Route.extend({
|
|||
|
||||
actions: {
|
||||
filterLogs: function() {
|
||||
Ember.run.cancel(this.get('runLaterId'));
|
||||
this.set('runLaterId', null);
|
||||
|
||||
this.refresh();
|
||||
},
|
||||
logsSorted: function() {
|
||||
Ember.run.cancel(this.get('runLaterId'));
|
||||
this.set('runLaterId', null);
|
||||
},
|
||||
next: function() {
|
||||
|
||||
Ember.run.cancel(this.get('runLaterId'));
|
||||
|
|
|
|||
|
|
@ -5,70 +5,51 @@
|
|||
</section>
|
||||
<section>
|
||||
<div class="well">
|
||||
<div class="over-hr r-mt5 {{if showFilter '' 'r-mb15'}}">
|
||||
<span style="text-transform: none;">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm r-m0">
|
||||
<li>
|
||||
<a class="hand" {{action "toggleFilter"}}>Show Filters</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="form-inline r-mb25 inline-block">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
{{input class="form-control input-sm" value=filters.eventType placeholder="Event Type"}}
|
||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">{{if filters.resourceType filters.resourceType 'Resource Type:'}} <i class="icon icon-chevron-down"></i></button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li role="presentation" class="dropdown-header">
|
||||
Select A Resource Type:
|
||||
</li>
|
||||
{{#each model.resourceTypes as |resource|}}
|
||||
<li {{action "updateResourceType" resource}}>
|
||||
<a>{{resource}}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
{{input class="form-control input-sm" value=filters.clientIp placeholder="Client IP"}}
|
||||
{{input class="form-control input-sm" value=filters.resourceId placeholder="Resource ID"}}
|
||||
<span class="dropdown">
|
||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">{{if authTypeReadable authTypeReadable 'Auth Type:'}} <i class="icon icon-chevron-down"></i></button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li role="presentation" class="dropdown-header">
|
||||
Select A Auth Type:
|
||||
</li>
|
||||
{{#each authTypes as |type|}}
|
||||
<li {{action "updateAuthType" type}}>
|
||||
<a>{{type.value}}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</nav>
|
||||
</span>
|
||||
</span>
|
||||
<a class="btn btn-sm btn-primary" {{action "clearAll"}} style="margin-right: 8px;"><i class="icon icon-close icon-sm"></i> Clear All</a>
|
||||
</div>
|
||||
</div>
|
||||
{{#liquid-if showFilter class="auditlog-filters"}}
|
||||
<a class="btn btn-sm btn-primary pull-right hand {{if showFilter 'enabled' 'disabled'}}" {{action "clearAll"}} style="margin-right: 8px;"><i class="icon icon-close icon-sm"></i> Clear All</a>
|
||||
<table class="grid fixed table table-hover r-mb10">
|
||||
<thead>
|
||||
<th width="125"></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th width="100"></th>
|
||||
<th width="100"></th>
|
||||
<th width="150"></th>
|
||||
<th width=""></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{{input class="form-control input-sm" value=filters.eventType placeholder="event type"}}</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">{{if filters.resourceType filters.resourceType 'Resource Type:'}} <i class="icon icon-chevron-down"></i></button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li role="presentation" class="dropdown-header">
|
||||
Select A Resource Type:
|
||||
</li>
|
||||
{{#each model.resourceTypes as |resource|}}
|
||||
<li {{action "updateResourceType" resource}}>
|
||||
<a>{{resource}}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</span>
|
||||
{{input class="form-control input-sm" value=filters.resourceId placeholder="resource id"}}
|
||||
</div>
|
||||
</td>
|
||||
<td>{{input class="form-control input-sm" value=filters.authType placeholder="auth type"}}</td>
|
||||
<td>{{input class="form-control input-sm" value=filters.authenticatedAsAccountId placeholder="account"}}</td>
|
||||
<td>{{input class="form-control input-sm" value=filters.authenticatedAsIdentityId placeholder="identity"}}</td>
|
||||
<td>{{input class="form-control input-sm" value=filters.clientIp placeholder="clientIp"}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{/liquid-if}}
|
||||
<table class="grid fixed table table-hover r-mb15">
|
||||
<thead>
|
||||
{{sortable-th sortable=this action="changeSort" name="created" label="Time" width="125" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="eventType" width="" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="resourceType" label="Resource Type:Resource Id" width="" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="authType" width="100" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="authenticatedAsAccountId" label="Account" width="100" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="clientIp" label="Request IP" width="150" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="authType" width="125" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="authenticatedAsAccountId" label="Environment" width="125" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="authenticatedAsIdentityId" label="Identity" width="150" class="r-pl10"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="clientIp" width="" class="r-pl10"}}
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each model.auditLog as |log|}}
|
||||
|
|
@ -78,10 +59,10 @@
|
|||
{{log.eventType}} <i class="icon icon-info addtl-info-trigger" {{action 'showResponseObjects' log.requestObject log.responseObject }}></i>
|
||||
</td>
|
||||
<td class="clip" title="{{log.resourceType}}"><a href="{{log.links.self}}" target="_blank">{{log.resourceType}}{{if log.resourceId ':'}}{{log.resourceId}}</a></td>
|
||||
<td class="clip">{{log.clientIp}}</td>
|
||||
<td class="clip" title="{{log.authType}}">{{auth-type log.authType}}</td>
|
||||
<td class="clip" title="{{if log.account.name log.account.name log.account.id}}">{{if log.account.name log.account.name log.account.id}}</td>
|
||||
<td>{{identity-block identityNotParsed=log.authenticatedAsIdentityId}}</td>
|
||||
<td class="clip">{{log.clientIp}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export default Ember.Component.extend({
|
|||
responseJSON: null,
|
||||
|
||||
didInitAttrs: function() {
|
||||
this.set('requestJSON', JSON.stringify(this.get('requestObject'), null,2));
|
||||
this.set('responseJSON', JSON.stringify(this.get('responseObject'), null,2));
|
||||
this.set('requestJSON', JSON.stringify(JSON.parse(this.get('requestObject')),null,2));
|
||||
this.set('responseJSON', JSON.stringify(JSON.parse(this.get('responseObject')),null,2));
|
||||
Ember.run.next(() =>{
|
||||
this.highlightAll();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,17 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const AUTHTYPES = {
|
||||
AdminAuth: 'None',
|
||||
BasicAuth: 'API Key',
|
||||
HeaderAuth: 'HeaderAuth',
|
||||
RegistrationToken: 'Host Registration',
|
||||
TokenAccount: 'TokenAccount',
|
||||
TokenAuth: 'UI Session'
|
||||
};
|
||||
|
||||
import C from 'ui/utils/constants';
|
||||
|
||||
export function authType(type /*, hash*/) {
|
||||
return AUTHTYPES[type];
|
||||
return C.AUTH_TYPES[type];
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(authType);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,5 @@
|
|||
import Resource from 'ember-api-store/models/resource';
|
||||
import C from 'ui/utils/constants';
|
||||
import Serializable from 'ember-api-store/mixins/serializable';
|
||||
|
||||
function serialize(obj) {
|
||||
try {
|
||||
if ( Serializable.detect(obj) )
|
||||
{
|
||||
return obj.serialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
message: "Error parsing JSON",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var AuditLog = Resource.extend({});
|
||||
|
||||
|
|
@ -26,21 +8,6 @@ AuditLog.reopenClass({
|
|||
[C.HEADER.PROJECT]: undefined, // Requests for projects use the user's scope, not the project
|
||||
},
|
||||
|
||||
mangleIn: function(data) {
|
||||
// request and responseObject should be plain JSON objects, not typeified.
|
||||
if ( data.requestObject )
|
||||
{
|
||||
data.requestObject = serialize(data.requestObject);
|
||||
}
|
||||
|
||||
if ( data.responseObject )
|
||||
{
|
||||
data.responseObject = serialize(data.responseObject);
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
export default AuditLog;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,15 @@ var C = {
|
|||
TYPE_ADMIN: 'admin',
|
||||
BASIC_BEARER: 'x-api-bearer',
|
||||
},
|
||||
|
||||
AUTH_TYPES: {
|
||||
AdminAuth: 'None',
|
||||
BasicAuth: 'API Key',
|
||||
HeaderAuth: 'HeaderAuth',
|
||||
RegistrationToken: 'Host Registration',
|
||||
TokenAccount: 'TokenAccount',
|
||||
TokenAuth: 'UI Session'
|
||||
},
|
||||
};
|
||||
|
||||
C.TOKEN_TO_SESSION_KEYS = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue