Skip to content

Commit

Permalink
Merge pull request #220 from stuartwoodman/AUS-3875-Remove-Default-Da…
Browse files Browse the repository at this point in the history
…ta-Search

AUS-3875 Remove default data search
  • Loading branch information
jia020 authored Dec 15, 2022
2 parents efae6cc + 8d28148 commit c9b4960
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
19 changes: 14 additions & 5 deletions src/app/menupanel/data-explorer/data-explorer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<div class="card">
<div class="card-body" style="padding-left: 0px;padding-right: 0px;">

<!-- Searches aren't run automatically any more, hide results and display message until a search has been done -->
<div class="row" *ngIf="!searchConducted">
<div class="col">
<div class="no-search-notification">
To search CSW services enter a search term, add any desired filters and press the search button below.
</div>
</div>
</div>

<!-- Any text search -->
<div class="row">
<div class="col">
Expand Down Expand Up @@ -175,9 +184,8 @@
</div>

<!-- Search results -->
<div class="row" #searchResults>
<div class="row" #searchResults *ngIf="searchConducted">
<div class="col">

<div class="submenu-header" (click)="searchResultsIsCollapsed = !searchResultsIsCollapsed">
Search Results
<span>
Expand All @@ -187,8 +195,9 @@
<i *ngIf="!searchResultsIsCollapsed" style="line-height:inherit;" class="fa fa-arrow-circle-up pull-right"></i>
</span>
</div>
<div [ngbCollapse]="searchResultsIsCollapsed" id="searchResults" >
<fieldset >
<div [ngbCollapse]="searchResultsIsCollapsed" id="searchResults">
<!-- Search results -->
<fieldset>
<legend class="control-label small" >Results ({{ getTotalSearchResultCount() }} Total)</legend>
<div class="container-fluid" style="margin: 0px; padding: 0px;">
<ul ngbNav #nav="ngbNav" class="nav-pills" >
Expand All @@ -205,7 +214,7 @@
</div>
</div>
<!-- Server error -->
<div *ngIf="!registry.value.searching && registry.value.searchError!==null">
<div *ngIf="!registry.value.searching && registry.value.searchError && registry.value.searchError!==''">
<div class="row" style="padding:10px;">
<div class="col" style="padding:10px;border:solid 1px black;border-radius:8px;word-break:break-all;background:#EBF5FB;color: black;">
<label>This registry reported a problem:<br><br>{{ registry.value.searchError }}</label>
Expand Down
8 changes: 8 additions & 0 deletions src/app/menupanel/data-explorer/data-explorer.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
width:auto;
margin-left:4px;
}

.input-group{
margin-left:4px;
margin-right:4px;
Expand All @@ -68,6 +69,13 @@
padding: 0px;
}
}

.no-search-notification {
border: solid 1px white;
border-radius: 6px;
padding: 10px;
}

#no-result-container{
padding:2px;
border:solid 1px $auscope-grey;
Expand Down
13 changes: 7 additions & 6 deletions src/app/menupanel/data-explorer/data-explorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class DataExplorerComponent implements OnInit{

// Search results
cswSearchResults: Map<String, LayerModel[]> = new Map<String, LayerModel[]>();
searchConducted = false; // Has a search has been conducted?
layerOpacities: Map<String, number> = new Map<String, number>();

// Collapsable menus
Expand All @@ -38,8 +39,6 @@ export class DataExplorerComponent implements OnInit{
registriesIsCollapsed: boolean = true;
searchResultsIsCollapsed: boolean = true;



// Faceted search parameters
anyTextValue: string = "";
spatialBoundsText: string = "";
Expand Down Expand Up @@ -87,7 +86,7 @@ export class DataExplorerComponent implements OnInit{
this.dataExplorerService.updateRegistries().subscribe(
(data: Registry[]) => {
// Update registries
for (let registry of data) {
for (const registry of data) {
registry.checked = true;
registry.startIndex = 1;
registry.prevIndices = [];
Expand All @@ -101,7 +100,6 @@ export class DataExplorerComponent implements OnInit{
// facetedSearch to ensure at least 1 filter has been used or de-
// selecting a registry will populate results)
this.getFacetedKeywords();
this.facetedSearchAllRegistries();
},
(error) => {
// TODO: Proper error reporting
Expand Down Expand Up @@ -154,6 +152,8 @@ export class DataExplorerComponent implements OnInit{
*/
public facetedSearchAllRegistries(): void {

this.searchConducted = true;

// Available registries and start
let serviceIds: string[] = [];
let starts: number[] = [];
Expand Down Expand Up @@ -270,7 +270,6 @@ export class DataExplorerComponent implements OnInit{
registry.searchError =
response["data"].searchErrors[registry.id];
}


for (let i = 0; i < response["itemLayers"].length; i++) {
const uiLayerModel = new UILayerModel(
Expand All @@ -284,7 +283,7 @@ export class DataExplorerComponent implements OnInit{
uiLayerModel
);
}

this.cswSearchResults.set(registry.id, response["itemLayers"]);
registry.searching = false;

Expand All @@ -307,6 +306,8 @@ export class DataExplorerComponent implements OnInit{
*/
public facetedSearchSingleRegistry(registry: Registry): void {

this.searchConducted = true;

let fields: string[] = [];
let values: string[] = [];
let types: string[] = [];
Expand Down
16 changes: 8 additions & 8 deletions src/app/menupanel/data-explorer/data-explorer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export class DataExplorerService {

static RESULTS_PER_PAGE: number = 35;

constructor(private http: HttpClient) { }

private _registries: BehaviorSubject<Registry[]> = new BehaviorSubject([]);
public readonly registries: Observable<Registry[]> = this._registries.asObservable();


constructor(private http: HttpClient) { }

public getFilteredCSWKeywords(cswServiceId: string): Observable<any> {
let httpParams = new HttpParams();
httpParams = httpParams.append('cswServiceIds', cswServiceId);
Expand Down Expand Up @@ -153,11 +153,11 @@ export class DataExplorerService {
* executes getFacetedCSWServices.do in vgl service
*/
public updateRegistries(): Observable<Registry[]> {
let obs = this.getCSWServices();
const obs = this.getCSWServices();
obs.subscribe(registryList => this._registries.next(registryList));
return obs;
}
}

/**
* @param serviceId
* @param start
Expand Down Expand Up @@ -225,10 +225,10 @@ export class DataExplorerService {
// return response['data'];
return {
itemLayers: itemLayers,
data:response['data']
data: response['data']
}
}));
}
}

/**
* Returns an array of keywords for specified service IDs
Expand Down

0 comments on commit c9b4960

Please sign in to comment.