Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #111 from Netflix/develop
Browse files Browse the repository at this point in the history
Bump to v0.3.4
  • Loading branch information
Patrick Kelley committed Feb 20, 2015
2 parents e66463f + f6df4b6 commit a35b9be
Show file tree
Hide file tree
Showing 47 changed files with 805 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ part of security_monkey;
@Component(
selector: 'accountview',
templateUrl: 'packages/security_monkey/component/account_view_component/account_view_component.html',
cssUrl: const ['/css/bootstrap.min.css'])
//cssUrl: const ['/css/bootstrap.min.css'],
useShadowDom: false
)
class AccountViewComponent implements ScopeAware {
RouteProvider routeProvider;
Router router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ part of security_monkey;
@Component(
selector: 'ignoreentryview',
templateUrl: 'packages/security_monkey/component/ignore_entry_component/ignore_entry_component.html',
cssUrl: const ['/css/bootstrap.min.css'])
//: const ['/css/bootstrap.min.css'],
useShadowDom: false
)
class IgnoreEntryComponent implements ScopeAware {
RouteProvider routeProvider;
Router router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ part of security_monkey;
@Component(
selector: 'issue-table',
templateUrl: 'packages/security_monkey/component/issue_table_component/issue_table_component.html',
cssUrl: const ['/css/bootstrap.min.css'])
//cssUrl: const ['/css/bootstrap.min.css']
useShadowDom: false
)
class IssueTableComponent extends PaginatedTable implements ScopeAware {
List<Issue> issues = [];
RouteProvider routeProvider;
Expand All @@ -20,7 +22,8 @@ class IssueTableComponent extends PaginatedTable implements ScopeAware {
'active': null,
'searchconfig': null,
'page': '1',
'count': '25'
'count': '25',
'enabledonly': 'true'
};

IssueTableComponent(this.routeProvider, this.router, this.store) {
Expand Down
16 changes: 9 additions & 7 deletions dart/lib/component/itemdetails/itemdetails_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ part of security_monkey;
@Component(
selector: 'itemdetails',
templateUrl: 'packages/security_monkey/component/itemdetails/itemdetails.html',
cssUrl: const ['/css/bootstrap.min.css']
//cssUrl: const ['/css/bootstrap.min.css']
useShadowDom: false
)
class ItemDetailsComponent extends ShadowRootAware implements ScopeAware {
class ItemDetailsComponent implements ScopeAware { // extends ShadowRootAware
JustificationService js;
UsernameService us;

RouteProvider routeProvider;
ShadowRoot shadowRoot;
//ShadowRoot shadowRoot;

Item item;
String rev_id = null;
Expand Down Expand Up @@ -146,9 +147,10 @@ class ItemDetailsComponent extends ShadowRootAware implements ScopeAware {

void _scrollTo(int revid) {
print("Asked to scroll to revision $revid");
var item = shadowRoot.querySelector("#rev_id_$revid");
var item = querySelector("#rev_id_$revid");
item.scrollIntoView(ScrollAlignment.TOP);
//ScrollAlignment.CENTER);
// shadowRoot.querySelector
}

void scrollTo(int revid) {
Expand All @@ -163,9 +165,9 @@ class ItemDetailsComponent extends ShadowRootAware implements ScopeAware {
}
}

void onShadowRoot(ShadowRoot shadowRoot) {
this.shadowRoot = shadowRoot;
}
// void onShadowRoot(ShadowRoot shadowRoot) {
// this.shadowRoot = shadowRoot;
// }

String justification = "";
void justify() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ part of security_monkey;
selector: 'modaljustifyissues',
exportExpressions: const ["is_justifying", "selectedIssues", "classForOKButton", "ok"],
//templateUrl: 'packages/security_monkey/component/modal_justify_issues/modal_justify_issues.html',
cssUrl: const ['/css/bootstrap.min.css']
//useShadowDom: true
//cssUrl: const ['/css/bootstrap.min.css']
useShadowDom: false
)
class ModalJustifyIssues implements ScopeAware {
JustificationService js;
Expand Down
32 changes: 32 additions & 0 deletions dart/lib/component/paginated_table/paginated_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,36 @@ abstract class PaginatedTable implements ScopeAware {
}
}
/// PAGINATION END
/// COLUMN SORTING
String sorting_column = "none";
bool sort_asc = true;

void sort_column(var column) {
if (sorting_column == column) {
sort_asc = !sort_asc;
} else {
sorting_column = column;
sort_asc = true;
}
list();
}

String order_dir() {
if (sort_asc) return "Asc";
return "Desc";
}

String class_for_column(var column) {
if (sorting_column == column) {
if (sort_asc) {
return "glyphicon glyphicon-sort-by-alphabet";
} else {
return "glyphicon glyphicon-sort-by-alphabet-alt";
}
} else {
return "glyphicon glyphicon-sort";
}
}
/// COLUMN SORTING END
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ part of security_monkey;
@Component(
selector: 'revision-table',
templateUrl: 'packages/security_monkey/component/revision_table_component/revision_table_component.html',
cssUrl: const ['/css/bootstrap.min.css'])
//cssUrl: const ['/css/bootstrap.min.css'],
useShadowDom: false
)
class RevisionTableComponent extends PaginatedTable implements DetachAware {
List<Revision> revisions;
RouteProvider routeProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
<h6>Region</h6>
<input type="hidden" id="filterregions"></input>
<input type="hidden"
class="bigdrop select2-offscreen populate placeholder"
multiple="multiple" id="s2_regions" style="width: 100%">
class="bigdrop select2-offscreen populate placeholder full_width"
multiple="multiple" id="s2_regions">
</div>
<div>
<h6>Tech</h6>
<input type="hidden" id="filtertechnologies"></input>
<input type="hidden"
class="bigdrop select2-offscreen populate placeholder"
multiple="multiple" id="s2_technologies" style="width: 100%">
class="bigdrop select2-offscreen populate placeholder full_width"
multiple="multiple" id="s2_technologies">
</div>
<div>
<h6>Account</h6>
<input type="hidden" id="filteraccounts"></input>
<input type="hidden"
class="bigdrop select2-offscreen populate placeholder"
multiple="multiple" id="s2_accounts" style="width: 100%">
class="bigdrop select2-offscreen populate placeholder full_width"
multiple="multiple" id="s2_accounts">
<!-- Foundation -->
</div>
<div>
<h6>Name</h6>
<input type="hidden" id="filternames"></input>
<input type="hidden"
class="bigdrop select2-offscreen populate placeholder"
multiple="multiple" id="s2_names" style="width: 100%">
class="bigdrop select2-offscreen populate placeholder full_width"
multiple="multiple" id="s2_names">
</div>

<hr>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
part of security_monkey;

@Component(
selector: 'auditor-settings-cmp',
templateUrl: 'packages/security_monkey/component/settings/auditor_settings_component/auditor_settings_component.html',
useShadowDom: false
)
class AuditorSettingsComponent extends PaginatedTable {
Router router;
List<AuditorSetting> auditorlist;
ObjectStore store;
final Http _http;

get isLoaded => super.is_loaded;
get isError => super.is_error;

String url_encode(input) => param_to_url(input);

void toggleAuditorEnable(auditor) {
auditor.disabled = !auditor.disabled;
store.update(auditor);
}

AuditorSettingsComponent(this.router, this.store, this._http) {
list();
}

void list() {
super.is_loaded = false;
store.list(AuditorSetting, params: {
"count": ipp_as_int,
"page": currentPage,
"order_by": sorting_column,
"order_dir": order_dir()
}).then((auditor_settings) {
super.setPaginationData(auditor_settings.meta);
this.auditorlist = auditor_settings;
super.is_loaded = true;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<div class="col-lg-12">
<div class="panel panel-info" ng-switch="isLoaded">
<div class="panel-heading">Auditor Settings <span class="badge pull-right">{{ items_displayed() }} of {{ totalItems }}</span></div>
<div class="panel-body" ng-switch-when="false">
<p>Loading . . .</p>
</div>
<div class="panel-body" ng-switch-when="true">
<table class="table table-striped">
<tr>
<th ng-click="sort_column('issue')">Issue
<span ng-class="class_for_column('issue')">
</span>
</th>
<th ng-click="sort_column('account')">Account
<span ng-class="class_for_column('account')">
</span>
</th>
<th ng-click="sort_column('technology')">Technology
<span ng-class="class_for_column('technology')"></span>
</th>
<th ng-click="sort_column('issue_count')">Number of Issues
<span ng-class="class_for_column('issue_count')"></span>
</th>
<th ng-click="sort_column('enabled')">Disabled?
<span ng-class="class_for_column('enabled')"></span>
</th>
<th>Enable/Disable</th>
</tr>
<tr ng-repeat="auditoritem in auditorlist">
<td>{{auditoritem.issue}}</td>
<td>{{auditoritem.account}}</td>
<td>{{auditoritem.technology}}</td>
<td><a href="#/issues/-/{{url_encode(auditoritem.technology)}}/{{url_encode(auditoritem.account)}}/-/True/{{url_encode(auditoritem.issue)}}/1/25">{{auditoritem.count}}</a></td>
<td ng-if="auditoritem.disabled==true"><b>TRUE</b></td>
<td ng-if="auditoritem.disabled==false">false</td>
<td>
<button ng-if="auditoritem.disabled==false" class="btn btn-xs btn-danger" ng-click="toggleAuditorEnable(auditoritem)">Disable</button>
<button ng-if="auditoritem.disabled==true" class="btn btn-xs" ng-click="toggleAuditorEnable(auditoritem)">Enable</button>
</td>
</tr>
</table>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-lg-9">
<pagination
items-per-page="ipp_as_int"
total-items="totalItems"
page="currentPage"
on-select-page="pageChanged()"
max-size="maxSize"
boundary-links="true"

></pagination>
</div>
<div class="col-lg-3 pull-right">
<br/> <!-- Why do I need a br-tag to get the dropdown to line up properly? -->
<select ng-model="items_per_page" class="form-control">
<option
ng-repeat="page in items_per_page_options"
value="{{page}}">{{page}}</option>
</select>
</div>
<div class="clearfix"></div>
</div>
<!-- -->
</div>
</div>
</div>
28 changes: 24 additions & 4 deletions dart/lib/component/settings_component/settings_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ part of security_monkey;
@Component(
selector: 'settings-cmp',
templateUrl: 'packages/security_monkey/component/settings_component/settings_component.html',
cssUrl: const ['/css/bootstrap.min.css'])
//cssUrl: const ['/css/bootstrap.min.css']
useShadowDom: false
)
class SettingsComponent extends PaginatedTable {
Router router;
List<Account> accounts;
List<NetworkWhitelistEntry> cidrs;
List<IgnoreEntry> ignorelist;
List<AuditorSetting> auditorlist;
ObjectStore store;
UserSetting user_setting;

Expand All @@ -21,11 +24,15 @@ class SettingsComponent extends PaginatedTable {
});

store.list(NetworkWhitelistEntry).then( (cidrs) {
this.cidrs = cidrs;
this.cidrs = cidrs;
});

store.list(IgnoreEntry).then( (ignoreItems) {
this.ignorelist = ignoreItems;
this.ignorelist = ignoreItems;
});

store.list(AuditorSetting).then( (auditorItems) {
this.auditorlist = auditorItems;
});
}

Expand Down Expand Up @@ -82,7 +89,9 @@ class SettingsComponent extends PaginatedTable {
method: 'POST',
url: '$API_HOST/settings',
data: user_setting.toJson(),
withCredentials: true)).then((_) {
withCredentials: true,
xsrfCookieName: 'XSRF-COOKIE',
xsrfHeaderName:'X-CSRFToken')).then((_) {
// Poor way to give feedback of success:
super.is_loaded = true;
});
Expand Down Expand Up @@ -116,6 +125,17 @@ class SettingsComponent extends PaginatedTable {
});
}

void disableAuditor(auditor) {
auditor.disabled = true;
store.update(auditor);
}

void enableAuditor(auditor) {
auditor.disabled = false;
store.update(auditor);
}

String url_encode(input) => param_to_url(input);

get isLoaded => super.is_loaded;
get isError => super.is_error;
Expand Down
8 changes: 6 additions & 2 deletions dart/lib/component/settings_component/settings_component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h6>Daily Email</h6>
<div class="col-md-4 text-center">

<button class="btn btn-sm btn-primary"
ng-click="saveNotificationSettings()"">Save</button>
ng-click="saveNotificationSettings()">Save</button>
</div>
<div class="col-md-8">
</div>
Expand All @@ -39,7 +39,7 @@ <h6>Daily Email</h6>
<div class="panel panel-info">
<div class="panel-heading">Accounts <span class="badge pull-right">{{ items_displayed() }} of {{ totalItems }}</span></div>
<div class="panel-body" ng-switch-when="false" ng-switch="isError">
<p ng-switch-when="false"">Loading . . .</p>
<p ng-switch-when="false">Loading . . .</p>
<div ng-switch-when="true" class="alert alert-danger">
{{err_message}}
</div>
Expand Down Expand Up @@ -158,5 +158,9 @@ <h6>Daily Email</h6>
</div>
</div>
</tab>
<tab heading="Auditor Settings">
<br />
<auditor-settings-cmp></auditor-settings-cmp>
</tab>
<!-- USER MANAGEMENT TABS WILL BE ADDED HERE -->
</tabset>
Loading

0 comments on commit a35b9be

Please sign in to comment.