Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d78b478
add upload component and functionality
michaelmattig Mar 24, 2021
ee46592
Merge branch 'master' of https://github.com/umr-dbs/wave into upload
michaelmattig Mar 24, 2021
e2d60fd
prettier
michaelmattig Mar 24, 2021
c4343fc
use util function
michaelmattig Mar 25, 2021
d8c6ed2
get session only once
michaelmattig Mar 25, 2021
7b114b9
clean up
michaelmattig Mar 25, 2021
a8cbb47
add core-new to build command
michaelmattig Mar 25, 2021
248d3f5
delete unnecessary folders
ChristianBeilschmidt Mar 25, 2021
1c7106c
remove codelyzer
ChristianBeilschmidt Mar 25, 2021
bf529c7
Merge branch 'master' of https://github.com/umr-dbs/wave into angular11
ChristianBeilschmidt Mar 25, 2021
5abb2fe
update angular core and cli
ChristianBeilschmidt Mar 25, 2021
53e9c54
material update
ChristianBeilschmidt Mar 25, 2021
62c5bfc
update cli
ChristianBeilschmidt Mar 25, 2021
2a2b5d0
clean up package.json
ChristianBeilschmidt Mar 25, 2021
734dd6d
update eslint
ChristianBeilschmidt Mar 26, 2021
95320f6
Merge pull request #142 from umr-dbs/angular11
michaelmattig Mar 26, 2021
678728d
Merge branch 'master' of https://github.com/umr-dbs/wave into geoengine
ChristianBeilschmidt Mar 26, 2021
5e3e79f
revert proxy config
michaelmattig Mar 30, 2021
ed83aa3
loading indicator and styling
michaelmattig Mar 30, 2021
9801b46
two way binding of loading info
michaelmattig Mar 30, 2021
cb0127c
Merge branch 'master' of https://github.com/umr-dbs/wave into geoengine
ChristianBeilschmidt Mar 30, 2021
e5b7035
bugfix: remove plot removed layer streams
ChristianBeilschmidt Mar 30, 2021
c9c9992
Merge branch 'main' of https://github.com/geo-engine/geoengine-ui int…
michaelmattig Mar 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ng": "ng",
"prettier": "prettier",
"start": "ng serve",
"build": "npm run build-prod:core && npm run build-prod:wave && npm run build-prod:gfbio && npm run build-prod:nature40",
"build": "npm run build-prod:core && npm run build-prod:wave && npm run build-prod:gfbio && npm run build-prod:nature40 && npm run build-prod:core-new",
"check": "prettier --check . && ng lint wave-core-new && ng lint geoengine-app && ng lint data-atlas-app",
"ci-core": "ng build --prod wave-core-new",
"serve:wave": "ng serve wave-app --proxy-config proxy.conf.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component, OnInit, ChangeDetectionStrategy, Input} from '@angular/core';
import {LayoutService, SidenavConfig} from '../../layout.service';
import {createIconDataUrl} from '../../util/icons';
import {DatasetListComponent} from '../dataset-list/dataset-list.component';
import {UploadComponent} from '../upload/upload.component';

Expand Down Expand Up @@ -43,7 +44,7 @@ export class AddDataComponent implements OnInit {
return {
name: 'Data Sets',
description: 'Available Data Sets',
iconSrc: this.createIconDataUrl('DataSets'),
iconSrc: createIconDataUrl('DataSets'),
sidenavConfig: {component: DatasetListComponent, keepParent: true},
};
}
Expand All @@ -52,43 +53,8 @@ export class AddDataComponent implements OnInit {
return {
name: 'Upload',
description: 'Upload data from you local computer',
iconSrc: this.createIconDataUrl('Upload'),
iconSrc: createIconDataUrl('Upload'),
sidenavConfig: {component: UploadComponent, keepParent: true},
};
}

/**
* Each operator type must have a method that returns
* an icon as a data uri image. This provides a default
* out of the operator name.
*/
static createIconDataUrl(iconName: string): string {
// TODO: replace with proper icons
// from `http://stackoverflow.com/questions/3426404/
// create-a-hexadecimal-colour-based-on-a-string-with-javascript`
const hashCode = (str: string): number => {
// java String#hashCode
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash); // eslint-disable-line no-bitwise
}
return hash;
};
const intToRGB = (i: number): string => {
const c = (i & 0x00ffffff).toString(16).toUpperCase(); // eslint-disable-line no-bitwise

return '00000'.substring(0, 6 - c.length) + c;
};

const color = '#' + intToRGB(hashCode(iconName));
const size = 64;

const canvas = document.createElement('canvas');
canvas.width = size;
canvas.height = size;
const context = canvas.getContext('2d');
context.fillStyle = color;
context.fillRect(0, 0, 64, 64);
return canvas.toDataURL('image/png');
}
}
6 changes: 3 additions & 3 deletions projects/wave-core-new/src/lib/datasets/dataset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {DataSet} from './dataset.model';
import {UserService} from '../users/user.service';
import {map, mergeMap} from 'rxjs/operators';
import {HttpEvent} from '@angular/common/http';
import {CreateDataSetDict, UploadResponseDict} from '../backend/backend.model';
import {CreateDataSetDict, DataSetIdDict, UploadResponseDict} from '../backend/backend.model';

@Injectable({
providedIn: 'root',
Expand All @@ -21,10 +21,10 @@ export class DataSetService {
}

upload(form: FormData): Observable<HttpEvent<UploadResponseDict>> {
return this.userService.getSessionStream().pipe(mergeMap((session) => this.backend.upload(session.sessionToken, form)));
return this.userService.getSessionTokenForRequest().pipe(mergeMap((token) => this.backend.upload(token, form)));
}

createDataSet(create: CreateDataSetDict): Observable<DataSetIdDict> {
return this.userService.getSessionStream().pipe(mergeMap((session) => this.backend.createDataSet(session.sessionToken, create)));
return this.userService.getSessionTokenForRequest().pipe(mergeMap((token) => this.backend.createDataSet(token, create)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface ExampleLoadingInfo {
})
export class UploadComponent implements OnInit {
selectedFiles: FileList;
progress$ = new Subject();
progress$ = new Subject<number>();
submittedUpload = false;
submittedCreate = false;

Expand Down Expand Up @@ -132,13 +132,12 @@ export class UploadComponent implements OnInit {

loadingInfo = '';

constructor(private dataSetService: DataSetService, private notificationService: NotificationService) {}
constructor(protected dataSetService: DataSetService, protected notificationService: NotificationService) {}

ngOnInit(): void {}

selectFiles(event): void {
this.selectedFiles = event.target.files;
console.log(this.selectedFiles);
}

upload(): void {
Expand All @@ -157,7 +156,6 @@ export class UploadComponent implements OnInit {
} else if (event.type === HttpEventType.Response) {
this.uploadId$.next(event.body.id);
}
console.log(event);
},
(err) => {
this.notificationService.error('File upload failed: ' + err);
Expand Down
2 changes: 1 addition & 1 deletion proxy-data-atlas.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/api/*": {
"target": "http://pc12736.mathematik.uni-marburg.de:7777/api",
"target": "http://localhost:3030/",
"changeOrigin": true,
"pathRewrite": {
"^/api": ""
Expand Down
2 changes: 1 addition & 1 deletion proxy-geoengine.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/api/*": {
"target": "http://pc12608.mathematik.uni-marburg.de:3030/",
"target": "http://localhost:3030/",
"changeOrigin": true,
"pathRewrite": {
"^/api": ""
Expand Down