Skip to content

Commit

Permalink
Merge pull request #187 from AuScope/AUS-3743
Browse files Browse the repository at this point in the history
AUS-3743 Improve presentation of constraints in info panel
  • Loading branch information
laughing0li authored Nov 7, 2022
2 parents c97f272 + bce3727 commit 13daaa0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
14 changes: 9 additions & 5 deletions src/app/menupanel/common/filterpanel/filterpanel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,15 @@
</div>
<div *ngIf="optionalFilter.type=='OPTIONAL.PROVIDER'">
<div class="form-group">
<div *ngFor="let provider of providers;let idx = index">
<input class="form-control-sm" id="{{ 'filter-OPTIONAL.PROVIDER-' + idx + '-' + layer.id }}" type="checkbox" [(ngModel)]="optionalFilter.value[provider.value]"/>
<label for="{{ 'filter-OPTIONAL.PROVIDER-' + idx + '-' + layer.id }}">
{{provider.label}}
</label>
<div style="display: flex" *ngFor="let provider of providers;let idx = index">
<div style="width: 10%;">
<input class="form-control-sm" id="{{ 'filter-OPTIONAL.PROVIDER-' + idx + '-' + layer.id }}" type="checkbox" [(ngModel)]="optionalFilter.value[provider.value]"/>
</div>
<div style="width: 90%">
<label for="{{ 'filter-OPTIONAL.PROVIDER-' + idx + '-' + layer.id }}">
{{provider.label}}
</label>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h4><span class="text-primary">Metadata</span></h4>
<div class="card-header">
<h4 class="card-title">
<a class="accordion-link" data-toggle="collapse" href="#info-link{{i}}" (click)="cswRecord.expanded = !cswRecord.expanded" >
<i *ngIf='layerStatus.showInfoWarning(layer.id, cswRecord)' class="fa fa-warning text-warning"> </i>{{cswRecord.adminArea !='' && cswRecord.adminArea!=null ? cswRecord.adminArea : 'More Information'}}
<i *ngIf='layerStatus.showInfoWarning(layer.id, cswRecord)' class="fa fa-warning text-warning"> </i>{{cswRecord.contactOrg !='' && cswRecord.contactOrg != null ? cswRecord.contactOrg : 'More Information'}}
</a>
</h4>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ export class InfoPanelSubComponent implements OnChanges {


/**
* Remove unwanted strings from metadata constraints fields
* Remove unwanted and empty strings from metadata constraints fields
* @param constraints string array of contraints
* @return string constraints in string format
*/
public cleanConstraints(constraints: string[]) {

let outStr = "";
for (const conStr of constraints) {
if (conStr.indexOf("#MD_RestrictionCode") < 0) {
outStr += conStr + ", ";
if (conStr.indexOf("no conditions apply") < 0 &&
conStr.indexOf("#MD_RestrictionCode") < 0 && conStr.trim() != "") {
outStr += conStr.trim() + ", ";
}
}
// Remove trailing comma
Expand Down
2 changes: 1 addition & 1 deletion src/app/menupanel/menupanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ p a {
/* Position checkboxes and labels e.g. providers, hylogged boreholes */
input[type=checkbox] {
position: relative;
top: 10px;
top: -4px;
}

input[type=checkbox] + label {
Expand Down
2 changes: 1 addition & 1 deletion src/app/menupanel/record-modal/record-modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h4><span class="text-primary">Metadata</span></h4>
<div class="card-header">
<h4 class="card-title">
<a class="accordion-link" data-toggle="collapse" href="#info-link{{i}}" (click)="cswRecord.expanded = !cswRecord.expanded" (mouseenter)="highlightOnPreviewMap(cswRecord.id)" (mouseleave)="lowlightOnPreviewMap(cswRecord.id)">
<i *ngIf='layerStatus.showInfoWarning(layer.id, cswRecord)' class="fa fa-warning text-warning"> </i>{{cswRecord.adminArea !='' && cswRecord.adminArea!=null ? cswRecord.adminArea : 'More Information'}}
<i *ngIf='layerStatus.showInfoWarning(layer.id, cswRecord)' class="fa fa-warning text-warning"> </i>{{cswRecord.contactOrg !='' && cswRecord.contactOrg!=null ? cswRecord.contactOrg : 'More Information'}}
</a>
</h4>
</div>
Expand Down
16 changes: 8 additions & 8 deletions src/app/services/filter/filter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ export class FilterService {
if (!existingLayerProviders) {
const layerProviders = [];
const cswRecords = layer.cswRecords;
// Set up a map of admin areas + URLs that belong to each
const adminAreasMap = {};
// Set up a map of contact orgs + URLs that belong to each
const contactOrgsMap = {};
for (const record of cswRecords) {
const adminArea = record.adminArea;
if (adminArea !== null) {
const contactOrg = record.contactOrg;
if (contactOrg !== null) {
const allOnlineResources = this.layerHandlerService.getOnlineResourcesFromCSW(record);
if (allOnlineResources.length > 0) {
adminAreasMap[adminArea] = UtilitiesService.getUrlDomain(allOnlineResources[0].url);
contactOrgsMap[contactOrg] = UtilitiesService.getUrlDomain(allOnlineResources[0].url);
}
}
}
// Set up a list of each unique admin area
for (const key in adminAreasMap) {
// Set up a list of each unique contact org
for (const key in contactOrgsMap) {
layerProviders.push({
label: key,
value: adminAreasMap[key]
value: contactOrgsMap[key]
});
}
const layerProvidersBS: BehaviorSubject<Array<Object>> = new BehaviorSubject(layerProviders);
Expand Down

0 comments on commit 13daaa0

Please sign in to comment.