Skip to content

Commit

Permalink
last correction for version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjornej committed Aug 17, 2015
1 parent 93072ee commit e5b2f96
Show file tree
Hide file tree
Showing 13 changed files with 709 additions and 37,620 deletions.
1 change: 1 addition & 0 deletions Database/Database/Database.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<TargetDatabaseSet>True</TargetDatabaseSet>
<DacApplicationName>Bazooka</DacApplicationName>
<GenerateCreateScript>True</GenerateCreateScript>
<DacVersion>0.1.0</DacVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Agent/Controllers/DeployController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public ExecutionResult Uninstall(UninstallDto uninstallOptions)
}
}

[HttpGet]
[HttpPost]
public ExecutionResult ExecuteScript(RemoteScriptDto options)
{
var logger = new StringLogger();
Expand Down
32 changes: 30 additions & 2 deletions Sources/Jobs/DeployJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ private static void RemoteScriptTask(int id, int deploymentId, string version, s
var res = new List<string>();
ExecutionResult ret;

using (var session = Store.OpenSession())
{
session.Save(new DataAccess.Write.LogEntry()
{
DeploymentId = deploymentId,
Error = false,
Text = "Executing remote script " + unit.Name,
TimeStamp = DateTime.UtcNow
});

session.Flush();
}

var address = unit.Machine;

using (var client = new HttpClient())
Expand All @@ -171,7 +184,22 @@ private static void RemoteScriptTask(int id, int deploymentId, string version, s
var result = result2.Result;
var response = result.Content.ReadAsStringAsync().Result;

ret = JsonConvert.DeserializeObject<ExecutionResult>(response);
ret = JsonConvert.DeserializeObject<ExecutionResult>(response);

using (var session = Store.OpenSession())
{

session.Save(new DataAccess.Write.LogEntry()
{
DeploymentId = deploymentId,
Error = false,
Text = String.Join("\r\n", ret.Log.Select(x => x.Text)),
TimeStamp = DateTime.UtcNow
});

session.Flush();
}

}

using (var session = Store.OpenSession())
Expand Down Expand Up @@ -221,7 +249,7 @@ private static void LocalScriptTask(int id, int deploymentId, string version, st
{
DeploymentId = deploymentId,
Error = false,
Text = String.Join("\r\n", logger.Logs),
Text = String.Join("\r\n", logger.Logs.Select(x => x.Text)),
TimeStamp = DateTime.UtcNow
});

Expand Down
4 changes: 2 additions & 2 deletions Sources/Web/App/Enviroments/ActionsCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import reqwest from "reqwest";

module.exports = {
updateAllEnviroments: function() {
reqwest({
return reqwest({
url: "/api/enviroments/",
type: 'json',
contentType: 'application/json',
Expand All @@ -11,7 +11,7 @@ module.exports = {
},

updateEnviroments: function(applicationId) {
reqwest({
return reqwest({
url: "/api/enviroments/" + applicationId,
type: 'json',
contentType: 'application/json',
Expand Down
1 change: 1 addition & 0 deletions Sources/Web/App/Tasks/LocalScriptTask/CreateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var LocalScriptTaskCreateDialog = React.createClass({
create:function(){
if(this.state.Name!="" && this.state.Script!=""){
Actions.createLocalScriptTask(this.state.Name, this.state.Script, this.props.EnviromentId).then(x => {
this.props.onCreate();
this.props.onRequestHide();
})
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Web/App/Tasks/MailTask/CreateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var MailTaskCreateDialog = React.createClass({
if(this.state.Name!="" && this.state.Recipients!="" && this.state.Sender!=""){
Actions.createMailTask(this.state.Name, this.state.Text,this.state.Recipients,this.state.Sender, this.props.EnviromentId).then(x => {
this.props.onRequestHide()
this.props.onTaskCreate();
this.props.onCreate();
})
}
},
Expand Down
1 change: 1 addition & 0 deletions Sources/Web/App/Tasks/RemoteScriptTask/CreateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var RemoteScriptTaskCreateDialog = React.createClass({
create:function(){
if(this.state.Name!="" && this.state.Script!=""&& this.state.Machine!=""&& this.state.Folder!=""){
Actions.createRemoteScriptTask(this.state.Name, this.state.Script,this.state.Machine,this.state.Folder, this.props.EnviromentId).then(x => {
this.props.onCreate();
this.props.onRequestHide();
})
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/Web/App/Tasks/TasksPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ var TaskSelectDialog = React.createClass({
return(
<Modal {...this.props} enforceFocus={false} title="Add new task">
<div className="modal-body">
<ModalTrigger modal={<DeployUnitDialog Enviroment={this.props.EnviromentId} />} >
<ModalTrigger modal={<DeployUnitDialog onCreate={this.props.onCreate} Enviroment={this.props.EnviromentId} />} >
<button type="button" className="btn btn-default btn-lg btn-block">Deploy task</button>
</ModalTrigger>
<ModalTrigger modal={<MailTaskDialog EnviromentId={this.props.EnviromentId} />} >
<ModalTrigger modal={<MailTaskDialog onCreate={this.props.onCreate} EnviromentId={this.props.EnviromentId} />} >
<button type="button" className="btn btn-default btn-lg btn-block">Mail task</button>
</ModalTrigger>
<ModalTrigger modal={<LocalScriptTaskDialog EnviromentId={this.props.EnviromentId} />} >
<ModalTrigger modal={<LocalScriptTaskDialog onCreate={this.props.onCreate} EnviromentId={this.props.EnviromentId} />} >
<button type="button" className="btn btn-default btn-lg btn-block">Local script task</button>
</ModalTrigger>
<ModalTrigger modal={<RemoteScriptTaskDialog EnviromentId={this.props.EnviromentId} />} >
<ModalTrigger modal={<RemoteScriptTaskDialog onCreate={this.props.onCreate} EnviromentId={this.props.EnviromentId} />} >
<button type="button" className="btn btn-default btn-lg btn-block">Remote script task</button>
</ModalTrigger>
</div>
Expand Down Expand Up @@ -166,7 +166,7 @@ var TaskSelectDialog = React.createClass({

<table className="table table-bordered table-striped">
<thead><tr><th>Tasks
<ModalTrigger modal={<TaskSelectDialog EnviromentId={this.getParams().enviromentId}/>}>
<ModalTrigger modal={<TaskSelectDialog onCreate={this.updateTasks} EnviromentId={this.getParams().enviromentId}/>}>
<button className='btn btn-xs btn-primary pull-right'>New</button></ModalTrigger></th></tr></thead>
<tbody>
{this.state.tasks.map(x => x.Type == 0 ? (
Expand Down

0 comments on commit e5b2f96

Please sign in to comment.