Skip to content

Commit

Permalink
fix(deps): moves Submissions out of modal (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Vaughan authored May 7, 2024
1 parent 371dd53 commit d7e7cd0
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 14 deletions.
61 changes: 61 additions & 0 deletions src/DARE-FrontEnd/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,67 @@ public IActionResult GetProject(int id)
return View(projectView);
}

public IActionResult SubmissionProjectSQL(int id)
{

var paramlist = new Dictionary<string, string>();
paramlist.Add("projectId", id.ToString());
var project = _clientHelper.CallAPIWithoutModel<Project?>(
"/api/Project/GetProject/", paramlist).Result;

ViewBag.UserCanDoSubmissions = IsUserOnProject(project);

var projectView = new ProjectUserTre()
{
Id = project.Id,
Name = project.Name
};

return View(projectView);
}


public IActionResult SubmissionProjectGraphQL(int id)
{

var paramlist = new Dictionary<string, string>();
paramlist.Add("projectId", id.ToString());
var project = _clientHelper.CallAPIWithoutModel<Project?>(
"/api/Project/GetProject/", paramlist).Result;

ViewBag.UserCanDoSubmissions = IsUserOnProject(project);

var projectView = new ProjectUserTre()
{
Id = project.Id,
Name = project.Name
};

return View(projectView);
}

public IActionResult SubmissionProjectCrate(int id)
{

var paramlist = new Dictionary<string, string>();
paramlist.Add("projectId", id.ToString());
var project = _clientHelper.CallAPIWithoutModel<Project?>(
"/api/Project/GetProject/", paramlist).Result;

ViewBag.UserCanDoSubmissions = IsUserOnProject(project);

var projectView = new ProjectUserTre()
{
Id = project.Id,
Name = project.Name
};

return View(projectView);
}




[HttpGet]
[AllowAnonymous]
public IActionResult GetAllProjects()
Expand Down
6 changes: 3 additions & 3 deletions src/DARE-FrontEnd/Controllers/SubmissionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task<IActionResult> SubmissionWizard(SubmissionWizard model)

var result = await _clientHelper.CallAPI<TesTask, TesTask?>("/v1/tasks", TesTask);

