Skip to content

Commit

Permalink
Merge pull request #48 from can-anierzad/bug/ui-and-whitelist-bugs
Browse files Browse the repository at this point in the history
UI tidy and whitelist fix
  • Loading branch information
StevenFisherCantarus authored Feb 12, 2019
2 parents 06b8e16 + 7e11fa8 commit 475e568
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 148 deletions.
29 changes: 2 additions & 27 deletions PolyDeploy/Clients/Manage/src/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,9 @@

#cantarus-poly-deploy {

#menu {

ul {
list-style: none;
margin: 0;
padding: 0;

li {
list-style: inherit;
margin: 0;
padding: 0;
}
}
}

.form-group {
&.form-group-middle {
label {
text-align: right;
}
}
}

.controls {
margin-top: 10px;

@media screen and (max-width: 767px) {
margin-top: 0;
&.form-group-last {
margin-bottom: 0;
}
}

Expand Down
6 changes: 1 addition & 5 deletions PolyDeploy/Clients/Manage/src/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
function ($stateProvider, $urlRouterProvider, $httpProvider) {

// Default route.
$urlRouterProvider.otherwise('/');
$urlRouterProvider.otherwise('/events');

// States.
$stateProvider
.state('menu', {
template: require('./templates/menu.html')
})
.state('menu.welcome', {
url: '/',
template: require('./templates/welcome.html')
})
.state('menu.users', {
url: '/users',
template: require('./templates/users.html'),
Expand Down
13 changes: 4 additions & 9 deletions PolyDeploy/Clients/Manage/src/js/templates/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@

<!-- Menu -->
<div class="col-sm-2">
<div class="panel panel-default">
<div class="panel-body">
<ul>
<li><a ui-sref="menu.welcome">Welcome</a></li>
<li><a ui-sref="menu.users">API Users</a></li>
<li><a ui-sref="menu.whitelist">IP Whitelist</a></li>
<li><a ui-sref="menu.events">Event Log</a></li>
</ul>
</div>
<div class="list-group">
<a class="list-group-item" ui-sref-active="active" ui-sref="menu.events">Event Log</a>
<a class="list-group-item" ui-sref-active="active" ui-sref="menu.users">API Users</a>
<a class="list-group-item" ui-sref-active="active" ui-sref="menu.whitelist">IP Whitelist</a>
</div>
</div>
<!-- /Menu -->
Expand Down
3 changes: 2 additions & 1 deletion PolyDeploy/Clients/Manage/src/js/templates/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ <h3 class="panel-title">New API User</h3>
<input type="checkbox" ng-model="newUser.bypassIPWhitelist" />
</div>
</div>
<div class="form-group">
<div class="form-group form-group-last">
<div class="col-sm-offset-3 col-sm-9">
<button type="button" class="btn btn-success" ng-click="createUser(newUser)">Create</button>
</div>
</div>
</div>

<div class="clearfix"></div>
</div>
</div>
Expand Down
14 changes: 10 additions & 4 deletions PolyDeploy/Clients/Manage/src/js/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

<div class="row">
<div class="col-xs-12">
<h2>Welcome</h2>
<p>
This is the PolyDeply management utility.
</p>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Welcome</h3>
</div>
<div class="panel-body">
<p>
This is the PolyDeply management utility.
</p>
</div>
</div>
</div>
</div>

Expand Down
98 changes: 0 additions & 98 deletions PolyDeploy/Clients/Manage/src/js/templates/whitelist.html

This file was deleted.

14 changes: 13 additions & 1 deletion PolyDeploy/Components/WebAPI/ActionFilters/InWhitelist.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cantarus.Modules.PolyDeploy.Components.DataAccess.Models;
using Cantarus.Modules.PolyDeploy.Components.Exceptions;
using Cantarus.Modules.PolyDeploy.Components.Logging;
using System;
using System.Net;
Expand All @@ -16,7 +17,18 @@ public override void OnActionExecuting(HttpActionContext actionContext)
base.OnActionExecuting(actionContext);

// Get whitelist state.
bool whitelistDisabled = SettingManager.GetSetting("WHITELIST", "STATE").Value.ToLower() == "false";
bool whitelistDisabled;

try
{
// Attempt to retrieve disabled state.
whitelistDisabled = SettingManager.GetSetting("WHITELIST", "STATE").Value.ToLower() == "false";
}
catch (SettingNotFoundException ex)
{
// Setting not set, default to off.
whitelistDisabled = true;
}

// Get api user.
string apiKey = actionContext.Request.GetApiKey();
Expand Down
1 change: 0 additions & 1 deletion PolyDeploy/PolyDeploy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
<Content Include="Clients\Manage\src\js\controllers\UsersController.js" />
<Content Include="Clients\Manage\src\js\services\index.js" />
<Content Include="Clients\Manage\src\js\templates\events.html" />
<Content Include="Clients\Manage\src\js\templates\whitelist.html" />
<Content Include="Clients\Manage\src\js\templates\welcome.html" />
<Content Include="Clients\Manage\src\js\templates\menu.html" />
<Content Include="Clients\Manage\src\js\templates\users.html" />
Expand Down
5 changes: 3 additions & 2 deletions PolyDeploy/SqlDataProviders/00.09.00.SqlDataProvider
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ CREATE PROCEDURE {databaseOwner}[{objectQualifier}Cantarus_PolyDeploy_SpExists]
AS
SELECT CASE WHEN EXISTS (
SELECT *
FROM dbo.sysobjects
WHERE id = object_id(@SpName)
FROM dbo.sysobjects
WHERE id = object_id(@SpName)
AND OBJECTPROPERTY(id, N'IsProcedure') = 1
)
THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT)
Expand Down

0 comments on commit 475e568

Please sign in to comment.