#8148 - [Bug fix] drafts.component.ts & recent-edited-activity.component.ts & recent-edited-dataset-activity.component.ts & recent-edited-dmp-activity.component.ts: Updated check to redirect to first page, if page parameter is bigger than the latest page.
This commit is contained in:
parent
0d9b6f9622
commit
b435994c51
|
@ -122,7 +122,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
|
||||||
this.datasetDrafts = response.data;
|
this.datasetDrafts = response.data;
|
||||||
this.totalCount = response.totalCount;
|
this.totalCount = response.totalCount;
|
||||||
this.totalCountDraftDatasets.emit(this.datasetDrafts.length);
|
this.totalCountDraftDatasets.emit(this.datasetDrafts.length);
|
||||||
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
|
if(this.totalCount > 0 && this.totalCount <= (this.page-1)*this.pageSize && this.page > 1) {
|
||||||
let queryParams = { type: "drafts", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "drafts", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
|
|
|
@ -123,6 +123,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
let keyword = (params['keyword'] === undefined || params['keyword'].length <= 0) ? "" : params['keyword'];
|
let keyword = (params['keyword'] === undefined || params['keyword'].length <= 0) ? "" : params['keyword'];
|
||||||
this.formGroup.get("like").setValue(keyword);
|
this.formGroup.get("like").setValue(keyword);
|
||||||
|
|
||||||
|
console.log("init");
|
||||||
this.updateUrl();
|
this.updateUrl();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -151,20 +152,27 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
||||||
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) {
|
if(this.allRecentActivities.length == 0 && this.page > 1) {
|
||||||
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
}
|
}
|
||||||
|
console.log(queryParams);
|
||||||
this.router.navigate(["/home"], { queryParams: queryParams })
|
this.router.navigate(["/home"], { queryParams: queryParams })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.formGroup.get('like').valueChanges
|
this.formGroup.get('like').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
||||||
.subscribe(x => this.refresh());
|
.subscribe(x => {
|
||||||
|
console.log("like changed");
|
||||||
|
this.refresh()
|
||||||
|
});
|
||||||
this.formGroup.get('order').valueChanges
|
this.formGroup.get('order').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.refresh());
|
.subscribe(x => {
|
||||||
|
console.log("order changed");
|
||||||
|
this.refresh()
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.publicMode = true;
|
this.publicMode = true;
|
||||||
if(!this.formGroup.get('order').value) {
|
if(!this.formGroup.get('order').value) {
|
||||||
|
@ -186,25 +194,33 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
||||||
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) {
|
if(this.allRecentActivities.length == 0 && this.page > 1) {
|
||||||
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
}
|
}
|
||||||
|
console.log(queryParams);
|
||||||
this.router.navigate(["/home"], { queryParams: queryParams })
|
this.router.navigate(["/home"], { queryParams: queryParams })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.formGroup.get('like').valueChanges
|
this.formGroup.get('like').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
||||||
.subscribe(x => this.refresh());
|
.subscribe(x => {
|
||||||
|
console.log("like changed 1");
|
||||||
|
this.refresh()
|
||||||
|
});
|
||||||
this.formGroup.get('order').valueChanges
|
this.formGroup.get('order').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.refresh());
|
.subscribe(x => {
|
||||||
|
console.log("order changed 1");
|
||||||
|
this.refresh()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
if(this.isActive) {
|
if(this.isActive) {
|
||||||
|
console.log("active");
|
||||||
this.updateUrl();
|
this.updateUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,6 +233,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
if(parameters) {
|
if(parameters) {
|
||||||
parameters = "?type=recent" + parameters;
|
parameters = "?type=recent" + parameters;
|
||||||
}
|
}
|
||||||
|
console.log(parameters);
|
||||||
this.location.go(this.router.url.split('?')[0]+parameters);
|
this.location.go(this.router.url.split('?')[0]+parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,6 +710,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
this.datasetOffset = 0;
|
this.datasetOffset = 0;
|
||||||
this.dmpOffset = 0;
|
this.dmpOffset = 0;
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
|
console.log("refresh");
|
||||||
this.updateUrl();
|
this.updateUrl();
|
||||||
|
|
||||||
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
|
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
|
||||||
|
@ -745,6 +763,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
// return [];
|
// return [];
|
||||||
} else {
|
} else {
|
||||||
this.page = this.page + (more ? 1 : -1);
|
this.page = this.page + (more ? 1 : -1);
|
||||||
|
console.log("loadNextOrPrevious");
|
||||||
this.updateUrl();
|
this.updateUrl();
|
||||||
// if(more) {
|
// if(more) {
|
||||||
// result.forEach(recentActivity => {
|
// result.forEach(recentActivity => {
|
||||||
|
|
|
@ -122,7 +122,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
||||||
this.datasetActivities = response.data;
|
this.datasetActivities = response.data;
|
||||||
this.totalCount = response.totalCount;
|
this.totalCount = response.totalCount;
|
||||||
this.totalCountDatasets.emit(this.datasetActivities.length)
|
this.totalCountDatasets.emit(this.datasetActivities.length)
|
||||||
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
|
if(this.totalCount > 0 && this.totalCount <= (this.page-1)*this.pageSize && this.page > 1) {
|
||||||
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
|
@ -146,7 +146,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
||||||
this.datasetActivities = response.data;
|
this.datasetActivities = response.data;
|
||||||
this.totalCount = response.totalCount;
|
this.totalCount = response.totalCount;
|
||||||
this.totalCountDatasets.emit(this.datasetActivities.length);
|
this.totalCountDatasets.emit(this.datasetActivities.length);
|
||||||
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
|
if(this.totalCount > 0 && this.totalCount <= (this.page-1)*this.pageSize && this.page > 1) {
|
||||||
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
|
|
|
@ -133,7 +133,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
||||||
this.dmpActivities = response.data;
|
this.dmpActivities = response.data;
|
||||||
this.totalCount = response.totalCount;
|
this.totalCount = response.totalCount;
|
||||||
this.totalCountDmps.emit(this.dmpActivities.length);
|
this.totalCountDmps.emit(this.dmpActivities.length);
|
||||||
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
|
if(this.totalCount > 0 && this.totalCount <= (this.page-1)*this.pageSize && this.page > 1) {
|
||||||
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
|
@ -182,7 +182,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
||||||
this.dmpActivities = response.data;
|
this.dmpActivities = response.data;
|
||||||
this.totalCount = response.totalCount;
|
this.totalCount = response.totalCount;
|
||||||
this.totalCountDmps.emit(this.dmpActivities.length);
|
this.totalCountDmps.emit(this.dmpActivities.length);
|
||||||
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
|
if(this.totalCount > 0 && this.totalCount <= (this.page-1)*this.pageSize && this.page > 1) {
|
||||||
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
|
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
|
||||||
if(this.formGroup.get("like").value) {
|
if(this.formGroup.get("like").value) {
|
||||||
queryParams['keyword'] = this.formGroup.get("like").value;
|
queryParams['keyword'] = this.formGroup.get("like").value;
|
||||||
|
|
Loading…
Reference in New Issue