return RedirectToAction("GetProject", "Project", new { id = model.ProjectId });
return Ok();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -191,7 +191,7 @@ public async Task<ActionResult> AddiSubmissionWizard(AddiSubmissionWizard model,
try
{


var listOfTre = "";

var paramlist = new Dictionary<string, string>();
Expand Down Expand Up @@ -354,7 +354,7 @@ public async Task<ActionResult> AddiSubmissionWizard(AddiSubmissionWizard model,
var result = await _clientHelper.CallAPI<TesTask, TesTask?>("/v1/tasks", test);


return RedirectToAction("GetProject", "Project", new { id = model.ProjectId });
return Ok();
}
catch (Exception e)
{
Expand Down
10 changes: 5 additions & 5 deletions src/DARE-FrontEnd/Views/Project/GetProject.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@
{
<div class="d-flex align-items-center mb-3">

<a class="btn btn-primary btn-sm d-flex align-items-center mb-3 text-decoration-none" id="showModalButton">
<a class="btn btn-primary btn-sm d-flex align-items-center mb-3 text-decoration-none" href="@Url.Action("SubmissionProjectCrate", "Project", new { id = pId })">
<i class="fa fa-table-columns align-middle me-2"></i>
<span>Submit with Crate Submission Wizard</span>
<span>Submit with Crate Submission Wizard </span>
</a>

<a class="btn btn-link btn-sm d-flex align-items-center mb-3 text-decoration-none" id="showModalButton2">
<a class="btn btn-link btn-sm d-flex align-items-center mb-3 text-decoration-none" href="@Url.Action("SubmissionProjectSQL", "Project", new { id = pId })">
<i class="fa fa-table-columns align-middle me-2"></i>
<span>Submit with SQL TES Wizard</span>
<span >Submit with SQL TES Wizard </span>
</a>

<a class="btn btn-link btn-sm d-flex align-items-center mb-3 text-decoration-none" id="showModalButton3">
<a class="btn btn-link btn-sm d-flex align-items-center mb-3 text-decoration-none" href="@Url.Action("SubmissionProjectGraphQL", "Project", new { id = pId })">
<i class="fa fa-table-columns align-middle me-2"></i>
<span>Submit with GraphQL TES Wizard</span>
</a>
Expand Down
13 changes: 13 additions & 0 deletions src/DARE-FrontEnd/Views/Project/SubmissionProjectCrate.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using BL.Models.ViewModels
@model BL.Models.ViewModels.ProjectUserTre
@{
string pageName = Model.Name;

ViewData["Title"] = @pageName;
int pId = Model.Id;
}

@if (ViewBag.UserCanDoSubmissions)
{
@await Component.InvokeAsync("SubmissionWizerd", new {projectId=pId})
}
13 changes: 13 additions & 0 deletions src/DARE-FrontEnd/Views/Project/SubmissionProjectGraphQL.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using BL.Models.ViewModels
@model BL.Models.ViewModels.ProjectUserTre
@{
string pageName = Model.Name;

ViewData["Title"] = @pageName;
int pId = Model.Id;
}

@if (ViewBag.UserCanDoSubmissions)
{
@await Component.InvokeAsync("SubmissionWizardRawGraphQL", new {projectId=pId})
}
13 changes: 13 additions & 0 deletions src/DARE-FrontEnd/Views/Project/SubmissionProjectSQL.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using BL.Models.ViewModels
@model BL.Models.ViewModels.ProjectUserTre
@{
string pageName = Model.Name;

ViewData["Title"] = @pageName;
int pId = Model.Id;
}

@if (ViewBag.UserCanDoSubmissions)
{
@await Component.InvokeAsync("SubmissionWizardRaw", new {projectId=pId})
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<thead>
<tr>
<th class="col-md-5">Image</th>
<th class="col-md-7">Command</th>
<th class="col-md-7">Environment Variables</th>
</tr>
</thead>
Expand Down Expand Up @@ -117,7 +118,7 @@
<div class="hero-block-1">

<button type="button" class="btn btn-sm btn-link" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
<button type="button" class="btn btn-sm btn-primary">Submit</button>
</div>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<tr>
<th class="col-md-5">Image</th>
<th class="col-md-7">Command</th>
<th class="col-md-7">Environment Variabl</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -117,7 +118,7 @@
<div class="hero-block-1">

<button type="button" class="btn btn-sm btn-link" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
<button type="button" class="btn btn-sm btn-primary">Submit</button>
</div>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}


@using (Html.BeginForm("SubmissionWizard", "Submission", FormMethod.Post, new { enctype = "multipart/form-data", id = "frmMain" }))
@using (Html.BeginForm("GetAllProjects", "Project", FormMethod.Post, new { enctype = "multipart/form-data", id = "frmMain" }))
{
@Html.HiddenFor(x => x.ProjectId)
{
Expand Down Expand Up @@ -100,7 +100,7 @@
<div class="hero-block-1">

<button type="button" class="btn btn-sm btn-link" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
<button type="button" class="btn btn-sm btn-primary">Submit</button>
</div>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions src/DARE-FrontEnd/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
contentType: false,
processData: false,
success: function (result) {
location.reload();
window.location.href = "/Project/GetProject/" + this.data.get("ProjectId");
console.log(result);
},
error: function (error) {
Expand Down Expand Up @@ -621,7 +621,7 @@
contentType: false,
processData: false,
success: function (result) {
location.reload();
window.location.href = "/Project/GetProject/" + this.data.get("ProjectId");
console.log(result);
},
error: function (error) {
Expand Down

0 comments on commit d7e7cd0

Please sign in to comment.