Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit c56ae4d

Browse files
authored
Merge pull request #19 from code-kern-ai/import-options
Transfers import options to backend
2 parents 9c22493 + 8ebc682 commit c56ae4d

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

src/app/import/components/upload-records/upload-records.component.html

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
</div>
55
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
66
<div>
7-
<label
8-
class="rounded-lg relative border p-4 flex cursor-pointer h-full focus:outline-none bg-white"
7+
<label class="rounded-lg relative border p-4 flex cursor-pointer h-full focus:outline-none bg-white"
98
(click)="toggleTab(0)" [ngClass]="openTab === 0 ? 'border-black' : 'border-gray'">
109
<input type="radio" name="upload-file" [value]="0" [checked]="true"
1110
class="h-4 w-4 mt-0.5 cursor-pointer shrink-0 text-indigo-600 border-gray-300 focus:ring-indigo-500"
@@ -26,8 +25,7 @@
2625
<div class="col-span-3 lg:col-span-4 ml-3">
2726
<span id="integrate-api-0-label" class="block text-sm font-medium text-gray-900">
2827
Integrate via API </span>
29-
<span id="integrate-api-0-description"
30-
class="block text-sm font-normal text-gray-500"> Upload data
28+
<span id="integrate-api-0-description" class="block text-sm font-normal text-gray-500"> Upload data
3129
via our API. </span>
3230
</div>
3331
<div class="col-span-3 lg:col-span-2 text-right items-center flex">
@@ -42,10 +40,10 @@
4240
<label class="bg-white rounded-lg relative border p-4 flex h-full focus:outline-none">
4341
<div class="grid grid-cols-6 gap-4 w-full">
4442
<div class="col-span-3 lg:col-span-4 ml-3">
45-
<span id="integrate-database-0-label"
46-
class="block text-sm font-medium text-gray-900"> Integrate database </span>
47-
<span id="integrate-database-0-description"
48-
class="block text-sm font-normal text-gray-500"> Integrate data directly from a
43+
<span id="integrate-database-0-label" class="block text-sm font-medium text-gray-900"> Integrate
44+
database </span>
45+
<span id="integrate-database-0-description" class="block text-sm font-normal text-gray-500">
46+
Integrate data directly from a
4947
DB. </span>
5048
</div>
5149
<div class="col-span-3 lg:col-span-2 text-right items-center flex">
@@ -70,8 +68,7 @@
7068
href="https://docs.kern.ai/docs/setup" target="_blank"><span
7169
class="underline cursor-pointer">documentation</span></a> for further
7270
details.</label>
73-
<input name="twitterAPI" type="text"
74-
class="input input-sm input-bordered w-full placeholder-italic"
71+
<input name="twitterAPI" type="text" class="input input-sm input-bordered w-full placeholder-italic"
7572
placeholder="Enter your API key here ...">
7673
</div>
7774
<div class="form-control mt-6">
@@ -102,16 +99,16 @@ <h3 class="text-sm font-medium text-yellow-800">File required</h3>
10299
<div class="form-group" *ngIf="openTab === 0">
103100
<label class="text-gray-500 text-sm font-normal">
104101
You can specify import file upload options for your file. See how this is done for <a
105-
href="https://pandas.pydata.org/docs/reference/api/pandas.read_json.html"
106-
target="_blank"><span class="underline cursor-pointer">JSON</span></a>, <a
107-
href="https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html"
108-
target="_blank"><span class="underline cursor-pointer">CSV</span></a> and <a
109-
href="https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html"
110-
target="_blank"><span class="underline cursor-pointer">spreadsheets</span></a>. If you leave
102+
href="https://pandas.pydata.org/docs/reference/api/pandas.read_json.html" target="_blank"><span
103+
class="underline cursor-pointer">JSON</span></a>, <a
104+
href="https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html" target="_blank"><span
105+
class="underline cursor-pointer">CSV</span></a> and <a
106+
href="https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html" target="_blank"><span
107+
class="underline cursor-pointer">spreadsheets</span></a>. If you leave
111108
it blank, we'll use default settings
112109
</label>
113110
<div>
114-
<textarea class="shadow mt-1 p-4 text-sm w-full placeholder-indigo" rows="3"
111+
<textarea #importOptions class="shadow mt-1 p-4 text-sm w-full placeholder-indigo" rows="3"
115112
placeholder="E.g. for uncommon CSV&#10;sep=\t&#10;lineterminator=\r"></textarea>
116113
</div>
117-
</div>
114+
</div>

src/app/import/components/upload-records/upload-records.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
1+
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { timer } from 'rxjs';
44
import { ProjectApolloService } from 'src/app/base/services/project/project-apollo.service';
@@ -21,6 +21,7 @@ export class UploadRecordsComponent implements OnInit {
2121
isFileUploaded: boolean = false;
2222
openTab: number = 0;
2323
@ViewChild(UploadComponent) uploadComponent;
24+
@ViewChild('importOptions', { read: ElementRef }) importOptionsHTML: ElementRef;
2425

2526

2627
constructor(private projectApolloService: ProjectApolloService, private router: Router) { }
@@ -61,6 +62,6 @@ export class UploadRecordsComponent implements OnInit {
6162
this.router.navigate(['projects', this.projectId, 'settings'])
6263
})
6364
}
64-
this.uploadComponent.finishUpUpload(finalFileName, '');
65+
this.uploadComponent.finishUpUpload(finalFileName, this.importOptionsHTML.nativeElement.value);
6566
}
6667
}

0 commit comments

Comments
 (0)