Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/wg-166-questionnaire-preview-title #171

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="asset-detail-header">
<app-feature-icon [feature]="feature"></app-feature-icon>
<div class="feature-label">
{{ feature.properties.label || feature.properties.title || feature.id }}
sophia-massie marked this conversation as resolved.
Show resolved Hide resolved
{{ title }}
</div>
<div>
<button class="close-button" (click)="close()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.asset-detail-header
display flex
align-items center
padding 5px
position fixed
z-index 5000
width 35%
Expand Down
12 changes: 12 additions & 0 deletions angular/src/app/components/asset-detail/asset-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class AssetDetailComponent implements OnInit {
featureSource: string;
activeProject: Project;
safePointCloudUrl: SafeResourceUrl;
title: string;
constructor(
private geoDataService: GeoDataService,
private tapisFilesService: TapisFilesService,
Expand Down Expand Up @@ -48,6 +49,12 @@ export class AssetDetailComponent implements OnInit {
this.featureSource = null;
this.safePointCloudUrl = null;
}
if (this.feature.assets.length && this.feature.assets[0].display_path) {
const fileName = this.extractFileName(this.feature.assets[0].display_path);
this.title = fileName;
} else {
this.title = this.feature.id.toString();
}
});
this.projectsService.activeProject.subscribe((current) => {
this.activeProject = current;
Expand Down Expand Up @@ -81,6 +88,11 @@ export class AssetDetailComponent implements OnInit {
this.bsModalService.show(ModalQuestionnaireViewerComponent, modalConfig);
}

extractFileName(path: string): string {
const pathSegments = path.split('/');
return pathSegments.pop();
}

close() {
this.geoDataService.activeFeature = null;
}
Expand Down
Loading