diff --git a/pdb-js/src/app/app.module.ts b/pdb-js/src/app/app.module.ts
index 579a93c..e8aaf6d 100644
--- a/pdb-js/src/app/app.module.ts
+++ b/pdb-js/src/app/app.module.ts
@@ -23,6 +23,7 @@ import { QueryAutocompleteComponent } from './query-autocomplete/query-autocompl
import { LimitByComponent } from './limit-by/limit-by.component';
import { PlotViewComponent } from './plot-view/plot-view.component';
import { GalleryViewComponent, GalleryItemView } from './gallery-view/gallery-view.component';
+import { ImageToggleComponent } from './image-toggle/image-toggle.component';
@NgModule({
declarations: [
@@ -36,7 +37,8 @@ import { GalleryViewComponent, GalleryItemView } from './gallery-view/gallery-vi
LimitByComponent,
PlotViewComponent,
GalleryViewComponent,
- GalleryItemView
+ GalleryItemView,
+ ImageToggleComponent
],
imports: [
BrowserModule,
diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.html b/pdb-js/src/app/gallery-view/gallery-view.component.html
index 094ce5f..b68101e 100644
--- a/pdb-js/src/app/gallery-view/gallery-view.component.html
+++ b/pdb-js/src/app/gallery-view/gallery-view.component.html
@@ -1,4 +1,27 @@
-
+
+
+
+ Sort By:
+
+ name
+ max value
+ average
+ #values
+ #plotted values
+
+
+
+
+
+
+
diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.scss b/pdb-js/src/app/gallery-view/gallery-view.component.scss
index c25801b..dea0b1b 100644
--- a/pdb-js/src/app/gallery-view/gallery-view.component.scss
+++ b/pdb-js/src/app/gallery-view/gallery-view.component.scss
@@ -1,7 +1,18 @@
-.card-grid-300 {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(300px, 300px));
- grid-gap: 10px;
- padding: 10px;
+
+#gallery-filters{
+ padding: 0.5em 0.5em 0em 0.5em;
+ margin: 0 1em 0em 0em;
+ border-radius: 5px;
+ background-color: #f8f8f8;
+}
+
+
+.card-grid-300 {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 300px));
+ grid-gap: 10px;
+ padding: 10px;
+ overflow-y: auto;
+ height: calc(100% - 4.5em);
}
diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.ts b/pdb-js/src/app/gallery-view/gallery-view.component.ts
index 16d9e9f..0e4c104 100644
--- a/pdb-js/src/app/gallery-view/gallery-view.component.ts
+++ b/pdb-js/src/app/gallery-view/gallery-view.component.ts
@@ -12,7 +12,24 @@ export class GalleryViewComponent implements OnInit {
galleryItems: Array
= new Array();
+ show = false;
+
splitByValuesQueue = new Array();
+
+ _sortBy= "NAME";
+
+ sortOrder = 0;
+
+ ascDescImages = JSON.stringify([
+ {
+ imageUrl: 'assets/img/ascending-filter.svg',
+ title: 'ascending'
+ },
+ {
+ imageUrl: 'assets/img/descending-filter.svg',
+ title: 'descending'
+ }
+ ]);
constructor(private plotService: PlotService, private snackBar: MatSnackBar) {
}
@@ -27,6 +44,28 @@ export class GalleryViewComponent implements OnInit {
ngOnInit() {
}
+ sortGallery() {
+ const orderFactor = this.sortOrder == 0 ? 1 : -1; // ASC=1, DESC=-1
+
+ switch (this._sortBy) {
+ case "NAME":
+ this.galleryItems.sort(function(a, b){return orderFactor*a.splitByValue.localeCompare(b.splitByValue);});
+ break;
+ case "VALUES":
+ this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.values - b.stats.values);});
+ break;
+ case "PLOTTED_VALUES":
+ this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.plottedValues - b.stats.plottedValues);});
+ break;
+ case "MAX_VALUE":
+ this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.maxValue - b.stats.maxValue);});
+ break;
+ case "AVERAGE":
+ this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.average - b.stats.average);});
+ break;
+ }
+ }
+
renderGallery(request: PlotRequest, splitByField: string) {
const that=this;
@@ -64,12 +103,25 @@ export class GalleryViewComponent implements OnInit {
plotResponse.imageUrl = "http://"+window.location.hostname+':8080/'+plotResponse.imageUrl;
let galleryItem = new GalleryItem(splitByValue, plotResponse);
that.galleryItems.push(galleryItem);
+ that.sortGallery();
that.renderGalleryRecursively(masterRequest, splitByField);
},
error => {
that.showError(error.error.message);
});
}
+
+ set sortBy(name: string) {
+ this._sortBy = name;
+ this.sortGallery();
+ }
+
+ get sortBy(): string { return this._sortBy; }
+
+ sortOrderChanged(event){
+ this.sortOrder = event;
+ this.sortGallery();
+ }
}
diff --git a/pdb-js/src/app/image-toggle/image-toggle.component.html b/pdb-js/src/app/image-toggle/image-toggle.component.html
new file mode 100644
index 0000000..1738d6f
--- /dev/null
+++ b/pdb-js/src/app/image-toggle/image-toggle.component.html
@@ -0,0 +1 @@
+
diff --git a/pdb-js/src/app/image-toggle/image-toggle.component.scss b/pdb-js/src/app/image-toggle/image-toggle.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/pdb-js/src/app/image-toggle/image-toggle.component.spec.ts b/pdb-js/src/app/image-toggle/image-toggle.component.spec.ts
new file mode 100644
index 0000000..2f7cc73
--- /dev/null
+++ b/pdb-js/src/app/image-toggle/image-toggle.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ImageToggleComponent } from './image-toggle.component';
+
+describe('ImageToggleComponent', () => {
+ let component: ImageToggleComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ImageToggleComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ImageToggleComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/pdb-js/src/app/image-toggle/image-toggle.component.ts b/pdb-js/src/app/image-toggle/image-toggle.component.ts
new file mode 100644
index 0000000..65d0c49
--- /dev/null
+++ b/pdb-js/src/app/image-toggle/image-toggle.component.ts
@@ -0,0 +1,38 @@
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+
+@Component({
+ selector: 'pdb-image-toggle',
+ templateUrl: './image-toggle.component.html',
+ styleUrls: ['./image-toggle.component.scss']
+})
+export class ImageToggleComponent implements OnInit {
+
+ @Input()
+ images : string = "";
+
+ value: number = 0;
+
+ @Output()
+ valueChanged : EventEmitter = new EventEmitter();
+
+ _states : Array;
+
+ constructor() { }
+
+ ngOnInit() {
+ this._states = JSON.parse(this.images);
+ }
+
+ imageUrl() : string {
+ return this._states[this.value].imageUrl;
+ }
+
+ title() : string {
+ return this._states[this.value].title;
+ }
+
+ toggle(event){
+ this.value = (this.value+1) % this._states.length;
+ this.valueChanged.emit(this.value);
+ }
+}
diff --git a/pdb-js/src/app/visualization-page/visualization-page.component.html b/pdb-js/src/app/visualization-page/visualization-page.component.html
index cbba769..9dfc187 100644
--- a/pdb-js/src/app/visualization-page/visualization-page.component.html
+++ b/pdb-js/src/app/visualization-page/visualization-page.component.html
@@ -4,7 +4,7 @@
+
\ No newline at end of file
+
+
diff --git a/pdb-js/src/assets/img/descending-filter.svg b/pdb-js/src/assets/img/descending-filter.svg
index b3e8196..9753e1a 100644
--- a/pdb-js/src/assets/img/descending-filter.svg
+++ b/pdb-js/src/assets/img/descending-filter.svg
@@ -1 +1,66 @@
-
\ No newline at end of file
+
+
diff --git a/pdb-js/src/styles.scss b/pdb-js/src/styles.scss
index 2ce1286..4c24d1f 100644
--- a/pdb-js/src/styles.scss
+++ b/pdb-js/src/styles.scss
@@ -93,9 +93,19 @@ mat-form-field:last-child {
mat-form-field.pdb-form-number {
width: 3.5em;
}
+.pdb-form-icon-small {
+ display: inline-block;
+ width: 2em;
+ vertical-align: middle;
+}
mat-form-field.pdb-form-mid {
width: 7.5em;
}
+mat-form-field.pdb-form-wide {
+ width: 10em;
+}
+
+
.errorPanel {