Skip to content

Commit

Permalink
Merge pull request #142 from bfrgoncalves/prevV1
Browse files Browse the repository at this point in the history
Prev v1
  • Loading branch information
bfrgoncalves authored Sep 21, 2018
2 parents 935de62 + 9d8d2c9 commit 2c0d6ed
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 17 deletions.
9 changes: 9 additions & 0 deletions app/static/controllers/js_objects/projects_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ const Projects_Table = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http) => {
' able to run more analysis on this Project. This option is' +
' useful to release space from the Storage. Do you really' +
' want to proceed?', "Project Lock", () => {

$("#submission_status").html("Locking Project...");
$("#overlayProjects").css({"display":"block"});
$("#overlayWorking").css({"display":"block"});

pg_requests.lock_project(project_id, (response) => {
const new_projects = [];

Expand All @@ -315,6 +320,10 @@ const Projects_Table = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http) => {

projects = new_projects;

$("#overlayProjects").css({"display":"none"});
$("#overlayWorking").css({"display":"none"});
$("#submission_status").empty();

callback({projects: projects});
});
});
Expand Down
27 changes: 24 additions & 3 deletions app/static/controllers/js_objects/single_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
if (!strains_dict.hasOwnProperty($.trim(data.strainID))) {
strains_dict[$.trim(data.strainID)] = data.id;
}

for (const s in sd) {
sd[s] = sd[s] !== "" ? sd[s] : "NA";
}

strains.push(sd);

callback({
Expand Down Expand Up @@ -746,6 +751,12 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
sd["FilesLocation"] = data[i].fq_location;
sd["has_files"] = data[i].has_files;
sd["Accession"] = data[i].Accession;

// Parse for empty cell data
for (const s in sd) {
sd[s] = sd[s] !== "" ? sd[s] : "NA";
}

new_strains.push(sd);
}
public_strains = new_strains;
Expand Down Expand Up @@ -832,6 +843,12 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
if (!strains_dict.hasOwnProperty($.trim(data[i].strainID))) {
strains_dict[$.trim(data[i].strainID)] = data[i].id;
}

for (const s in sd) {
sd[s] = sd[s] !== "" ? sd[s] : "NA";
}


add_strains.push(sd);
}
strains = add_strains;
Expand Down Expand Up @@ -941,8 +958,6 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
let workflow_ids_added = {};
let pipelines_ids = [];

console.log(response);

if (response.status === 200) {
const total_pip = response.data.length;
let processed_pip = 0;
Expand Down Expand Up @@ -2854,7 +2869,7 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
" between: Human; Food; Animal, cattle; Animal, poultry; Animal, swine; Animal, other; Environment; Water;"],
"Sampling-Date": [true, "Optional"],
"Sample-Received-Date": [true, "Optional"],
"Owner": [true, "Optional"],
"Owner": [true, "Required", "The Owner field is mandatory."],
"Submitter": [true, "Required", " Strain submitter is" +
" required. Must be the same as the user which is logged in."],
"Location": [true, "Optional"],
Expand Down Expand Up @@ -3030,6 +3045,12 @@ let Single_Project = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http, $rootScope) =>
}
}

if (headers_array[header_to_check] === "Owner") {
if (used_headers[headers_array[header_to_check]][1] === "Required" && bline_to_use[x] === "") {
required_headers_missed.push([headers_array[header_to_check], used_headers[headers_array[header_to_check]][2]]);
}
}

