Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mainly Layout and disabling authenticate. #441

Merged
merged 1 commit into from
May 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ open System.IO
open System.Runtime.Serialization.Json

module FileIO =
let assertDirectory f (path:string) =
let dir = IO.Path.GetDirectoryName(path)
if not <| IO.Directory.Exists(dir)
then IO.Directory.CreateDirectory(dir) |> ignore
f path
let mutable Exists = IO.File.Exists
let mutable OpenRead = fun (path:string) -> IO.File.OpenRead(path) :> IO.Stream
let mutable Create = fun (path:string) -> IO.File.Create(path) :> IO.Stream
let mutable Create = assertDirectory (fun path -> IO.File.Create(path) :> IO.Stream)

module Provider =
let mutable dataFolder = ""
Expand Down
2 changes: 1 addition & 1 deletion src/deploy.web/Fake.Deploy.Web/AgentProxy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type AgentProxy(dataProvider : IDataProvider) as this =
match getAgent agentId with
| None -> failwith (sprintf "Agent %s not found!" agentId)
| Some agent ->
authenticate agent
//authenticate agent
let url = sprintf "%Afake/%s" (agent.Address) urlPart
let wc = new WebClient()
wc.Headers.Add("AuthToken", authToken.ToString())
Expand Down
3 changes: 2 additions & 1 deletion src/deploy.web/Fake.Deploy.Web/Bootstrapper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type Bootstrapper() =
let m = UserMapper()
container.Register<IUserMapper, UserMapper>(m) |> ignore
container.Register<UserMapper, UserMapper>(m) |> ignore
container.Register<AgentProxy, AgentProxy>().AsSingleton() |> ignore
let c = new Configuration()
Data.start c
container.Register<Configuration>(c) |> ignore
Expand All @@ -24,6 +23,8 @@ type Bootstrapper() =
let fm (x: TinyIoc.TinyIoCContainer) (y : TinyIoc.NamedParameterOverloads) = c.Membership
container.Register<IMembershipProvider>(fm) |> ignore

container.Register<AgentProxy, AgentProxy>().AsSingleton() |> ignore


override this.ApplicationStartup (container, pipelines) =
//StaticConfiguration.Caching.EnableRuntimeViewUpdates <- true
Expand Down
61 changes: 33 additions & 28 deletions src/deploy.web/Fake.Deploy.Web/Views/_layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<meta name="author" content="">

<!-- Le styles -->
<link href="@Url.Content("~/content/bootstrap.css")" rel="stylesheet">
<link href="@Url.Content("~/content/bootstrap.min.css")" rel="stylesheet">
<link href="@Url.Content("~/content/bootstrap-theme.min.css")" rel="stylesheet">
<link href="@Url.Content("~/content/jquery.fileupload-ui.css")" rel="stylesheet">
<link href="@Url.Content("~/content/toastr.css")" rel="stylesheet">
<style type="text/css">
Expand Down Expand Up @@ -65,11 +66,11 @@
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="/favicon.ico">
<script src="@Url.Content("~/Scripts/jquery-2.1.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-2.1.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.serializeToJson.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/bootstrap.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/toastr.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/knockout-2.2.1.debug.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/knockout-3.1.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/knockout.mapping-latest.debug.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/extensions.js")" type="text/javascript"></script>
@RenderSection("header", false)
Expand All @@ -81,38 +82,42 @@
@if (RenderContext.Context.CurrentUser != null) // (RenderContext.Context.CurrentUser.IsAuthenticated())
{
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="#">Fake Deploy Web</a>
<ul class="nav">
<li class="active divider-vertical"><a href="/">Home</a></li>
@if (Fake.Deploy.Web.Extensions.IsInRole(RenderContext.Context.CurrentUser, "Administrator"))
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Administration<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/admin/environment">Environments</a></li>
<li><a href="/admin/agent">Agents</a></li>
<li><a href="/admin/users">Users</a></li>
</ul>
</li>
}
</ul>
@Html.Partial("_LoginPartial")
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Fake Deploy Web</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active divider"><a href="/">Home</a></li>
@if (Fake.Deploy.Web.Extensions.IsInRole(RenderContext.Context.CurrentUser, "Administrator"))
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Administration<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/admin/environment">Environments</a></li>
<li><a href="/admin/agent">Agents</a></li>
<li><a href="/admin/users">Users</a></li>
</ul>
</li>
}
</ul>

<ul class="nav navbar-nav navbar-right">
@Html.Partial("_LoginPartial")
</ul>
</div>
</div>
</div>
}


<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
@RenderBody()
</div>
<div class="row col-md-10 col-md-offset-1">
@RenderBody()
</div>
</div>
<div class="push"></div>
</div>
@if (RenderContext.Context.CurrentUser != null) // (RenderContext.Context.CurrentUser.IsAuthenticated())
{
Expand Down
31 changes: 12 additions & 19 deletions src/deploy.web/Fake.Deploy.Web/Views/admin/agent.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,35 @@
}

<div class="page-header">
<h1>Manage agents</h1>
<h2>Manage agents</h2>
</div>

