-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add jobs resource. Add simple test view for sync list * Add schema to onboarding and create source * Show logs for sync history * Add jobList polling. Small ui fixes * Add log time * Fix style config * code style Co-authored-by: cgardens <giardina.charles@gmail.com>
- Loading branch information
Showing
30 changed files
with
748 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
const config: { | ||
ui: { helpLink: string; docsLink: string; workspaceId: string }; | ||
apiUrl: string; | ||
ui: { helpLink: string; docsLink: string; workspaceId: string }; | ||
apiUrl: string; | ||
} = { | ||
ui: { | ||
helpLink: "https://dataline.io/", | ||
docsLink: "https://docs.dataline.io", | ||
workspaceId: "5ae6b09b-fdec-41af-aaf7-7d94cfc33ef6" | ||
}, | ||
apiUrl: process.env.REACT_APP_API_URL || `${window.location.protocol}//${window.location.hostname}:8001/api/v1/` | ||
ui: { | ||
helpLink: "https://dataline.io/", | ||
docsLink: "https://docs.dataline.io", | ||
workspaceId: "5ae6b09b-fdec-41af-aaf7-7d94cfc33ef6" | ||
}, | ||
apiUrl: | ||
process.env.REACT_APP_API_URL || | ||
`${window.location.protocol}//${window.location.hostname}:8001/api/v1/` | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { SyncSchema } from "./resources/Schema"; | ||
|
||
export const constructInitialSchemaState = (syncSchema: SyncSchema) => { | ||
const initialChecked: Array<string> = []; | ||
syncSchema.tables.map(item => | ||
item.columns.forEach(column => | ||
column.selected | ||
? initialChecked.push(`${item.name}_${column.name}`) | ||
: null | ||
) | ||
); | ||
|
||
const formSyncSchema = syncSchema.tables.map((item: any) => ({ | ||
value: item.name, | ||
label: item.name, | ||
children: item.columns.map((column: any) => ({ | ||
value: `${item.name}_${column.name}`, | ||
label: column.name | ||
})) | ||
})); | ||
|
||
return { | ||
formSyncSchema, | ||
initialChecked | ||
}; | ||
}; | ||
|
||
export const constructNewSchema = ( | ||
syncSchema: SyncSchema, | ||
checkedState: string[] | ||
) => { | ||
const newSyncSchema = { | ||
tables: syncSchema.tables.map(item => ({ | ||
...item, | ||
columns: item.columns.map(column => ({ | ||
...column, | ||
selected: checkedState.includes(`${item.name}_${column.name}`) | ||
})) | ||
})) | ||
}; | ||
|
||
return newSyncSchema; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Resource, FetchOptions } from "rest-hooks"; | ||
import BaseResource from "./BaseResource"; | ||
import JobLogsResource from "./JobLogs"; | ||
|
||
export interface Job { | ||
id: number; | ||
configType: string; | ||
configId: string; | ||
createdAt: number; | ||
startedAt: number; | ||
updatedAt: number; | ||
status: string; | ||
} | ||
|
||
export default class JobResource extends BaseResource implements Job { | ||
readonly id: number = 0; | ||
readonly configType: string = ""; | ||
readonly configId: string = ""; | ||
readonly createdAt: number = 0; | ||
readonly startedAt: number = 0; | ||
readonly updatedAt: number = 0; | ||
readonly status: string = ""; | ||
|
||
pk() { | ||
return this.id?.toString(); | ||
} | ||
|
||
static urlRoot = "jobs"; | ||
|
||
static getFetchOptions(): FetchOptions { | ||
return { | ||
pollFrequency: 2500 // every 2,5 seconds | ||
}; | ||
} | ||
|
||
static listShape<T extends typeof Resource>(this: T) { | ||
return { | ||
...super.listShape(), | ||
schema: { jobs: [this.asSchema()] } | ||
}; | ||
} | ||
|
||
static detailShape<T extends typeof Resource>(this: T) { | ||
return { | ||
...super.detailShape(), | ||
schema: { | ||
job: this.asSchema(), | ||
logs: JobLogsResource.asSchema() | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import BaseResource from "./BaseResource"; | ||
|
||
export interface JobLogs { | ||
stdout: string[]; | ||
stderr: string[]; | ||
} | ||
|
||
export default class JobLogsResource extends BaseResource implements JobLogs { | ||
readonly stdout: string[] = []; | ||
readonly stderr: string[] = []; | ||
|
||
pk() { | ||
return ""; | ||
} | ||
|
||
static urlRoot = "jobs"; | ||
} |
Oops, something went wrong.