Commit dc5a276e authored by Ziwen Su's avatar Ziwen Su

Adjusted the function and display of Jobtag.

parent 7a2ee090
......@@ -132,7 +132,7 @@
<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" [style]="{'minWidth':'65px','width':'65px'}"></p-dropdown> of the following tags:
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>
......
......@@ -220,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;
......@@ -243,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;
......@@ -262,6 +262,9 @@ 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_bool[0] = (localStorage.getItem('JTAG_1'))==='true';
......@@ -272,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'] )
......@@ -415,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;
......@@ -425,6 +428,7 @@ export class SearchComponent implements OnInit {
this.nodename = null;
this.jobtag_bool = [false, false, false, false, false];
this.jobtag_sum = null;
this.selected_jobtag_option = "and";
this.selected_jobtags = null;
this.footprint_code = null;
this.footprint_name = null;
......@@ -443,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();
......@@ -464,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);
}
}
......@@ -474,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);
}
}
......@@ -484,26 +488,26 @@ 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(){
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;
var jobtag_display;
if ( this.jobtag_bool[0] ){
if ( this.jobtag_bool[0] ) {
jobtag_display = "memory-bound";
} else if ( this.jobtag_bool[1] ){
jobtag_display = "compute-bound";
......@@ -516,35 +520,35 @@ export class SearchComponent implements OnInit {
}
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();
......@@ -574,14 +578,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 ) {
......@@ -593,7 +597,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 {
......@@ -607,10 +611,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 ){
if ( this.jobtag_sum && this.jobtag_sum != 0 ) {
this.monitoringservice.addFilterItem('TAGS', this.jobtag_sum.toString());
}
if ( this.selected_jobtags ){
if ( this.selected_jobtags ) {
localStorage.setItem('SELECTED_JTG', this.selected_jobtags);
}
......@@ -653,16 +657,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});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment