conjur-asset-ui 1.4.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -3
- data/CHANGELOG.md +10 -0
- data/Makefile +19 -0
- data/README.md +0 -3
- data/Rakefile +22 -17
- data/TODO.md +0 -23
- data/app/.csscomb.json +304 -0
- data/app/.eslintignore +3 -0
- data/app/.eslintrc +265 -0
- data/app/config/preprocessor.js +19 -0
- data/app/config/webpack.js +124 -0
- data/app/gulpfile.js +96 -0
- data/app/package.json +86 -0
- data/app/src/actions.js +550 -0
- data/app/src/app.js +83 -0
- data/app/src/clients/audit.js +34 -0
- data/app/src/clients/auth.js +24 -0
- data/app/src/clients/generic.js +52 -0
- data/app/src/clients/graph.js +7 -0
- data/app/src/clients/layer_members.js +18 -0
- data/app/src/clients/list.js +31 -0
- data/app/src/clients/members.js +20 -0
- data/app/src/clients/request.js +531 -0
- data/app/src/clients/search.js +5 -0
- data/app/src/components/app/__tests__/app-test.js +22 -0
- data/app/src/components/app/app.js +36 -0
- data/app/src/components/app/wrapper.js +17 -0
- data/app/src/components/audit/__tests__/table_header-test.js +22 -0
- data/app/src/components/audit/box.js +9 -0
- data/app/src/components/audit/constants.js +5 -0
- data/app/src/components/audit/entry.js +105 -0
- data/app/src/components/audit/fields_mixin.js +11 -0
- data/app/src/components/audit/humanize_event.js +213 -0
- data/app/src/components/audit/table.js +64 -0
- data/app/src/components/audit/table_header.js +37 -0
- data/app/src/components/audit/timestamp.js +28 -0
- data/app/src/components/auth/login.js +177 -0
- data/app/src/components/auth/login.less +71 -0
- data/app/src/components/auth/logout.js +42 -0
- data/app/src/components/auth/logout.less +21 -0
- data/app/src/components/chart/chart.js +540 -0
- data/app/src/components/chart/chart_helper_mixin.js +78 -0
- data/app/src/components/custom/list.js +3 -0
- data/app/src/components/custom/view.js +81 -0
- data/app/src/components/dashboard/activity.js +144 -0
- data/app/src/components/dashboard/dashboard.js +46 -0
- data/app/src/components/flash/flash.js +98 -0
- data/app/src/components/flash/flash.less +3 -0
- data/app/src/components/generic/__tests__/time-test.js +42 -0
- data/app/src/components/generic/annotations.js +39 -0
- data/app/src/components/generic/breadcrumbs.js +57 -0
- data/app/src/components/generic/foldable_audit_section.js +204 -0
- data/app/src/components/generic/list.js +141 -0
- data/app/src/components/generic/list_factory.js +41 -0
- data/app/src/components/generic/resource_link.js +64 -0
- data/app/src/components/generic/role_link.js +66 -0
- data/app/src/components/generic/tab_mixin.js +146 -0
- data/app/src/components/generic/time.js +32 -0
- data/app/src/components/graph/__tests__/collapse-test.js +133 -0
- data/app/src/components/graph/__tests__/edges-from-vertices-test.js +48 -0
- data/app/src/components/graph/__tests__/new-vertex-set-test.js +16 -0
- data/app/src/components/graph/__tests__/next-id-test.js +27 -0
- data/app/src/components/graph/__tests__/role-kind-from-id-test.js +24 -0
- data/app/src/components/graph/__tests__/vertices-from-edges-test.js +72 -0
- data/app/src/components/graph/graph.js +449 -0
- data/app/src/components/graph/graph.less +39 -0
- data/app/src/components/graph/helpers.js +368 -0
- data/app/src/components/group/list.js +3 -0
- data/app/src/components/group/view.js +153 -0
- data/app/src/components/host/activity.js +111 -0
- data/app/src/components/host/details.js +28 -0
- data/app/src/components/host/executors.js +77 -0
- data/app/src/components/host/host_link.js +18 -0
- data/app/src/components/host/list.js +3 -0
- data/app/src/components/host/updaters.js +77 -0
- data/app/src/components/host/view.js +145 -0
- data/app/src/components/layer/list.js +3 -0
- data/app/src/components/layer/view.js +197 -0
- data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
- data/app/src/components/navbar/nav_search_form.js +40 -0
- data/app/src/components/navbar/navbar.js +96 -0
- data/app/src/components/notfound/notfound.js +35 -0
- data/app/src/components/notfound/notfound.less +21 -0
- data/app/src/components/owned_resources/owned_resources.js +84 -0
- data/app/src/components/owned_resources/owned_resources_box.js +101 -0
- data/app/src/components/permissions/permissions.js +138 -0
- data/app/src/components/permissions/permissions_table.js +101 -0
- data/app/src/components/policy/list.js +3 -0
- data/app/src/components/policy/view.js +107 -0
- data/app/src/components/refresh/refresh.js +29 -0
- data/app/src/components/refresh/refresh.less +15 -0
- data/app/src/components/search/group.js +43 -0
- data/app/src/components/search/group_heading.js +50 -0
- data/app/src/components/search/group_title.js +37 -0
- data/app/src/components/search/result_item.js +55 -0
- data/app/src/components/search/search.js +118 -0
- data/app/src/components/user/activity.js +112 -0
- data/app/src/components/user/details.js +30 -0
- data/app/src/components/user/list.js +3 -0
- data/app/src/components/user/pubkeys.js +118 -0
- data/app/src/components/user/pubkeys.less +56 -0
- data/app/src/components/user/view.js +143 -0
- data/app/src/components/variable/activity.js +101 -0
- data/app/src/components/variable/details.js +46 -0
- data/app/src/components/variable/fetchers.js +77 -0
- data/app/src/components/variable/list.js +3 -0
- data/app/src/components/variable/updaters.js +77 -0
- data/app/src/components/variable/view.js +115 -0
- data/app/src/constants.js +36 -0
- data/{public → app/src}/images/conjur-logo.svg +0 -0
- data/{public → app/src}/images/icon-client-pc.svg +0 -0
- data/{public → app/src}/images/icon-environment.png +0 -0
- data/{public → app/src}/images/icon-person.svg +0 -0
- data/{public → app/src}/images/icon-policy.png +0 -0
- data/{public → app/src}/images/icon-resource.png +0 -0
- data/{public → app/src}/images/icon-service-dots.svg +0 -0
- data/{public → app/src}/images/icon-variable.png +0 -0
- data/app/src/pages/index.html +27 -0
- data/app/src/routes.js +64 -0
- data/app/src/stores/app_store.js +35 -0
- data/app/src/stores/audit_store.js +143 -0
- data/app/src/stores/graph_store.js +51 -0
- data/app/src/stores/group_store.js +104 -0
- data/app/src/stores/host_store.js +111 -0
- data/app/src/stores/layer_store.js +115 -0
- data/app/src/stores/policy_store.js +88 -0
- data/app/src/stores/resources_store.js +115 -0
- data/app/src/stores/route_store.js +21 -0
- data/app/src/stores/search_store.js +77 -0
- data/app/src/stores/user_store.js +109 -0
- data/app/src/stores/variable_store.js +93 -0
- data/app/src/styles/bootstrap.less +54 -0
- data/{public/css → app/src/styles}/styles.less +26 -82
- data/app/src/utils.js +38 -0
- data/app/src/vendor/pace.js +2 -0
- data/conjur-asset-ui.gemspec +3 -4
- data/docker/assets-build/Dockerfile +12 -0
- data/docker/conjur-ui/Dockerfile +33 -0
- data/docker/conjur-ui/README.md +38 -0
- data/docker/conjur-ui/mime.types +90 -0
- data/docker/conjur-ui/nginx.conf +110 -0
- data/docker/conjur-ui/start.py +72 -0
- data/docker/conjur-ui/start.sh +18 -0
- data/docker/conjur-ui/test.env +8 -0
- data/lib/conjur-asset-ui-version.rb +1 -1
- data/lib/conjur/command/ui.rb +10 -2
- data/lib/conjur/webserver/home.rb +3 -3
- data/lib/conjur/webserver/login.rb +1 -1
- data/lib/conjur/webserver/server.rb +16 -4
- data/public/js/views/roleGraph.js +91 -0
- metadata +167 -105
- data/.jshintrc +0 -41
- data/bower.json +0 -98
- data/gulpfile.js +0 -139
- data/package.json +0 -47
- data/preprocessor.js +0 -7
- data/public/_client_libs.html +0 -9
- data/public/index.html.erb +0 -63
- data/public/js/init.js +0 -196
- data/public/js/lib/pace.js +0 -2
- data/public/js/lib/sorted-set.no-require.js +0 -1145
- data/public/js/lib/sorted-set.no-require.js.txt +0 -6
- data/public/js/models/groupRecord.js +0 -72
- data/public/js/models/hostRecord.js +0 -60
- data/public/js/models/layerRecord.js +0 -79
- data/public/js/models/namespace.js +0 -12
- data/public/js/models/policyList.js +0 -16
- data/public/js/models/policyRecord.js +0 -54
- data/public/js/models/record.js +0 -117
- data/public/js/models/resourceList.js +0 -87
- data/public/js/models/userList.js +0 -25
- data/public/js/models/userRecord.js +0 -75
- data/public/js/models/variableList.js +0 -27
- data/public/js/models/variableRecord.js +0 -77
- data/public/js/routers.js +0 -242
- data/public/js/views/annotations.js +0 -47
- data/public/js/views/audit.js +0 -369
- data/public/js/views/breadcrumbs.js +0 -62
- data/public/js/views/chart.js +0 -617
- data/public/js/views/dashboard.js +0 -146
- data/public/js/views/generic.js +0 -122
- data/public/js/views/group.js +0 -109
- data/public/js/views/groups.js +0 -26
- data/public/js/views/host.js +0 -200
- data/public/js/views/hosts.js +0 -26
- data/public/js/views/layer.js +0 -146
- data/public/js/views/layers.js +0 -26
- data/public/js/views/mixins/search.js +0 -22
- data/public/js/views/mixins/tabs.js +0 -154
- data/public/js/views/namespaces.js +0 -40
- data/public/js/views/navSearch.js +0 -36
- data/public/js/views/owned.js +0 -184
- data/public/js/views/permissions.js +0 -254
- data/public/js/views/policies.js +0 -26
- data/public/js/views/policy.js +0 -70
- data/public/js/views/resource.js +0 -59
- data/public/js/views/role.js +0 -63
- data/public/js/views/searchResults.js +0 -212
- data/public/js/views/sections.js +0 -226
- data/public/js/views/time.js +0 -39
- data/public/js/views/user.js +0 -297
- data/public/js/views/users.js +0 -26
- data/public/js/views/variable.js +0 -310
- data/public/js/views/variables.js +0 -26
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/support/jasmine.yml +0 -112
- data/spec/javascripts/support/jasmine_helper.rb +0 -22
- data/spec/javascripts/support/run.html.erb +0 -23
- data/spec/javascripts/views/AuditSpec.js +0 -22
- data/spec/javascripts/views/AuditSpec.ls +0 -18
@@ -0,0 +1,30 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
|
3
|
+
var RoleLink = require('../generic/role_link'),
|
4
|
+
Refresh = require('../refresh/refresh');
|
5
|
+
|
6
|
+
export default React.createClass({
|
7
|
+
displayName: 'UserDetails',
|
8
|
+
|
9
|
+
render: function() {
|
10
|
+
// TODO: refactor
|
11
|
+
// TODO: show public keys
|
12
|
+
// TODO: actions menu (e.g. 'upload public key', 'add annotation')
|
13
|
+
// TODO: memberships panel
|
14
|
+
return (
|
15
|
+
<div className="b-user-details">
|
16
|
+
<h2>Details<Refresh show={this.props.isLoading} /></h2>
|
17
|
+
<dl className="dl-horizontal">
|
18
|
+
<dt>Created by</dt>
|
19
|
+
<dd><RoleLink id={this.props.user.userid}/></dd>
|
20
|
+
|
21
|
+
<dt>Owner</dt>
|
22
|
+
<dd><RoleLink id={this.props.owner}/></dd>
|
23
|
+
|
24
|
+
<dt>Uidnumber</dt>
|
25
|
+
<dd>{this.props.user.uidnumber}</dd>
|
26
|
+
</dl>
|
27
|
+
</div>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
});
|
@@ -0,0 +1,118 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
|
3
|
+
require('./pubkeys.less');
|
4
|
+
|
5
|
+
var PubkeyItem = React.createClass({
|
6
|
+
displayName: 'PubkeyItem',
|
7
|
+
|
8
|
+
render: function() {
|
9
|
+
return (
|
10
|
+
<div className="b-pubkey">
|
11
|
+
<div className="b-pubkey__logo">
|
12
|
+
<span className="badge">{this.props.pubkey[0]}</span>
|
13
|
+
</div>
|
14
|
+
<ul className="b-pubkey__list list-unstyled">
|
15
|
+
<li className="b-pubkey__name">
|
16
|
+
{this.props.pubkey[2]}
|
17
|
+
</li>
|
18
|
+
<li className="b-pubkey__fingerprint">
|
19
|
+
{/* TODO: key fingerprint */}
|
20
|
+
</li>
|
21
|
+
<li className="b-pubkey__info">
|
22
|
+
{/* TODO: When added, when last time used */}
|
23
|
+
</li>
|
24
|
+
</ul>
|
25
|
+
<div className="b-pubkeys__actions">
|
26
|
+
{/* TODO: Action buttons */}
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
var PubkeysHelp = React.createClass({
|
34
|
+
displayName: 'PubkeysHelp',
|
35
|
+
|
36
|
+
render: function() {
|
37
|
+
var ret;
|
38
|
+
|
39
|
+
if (React.Children.count(this.props.children) > 0) {
|
40
|
+
ret = (
|
41
|
+
<p className="b-pubkeys__help">
|
42
|
+
{this.props.children}
|
43
|
+
</p>
|
44
|
+
);
|
45
|
+
} else {
|
46
|
+
var login = this.props.login;
|
47
|
+
|
48
|
+
ret = (
|
49
|
+
<p className="b-pubkeys__help">
|
50
|
+
There are no pubkeys registered for this user yet.
|
51
|
+
Use following command to upload one from a file:
|
52
|
+
<pre>$ conjur pubkeys add {login} @userkeyfile.pub</pre>
|
53
|
+
</p>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
|
57
|
+
return ret;
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
var PubkeysList = React.createClass({
|
62
|
+
displayName: 'PubkeysList',
|
63
|
+
|
64
|
+
render: function() {
|
65
|
+
var login = this.props.login;
|
66
|
+
|
67
|
+
var pubkeysList = this.props.pubkeys.map(function(k, idx, coll) {
|
68
|
+
var tokens = k.split(' ');
|
69
|
+
|
70
|
+
var className = 'b-pubkeys__item list-group-item list-group-item-noborder';
|
71
|
+
|
72
|
+
if (idx + 1 !== coll.length) {
|
73
|
+
className += ' b-pubkeys__item--headline';
|
74
|
+
}
|
75
|
+
|
76
|
+
return (
|
77
|
+
<li className={className}>
|
78
|
+
<PubkeyItem pubkey={tokens} />
|
79
|
+
</li>
|
80
|
+
);
|
81
|
+
});
|
82
|
+
|
83
|
+
return (
|
84
|
+
<div className="b-pubkeys">
|
85
|
+
<PubkeysHelp>
|
86
|
+
This is list of SSH public keys associated with user {login}.
|
87
|
+
</PubkeysHelp>
|
88
|
+
<ul className="b-pubkeys__list">
|
89
|
+
{pubkeysList}
|
90
|
+
</ul>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
});
|
95
|
+
|
96
|
+
export default React.createClass({
|
97
|
+
render: function() {
|
98
|
+
var body;
|
99
|
+
|
100
|
+
if (this.props.isLoading) {
|
101
|
+
body = (
|
102
|
+
<p>Loading...</p>
|
103
|
+
);
|
104
|
+
} else if (this.props.pubkeys.length > 0) {
|
105
|
+
body = (
|
106
|
+
<PubkeysList login={this.props.login} pubkeys={this.props.pubkeys} />
|
107
|
+
);
|
108
|
+
} else {
|
109
|
+
body = (
|
110
|
+
<div className="b-pubkeys">
|
111
|
+
<PubkeysHelp login={this.props.login} />
|
112
|
+
</div>
|
113
|
+
);
|
114
|
+
}
|
115
|
+
|
116
|
+
return body;
|
117
|
+
}
|
118
|
+
});
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/* -Pubkeys-------------------------- */
|
2
|
+
|
3
|
+
.b-pubkeys {
|
4
|
+
|
5
|
+
}
|
6
|
+
|
7
|
+
.b-pubkeys__help {
|
8
|
+
|
9
|
+
}
|
10
|
+
|
11
|
+
.b-pubkeys__list {
|
12
|
+
padding-top: 10px;
|
13
|
+
}
|
14
|
+
|
15
|
+
.b-pubkeys__item {
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
.b-pubkeys__item--headline {
|
20
|
+
margin-bottom: 1px;
|
21
|
+
box-shadow: 0 2px 1px -2px gray;
|
22
|
+
}
|
23
|
+
|
24
|
+
.b-pubkey {
|
25
|
+
margin-right: 55px;
|
26
|
+
height: 20px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.b-pubkey__logo {
|
30
|
+
display: inline-block;
|
31
|
+
width: 70px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.b-pubkey__list {
|
35
|
+
display: inline-block;
|
36
|
+
}
|
37
|
+
|
38
|
+
.b-pubkey__name {
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
.b-pubkey__fingerprint {
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
.b-pubkey__info {
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
.b-pubkey__actions {
|
51
|
+
display: inline-block;
|
52
|
+
}
|
53
|
+
|
54
|
+
.b-chart-demo {
|
55
|
+
height: 300px;
|
56
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
var React = require('react'),
|
2
|
+
Fluxxor = require('fluxxor');
|
3
|
+
|
4
|
+
import {compact} from 'lodash';
|
5
|
+
|
6
|
+
var FluxMixin = Fluxxor.FluxMixin(React),
|
7
|
+
StoreWatchMixin = Fluxxor.StoreWatchMixin;
|
8
|
+
|
9
|
+
var TabbedArea = require('react-bootstrap/lib/TabbedArea'),
|
10
|
+
TabPane = require('react-bootstrap/lib/TabPane');
|
11
|
+
|
12
|
+
var TabMixin = require('../generic/tab_mixin'),
|
13
|
+
AuditTable = require('../audit/table'),
|
14
|
+
Breadcrumbs = require('../generic/breadcrumbs'),
|
15
|
+
Annotations = require('../generic/annotations'),
|
16
|
+
FoldableAuditSection = require('../generic/foldable_audit_section'),
|
17
|
+
Refresh = require('../refresh/refresh'),
|
18
|
+
RoleGraph = require('../graph/graph');
|
19
|
+
|
20
|
+
import {getTabname} from '../../utils';
|
21
|
+
|
22
|
+
var PubkeysTabContent = require('./pubkeys'),
|
23
|
+
Details = require('./details'),
|
24
|
+
Activity = require('./activity');
|
25
|
+
|
26
|
+
export default React.createClass({
|
27
|
+
displayName: 'UserView',
|
28
|
+
|
29
|
+
mixins: [FluxMixin, StoreWatchMixin('audit', 'user', 'resources', 'route'), TabMixin],
|
30
|
+
|
31
|
+
askForNewData(state) {
|
32
|
+
var actions = this.getFlux().actions;
|
33
|
+
|
34
|
+
actions.audit.loadForRole('user', state.id);
|
35
|
+
actions.audit.loadForResource('user', state.id);
|
36
|
+
actions.user.load(state.id);
|
37
|
+
actions.resources.loadOne('user', state.id);
|
38
|
+
},
|
39
|
+
|
40
|
+
componentDidMount() {
|
41
|
+
this.askForNewData(this.state);
|
42
|
+
},
|
43
|
+
|
44
|
+
componentWillUpdate(nextProps, nextState) {
|
45
|
+
if (this.state.id !== nextState.id) {
|
46
|
+
this.askForNewData(nextState);
|
47
|
+
}
|
48
|
+
|
49
|
+
return true;
|
50
|
+
},
|
51
|
+
|
52
|
+
getStateFromFlux() {
|
53
|
+
var flux = this.getFlux(),
|
54
|
+
id = flux.store('route').getParam('id'),
|
55
|
+
audit = flux.store('audit').getEventFor('user', id),
|
56
|
+
data = flux.store('user').getData(),
|
57
|
+
resource = flux.store('resources').getResource('user', id);
|
58
|
+
|
59
|
+
var ret = {
|
60
|
+
id: id,
|
61
|
+
loading: data.loading,
|
62
|
+
user: data.user,
|
63
|
+
owned: data.owned,
|
64
|
+
roles: data.roles,
|
65
|
+
owner: resource.data.owner,
|
66
|
+
annotations: resource.data.annotations,
|
67
|
+
resource: resource.data,
|
68
|
+
pubkeys: data.pubkeys,
|
69
|
+
audit: audit.data,
|
70
|
+
resources: data.resources
|
71
|
+
};
|
72
|
+
|
73
|
+
ret.loading.audit = audit.loading;
|
74
|
+
ret.loading.owner = resource.loading;
|
75
|
+
ret.loading.annotations = resource.loading;
|
76
|
+
|
77
|
+
return ret;
|
78
|
+
},
|
79
|
+
|
80
|
+
render() {
|
81
|
+
var pubkeysTab = (
|
82
|
+
<TabPane eventKey="pubkeys"
|
83
|
+
tab={getTabname('Public Keys', this.state.pubkeys)}>
|
84
|
+
<PubkeysTabContent login={this.state.user.login}
|
85
|
+
pubkeys={this.state.pubkeys} />
|
86
|
+
</TabPane>
|
87
|
+
);
|
88
|
+
|
89
|
+
var permissionsTab = this.permissionsTab(this.state.user.roleid),
|
90
|
+
membershipsTab = this.membershipsTab(this.state.user.roleid),
|
91
|
+
ownedTab = this.ownedTab();
|
92
|
+
|
93
|
+
var tabs = compact([
|
94
|
+
pubkeysTab,
|
95
|
+
ownedTab,
|
96
|
+
membershipsTab,
|
97
|
+
permissionsTab
|
98
|
+
]);
|
99
|
+
|
100
|
+
var elems = [
|
101
|
+
{url: '/ui/users', text: 'Users'},
|
102
|
+
{url: '', text: this.state.user.login},
|
103
|
+
{url: '', text: '(owned by ' + this.state.user.ownerid + ')'}
|
104
|
+
];
|
105
|
+
|
106
|
+
return (
|
107
|
+
<div className="b-user">
|
108
|
+
<Breadcrumbs elems={elems} />
|
109
|
+
<hr />
|
110
|
+
<Activity audit={this.state.audit}
|
111
|
+
roleid={this.state.user.roleid}
|
112
|
+
isLoading={this.state.loading.user || this.state.loading.audit} />
|
113
|
+
<hr />
|
114
|
+
{FoldableAuditSection.warnings(this.state.audit, this.state.loading.audit)}
|
115
|
+
<hr />
|
116
|
+
<div className="row">
|
117
|
+
<div className="col-md-6">
|
118
|
+
<Details owner={this.state.owner}
|
119
|
+
user={this.state.user}
|
120
|
+
isLoading={this.state.loading.user || this.state.loading.owner} />
|
121
|
+
</div>
|
122
|
+
<div className="col-md-6">
|
123
|
+
<h2>Annotations<Refresh show={this.state.loading.annotations} /></h2>
|
124
|
+
<Annotations annotations={this.state.annotations} />
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
<hr />
|
128
|
+
<h2>Other</h2>
|
129
|
+
<TabbedArea>
|
130
|
+
{tabs}
|
131
|
+
</TabbedArea>
|
132
|
+
<hr />
|
133
|
+
<RoleGraph height="400"
|
134
|
+
kind="user"
|
135
|
+
id={this.state.id} />
|
136
|
+
<hr />
|
137
|
+
<AuditTable events={this.state.audit}
|
138
|
+
caption="Recent Activity"
|
139
|
+
isLoading={this.state.loading.audit} />
|
140
|
+
</div>
|
141
|
+
);
|
142
|
+
}
|
143
|
+
});
|
@@ -0,0 +1,101 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
|
3
|
+
var Chart = require('../chart/chart'),
|
4
|
+
ChartHelperMixin = require('../chart/chart_helper_mixin'),
|
5
|
+
Refresh = require('../refresh/refresh');
|
6
|
+
|
7
|
+
export default React.createClass({
|
8
|
+
displayName: 'VariableActivity',
|
9
|
+
|
10
|
+
mixins: [ChartHelperMixin],
|
11
|
+
|
12
|
+
propTypes: {
|
13
|
+
audit: React.PropTypes.array,
|
14
|
+
isLoading: React.PropTypes.bool
|
15
|
+
},
|
16
|
+
|
17
|
+
getDefaultProps() {
|
18
|
+
return {
|
19
|
+
audit: [],
|
20
|
+
isLoading: false,
|
21
|
+
options: {
|
22
|
+
legend: {
|
23
|
+
sread: 'Successful reads',
|
24
|
+
supdate: 'Successful updates',
|
25
|
+
fread: 'Failed reads',
|
26
|
+
fupdate: 'Failed updates'
|
27
|
+
},
|
28
|
+
axis: {
|
29
|
+
y: {
|
30
|
+
label: 'Value'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
};
|
35
|
+
},
|
36
|
+
|
37
|
+
getDefaultItem() {
|
38
|
+
return {
|
39
|
+
sread: 0,
|
40
|
+
supdate: 0,
|
41
|
+
fread: 0,
|
42
|
+
fupdate: 0
|
43
|
+
};
|
44
|
+
},
|
45
|
+
|
46
|
+
getEventType(e) {
|
47
|
+
if (e.action === 'check') {
|
48
|
+
if (e.hasOwnProperty('error') || e.allowed === false) {
|
49
|
+
if (e.privilege === 'execute') {
|
50
|
+
return 'fread';
|
51
|
+
} else if (e.privilege === 'update') {
|
52
|
+
return 'fupdate';
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
if (!e.hasOwnProperty('error') && e.allowed !== false) {
|
57
|
+
if (e.privilege === 'execute') {
|
58
|
+
return 'sread';
|
59
|
+
} else if (e.privilege === 'update') {
|
60
|
+
return 'supdate';
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return null;
|
66
|
+
},
|
67
|
+
|
68
|
+
getInitialState() {
|
69
|
+
return {showActivity: false};
|
70
|
+
},
|
71
|
+
|
72
|
+
toggleActivity(e) {
|
73
|
+
e.preventDefault();
|
74
|
+
|
75
|
+
this.setState({showActivity: !this.state.showActivity});
|
76
|
+
},
|
77
|
+
|
78
|
+
render() {
|
79
|
+
var data = this.getData(this.props.audit);
|
80
|
+
var activityBody = [];
|
81
|
+
|
82
|
+
var msg = this.state.showActivity ? 'Hide' : 'Show graph';
|
83
|
+
|
84
|
+
if (this.state.showActivity) {
|
85
|
+
activityBody.push(
|
86
|
+
<div className="b-variable-activity__graph">
|
87
|
+
<Chart options={this.props.options}
|
88
|
+
data={data} />
|
89
|
+
</div>
|
90
|
+
);
|
91
|
+
}
|
92
|
+
|
93
|
+
return (
|
94
|
+
<div className="b-variable-activity">
|
95
|
+
<h2>Activity<Refresh show={this.props.isLoading} /></h2>
|
96
|
+
<a href="#" onClick={this.toggleActivity}>{msg}</a>
|
97
|
+
{activityBody}
|
98
|
+
</div>
|
99
|
+
);
|
100
|
+
}
|
101
|
+
});
|