change export directory

This commit is contained in:
2022-12-28 07:51:41 +01:00
parent 149734cb19
commit 2bdea63c0a
3 changed files with 6 additions and 7 deletions

View File

@@ -95,12 +95,10 @@ export class DataSet extends Base {
}) })
}) })
} }
static parseGoogleSheet(sheetId: string, _http: HttpClient): Promise<any> { static parseGoogleSheet(sheetId: string, _http: HttpClient): Promise<DataSet> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
_http.get<any>(`${environment.api.url}/datasets/parseGoogleSheet/${sheetId}`, _http.get<DataSet>(`${environment.api.url}/datasets/parseGoogleSheet/${sheetId}`,
).pipe(map(data => { ).pipe(map(data => new DataSet().deserialize(data)))
data.dataRows = data.dataRows.map((x: any) => new DataRow().deserialize(x))
}))
.subscribe({ .subscribe({
next: (data) => { next: (data) => {
resolve(data); resolve(data);

View File

@@ -65,7 +65,8 @@ export class DataSetEditComponent implements OnInit {
} }
async parseGoogleSheet() { async parseGoogleSheet() {
const id = this.form.get('sheetId')?.value; const id = this.form.get('sheetId')?.value;
this.document.dataRows = await DataSet.parseGoogleSheet(id, this.http$); this.document = await DataSet.parseGoogleSheet(id, this.http$);
this.document.fillForm(this.form);
this.dataSource = new MatTableDataSource(this.document.dataRows); this.dataSource = new MatTableDataSource(this.document.dataRows);
this.dataSource.paginator = this.paginator; this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;

View File

@@ -28,7 +28,7 @@ namespace WebAPI.Exports
Google.Apis.Drive.v3.Data.File body = new Google.Apis.Drive.v3.Data.File(); Google.Apis.Drive.v3.Data.File body = new Google.Apis.Drive.v3.Data.File();
body.Name = $"export-{DateTime.Now}"; body.Name = $"export-{DateTime.Now}";
body.MimeType = "application/vnd.google-apps.spreadsheet"; body.MimeType = "application/vnd.google-apps.spreadsheet";
body.Parents = new List<string> { "1Sar-9ux6GWlXKZiD-l1Mfh1gdsxZif3j" }; body.Parents = new List<string> { "1c5GBQmsIoj6a9L-JYFTaLEZ3EfkbQHPt" };
CreateRequest request = googleDriveHelper.Service.Files.Create(body); CreateRequest request = googleDriveHelper.Service.Files.Create(body);
var file = request.Execute(); var file = request.Execute();