conjur-asset-ui 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/Gemfile +1 -3
- data/README.md +0 -34
- data/Rakefile +1 -69
- data/conjur-asset-ui.gemspec +1 -1
- data/lib/conjur-asset-ui-version.rb +1 -1
- data/lib/conjur/command/ui.rb +1 -1
- data/lib/conjur/webserver/server.rb +8 -14
- data/public/_client_code.html +42 -0
- data/public/_client_libs.html +15 -2
- data/public/css/bootstrap.css +7 -0
- data/public/css/styles.less +4 -170
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/index.html.erb +7 -5
- data/public/js/init.js +97 -183
- data/public/js/lib/JSXTransformer.js +10862 -0
- data/public/js/lib/async.js +958 -0
- data/public/js/lib/backbone.js +2 -0
- data/public/js/lib/bootstrap.js +6 -0
- data/public/js/lib/less.js +16 -0
- data/public/js/lib/moment.js +7768 -0
- data/public/js/lib/react-bootstrap.js +5346 -0
- data/public/js/lib/react-bootstrap.min.js +4 -0
- data/public/js/lib/sorted-set.no-require.js +28 -3
- data/public/js/lib/underscore-min.js +6 -0
- data/public/js/lib/underscore.string.min.js +1 -0
- data/public/js/main.js +57 -0
- data/public/js/models/groupRecord.js +11 -12
- data/public/js/models/hostRecord.js +7 -6
- data/public/js/models/layerRecord.js +11 -12
- data/public/js/models/namespace.js +0 -2
- data/public/js/models/policyList.js +1 -3
- data/public/js/models/policyRecord.js +7 -6
- data/public/js/models/record.js +23 -24
- data/public/js/models/resourceList.js +10 -28
- data/public/js/models/userList.js +2 -7
- data/public/js/models/userRecord.js +8 -7
- data/public/js/models/variableList.js +7 -18
- data/public/js/models/variableRecord.js +12 -13
- data/public/js/routers.js +26 -72
- data/public/js/views/annotations.js +27 -38
- data/public/js/views/audit.js +17 -23
- data/public/js/views/dashboard.js +58 -94
- data/public/js/views/generic.js +9 -16
- data/public/js/views/group.js +55 -94
- data/public/js/views/groups.js +7 -3
- data/public/js/views/host.js +44 -75
- data/public/js/views/hosts.js +6 -2
- data/public/js/views/layer.js +82 -127
- data/public/js/views/layers.js +6 -2
- data/public/js/views/mixins/search.js +5 -12
- data/public/js/views/mixins/tabs.js +55 -95
- data/public/js/views/navSearch.js +5 -16
- data/public/js/views/owned.js +8 -14
- data/public/js/views/permissions.js +178 -244
- data/public/js/views/policies.js +4 -2
- data/public/js/views/policy.js +38 -65
- data/public/js/views/resource.js +34 -49
- data/public/js/views/role.js +37 -52
- data/public/js/views/searchResults.js +138 -205
- data/public/js/views/time.js +13 -26
- data/public/js/views/user.js +55 -178
- data/public/js/views/users.js +7 -2
- data/public/js/views/variable.js +45 -226
- data/public/js/views/variables.js +8 -4
- metadata +19 -18
- data/.jshintrc +0 -41
- data/bower.json +0 -93
- data/features/navigation_bar.feature +0 -31
- data/features/step_definitions/custom_step.rb +0 -32
- data/features/support/env.rb +0 -38
- data/features/support/hooks.rb +0 -30
- data/features/support/world.rb +0 -17
- data/gulpfile.js +0 -140
- data/package.json +0 -47
- data/preprocessor.js +0 -7
- data/public/js/views/chart.js +0 -471
data/public/js/views/policies.js
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React */
|
3
2
|
|
4
3
|
(function(conjur, React) {
|
5
4
|
'use strict';
|
6
5
|
|
7
6
|
var GenericList = conjur.views.GenericList;
|
8
7
|
|
9
|
-
this.PolicyBox = React.createClass({
|
8
|
+
var PolicyBox = this.PolicyBox = React.createClass({
|
9
|
+
/*getInitialState: function() {
|
10
|
+
return { currentNamespace: "", members: [] };
|
11
|
+
},*/
|
10
12
|
render: function() {
|
11
13
|
return (
|
12
14
|
<div className="policyBox">
|
data/public/js/views/policy.js
CHANGED
@@ -1,70 +1,43 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, ReactBootstrap, _ */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
</dl>
|
28
|
-
</TabPane>
|
29
|
-
);
|
30
|
-
|
31
|
-
var permissionsTab = this.permissionsTab(policy.id),
|
32
|
-
membershipsTab = this.membershipsTab(policy.id),
|
33
|
-
annotationsTab = this.annotationsTab(),
|
34
|
-
ownedTab = this.ownedTab();
|
35
|
-
|
36
|
-
var auditTab = (
|
37
|
-
<TabPane key="audit" tab="Recent Activity">
|
3
|
+
var Policy = React.createClass({
|
4
|
+
mixins: [conjur.views.mixins.Tab],
|
5
|
+
render: function() {
|
6
|
+
var policy = this.props.data.policy;
|
7
|
+
var id = policy.id.split(':')[2];
|
8
|
+
|
9
|
+
//TODO: policy loader
|
10
|
+
//TODO in CLI: why not save text of policy as an annotation?
|
11
|
+
var overview_tab =
|
12
|
+
<TabPane key="overview" tab="Overview">
|
13
|
+
<dl className="dl-horizontal">
|
14
|
+
<dt>Owner</dt>
|
15
|
+
<dd><RoleLink id={policy.id}/></dd>
|
16
|
+
</dl>
|
17
|
+
</TabPane>;
|
18
|
+
|
19
|
+
var permissions_tab = this.permissions_tab(policy.id);
|
20
|
+
var memberships_tab = this.memberships_tab(policy.id);
|
21
|
+
var annotations_tab = this.annotations_tab();
|
22
|
+
var owned_tab = this.owned_tab();
|
23
|
+
|
24
|
+
var audit_tab =
|
25
|
+
<TabPane key="audit" tab="Recent Activity">
|
38
26
|
<div className="audit auditGroup">
|
39
27
|
<AuditBox roles={[policy.id]} tabview={true} />
|
40
28
|
</div>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
<TabbedArea defaultActiveKey="overview">
|
57
|
-
{tabs}
|
58
|
-
</TabbedArea>
|
59
|
-
</div>
|
60
|
-
);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
|
64
|
-
}).bind(conjur.views)
|
65
|
-
(
|
66
|
-
conjur,
|
67
|
-
React,
|
68
|
-
ReactBootstrap,
|
69
|
-
_
|
70
|
-
);
|
29
|
+
</TabPane>;
|
30
|
+
var tabs = _.compact( [ overview_tab, owned_tab, memberships_tab, permissions_tab,
|
31
|
+
annotations_tab, audit_tab
|
32
|
+
] );
|
33
|
+
|
34
|
+
return (
|
35
|
+
<div className="policy">
|
36
|
+
<h2>Policy {id}</h2>
|
37
|
+
<TabbedArea defaultActiveKey="overview">
|
38
|
+
{tabs}
|
39
|
+
</TabbedArea>
|
40
|
+
</div>
|
41
|
+
);
|
42
|
+
}
|
43
|
+
});
|
data/public/js/views/resource.js
CHANGED
@@ -1,54 +1,39 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, _ */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
} else {
|
33
|
-
classes.push('abstract');
|
34
|
-
|
35
|
-
if (text === id) {
|
36
|
-
text = [kind, text].join(':'); // prepend kind to id
|
37
|
-
}
|
38
|
-
}
|
39
|
-
} else if (text === id) {
|
40
|
-
text = [kind, text].join(':'); // prepend kind to id
|
3
|
+
/**
|
4
|
+
Renders a link to the resource with id given by this.props.data.
|
5
|
+
|
6
|
+
Includes a slick little icon for the following kinds:
|
7
|
+
TODO which kinds?
|
8
|
+
**/
|
9
|
+
var ResourceLink = React.createClass({
|
10
|
+
render: function(){
|
11
|
+
var resourceId = this.props.id || this.props.data.id || this.props.data;
|
12
|
+
|
13
|
+
var tokens = resourceId.split(':');
|
14
|
+
var kind = tokens[1];
|
15
|
+
var id = tokens[tokens.length - 1];
|
16
|
+
var text = this.props.text || id;
|
17
|
+
|
18
|
+
var known_types=['user','group','layer','host','variable','policy'];
|
19
|
+
var resource_is_known = _.contains(known_types, kind);
|
20
|
+
|
21
|
+
// we shouldn't build links to for unsupported resources
|
22
|
+
var href = "/ui/" + conjur.utils.pluralize(kind) + "/" + encodeURIComponent(id);
|
23
|
+
var classes = [ 'resource-link' ];
|
24
|
+
if( !this.props.noIcon ) {
|
25
|
+
if (resource_is_known) {
|
26
|
+
classes.push(kind);
|
27
|
+
} else {
|
28
|
+
classes.push('abstract');
|
29
|
+
if (text==id) {
|
30
|
+
text=[kind,text].join(":"); // prepend kind to id
|
41
31
|
}
|
42
|
-
|
43
|
-
return (
|
44
|
-
<a className={classes.join(' ')} href={href}>{text}</a>
|
45
|
-
);
|
46
32
|
}
|
47
|
-
})
|
33
|
+
} else if (text==id) {
|
34
|
+
text=[kind,text].join(":"); // prepend kind to id
|
35
|
+
}
|
48
36
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
React,
|
53
|
-
_
|
54
|
-
);
|
37
|
+
return <a className={classes.join(' ')} href={href}>{text}</a>
|
38
|
+
}
|
39
|
+
});
|
data/public/js/views/role.js
CHANGED
@@ -1,56 +1,41 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, _ */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
/** render a link to the role represented by this.props.id
|
4
|
+
Example: <RoleLink id="ci:user:jon"/>
|
5
|
+
*/
|
6
|
+
var RoleLink = React.createClass({
|
7
|
+
render: function() {
|
8
|
+
var tokens = this.props.id.split(":");
|
9
|
+
var kind = tokens[1];
|
10
|
+
var id = tokens[tokens.length-1];
|
11
|
+
if (tokens.length==1) { // just username
|
12
|
+
kind="user";
|
13
|
+
id=tokens[0];
|
14
|
+
}
|
15
|
+
|
16
|
+
// TODO: shouldn't point to unknown types
|
17
|
+
var href = "/ui/" + conjur.utils.pluralize(kind) + "/" + encodeURIComponent(id);
|
18
|
+
var classes = ["role-link"];
|
19
|
+
|
20
|
+
var known_types=['user','group','layer','host','policy'];
|
21
|
+
var kind_is_known = _.contains(known_types, kind);
|
22
|
+
var text = id;
|
23
|
+
|
24
|
+
if( !this.props.noIcon ) {
|
25
|
+
if (kind_is_known) {
|
26
|
+
classes.push(kind);
|
27
|
+
} else {
|
28
|
+
classes.push('abstract'); // we have no picture for abstract role yet
|
29
|
+
if (text==id) {
|
30
|
+
text=[kind,text].join(":"); // prepend kind to id
|
19
31
|
}
|
20
|
-
|
21
|
-
// TODO: shouldn't point to unknown types
|
22
|
-
var href = '/ui/' + conjur.utils.pluralize(kind) + '/' + window.encodeURIComponent(id);
|
23
|
-
|
24
|
-
var classes = ['role-link'],
|
25
|
-
knownTypes = ['user','group','layer','host','policy'],
|
26
|
-
kindIsKnown = _.contains(knownTypes, kind),
|
27
|
-
text = id;
|
28
|
-
|
29
|
-
if (!this.props.noIcon) {
|
30
|
-
if (kindIsKnown) {
|
31
|
-
classes.push(kind);
|
32
|
-
} else {
|
33
|
-
classes.push('abstract'); // we have no picture for abstract role yet
|
34
|
-
|
35
|
-
if (text === id) {
|
36
|
-
text = [kind, text].join(':'); // prepend kind to id
|
37
|
-
}
|
38
|
-
}
|
39
|
-
} else if (text === id) {
|
40
|
-
text = [kind, text].join(':'); // prepend kind to id
|
41
|
-
}
|
42
|
-
|
43
|
-
return (
|
44
|
-
<a className={classes.join(' ')} href={href}>
|
45
|
-
{text}
|
46
|
-
</a>
|
47
|
-
);
|
48
32
|
}
|
49
|
-
})
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
33
|
+
} else if (text==id) {
|
34
|
+
text=[kind,text].join(":"); // prepend kind to id
|
35
|
+
}
|
36
|
+
|
37
|
+
return <a className={classes.join(' ')} href={href}>
|
38
|
+
{text}
|
39
|
+
</a>;
|
40
|
+
}
|
41
|
+
});
|
@@ -1,212 +1,145 @@
|
|
1
1
|
/**@jsx React.DOM*/
|
2
|
-
/* global conjur, React, jQuery, _ */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
var SearchGroupTitle = React.createClass({
|
4
|
+
render: function(){
|
5
|
+
return <span>{this.title()}</span>
|
6
|
+
},
|
7
|
+
|
8
|
+
title: function(){
|
9
|
+
var words = this.props.data.kind.replace(/[-_]/, ' ').split(' ');
|
10
|
+
words[words.length - 1] = conjur.utils.pluralize(words[words.length - 1]);
|
11
|
+
return words.map(_.str.capitalize).join(' ') + ' (' + this.props.data.items.length + ')';
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
var SearchGroupHeading = React.createClass({
|
16
|
+
render: function(){
|
17
|
+
var targetId = "#search-collapse-" + this.props.data.kind;
|
18
|
+
return <div className="panel-heading">
|
19
|
+
<h4 className="panel-title">
|
20
|
+
<a data-toggle="collapse" data-target={targetId}
|
21
|
+
className={'group-heading' + this.props.data.kind}>
|
22
|
+
<SearchGroupTitle data={this.props.data} />
|
23
|
+
</a>
|
24
|
+
</h4>
|
25
|
+
</div>;
|
26
|
+
},
|
27
|
+
|
28
|
+
title: function(){
|
29
|
+
var words = this.props.data.kind.replace(/[-_]/, ' ').split(' ');
|
30
|
+
words[words.length - 1] = conjur.utils.pluralize(words[words.length - 1]);
|
31
|
+
return words.map(_.str.capitalize).join(' ') + ' (' + this.props.data.items.length + ')';
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
var SearchResultItem = React.createClass({
|
36
|
+
render: function(){
|
37
|
+
return <div className="item">
|
38
|
+
<h4> { this.titleLink() } </h4>
|
39
|
+
<div className="details">
|
40
|
+
<strong> ID: </strong> <ResourceLink data={this.props.data.id} noIcon="true"/>
|
41
|
+
<strong> Owner: </strong> <RoleLink id={this.props.data.owner} noIcon="true"/>
|
42
|
+
</div>
|
43
|
+
<div className="comment">
|
44
|
+
{this.commentText()}
|
45
|
+
</div>
|
46
|
+
</div>;
|
47
|
+
},
|
48
|
+
|
49
|
+
commentText: function(){
|
50
|
+
var annots = this.annotationsMap();
|
51
|
+
return annots['description'] || "";
|
52
|
+
},
|
53
|
+
|
54
|
+
titleLink: function(){
|
55
|
+
var annots = this.annotationsMap();
|
56
|
+
return <ResourceLink data={this.props.data.id} text={annots['name']}/>
|
57
|
+
},
|
58
|
+
|
59
|
+
annotationsMap: function(){
|
60
|
+
if(this._annotationsMap) return this._annotationsMap;
|
61
|
+
var map = this._annotationsMap = {};
|
62
|
+
(this.props.data.annotations || []).forEach(function(a){
|
63
|
+
map[a.name] = a.value;
|
27
64
|
});
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
65
|
+
return map;
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
// accepts props like data: { kind:"", items:[] }
|
70
|
+
var SearchGroup = React.createClass({
|
71
|
+
render: function(){
|
72
|
+
var id = "search-group-" + this.props.data.kind;
|
73
|
+
var items = this.props.data.items.map(function(r){
|
74
|
+
return <SearchResultItem data={r}/>
|
75
|
+
})
|
76
|
+
return <div id={id} className="panel panel-default search-group">
|
77
|
+
<SearchGroupHeading data={this.props.data}/>
|
78
|
+
<div id={"search-collapse-" + this.props.data.kind} className="panel-collapse collapse in">
|
79
|
+
<div className="panel-body">
|
80
|
+
{items}
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>;
|
84
|
+
}
|
85
|
+
});
|
86
|
+
|
87
|
+
var SearchResults = React.createClass({
|
88
|
+
render: function() {
|
89
|
+
var results = this.props.data.results;
|
90
|
+
var grouped = _.groupBy(results, function(r){
|
91
|
+
return r.id.split(':')[1];
|
55
92
|
});
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
noIcon="true" />
|
65
|
-
<strong> Owner: </strong> <RoleLink id={this.props.data.owner}
|
66
|
-
noIcon="true" />
|
67
|
-
</div>
|
68
|
-
<div className="comment">
|
69
|
-
{this.commentText()}
|
70
|
-
</div>
|
71
|
-
</div>
|
72
|
-
);
|
73
|
-
},
|
74
|
-
|
75
|
-
commentText: function() {
|
76
|
-
var annots = this.annotationsMap();
|
77
|
-
|
78
|
-
return annots.description || '';
|
79
|
-
},
|
80
|
-
|
81
|
-
titleLink: function(){
|
82
|
-
var annots = this.annotationsMap();
|
83
|
-
|
84
|
-
return (
|
85
|
-
<ResourceLink data={this.props.data.id} text={annots.name} />
|
86
|
-
);
|
87
|
-
},
|
88
|
-
|
89
|
-
annotationsMap: function(){
|
90
|
-
if (this._annotationsMap) {
|
91
|
-
return this._annotationsMap;
|
92
|
-
}
|
93
|
-
|
94
|
-
var map = this._annotationsMap = {};
|
95
|
-
|
96
|
-
(this.props.data.annotations || []).forEach(function(a) {
|
97
|
-
map[a.name] = a.value;
|
98
|
-
});
|
99
|
-
|
100
|
-
return map;
|
101
|
-
}
|
93
|
+
// Don't care about these
|
94
|
+
delete grouped['environment-variables']
|
95
|
+
delete grouped['notification']
|
96
|
+
delete grouped['queue']
|
97
|
+
|
98
|
+
var groups = _.map(grouped,function(items, key){
|
99
|
+
var data = {items:items, kind: key}; // - prevent editor barfing
|
100
|
+
return <SearchGroup data={data}/>
|
102
101
|
});
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
return (
|
116
|
-
<div id={id} className="panel panel-default search-group">
|
117
|
-
<SearchGroupHeading data={this.props.data}/>
|
118
|
-
<div id={'search-collapse-' + this.props.data.kind}
|
119
|
-
className="panel-collapse collapse in">
|
120
|
-
<div className="panel-body">
|
121
|
-
{items}
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
);
|
126
|
-
}
|
102
|
+
var scores = {
|
103
|
+
'policy': 1,
|
104
|
+
'layer': 2,
|
105
|
+
'group': 3,
|
106
|
+
'host': 4,
|
107
|
+
'user': 5,
|
108
|
+
'variable': 6,
|
109
|
+
'key_pair': 7
|
110
|
+
};
|
111
|
+
groups.sort(function(a, b) {
|
112
|
+
return ( scores[a.props.data.kind] || 100 ) - ( scores[b.props.data.kind] || 100 );
|
127
113
|
});
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
var grouped = _.groupBy(results, function(r) {
|
134
|
-
return r.id.split(':')[1];
|
135
|
-
});
|
136
|
-
|
137
|
-
// Don't care about these
|
138
|
-
delete grouped['environment-variables'];
|
139
|
-
delete grouped.notification;
|
140
|
-
delete grouped.queue;
|
141
|
-
|
142
|
-
var groups = _.map(grouped, function(items, key) {
|
143
|
-
var data = {items: items, kind: key}; // - prevent editor barfing
|
144
|
-
return <SearchGroup data={data}/>;
|
145
|
-
});
|
146
|
-
|
147
|
-
var scores = {
|
148
|
-
'policy': 1,
|
149
|
-
'layer': 2,
|
150
|
-
'group': 3,
|
151
|
-
'host': 4,
|
152
|
-
'user': 5,
|
153
|
-
'variable': 6,
|
154
|
-
'key_pair': 7
|
155
|
-
};
|
156
|
-
|
157
|
-
groups.sort(function(a, b) {
|
158
|
-
return (
|
159
|
-
(scores[a.props.data.kind] || 100) -
|
160
|
-
(scores[b.props.data.kind] || 100)
|
161
|
-
);
|
162
|
-
});
|
163
|
-
|
164
|
-
var toc = groups.map(function(g) {
|
165
|
-
var gid = '#search-group-' + g.props.data.kind;
|
166
|
-
|
167
|
-
return (
|
168
|
-
<div className="toc-item">
|
169
|
-
<a href={gid}><SearchGroupTitle data={g.props.data} /></a>
|
170
|
-
</div>
|
171
|
-
);
|
172
|
-
});
|
173
|
-
|
174
|
-
var heading = 'Found ' + this.props.data.results.length +
|
175
|
-
' resources matching "' + this.props.data.search + '"';
|
176
|
-
|
177
|
-
return (
|
178
|
-
<div id="searchResults">
|
179
|
-
<div className="searchResults">
|
180
|
-
<h3> { heading } </h3>
|
181
|
-
<div className="search-results-toc">
|
182
|
-
{toc}
|
183
|
-
</div>
|
184
|
-
<div className="search-results">
|
185
|
-
{groups}
|
186
|
-
</div>
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
);
|
190
|
-
}
|
114
|
+
var toc = groups.map(function(g) {
|
115
|
+
var gid = "#search-group-" + g.props.data.kind;
|
116
|
+
return <div className="toc-item">
|
117
|
+
<a href={gid}><SearchGroupTitle data={g.props.data} /></a>
|
118
|
+
</div>
|
191
119
|
});
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
)
|
120
|
+
var heading = "Found " + this.props.data.results.length +
|
121
|
+
" resources matching \"" + this.props.data.search + "\"";
|
122
|
+
return (
|
123
|
+
<div id="searchResults">
|
124
|
+
<div className="searchResults">
|
125
|
+
<h3> { heading } </h3>
|
126
|
+
<div className="search-results-toc">
|
127
|
+
{toc}
|
128
|
+
</div>
|
129
|
+
<div className="search-results">
|
130
|
+
{groups}
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
);
|
135
|
+
}
|
136
|
+
});
|
137
|
+
|
138
|
+
SearchResults.search = function(search, container){
|
139
|
+
container = container || document.getElementById('content');
|
140
|
+
$.get(conjur.app.endpoints.authz("resources", {search: search.replace('-',' ')}), function(results){
|
141
|
+
|
142
|
+
var data = {search: search, results: results};
|
143
|
+
React.renderComponent(<SearchResults data={data}/>, container);
|
144
|
+
});
|
145
|
+
}
|