conjur-asset-ui-beta 1.5.0 → 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/TODO.md +0 -23
- data/app/build/js/app.js +72652 -50337
- data/app/package.json +2 -0
- data/app/src/actions.js +56 -3
- data/app/src/app.js +7 -3
- data/app/src/clients/graph.js +24 -0
- data/app/src/clients/members.js +3 -3
- data/app/src/components/audit/table.js +9 -0
- data/app/src/components/custom/view.js +26 -14
- data/app/src/components/dashboard/activity.js +24 -4
- data/app/src/components/generic/foldable_audit_section.js +17 -0
- data/app/src/components/generic/role_link.js +2 -1
- data/app/src/components/graph/graph.js +421 -0
- data/app/src/components/graph/graph.less +39 -0
- data/app/src/components/group/view.js +31 -14
- data/app/src/components/host/activity.js +24 -4
- data/app/src/components/host/executors.js +83 -0
- data/app/src/components/host/updaters.js +83 -0
- data/app/src/components/host/view.js +46 -14
- data/app/src/components/layer/view.js +30 -13
- data/app/src/components/policy/view.js +23 -14
- data/app/src/components/search/search.js +21 -7
- data/app/src/components/user/activity.js +25 -4
- data/app/src/components/user/view.js +30 -13
- data/app/src/components/variable/activity.js +25 -4
- data/app/src/components/variable/fetchers.js +1 -1
- data/app/src/components/variable/updaters.js +1 -1
- data/app/src/components/variable/view.js +24 -13
- data/app/src/constants.js +4 -2
- data/app/src/stores/graph_store.js +55 -0
- data/app/src/stores/host_store.js +12 -1
- data/app/src/stores/route_store.js +7 -5
- data/app/src/stores/search_store.js +11 -6
- data/conjur-asset-ui.gemspec +1 -1
- data/lib/conjur-asset-ui-version.rb +1 -1
- metadata +9 -3
@@ -0,0 +1,83 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var React = require('react'),
|
4
|
+
take = require('lodash/array/take');
|
5
|
+
|
6
|
+
var RoleLink = require('../generic/role_link'),
|
7
|
+
Refresh = require('../refresh/refresh');
|
8
|
+
|
9
|
+
module.exports = React.createClass({
|
10
|
+
displayName: 'HostUpdaters',
|
11
|
+
|
12
|
+
propTypes: {
|
13
|
+
data: React.PropTypes.array,
|
14
|
+
isLoading: React.PropTypes.bool
|
15
|
+
},
|
16
|
+
|
17
|
+
getDefaultProps() {
|
18
|
+
return {
|
19
|
+
data: [],
|
20
|
+
isLoading: false
|
21
|
+
};
|
22
|
+
},
|
23
|
+
|
24
|
+
getInitialState() {
|
25
|
+
return {showAll: false};
|
26
|
+
},
|
27
|
+
|
28
|
+
handleClick(e) {
|
29
|
+
e.preventDefault();
|
30
|
+
|
31
|
+
this.setState({showAll: !this.state.showAll});
|
32
|
+
},
|
33
|
+
|
34
|
+
getItems() {
|
35
|
+
var items = this.props.data;
|
36
|
+
|
37
|
+
if (!this.state.showAll) {
|
38
|
+
items = take(items, 5);
|
39
|
+
}
|
40
|
+
|
41
|
+
return items.map((e) => {
|
42
|
+
return (
|
43
|
+
<li className="list-group-item list-group-item-noborder">
|
44
|
+
<RoleLink id={e} />
|
45
|
+
</li>
|
46
|
+
);
|
47
|
+
});
|
48
|
+
},
|
49
|
+
|
50
|
+
render() {
|
51
|
+
var items = this.getItems(),
|
52
|
+
msg = this.state.showAll ? 'Show top 5' : 'See all',
|
53
|
+
empty = items.length === 0,
|
54
|
+
lessThan5 = items.length <= 5,
|
55
|
+
body = [(<h2>Updaters<Refresh show={this.props.isLoading} /></h2>)];
|
56
|
+
|
57
|
+
if (!empty) {
|
58
|
+
body.push(
|
59
|
+
<ul className="b-host-updaters__list list-unstyled list-group">
|
60
|
+
{items}
|
61
|
+
</ul>
|
62
|
+
);
|
63
|
+
} else {
|
64
|
+
body.push(
|
65
|
+
<p>There is no updaters</p>
|
66
|
+
);
|
67
|
+
}
|
68
|
+
|
69
|
+
if (!lessThan5) {
|
70
|
+
body.push(
|
71
|
+
<div className="b-host-updaters__toggle">
|
72
|
+
<a href="#" onClick={this.handleClick}>{msg}</a>
|
73
|
+
</div>
|
74
|
+
);
|
75
|
+
}
|
76
|
+
|
77
|
+
return (
|
78
|
+
<div className="b-host-updaters">
|
79
|
+
{body}
|
80
|
+
</div>
|
81
|
+
);
|
82
|
+
}
|
83
|
+
});
|
@@ -4,7 +4,6 @@ var React = require('react'),
|
|
4
4
|
Fluxxor = require('fluxxor'),
|
5
5
|
FluxMixin = Fluxxor.FluxMixin(React),
|
6
6
|
StoreWatchMixin = Fluxxor.StoreWatchMixin,
|
7
|
-
Router = require('react-router'),
|
8
7
|
compact = require('lodash/array/compact');
|
9
8
|
|
10
9
|
var TabbedArea = require('react-bootstrap/lib/TabbedArea');
|
@@ -13,34 +12,62 @@ var Annotations = require('../generic/annotations'),
|
|
13
12
|
Breadcrumbs = require('../generic/breadcrumbs'),
|
14
13
|
FoldableAuditSection = require('../generic/foldable_audit_section'),
|
15
14
|
TabMixin = require('../generic/tab_mixin'),
|
15
|
+
RoleGraph = require('../graph/graph'),
|
16
16
|
Refresh = require('../refresh/refresh');
|
17
17
|
|
18
18
|
var AuditTable = require('../audit/table');
|
19
19
|
|
20
20
|
var Activity = require('./activity'),
|
21
|
+
Updaters = require('./updaters'),
|
22
|
+
Executors = require('./executors'),
|
21
23
|
Details = require('./details');
|
22
24
|
|
23
25
|
module.exports = React.createClass({
|
24
26
|
displayName: 'HostView',
|
25
27
|
|
26
|
-
mixins: [FluxMixin, StoreWatchMixin('audit', 'host', 'resources'
|
28
|
+
mixins: [FluxMixin, StoreWatchMixin('audit', 'host', 'resources', 'route'), TabMixin],
|
29
|
+
|
30
|
+
askForNewData(state) {
|
31
|
+
var actions = this.getFlux().actions;
|
32
|
+
|
33
|
+
actions.audit.loadForRole('host', state.id);
|
34
|
+
actions.audit.loadForResource('host', state.id);
|
35
|
+
actions.host.load(state.id);
|
36
|
+
actions.resources.loadOne('host', state.id);
|
37
|
+
},
|
38
|
+
|
39
|
+
componentDidMount() {
|
40
|
+
this.askForNewData(this.state);
|
41
|
+
},
|
42
|
+
|
43
|
+
componentWillUpdate(nextProps, nextState) {
|
44
|
+
if (this.state.id !== nextState.id) {
|
45
|
+
this.askForNewData(nextState);
|
46
|
+
}
|
47
|
+
|
48
|
+
return true;
|
49
|
+
},
|
27
50
|
|
28
51
|
getStateFromFlux() {
|
29
52
|
var flux = this.getFlux(),
|
30
|
-
id =
|
53
|
+
id = flux.store('route').getParam('id'),
|
31
54
|
audit = flux.store('audit').getEventFor('host', id),
|
32
55
|
data = flux.store('host').getData(),
|
33
56
|
resource = flux.store('resources').getResource('host', id);
|
34
57
|
|
35
58
|
var ret = {
|
59
|
+
id: id,
|
36
60
|
loading: data.loading,
|
37
61
|
host: data.host,
|
38
62
|
owned: data.owned,
|
39
63
|
roles: data.roles,
|
40
64
|
owner: resource.data.owner,
|
41
65
|
annotations: resource.data.annotations,
|
66
|
+
resource: resource.data,
|
42
67
|
audit: audit.data,
|
43
|
-
resources: data.resources
|
68
|
+
resources: data.resources,
|
69
|
+
executors: data.executors,
|
70
|
+
updaters: data.updaters
|
44
71
|
};
|
45
72
|
|
46
73
|
ret.loading.audit = audit.loading;
|
@@ -77,6 +104,17 @@ module.exports = React.createClass({
|
|
77
104
|
<hr />
|
78
105
|
{FoldableAuditSection.warnings(this.state.audit, this.state.loading.audit)}
|
79
106
|
<hr />
|
107
|
+
<div className="row">
|
108
|
+
<div className="col-md-6">
|
109
|
+
<Updaters data={this.state.updaters}
|
110
|
+
isLoading={this.state.loading.updaters} />
|
111
|
+
</div>
|
112
|
+
<div className="col-md-6">
|
113
|
+
<Executors data={this.state.executors}
|
114
|
+
isLoading={this.state.loading.executors} />
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<hr />
|
80
118
|
<div className="row">
|
81
119
|
<div className="col-md-6">
|
82
120
|
<Details owner={this.state.owner}
|
@@ -94,20 +132,14 @@ module.exports = React.createClass({
|
|
94
132
|
{tabs}
|
95
133
|
</TabbedArea>
|
96
134
|
<hr />
|
135
|
+
<RoleGraph height="400"
|
136
|
+
kind="host"
|
137
|
+
id={this.state.id} />
|
138
|
+
<hr />
|
97
139
|
<AuditTable events={this.state.audit}
|
98
140
|
isLoading={this.state.loading.audit}
|
99
141
|
caption="Recent Activity" />
|
100
142
|
</div>
|
101
143
|
);
|
102
|
-
},
|
103
|
-
|
104
|
-
componentDidMount() {
|
105
|
-
var actions = this.getFlux().actions,
|
106
|
-
id = unescape(this.getParams().id);
|
107
|
-
|
108
|
-
actions.audit.loadForRole('host', id);
|
109
|
-
actions.audit.loadForResource('host', id);
|
110
|
-
actions.host.load(id);
|
111
|
-
actions.resources.loadOne('host', id);
|
112
144
|
}
|
113
145
|
});
|
@@ -4,7 +4,6 @@ var React = require('react'),
|
|
4
4
|
Fluxxor = require('fluxxor'),
|
5
5
|
FluxMixin = Fluxxor.FluxMixin(React),
|
6
6
|
StoreWatchMixin = Fluxxor.StoreWatchMixin,
|
7
|
-
Router = require('react-router'),
|
8
7
|
compact = require('lodash/array/compact');
|
9
8
|
|
10
9
|
var TabbedArea = require('react-bootstrap/lib/TabbedArea'),
|
@@ -15,6 +14,7 @@ var AuditTable = require('../audit/table'),
|
|
15
14
|
RoleLink = require('../generic/role_link'),
|
16
15
|
TabMixin = require('../generic/tab_mixin'),
|
17
16
|
HostLink = require('../host/host_link'),
|
17
|
+
RoleGraph = require('../graph/graph'),
|
18
18
|
utils = require('../../utils');
|
19
19
|
|
20
20
|
var abstractRole = function(expected) {
|
@@ -31,22 +31,45 @@ var abstractRole = function(expected) {
|
|
31
31
|
module.exports = React.createClass({
|
32
32
|
displayName: 'LayerView',
|
33
33
|
|
34
|
-
mixins: [FluxMixin, StoreWatchMixin('audit', 'layer', 'resources'
|
34
|
+
mixins: [FluxMixin, StoreWatchMixin('audit', 'layer', 'resources', 'route'), TabMixin],
|
35
|
+
|
36
|
+
askForNewData(state) {
|
37
|
+
var actions = this.getFlux().actions;
|
38
|
+
|
39
|
+
actions.audit.loadForRole('layer', state.id);
|
40
|
+
actions.audit.loadForResource('layer', state.id);
|
41
|
+
actions.layer.load(state.id);
|
42
|
+
actions.resources.loadOne('layer', state.id);
|
43
|
+
},
|
44
|
+
|
45
|
+
componentDidMount() {
|
46
|
+
this.askForNewData(this.state);
|
47
|
+
},
|
48
|
+
|
49
|
+
componentWillUpdate(nextProps, nextState) {
|
50
|
+
if (this.state.id !== nextState.id) {
|
51
|
+
this.askForNewData(nextState);
|
52
|
+
}
|
53
|
+
|
54
|
+
return true;
|
55
|
+
},
|
35
56
|
|
36
57
|
getStateFromFlux() {
|
37
58
|
var flux = this.getFlux(),
|
38
|
-
id =
|
59
|
+
id = flux.store('route').getParam('id'),
|
39
60
|
audit = flux.store('audit').getEventFor('layer', id),
|
40
61
|
data = flux.store('layer').getData(),
|
41
62
|
resource = flux.store('resources').getResource('layer', id);
|
42
63
|
|
43
64
|
var ret = {
|
65
|
+
id: id,
|
44
66
|
loading: data.loading,
|
45
67
|
layer: data.layer,
|
46
68
|
owned: data.owned,
|
47
69
|
roles: data.roles,
|
48
70
|
owner: resource.data.owner,
|
49
71
|
annotations: resource.data.annotations,
|
72
|
+
resource: resource.data,
|
50
73
|
users: data.users,
|
51
74
|
admins: data.admins,
|
52
75
|
resources: data.resources,
|
@@ -164,17 +187,11 @@ module.exports = React.createClass({
|
|
164
187
|
<TabbedArea defaultActiveKey="overview">
|
165
188
|
{tabs}
|
166
189
|
</TabbedArea>
|
190
|
+
<hr />
|
191
|
+
<RoleGraph height="400"
|
192
|
+
kind="layer"
|
193
|
+
id={this.state.id} />
|
167
194
|
</div>
|
168
195
|
);
|
169
|
-
},
|
170
|
-
|
171
|
-
componentDidMount() {
|
172
|
-
var actions = this.getFlux().actions,
|
173
|
-
id = unescape(this.getParams().id);
|
174
|
-
|
175
|
-
actions.audit.loadForRole('layer', id);
|
176
|
-
actions.audit.loadForResource('layer', id);
|
177
|
-
actions.layer.load(id);
|
178
|
-
actions.resources.loadOne('layer', id);
|
179
196
|
}
|
180
197
|
});
|
@@ -4,7 +4,6 @@ var React = require('react'),
|
|
4
4
|
Fluxxor = require('fluxxor'),
|
5
5
|
FluxMixin = Fluxxor.FluxMixin(React),
|
6
6
|
StoreWatchMixin = Fluxxor.StoreWatchMixin,
|
7
|
-
Router = require('react-router'),
|
8
7
|
compact = require('lodash/array/compact');
|
9
8
|
|
10
9
|
var TabbedArea = require('react-bootstrap/lib/TabbedArea'),
|
@@ -17,17 +16,35 @@ var TabMixin = require('../generic/tab_mixin'),
|
|
17
16
|
module.exports = React.createClass({
|
18
17
|
displayName: 'PolicyView',
|
19
18
|
|
20
|
-
mixins: [FluxMixin, StoreWatchMixin('policy'
|
19
|
+
mixins: [FluxMixin, StoreWatchMixin('policy', 'route'), TabMixin],
|
20
|
+
|
21
|
+
askForNewData(state) {
|
22
|
+
var actions = this.getFlux().actions;
|
23
|
+
|
24
|
+
actions.policy.load(state.id);
|
25
|
+
actions.resources.loadOne('policy', state.id);
|
26
|
+
},
|
27
|
+
|
28
|
+
componentDidMount() {
|
29
|
+
this.askForNewData(this.state);
|
30
|
+
},
|
31
|
+
|
32
|
+
componentWillUpdate(nextProps, nextState) {
|
33
|
+
if (this.state.id !== nextState.id) {
|
34
|
+
this.askForNewData(nextState);
|
35
|
+
}
|
36
|
+
|
37
|
+
return true;
|
38
|
+
},
|
21
39
|
|
22
40
|
getStateFromFlux() {
|
23
41
|
var flux = this.getFlux(),
|
42
|
+
id = flux.store('route').getParam('id'),
|
24
43
|
data = flux.store('policy').getData(),
|
25
|
-
resource = flux.store('resources').getResource(
|
26
|
-
'policy',
|
27
|
-
unescape(this.getParams().id)
|
28
|
-
);
|
44
|
+
resource = flux.store('resources').getResource('policy', id);
|
29
45
|
|
30
46
|
var ret = {
|
47
|
+
id: id,
|
31
48
|
loading: data.loading,
|
32
49
|
resource: resource.data,
|
33
50
|
owner: resource.data.owner,
|
@@ -86,13 +103,5 @@ module.exports = React.createClass({
|
|
86
103
|
</TabbedArea>
|
87
104
|
</div>
|
88
105
|
);
|
89
|
-
},
|
90
|
-
|
91
|
-
componentDidMount() {
|
92
|
-
var actions = this.getFlux().actions,
|
93
|
-
id = unescape(this.getParams().id);
|
94
|
-
|
95
|
-
actions.policy.load(id);
|
96
|
-
actions.resources.loadOne('policy', id);
|
97
106
|
}
|
98
107
|
});
|
@@ -15,15 +15,33 @@ var SearchGroup = require('./group'),
|
|
15
15
|
module.exports = React.createClass({
|
16
16
|
displayName: 'Search',
|
17
17
|
|
18
|
-
mixins: [FluxMixin, StoreWatchMixin('search'), Router.State],
|
18
|
+
mixins: [FluxMixin, StoreWatchMixin('search', 'route'), Router.State],
|
19
|
+
|
20
|
+
askForNewData(state) {
|
21
|
+
this.getFlux().actions.search(state.query);
|
22
|
+
},
|
23
|
+
|
24
|
+
componentDidMount() {
|
25
|
+
this.askForNewData(this.state);
|
26
|
+
},
|
27
|
+
|
28
|
+
componentWillUpdate(nextProps, nextState) {
|
29
|
+
if (this.state.query !== nextState.query) {
|
30
|
+
this.askForNewData(nextState);
|
31
|
+
}
|
32
|
+
|
33
|
+
return true;
|
34
|
+
},
|
19
35
|
|
20
36
|
getStateFromFlux() {
|
21
|
-
var
|
37
|
+
var flux = this.getFlux(),
|
38
|
+
data = flux.store('search').getData(),
|
39
|
+
query = flux.store('route').getParam('query');
|
22
40
|
|
23
41
|
return {
|
24
42
|
loading: data.loading.results,
|
25
43
|
results: data.results,
|
26
|
-
query:
|
44
|
+
query: query
|
27
45
|
};
|
28
46
|
},
|
29
47
|
|
@@ -95,9 +113,5 @@ module.exports = React.createClass({
|
|
95
113
|
</div>
|
96
114
|
</div>
|
97
115
|
);
|
98
|
-
},
|
99
|
-
|
100
|
-
componentDidMount() {
|
101
|
-
this.getFlux().actions.search(unescape(this.getParams().query));
|
102
116
|
}
|
103
117
|
});
|
@@ -75,17 +75,38 @@ module.exports = React.createClass({
|
|
75
75
|
|
76
76
|
return null;
|
77
77
|
},
|
78
|
+
|
79
|
+
getInitialState() {
|
80
|
+
return {showActivity: false};
|
81
|
+
},
|
82
|
+
|
83
|
+
toggleActivity(e) {
|
84
|
+
e.preventDefault();
|
85
|
+
|
86
|
+
this.setState({showActivity: !this.state.showActivity});
|
87
|
+
},
|
88
|
+
|
78
89
|
|
79
90
|
render() {
|
80
91
|
var data = this.getData(this.props.audit);
|
92
|
+
var activity_body = [];
|
93
|
+
|
94
|
+
var msg = this.state.showActivity ? 'Hide' : 'Show graph';
|
95
|
+
|
96
|
+
if (this.state.showActivity) {
|
97
|
+
activity_body.push(
|
98
|
+
<div className="b-user-activity__graph">
|
99
|
+
<Chart options={this.props.options}
|
100
|
+
data={data} />
|
101
|
+
</div>
|
102
|
+
);
|
103
|
+
}
|
81
104
|
|
82
105
|
return (
|
83
106
|
<div className="b-user-activity">
|
84
107
|
<h2>Activity<Refresh show={this.props.isLoading} /></h2>
|
85
|
-
<
|
86
|
-
|
87
|
-
data={data} />
|
88
|
-
</div>
|
108
|
+
<a href="#" onClick={this.toggleActivity}>{msg}</a>
|
109
|
+
{activity_body}
|
89
110
|
</div>
|
90
111
|
);
|
91
112
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
var React = require('react'),
|
4
|
-
Router = require('react-router'),
|
5
4
|
Fluxxor = require('fluxxor'),
|
6
5
|
FluxMixin = Fluxxor.FluxMixin(React),
|
7
6
|
StoreWatchMixin = Fluxxor.StoreWatchMixin,
|
@@ -16,6 +15,7 @@ var TabMixin = require('../generic/tab_mixin'),
|
|
16
15
|
Annotations = require('../generic/annotations'),
|
17
16
|
FoldableAuditSection = require('../generic/foldable_audit_section'),
|
18
17
|
Refresh = require('../refresh/refresh'),
|
18
|
+
RoleGraph = require('../graph/graph'),
|
19
19
|
utils = require('../../utils');
|
20
20
|
|
21
21
|
var PubkeysTabContent = require('./pubkeys').PubkeysTabContent,
|
@@ -23,22 +23,45 @@ var PubkeysTabContent = require('./pubkeys').PubkeysTabContent,
|
|
23
23
|
Activity = require('./activity');
|
24
24
|
|
25
25
|
module.exports = React.createClass({
|
26
|
-
mixins: [FluxMixin, StoreWatchMixin('audit', 'user', 'resources'
|
26
|
+
mixins: [FluxMixin, StoreWatchMixin('audit', 'user', 'resources', 'route'), TabMixin],
|
27
|
+
|
28
|
+
askForNewData(state) {
|
29
|
+
var actions = this.getFlux().actions;
|
30
|
+
|
31
|
+
actions.audit.loadForRole('user', state.id);
|
32
|
+
actions.audit.loadForResource('user', state.id);
|
33
|
+
actions.user.load(state.id);
|
34
|
+
actions.resources.loadOne('user', state.id);
|
35
|
+
},
|
36
|
+
|
37
|
+
componentDidMount() {
|
38
|
+
this.askForNewData(this.state);
|
39
|
+
},
|
40
|
+
|
41
|
+
componentWillUpdate(nextProps, nextState) {
|
42
|
+
if (this.state.id !== nextState.id) {
|
43
|
+
this.askForNewData(nextState);
|
44
|
+
}
|
45
|
+
|
46
|
+
return true;
|
47
|
+
},
|
27
48
|
|
28
49
|
getStateFromFlux() {
|
29
50
|
var flux = this.getFlux(),
|
30
|
-
id =
|
51
|
+
id = flux.store('route').getParam('id'),
|
31
52
|
audit = flux.store('audit').getEventFor('user', id),
|
32
53
|
data = flux.store('user').getData(),
|
33
54
|
resource = flux.store('resources').getResource('user', id);
|
34
55
|
|
35
56
|
var ret = {
|
57
|
+
id: id,
|
36
58
|
loading: data.loading,
|
37
59
|
user: data.user,
|
38
60
|
owned: data.owned,
|
39
61
|
roles: data.roles,
|
40
62
|
owner: resource.data.owner,
|
41
63
|
annotations: resource.data.annotations,
|
64
|
+
resource: resource.data,
|
42
65
|
pubkeys: data.pubkeys,
|
43
66
|
audit: audit.data,
|
44
67
|
resources: data.resources
|
@@ -104,20 +127,14 @@ module.exports = React.createClass({
|
|
104
127
|
{tabs}
|
105
128
|
</TabbedArea>
|
106
129
|
<hr />
|
130
|
+
<RoleGraph height="400"
|
131
|
+
kind="user"
|
132
|
+
id={this.state.id} />
|
133
|
+
<hr />
|
107
134
|
<AuditTable events={this.state.audit}
|
108
135
|
caption="Recent Activity"
|
109
136
|
isLoading={this.state.loading.audit} />
|
110
137
|
</div>
|
111
138
|
);
|
112
|
-
},
|
113
|
-
|
114
|
-
componentDidMount() {
|
115
|
-
var actions = this.getFlux().actions,
|
116
|
-
id = unescape(this.getParams().id);
|
117
|
-
|
118
|
-
actions.audit.loadForRole('user', id);
|
119
|
-
actions.audit.loadForResource('user', id);
|
120
|
-
actions.user.load(id);
|
121
|
-
actions.resources.loadOne('user', id);
|
122
139
|
}
|
123
140
|
});
|
@@ -66,17 +66,38 @@ module.exports = React.createClass({
|
|
66
66
|
|
67
67
|
return null;
|
68
68
|
},
|
69
|
+
|
70
|
+
getInitialState() {
|
71
|
+
return {showActivity: false};
|
72
|
+
},
|
73
|
+
|
74
|
+
toggleActivity(e) {
|
75
|
+
e.preventDefault();
|
76
|
+
|
77
|
+
this.setState({showActivity: !this.state.showActivity});
|
78
|
+
},
|
79
|
+
|
69
80
|
|
70
81
|
render() {
|
71
82
|
var data = this.getData(this.props.audit);
|
83
|
+
var activity_body = [];
|
84
|
+
|
85
|
+
var msg = this.state.showActivity ? 'Hide' : 'Show graph';
|
86
|
+
|
87
|
+
if (this.state.showActivity) {
|
88
|
+
activity_body.push(
|
89
|
+
<div className="b-variable-activity__graph">
|
90
|
+
<Chart options={this.props.options}
|
91
|
+
data={data} />
|
92
|
+
</div>
|
93
|
+
);
|
94
|
+
}
|
72
95
|
|
73
96
|
return (
|
74
97
|
<div className="b-variable-activity">
|
75
98
|
<h2>Activity<Refresh show={this.props.isLoading} /></h2>
|
76
|
-
<
|
77
|
-
|
78
|
-
data={data} />
|
79
|
-
</div>
|
99
|
+
<a href="#" onClick={this.toggleActivity}>{msg}</a>
|
100
|
+
{activity_body}
|
80
101
|
</div>
|
81
102
|
);
|
82
103
|
}
|
@@ -51,7 +51,7 @@ module.exports = React.createClass({
|
|
51
51
|
var items = this.getItems(),
|
52
52
|
msg = this.state.showAll ? 'Show top 5' : 'See all',
|
53
53
|
empty = items.length === 0,
|
54
|
-
lessThan5 = items.length
|
54
|
+
lessThan5 = items.length <= 5,
|
55
55
|
body = [(<h2>Fetchers<Refresh show={this.props.isLoading} /></h2>)];
|
56
56
|
|
57
57
|
if (!empty) {
|
@@ -51,7 +51,7 @@ module.exports = React.createClass({
|
|
51
51
|
var items = this.getItems(),
|
52
52
|
msg = this.state.showAll ? 'Show top 5' : 'See all',
|
53
53
|
empty = items.length === 0,
|
54
|
-
lessThan5 = items.length
|
54
|
+
lessThan5 = items.length <= 5,
|
55
55
|
body = [(<h2>Updaters<Refresh show={this.props.isLoading} /></h2>)];
|
56
56
|
|
57
57
|
if (!empty) {
|
@@ -3,8 +3,7 @@
|
|
3
3
|
var React = require('react'),
|
4
4
|
Fluxxor = require('fluxxor'),
|
5
5
|
FluxMixin = Fluxxor.FluxMixin(React),
|
6
|
-
StoreWatchMixin = Fluxxor.StoreWatchMixin
|
7
|
-
Router = require('react-router');
|
6
|
+
StoreWatchMixin = Fluxxor.StoreWatchMixin;
|
8
7
|
|
9
8
|
var AuditTable = require('../audit/table'),
|
10
9
|
Annotations = require('../generic/annotations'),
|
@@ -20,16 +19,37 @@ var Activity = require('./activity'),
|
|
20
19
|
module.exports = React.createClass({
|
21
20
|
displayName: 'VariableView',
|
22
21
|
|
23
|
-
mixins: [FluxMixin, StoreWatchMixin('audit', 'variable', 'resources'
|
22
|
+
mixins: [FluxMixin, StoreWatchMixin('audit', 'variable', 'resources', 'route')],
|
23
|
+
|
24
|
+
askForNewData(state) {
|
25
|
+
var actions = this.getFlux().actions;
|
26
|
+
|
27
|
+
actions.audit.loadForResource('variable', state.id);
|
28
|
+
actions.variable.load(state.id);
|
29
|
+
actions.resources.loadOne('variable', state.id);
|
30
|
+
},
|
31
|
+
|
32
|
+
componentDidMount() {
|
33
|
+
this.askForNewData(this.state);
|
34
|
+
},
|
35
|
+
|
36
|
+
componentWillUpdate(nextProps, nextState) {
|
37
|
+
if (this.state.id !== nextState.id) {
|
38
|
+
this.askForNewData(nextState);
|
39
|
+
}
|
40
|
+
|
41
|
+
return true;
|
42
|
+
},
|
24
43
|
|
25
44
|
getStateFromFlux() {
|
26
45
|
var flux = this.getFlux(),
|
27
|
-
id =
|
46
|
+
id = flux.store('route').getParam('id'),
|
28
47
|
audit = flux.store('audit').getEventFor('variable', id),
|
29
48
|
data = flux.store('variable').getData(),
|
30
49
|
resource = flux.store('resources').getResource('variable', id);
|
31
50
|
|
32
51
|
var ret = {
|
52
|
+
id: id,
|
33
53
|
loading: data.loading,
|
34
54
|
variable: data.variable,
|
35
55
|
owner: resource.data.owner,
|
@@ -92,14 +112,5 @@ module.exports = React.createClass({
|
|
92
112
|
isLoading={this.state.loading.audit} />
|
93
113
|
</div>
|
94
114
|
);
|
95
|
-
},
|
96
|
-
|
97
|
-
componentDidMount() {
|
98
|
-
var actions = this.getFlux().actions,
|
99
|
-
id = unescape(this.getParams().id);
|
100
|
-
|
101
|
-
actions.audit.loadForResource('variable', id);
|
102
|
-
actions.variable.load(id);
|
103
|
-
actions.resources.loadOne('variable', id);
|
104
115
|
}
|
105
116
|
});
|
data/app/src/constants.js
CHANGED
@@ -7,9 +7,10 @@ var constants = {
|
|
7
7
|
}
|
8
8
|
};
|
9
9
|
|
10
|
-
function
|
10
|
+
function addExtraConsts(prefix) {
|
11
11
|
constants[prefix] = {};
|
12
12
|
|
13
|
+
constants[prefix].ASSET_TYPE = prefix.toLowerCase();
|
13
14
|
constants[prefix].LOAD = prefix + '_LOAD';
|
14
15
|
constants[prefix].LOAD_SUCCESS = prefix + '_LOAD_SUCCESS';
|
15
16
|
constants[prefix].LOAD_FAIL = prefix + '_LOAD_FAIL';
|
@@ -21,6 +22,7 @@ function addLoadConsts(prefix) {
|
|
21
22
|
'SEARCH',
|
22
23
|
'RESOURCES',
|
23
24
|
'RESOURCE',
|
25
|
+
'GRAPH',
|
24
26
|
// ---------------
|
25
27
|
'USER',
|
26
28
|
'GROUP',
|
@@ -29,7 +31,7 @@ function addLoadConsts(prefix) {
|
|
29
31
|
'VARIABLE',
|
30
32
|
'POLICY'
|
31
33
|
].forEach((prefix) => {
|
32
|
-
|
34
|
+
addExtraConsts(prefix);
|
33
35
|
});
|
34
36
|
|
35
37
|
module.exports = constants;
|