<div class="row" style="margin-left: 30px">
<div class="span6">
<div>
<div class="col-md-6">
<form class="form-horizontal" data-bind="submit: $root.registerAgent">
<fieldset>
<legend>Create Agent</legend>
<div class="control-group">
<div class="form-group">
<label class="control-label" for="environmentId">Environment</label>
<div class="controls">
<select id="environmentId" name="environmentId" data-bind="options: environments, optionsText: 'name', optionsValue: 'id', optionsCaption: 'Choose...'">
<select id="environmentId" name="environmentId" class="form-control" data-bind="options: environments, optionsText: 'name', optionsValue: 'id', optionsCaption: 'Choose...'">
</select>
</div>
</div>
<div class="control-group">
<div class="form-group">
<label class="control-label" for="agentName">Agent Name</label>
<div class="controls">
<input type="text" id="agentName" name="name" placeholder="Enter agent name...">
</div>

<input type="text" class="form-control" id="agentName" name="name" placeholder="Enter agent name...">
</div>
<div class="control-group">
<div class="form-group">
<label class="control-label" for="agentUrl">Agent Url</label>
<div class="controls">
<input type="text" id="agentUrl" name="address" placeholder="Enter agent base url...">
</div>
<input type="text" class="form-control" id="agentUrl" name="address" placeholder="Enter agent base url...">
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
</div>

<div class="span6">
<div class="col-md-6">
<table class="table table-bordered">
<thead>
<tr>
Expand All @@ -65,7 +58,7 @@
<td data-bind="text: address"></td>
<td>
<button class="btn btn-danger" data-bind="click: $root.deleteAgent">
<i class="icon-trash icon-white"></i>&nbsp;Delete
<i class="glyphicon-trash"></i>&nbsp;Delete
</button>
</td>
</tr>
Expand Down
26 changes: 10 additions & 16 deletions src/deploy.web/Fake.Deploy.Web/Views/admin/environment.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,27 @@

<h2>Manage environments</h2>

<div class="row" style="margin-left: 30px">
<div class="span6">
<div>
<div class="col-md-6">
<form class="form-horizontal" data-bind="submit: $root.saveEnvironment">
<fieldset>
<legend>Create Environment</legend>

<div class="control-group">
<div class="form-group">
<label class="control-label" for="Name">Environment Name</label>
<div class="controls">
<input type="text" id="Name" name="Name" placeholder="Enter environment name...">
</div>
<input type="text" id="Name" class="form-control" name="Name" placeholder="Enter environment name...">
</div>
<div class="control-group">
<div class="form-group">
<label class="control-label" for="Description">Environment Description</label>
<div class="controls">
<input type="text" id="Description" name="Description" placeholder="Environment Description...">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
<input type="text" class="form-control" id="Description" name="Description" placeholder="Environment Description...">
</div>
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</fieldset>
</form>
</div>

<div class="span6">
<div class="col-md-6">
<table class="table table-bordered">
<thead>
<tr>
Expand All @@ -57,7 +51,7 @@
<td data-bind="text: description"></td>
<td>
<button class="btn btn-danger" data-bind="click: $root.deleteEnvironment">
<i class="icon-trash icon-white"></i>&nbsp;Delete
<i class="glyphicon glyphicon-trash"></i>&nbsp;Delete
</button>
</td>
</tr>
Expand Down
52 changes: 21 additions & 31 deletions src/deploy.web/Fake.Deploy.Web/Views/admin/users.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,38 @@

<h2>Manage Users</h2>

<div class="row" style="margin-left: 30px">
<div class="span6">
<div>
<div class="col-md-6">
<form class="form-horizontal" data-bind="submit: $root.registerUser">
<fieldset>
<legend>Create User</legend>
</fieldset>
<div class="control-group">
<div class="form-group">
<label class="control-label">Username</label>
<div class="controls">
<input type="text" id="UserName" name="UserName"/>
</div>
<input type="text" class="form-control" id="Username" name="Username" />
</div>

<div class="control-group">
<div class="form-group">
<label class="control-label">E-mail</label>
<div class="controls">
<input type="text" id="Email" name="Email"/>
</div>
<input type="text" class="form-control" id="Email" name="Email" />
</div>

<div class="control-group">
<div class="form-group">
<label class="control-label">Password</label>
<div class="controls">
<input type="password" id="Password" name="Password"/>
</div>
<input type="password" class="form-control" id="Password" name="Password" />
</div>

<div class="control-group">
<div class="form-group">
<label class="control-label">Confirm Password</label>
<div class="controls">
<input type="password" id="ConfirmPassword" name="ConfirmPassword"/>
</div>
<input type="password" class="form-control" id="ConfirmPassword" name="ConfirmPassword" />
</div>

<div class="form-actions">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</div>

<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>

</form>
</div>
<div class="span6">
<div class="col-md-6">
<table class="table table-bordered">
<thead>
<tr>
Expand All @@ -67,13 +57,13 @@
</tr>
</thead>
<tbody data-bind="foreach: users">
<tr>
<td data-bind="text: username"></td>
<td data-bind="text: email"></td>
<td data-bind="if: $root.users().length > 1">
<button data-bind="click: $root.deleteUser" class="btn btn-danger" style="margin-left: 10px"><i class="icon-trash icon-white"></i>&nbsp;Delete User</button>
</td>
</tr>
<tr>
<td data-bind="text: username"></td>
<td data-bind="text: email"></td>
<td data-bind="if: $root.users().length > 1">
<button data-bind="click: $root.deleteUser" class="btn btn-danger" style="margin-left: 10px"><i class="glyphicon glyphicon-trash"></i>&nbsp;Delete User</button>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
Loading