Commit 90fead4f authored by Jie Yuan's avatar Jie Yuan

change the site with additional source information

parent 2b433b96
......@@ -57,8 +57,10 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
if (source === null || source === ''){
this.currentServiceSource = 'dpmt';
sessionStorage.setItem('currentServiceSource',this.currentServiceSource);
sessionStorage.setItem('currentSourceInfo','dpmt');
} else {
this.currentServiceSource = source;
sessionStorage.setItem('currentSourceInfo',source);
}
const stmp = 'JsonSiteList' + this.currentServiceSource.toUpperCase();
......@@ -261,6 +263,9 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
sessionStorage.setItem('preSitePage', 'Service')
sessionStorage.setItem('currentServiceSource',source);
if (source === 'dpmt' || source === 'gocdb') {
sessionStorage.setItem('currentSourceInfo',source);
}
//sessionStorage.setItem('currentSiteShortSource', 'dpmt');
}
......@@ -272,6 +277,9 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
sessionStorage.setItem('preSitePage', 'Site')
sessionStorage.setItem('currentSiteShortSource',source);
if (source === 'dpmt' || source === 'gocdb') {
sessionStorage.setItem('currentSourceInfo',source);
}
//sessionStorage.setItem('currentSiteShortSource', 'dpmt');
this.router.navigate(['/dashboard'], { relativeTo: this.route });
......@@ -280,20 +288,25 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
onClick(serverData: ServiceComponentRow) {
console.log('click on site from services');
console.log(serverData);
this.siteService.getASite(serverData.siteName)
.then(
(asite: Site) => {
sessionStorage.setItem('preSitePage', 'Service');
sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
}
).catch(
error => {
console.log('Error while loading sites ');
console.log(error);
}
);
const tmp=sessionStorage.getItem('currentSourceInfo');
if( tmp === 'dpmt' || tmp === 'gocdb') {
const sourceAndName = tmp.toUpperCase() + serverData.siteName;
this.siteService.getASite(sourceAndName)
.then(
(asite: Site) => {
sessionStorage.setItem('preSitePage', 'Service');
sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
}
).catch(
error => {
console.log('Error while loading sites ');
console.log(error);
}
);
}
}
......
......@@ -57,8 +57,10 @@ export class TableComponent implements OnInit, DoCheck,AfterViewInit {
if (stmp === null || stmp === ''){
this.currentSiteSource = 'dpmt';
sessionStorage.setItem('currentSiteShortSource',this.currentSiteSource);
sessionStorage.setItem('currentSourceInfo','dpmt');
} else {
this.currentSiteSource = stmp;
sessionStorage.setItem('currentSourceInfo',stmp);
}
const tmp = 'JsonSiteShortList' + this.currentSiteSource.toUpperCase();
......@@ -181,20 +183,25 @@ export class TableComponent implements OnInit, DoCheck,AfterViewInit {
onClick(serverData: SiteShort) {
console.log('click on table');
this.siteService.getASite(serverData.siteName)
.then(
(asite: Site) => {
sessionStorage.setItem('preSitePage', 'Site');
sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
const tmp = sessionStorage.getItem('currentSourceInfo');
if ( tmp === 'dpmt' || tmp == 'gocdb') {
const sourceAndName = tmp.toUpperCase() + serverData.siteName;
this.siteService.getASite(sourceAndName)
.then(
(asite: Site) => {
sessionStorage.setItem('preSitePage', 'Site');
sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
}
).catch(
error => {
console.log('Error while loading sites ');
console.log(error);
}
);
}
).catch(
error => {
console.log('Error while loading sites ');
console.log(error);
}
);
}
}
......@@ -222,6 +229,9 @@ public onClickSite(source: string) {
sessionStorage.setItem('preSitePage', 'Site')
sessionStorage.setItem('currentSiteShortSource',source);
if(source === 'dpmt' || source === 'gocdb') {
sessionStorage.setItem('currentSourceInfo',source);
}
//sessionStorage.setItem('currentSiteShortSource', 'dpmt');
// this.router.navigate(['/dashboard'], { relativeTo: this.route });
......@@ -234,6 +244,9 @@ public onClickService(source: string) {
sessionStorage.setItem('preSitePage', 'Service')
sessionStorage.setItem('currentServiceSource',source);
if (source === 'dpmt' || 'gocdb') {
sessionStorage.setItem('currentSourceInfo',source);
}
//sessionStorage.setItem('currentSiteShortSource', 'dpmt');
this.router.navigate(['/dashboard/fullTableComponent'], { 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