...
 
Commits (3)
......@@ -131,6 +131,9 @@
<p-overlayPanel #jobtags [showCloseIcon]="true">
<div class="p-grid p-dir-col">
<div class="p-col">
Select jobs that contain <p-dropdown [options]="jobtag_option" [(ngModel)]="selected_jobtag_option" (ngModelChange)="checkJobtags()" [style]="{'minWidth':'65px','width':'65px'}"></p-dropdown> of the following tags:
</div>
<div class="p-col">
<p-checkbox name="jobtag1" label="memory-bound" [(ngModel)]="jobtag_bool[0]" binary="true" (onChange)="checkJobtags()"></p-checkbox>
</div>
......
......@@ -129,8 +129,10 @@ export class SearchComponent implements OnInit {
nodename: string;
jobtag_bool: boolean[];
jobtag_sum: number;
jobtag_value: string;
selected_jobtags: string;
jobtag_option: SelectItem[];
selected_jobtag_option: string;
footprints: string[];
footprint_name: string;
......@@ -183,6 +185,10 @@ export class SearchComponent implements OnInit {
];
this.partitions = this.monitoringservice.getPartitions();
this.jobtag_option = [];
this.jobtag_option.push({label: 'All', value: 'and'});
this.jobtag_option.push({label: 'Any', value: 'or'});
this.footprints = [];
for (let label in convert_footprint_dict) {
this.footprints.push(label);
......@@ -214,13 +220,13 @@ export class SearchComponent implements OnInit {
// console.log("search-storage: ", localStorage.getItem('search-storage'));
var searchStorage:any = JSON.parse(localStorage.getItem('search-storage'));
if ( localStorage.getItem('SEARCHBY') ){
if ( localStorage.getItem('SEARCHBY') ) {
this.selected_search_option = localStorage.getItem('SEARCHBY');
if ( this.selected_search_option == 'null' )
this.selected_search_option = null;
}
// console.log("Liveoption: ", localStorage.getItem('LIVEOPTIN'));
if ( localStorage.getItem('LIVEOPTION') ){
if ( localStorage.getItem('LIVEOPTION') ) {
this.selected_live_option = localStorage.getItem('LIVEOPTION');
if ( this.selected_live_option == 'null' )
this.selected_live_option = null;
......@@ -237,12 +243,12 @@ export class SearchComponent implements OnInit {
this.selected_partition = searchStorage['PARTITION'].replace(/%/g,'');
if ( searchStorage['NODENAME'] )
this.nodename = searchStorage['NODENAME'].replace(/%/g,'');;
if ( searchStorage['FOOTPRINT'] ){
if ( searchStorage['FOOTPRINT'] ) {
this.footprint_code = searchStorage['FOOTPRINT'];
this.footprint_name = localStorage.getItem('FOOTPRINTS');
this.footprint_unit = localStorage.getItem('FOOTPRINT_UNIT');
this.footprint_unitprefix = Number(localStorage.getItem('FOOTPRINT_UNITPREFIX'));
if ( searchStorage['FOOTPRINT1_S'] ){
if ( searchStorage['FOOTPRINT1_S'] ) {
var footprint_temp = searchStorage['FOOTPRINT1_S'].split(" ");
this.footprint_min = footprint_temp[1]/this.footprint_unitprefix;
this.footprint_max = footprint_temp[2]/this.footprint_unitprefix;
......@@ -256,8 +262,11 @@ export class SearchComponent implements OnInit {
}
if ( searchStorage['STATUS'] )
this.jobstatus = searchStorage['STATUS'];
if ( localStorage.getItem('JOBTAG_OPTION') ) {
this.selected_jobtag_option = localStorage.getItem('JOBTAG_OPTION');
}
if ( searchStorage['TAGS'] ) {
this.jobtag_sum = Number(searchStorage['TAGS']);
this.jobtag_value = (searchStorage['TAGS']);
this.jobtag_bool[0] = (localStorage.getItem('JTAG_1'))==='true';
this.jobtag_bool[1] = (localStorage.getItem('JTAG_2'))==='true';
this.jobtag_bool[2] = (localStorage.getItem('JTAG_4'))==='true';
......@@ -266,7 +275,7 @@ export class SearchComponent implements OnInit {
this.selected_jobtags = localStorage.getItem('SELECTED_JTG');
}
if ( searchStorage['EXCLUSIVE'] ){
if ( searchStorage['EXCLUSIVE'] ) {
this.selected_allocation_type = searchStorage['EXCLUSIVE'];
}
if ( searchStorage['GLOBAL_DATE_FILTER'] )
......@@ -409,7 +418,7 @@ export class SearchComponent implements OnInit {
this.disable_time_interval = false;
this.project = null;
if ( this.login_user == 'admin' ){
if ( this.login_user == 'admin' ) {
this.user = null;
}
this.jobstatus = null;
......@@ -418,7 +427,8 @@ export class SearchComponent implements OnInit {
this.jobname = null;
this.nodename = null;
this.jobtag_bool = [false, false, false, false, false];
this.jobtag_sum = null;
this.jobtag_value = null;
this.selected_jobtag_option = "and";
this.selected_jobtags = null;
this.footprint_code = null;
this.footprint_name = null;
......@@ -437,11 +447,11 @@ export class SearchComponent implements OnInit {
}
getSearchChange(event :any){
if ( this.selected_search_option != null){
if ( this.selected_search_option != null) {
this.footprint_name = null;
this.footprint_code = null;
}
if ( this.interval_array.length == 6){
if ( this.interval_array.length == 6) {
if ( this.selected_search_option =='Live' ) {
this.interval_array.pop();
this.interval_array.pop();
......@@ -458,9 +468,9 @@ export class SearchComponent implements OnInit {
}
filterProjects(event: any) {
this.filtered_projects = [];
for(let i = 0; i < this.projects.length; i++) {
for ( let i = 0; i < this.projects.length; i++ ) {
let project = this.projects[i];
if( project.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
if ( project.toLowerCase().indexOf(event.query.toLowerCase()) == 0 ) {
this.filtered_projects.push(project);
}
}
......@@ -468,9 +478,9 @@ export class SearchComponent implements OnInit {
filterUsers(event: any) {
this.filtered_users = [];
for(let i = 0; i < this.users.length; i++) {
for ( let i = 0; i < this.users.length; i++ ) {
let user = this.users[i];
if( user.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
if ( user.toLowerCase().indexOf(event.query.toLowerCase()) == 0 ) {
this.filtered_users.push(user);
}
}
......@@ -478,67 +488,78 @@ export class SearchComponent implements OnInit {
filterPartitions(event: any) {
this.filtered_partitions = [];
for(let i = 0; i < this.partitions.length; i++) {
for ( let i = 0; i < this.partitions.length; i++ ) {
let selected_partition = this.partitions[i];
if(selected_partition.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
if ( selected_partition.toLowerCase().indexOf(event.query.toLowerCase()) == 0 ) {
this.filtered_partitions.push(selected_partition);
}
}
}
filterJobstatus(event: any) {
this.filtered_jobstatus = [];
for(let i = 0; i < this.jobstatus_option.length; i++) {
for ( let i = 0; i < this.jobstatus_option.length; i++ ) {
let jobstatus = this.jobstatus_option[i];
if( jobstatus.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
if ( jobstatus.toLowerCase().indexOf(event.query.toLowerCase()) == 0 ) {
this.filtered_jobstatus.push(jobstatus);
}
}
}
checkJobtags(){
this.jobtag_sum= Number(this.jobtag_bool[0]) + Number(this.jobtag_bool[1])*2 + Number(this.jobtag_bool[2])*4 + Number(this.jobtag_bool[3])*8 + Number(this.jobtag_bool[4])*16;
checkJobtags() {
if ( this.selected_jobtag_option == "or" ) {
var jobtag_arr:number[] = [];
for ( let i = 0; i < 5; i++ ) {
if ( this.jobtag_bool[i] ) {
jobtag_arr.push(Math.pow(2,i));
}
}
this.jobtag_value = jobtag_arr.join(" ");
}
else {
this.jobtag_value= (Number(this.jobtag_bool[0]) + Number(this.jobtag_bool[1])*2 + Number(this.jobtag_bool[2])*4 + Number(this.jobtag_bool[3])*8 + Number(this.jobtag_bool[4])*16).toString();
}
var jobtag_display;
if ( this.jobtag_bool[0] ){
if ( this.jobtag_bool[0] ) {
jobtag_display = "memory-bound";
} else if ( this.jobtag_bool[1] ){
} else if ( this.jobtag_bool[1] ) {
jobtag_display = "compute-bound";
} else if ( this.jobtag_bool[4] ){
} else if ( this.jobtag_bool[4] ) {
jobtag_display = "gpu-bound";
} else if ( this.jobtag_bool[2] ){
} else if ( this.jobtag_bool[2] ) {
jobtag_display = "io-heavy";
} else if ( this.jobtag_bool[3] ){
} else if ( this.jobtag_bool[3] ) {
jobtag_display = "network-heavy";
}
var jobtag_num;
jobtag_num = Number(this.jobtag_bool[0]) + Number(this.jobtag_bool[1]) + Number(this.jobtag_bool[2]) + Number(this.jobtag_bool[3]) + Number(this.jobtag_bool[4]);
if ( jobtag_num == 0 ){
if ( jobtag_num == 0 ) {
this.selected_jobtags = null;
} else if ( jobtag_num == 1 ){
} else if ( jobtag_num == 1 ) {
this.selected_jobtags = jobtag_display;
} else {
this.selected_jobtags = `${jobtag_display} and ${jobtag_num-1} more`;
this.selected_jobtags = `${jobtag_display} ${this.selected_jobtag_option} ${jobtag_num-1} more`;
}
}
filterFootprint(event: any) {
this.filteredFootprint = [];
for(let i = 0; i < this.footprints.length; i++) {
for ( let i = 0; i < this.footprints.length; i++ ) {
let footprint_name = this.footprints[i];
if( footprint_name.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
if ( footprint_name.toLowerCase().indexOf(event.query.toLowerCase()) == 0 ) {
this.filteredFootprint.push(footprint_name);
}
}
}
footprintChange(event: any){
footprintChange(event: any) {
this.footprint_min = null;
this.footprint_max = null;
if ( this.footprint_name ){
if ( this.footprint_name ) {
this.footprint_unit = convert_footprint_dict[this.footprint_name].unit;
}
else{
else {
this.footprint_code = null;
}
}
searchJID(){
searchJID() {
this.monitoringservice.clearFilter();
sessionStorage.removeItem('_filter');
sessionStorage.clear();
......@@ -568,14 +589,14 @@ export class SearchComponent implements OnInit {
this.monitoringservice.addFilterItem('PARTITION', "%" + this.selected_partition + "%");
if ( this.nodename )
this.monitoringservice.addFilterItem('NODENAME', "%" + this.nodename + "%");
if ( this.footprint_name ){
if ( this.footprint_name ) {
this.footprint_code = convert_footprint_dict[this.footprint_name].code;
this.footprint_unitprefix = convert_footprint_dict[this.footprint_name].unit_prefix;
this.monitoringservice.addFilterItem('FOOTPRINT', this.footprint_code);
localStorage.setItem('FOOTPRINTS', this.footprint_name);
localStorage.setItem('FOOTPRINT_UNIT', this.footprint_unit);
localStorage.setItem('FOOTPRINT_UNITPREFIX', this.footprint_unitprefix.toString());
if ( this.footprint_min || this.footprint_max ){
if ( this.footprint_min || this.footprint_max ) {
this.footprint_min = this.footprint_min*this.footprint_unitprefix;
this.footprint_max = this.footprint_max*this.footprint_unitprefix;
if ( this.footprint_min == 0 ) {
......@@ -587,7 +608,7 @@ export class SearchComponent implements OnInit {
this.monitoringservice.addFilterItem('FOOTPRINT1_S', this.footprint_code + " " + this.footprint_min +" "+ this.footprint_max);
}
}
if ( this.jobstatus ){
if ( this.jobstatus ) {
this.monitoringservice.addFilterItem('STATUS', this.jobstatus);
}
else {
......@@ -601,10 +622,10 @@ export class SearchComponent implements OnInit {
localStorage.setItem('JTAG_4', this.jobtag_bool[2].toString());
localStorage.setItem('JTAG_8', this.jobtag_bool[3].toString());
localStorage.setItem('JTAG_16', this.jobtag_bool[4].toString());
if ( this.jobtag_sum && this.jobtag_sum != 0 ){
this.monitoringservice.addFilterItem('TAGS', this.jobtag_sum.toString());
if ( this.jobtag_value && this.jobtag_value != "0" ) {
this.monitoringservice.addFilterItem('TAGS', this.jobtag_value);
}
if ( this.selected_jobtags ){
if ( this.selected_jobtags ) {
localStorage.setItem('SELECTED_JTG', this.selected_jobtags);
}
......@@ -647,16 +668,17 @@ export class SearchComponent implements OnInit {
localStorage.setItem('SEARCHBY', this.selected_search_option);
localStorage.setItem('LIVEOPTION', this.selected_live_option);
if ( this.jobid ){
localStorage.setItem('JOBTAG_OPTION', this.selected_jobtag_option);
if ( this.jobid ) {
localStorage.setItem('JID', this.jobid.toString());
}
if ( this.selected_search_option == 'Live' ){
if ( this.selected_live_option == 'Live-User' ){
if ( this.selected_search_option == 'Live' ) {
if ( this.selected_live_option == 'Live-User' ) {
this.router.navigate([this.selected_search_option, 'users-live'], {relativeTo: this.route});}
else if ( this.selected_live_option == 'Live-Job' ){
else if ( this.selected_live_option == 'Live-Job' ) {
this.router.navigate([this.selected_search_option, 'jobs-live'], {relativeTo: this.route});
}
else{
else {
this.router.navigate([this.selected_search_option, 'details-live'], {relativeTo: this.route});
}
}
......