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 3 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
13 changes: 4 additions & 9 deletions projects/geoengine-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {MatSidenav} from '@angular/material/sidenav';
import {MatTabGroup} from '@angular/material/tabs';
import {
AddDataComponent,
AddDataListButton,
AddDataButton,
Layer,
SidenavContainerComponent,
LayoutService,
Expand All @@ -42,7 +42,6 @@ import {
import {DomSanitizer} from '@angular/platform-browser';
import {ActivatedRoute} from '@angular/router';
import {AppConfig} from './app-config.service';
import {MockLayersComponent} from './mock-layers/mock-layers.component';

@Component({
selector: 'wave-app-root',
Expand Down Expand Up @@ -196,15 +195,11 @@ export class AppComponent implements OnInit, AfterViewInit {
return {component: AddDataComponent, config: {buttons: AppComponent.createAddDataListButtons()}};
}

private static createAddDataListButtons(): Array<AddDataListButton> {
private static createAddDataListButtons(): Array<AddDataButton> {
return [
AddDataComponent.createDataSetListButton(),
{
name: 'Mock data',
description: 'Mock data sets',
iconSrc: AddDataComponent.createIconDataUrl('mock'),
sidenavConfig: {component: MockLayersComponent, keepParent: true},
},
AddDataComponent.createUploadButton(),

// SourceOperatorListComponent.createDrawFeaturesButton(),
// ...SourceOperatorListComponent.createCustomFeaturesButtons(),
// {
Expand Down
12 changes: 12 additions & 0 deletions projects/wave-core-new/src/lib/backend/backend.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ export interface DataSetDict {
source_operator: string;
}

export interface DataSetIdDict {
Internal?: InternalDataSetIdDict;
}

export interface InternalDataSetIdDict {
Internal: UUID;
}
Expand Down Expand Up @@ -229,3 +233,11 @@ export interface MeasurementDict {
};
};
}

export interface UploadResponseDict {
id: UUID;
}

export interface CreateDataSetDict {
upload: UUID;
}
19 changes: 18 additions & 1 deletion projects/wave-core-new/src/lib/backend/backend.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import {HttpClient, HttpEvent, HttpHeaders, HttpParams} from '@angular/common/http';
import {Observable, Subject} from 'rxjs';
import {Config} from '../config.service';
import {bboxDictToExtent, unixTimestampToIsoString} from '../util/conversions';
Expand Down Expand Up @@ -27,6 +27,9 @@ import {
RasterResultDescriptorDict,
PlotResultDescriptorDict,
VectorResultDescriptorDict,
UploadResponseDict,
DataSetIdDict,
CreateDataSetDict,
} from './backend.model';

@Injectable({
Expand Down Expand Up @@ -241,6 +244,20 @@ export class BackendService {
});
}

upload(sessionId: UUID, form: FormData): Observable<HttpEvent<UploadResponseDict>> {
return this.http.post<UploadResponseDict>(this.config.API_URL + '/upload', form, {
headers: BackendService.authorizationHeader(sessionId),
reportProgress: true,
observe: 'events',
});
}

createDataSet(sessionId: UUID, createDataSet: CreateDataSetDict): Observable<DataSetIdDict> {
return this.http.post<DataSetIdDict>(this.config.API_URL + '/dataset', createDataSet, {
headers: BackendService.authorizationHeader(sessionId),
});
}

private static authorizationHeader(sessionId: UUID): HttpHeaders {
return new HttpHeaders().set('Authorization', `Bearer ${sessionId}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Component, OnInit, ChangeDetectionStrategy, Input} from '@angular/core';
import {LayoutService, SidenavConfig} from '../../layout.service';
import {DatasetListComponent} from '../dataset-list/dataset-list.component';
import {UploadComponent} from '../upload/upload.component';

export interface AddDataListButton {
export interface AddDataButton {
name: string;
description: string;
icon?: string;
Expand All @@ -21,7 +22,7 @@ export class AddDataComponent implements OnInit {
/**
* A list of data source dialogs to display
*/
@Input() buttons!: Array<AddDataListButton>;
@Input() buttons!: Array<AddDataButton>;

constructor(private layoutService: LayoutService) {}

Expand All @@ -38,7 +39,7 @@ export class AddDataComponent implements OnInit {
this.layoutService.setSidenavContentComponent(sidenavConfig);
}

static createDataSetListButton(): AddDataListButton {
static createDataSetListButton(): AddDataButton {
return {
name: 'Data Sets',
description: 'Available Data Sets',
Expand All @@ -47,6 +48,15 @@ export class AddDataComponent implements OnInit {
};
}

static createUploadButton(): AddDataButton {
return {
name: 'Upload',
description: 'Upload data from you local computer',
iconSrc: this.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
Expand Down
10 changes: 10 additions & 0 deletions projects/wave-core-new/src/lib/datasets/dataset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {Observable} from 'rxjs';
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';

@Injectable({
providedIn: 'root',
Expand All @@ -17,4 +19,12 @@ export class DataSetService {
map((dataSetDicts) => dataSetDicts.map((dict) => DataSet.fromDict(dict))),
);
}

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

createDataSet(create: CreateDataSetDict): Observable<DataSetIdDict> {
return this.userService.getSessionStream().pipe(mergeMap((session) => this.backend.createDataSet(session.sessionToken, create)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<wave-sidenav-header>Add Data</wave-sidenav-header>

<mat-card>
<mat-card-header>
<mat-card-title>Select files for upload</mat-card-title>
</mat-card-header>

<mat-card-content>
<input type="file" id="file" multiple (change)="selectFiles($event)" [disabled]="submittedUpload" />
<div class="actions">
<button type="button" mat-raised-button color="primary" (click)="upload()" [disabled]="!selectedFiles || submittedUpload">
Upload
</button>
</div>
<mat-progress-bar *ngIf="progress$ | async as progress" mode="determinate" [value]="progress"></mat-progress-bar>
</mat-card-content>
</mat-card>

<mat-card *ngIf="uploadId$ | async as uploadId">
<mat-card-header>
<mat-card-title>Specify loading information</mat-card-title>
</mat-card-header>

<mat-card-content>
<p>Upload ID: {{ uploadId }}</p>

<div>Specify the loading info as Json</div>

<div>
<mat-form-field appearance="fill">
<mat-label>Choose an example</mat-label>
<mat-select [disabled]="submittedCreate">
<mat-option *ngFor="let option of exampleLoadingInfos" [value]="option" (click)="selectLoadingInfo(option)">
{{ option.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div>
<textarea name="loadingInfo" mdInput placeholder="Loading Info" rows="25" cols="100" [disabled]="submittedCreate">{{
loadingInfo
}}</textarea>
</div>
<div class="actions">
<button type="button" mat-raised-button color="primary" (click)="submitLoadingInfo(uploadId)" [disabled]="submittedCreate">
Create dataset
</button>
</div>
</mat-card-content>
</mat-card>

<mat-card *ngIf="dataSetId$ | async as dataSetId">
<mat-card-header>
<mat-card-title>Upload succesful!</mat-card-title>
</mat-card-header>

<mat-card-content> Dataset ID: {{ dataSetId.id.Internal }} </mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.actions {
padding: 1rem;
}

mat-card {
margin-bottom: 1rem;
}
Loading