if (headers_array[header_to_check] === "Source") {

$('#' + hline_to_use[x] + " option").filter((e, i) => {
Expand Down
19 changes: 15 additions & 4 deletions app/static/controllers/modify_strains_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ innuendoApp.controller("modifyStrainsCtrl", ($scope, $rootScope, $http) => {
TO_LOAD_STRAINS = "";
TO_LOAD_PROJECTS = "";

let currentSelected = [];

$('#waiting_spinner').css({display:'block', position:'fixed', top:'40%', left:'50%'});

const objects_utils = Objects_Utils();
Expand All @@ -120,7 +122,7 @@ innuendoApp.controller("modifyStrainsCtrl", ($scope, $rootScope, $http) => {


$scope.metadata_fields = metadata.get_fields();
$scope.specie_name = CURRENT_SPECIES_NAME;
$scope.specie_name = SPECIES_CORRESPONDENCE[CURRENT_SPECIES_NAME];

let strains_headers = metadata.get_minimal_fields();

Expand Down Expand Up @@ -249,8 +251,12 @@ innuendoApp.controller("modifyStrainsCtrl", ($scope, $rootScope, $http) => {
modalAlert("Please select a strain first.", "Select Strains", () => {

});
currentSelected = [];
return;
}
else {
currentSelected = strain_selected;
}

const strain_id_in_use = strain_selected[0].id;

Expand All @@ -260,11 +266,16 @@ innuendoApp.controller("modifyStrainsCtrl", ($scope, $rootScope, $http) => {

$('#modifyStrainModal').modal("show");

const updateMetadataEl = $('#update_metadata_button');
/*const updateMetadataEl = $('#update_metadata_button');
updateMetadataEl.off("click").on("click", () => {
updateMetadata(strain_id_in_use);
});
console.log("AQUI");
//updateMetadata(strain_id_in_use);
});*/
};

$scope.change_Strain = () => {
updateMetadata(currentSelected[0].id);
};

const updateMetadata = (strain_id_in_use) => {
Expand Down
5 changes: 1 addition & 4 deletions app/static/controllers/projects_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ innuendoApp.controller("projectsCtrl", ($scope, $http) => {
$("#tools_button_li").css({"display":"block"});
$("#user_tools").css({"display":"block"});
$("#species_drop_button_li").css({"display":"block"});
//$("#protocols_button_li").css({"display":"none"});
//$("#workflows_button_li").css({"display":"none"});
$("#overview_li").css({"display":"none"});

//Reset application to overview page. Allows to select a diferent species
Expand Down Expand Up @@ -254,7 +252,6 @@ innuendoApp.controller("projectsCtrl", ($scope, $http) => {
else {
CURRENT_JOB_MINE = true;
}
console.log(CURRENT_PROJECT_ID);
projects_table.load_project(table_id, CURRENT_PROJECT_ID, false, (results) => {
CURRENT_PROJECT = results.project;
PROJECT_STATUS = results.project.is_removed;
Expand All @@ -270,7 +267,7 @@ innuendoApp.controller("projectsCtrl", ($scope, $http) => {
objects_utils.destroyTable('projects_table');
projects = results;
objects_utils.loadDataTables('projects_table', projects, project_col_defs);
modalAlert("Project Locked!");
modalAlert("Project Locked!", "Information", () => {});
});
});
}
Expand Down
5 changes: 3 additions & 2 deletions app/static/html_components/modals/modify_strain_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ <h4 class="modal-title">Modify Strain</h4>
name="SampleReceivedDate">-->
</div>
<div class="form-group col-md-6">
<label>Owner</label>
<input type="text" class="form-control" id="Owner" name="Owner" placeholder="Owner">
<label>Owner<sup>*</sup></label>
<input type="text" class="form-control" id="Owner"
name="Owner" placeholder="Owner" required>
</div>
</div>
<div class="row">
Expand Down
6 changes: 4 additions & 2 deletions app/static/html_components/modals/new_strain_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ <h4 class="modal-title">Add Strain</h4>
name="SampleReceivedDate">-->
</div>
<div class="form-group col-md-6">
<label>Owner</label>
<input type="text" class="form-control" id="Owner" name="Owner" placeholder="Owner">
<label>Owner<sup>*</sup></label>
<input type="text" class="form-control"
id="Owner" name="Owner"
placeholder="Owner" required>
</div>
</div>
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion app/static/html_components/modify_strains_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="container">
<div class="col-md-12 rule3" style="text-align: center;">
<p style="font-weight: bold;">Modify strain metadata!</p>
<p>{ specie_name }</p>
<p>{{ specie_name }}</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/static/html_components/projects_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<div class="banner-title rule1"></div>
</div>

<div class="col-md-12" >
<div class="col-md-12" style="overflow-x: auto;">
<table class="table table-striped table-bordered" cellspacing="0" id="projects_table" width='100%'>
<thead>
<tr>
Expand Down

0 comments on commit 2c0d6ed

Please sign in to comment.