Skip to content

Commit

Permalink
fix: #491 Detail Bookmark Link Not Accessible (#532)
Browse files Browse the repository at this point in the history
* Subscribe to onNavEnd observable early so directly using bookmark can work.

* Remove subscription from constructor, load queryParam first and check for getting project details instead.

* Adjust reading queryParam logic.

* Dummy commit to triger api deploy.

* Fix typo
  • Loading branch information
ianliuwk1019 authored Jan 4, 2024
1 parent 49e6633 commit ed5366a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ These are the steps to generate the client library used by the frontend componen
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,27 @@ export class DetailsPanelComponent implements OnDestroy, OnInit {
private projectService: ProjectService,
private spatialFeatureService: SpatialFeatureService,
private attachmentService: AttachmentService,
private fss: FeatureSelectService
private fss: FeatureSelectService,
) {}

ngOnInit(): void {
// Note, can't seem to get stateService.ts to get codeTable working here. Instead, subscribe to it.
// Subscribe to this first, seems to be slower and can cause minor page render issue due to no code.
this.projectService.workflowStateCodeControllerFindAll()
.pipe(take(1)).subscribe((data) => {
this.workflowStatus = _.keyBy(data, 'code');
});

// subscribe and watch for URL param changes

// First time component init. The `urlService.onNavEnd$` already ends, so
// do this initially first since queryParam is ready from route.
// Works if user has bookmarks the detail link.
this.getProjectDetails();

// Subscribe to onNavEnd so the component knows subsequent clicks on other details.
this.urlService.onNavEnd$.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(() => {
this.loadQueryParameters();
if (!this.projectIdFilter.filter.value) {
// no project to display
this.project = null;
} else if (!this.project || this.project.id.toString() !== this.projectIdFilter.filter.value) {
// no project yet selected, or different project selected
this.getProjectDetails();
}
});
.subscribe(() => {
this.getProjectDetails();
});

this.subscribeToFeatureSelectChange();
}
Expand All @@ -87,7 +86,14 @@ export class DetailsPanelComponent implements OnDestroy, OnInit {
* @memberof DetailsPanelComponent
*/
public getProjectDetails() {
this.loadQueryParameters();
const projectId = parseInt(this.projectIdFilter.filter.value);
if (!projectId) {
// no project to display
this.project = null;
return;
}

this.isAppLoading = true;
forkJoin({
project: this.projectService.projectControllerFindOne(projectId),
Expand Down

0 comments on commit ed5366a

Please sign in to comment.