-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cancel check connection button (#11360)
* Implement check connection * Add requeset cancelling * Remove unused props * Temporary comment analytics * Add analytics calls * Minor lint fixes * fix renaming
- Loading branch information
Showing
38 changed files
with
691 additions
and
648 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
44 changes: 44 additions & 0 deletions
44
airbyte-webapp/src/core/domain/connector/DestinationService.ts
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,44 @@ | ||
import { AirbyteRequestService } from "core/request/AirbyteRequestService"; | ||
|
||
import Status from "core/statuses"; | ||
import { LogsRequestError } from "core/request/LogsRequestError"; | ||
import { Scheduler } from "./types"; | ||
import { ConnectionConfiguration } from "core/domain/connection"; | ||
|
||
class DestinationService extends AirbyteRequestService { | ||
get url(): string { | ||
return "destinations"; | ||
} | ||
|
||
public async check_connection( | ||
params: { | ||
destinationId?: string; | ||
connectionConfiguration?: ConnectionConfiguration; | ||
}, | ||
requestParams?: RequestInit | ||
): Promise<Scheduler> { | ||
const url = !params.destinationId | ||
? `scheduler/${this.url}/check_connection` | ||
: params.connectionConfiguration | ||
? `${this.url}/check_connection_for_update` | ||
: `${this.url}/check_connection`; | ||
|
||
// migrated from rest-hooks. Needs proper fix to `Scheduler` type | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const result = await this.fetch<any>(url, params, requestParams); | ||
|
||
// If check connection for destination has status 'failed' | ||
if (result.status === Status.FAILED) { | ||
const jobInfo = { | ||
...result.jobInfo, | ||
status: result.status, | ||
}; | ||
|
||
throw new LogsRequestError(jobInfo, jobInfo, result.message); | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
|
||
export { DestinationService }; |
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,9 +1,43 @@ | ||
import { AirbyteRequestService } from "core/request/AirbyteRequestService"; | ||
import { ConnectionConfiguration } from "../connection"; | ||
import { Scheduler } from "./types"; | ||
import Status from "core/statuses"; | ||
import { LogsRequestError } from "core/request/LogsRequestError"; | ||
|
||
class SourceService extends AirbyteRequestService { | ||
get url(): string { | ||
return "sources"; | ||
} | ||
|
||
public async check_connection( | ||
params: { | ||
sourceId?: string; | ||
connectionConfiguration?: ConnectionConfiguration; | ||
}, | ||
requestParams?: RequestInit | ||
): Promise<Scheduler> { | ||
const url = !params.sourceId | ||
? `scheduler/${this.url}/check_connection` | ||
: params.connectionConfiguration | ||
? `${this.url}/check_connection_for_update` | ||
: `${this.url}/check_connection`; | ||
|
||
// migrated from rest-hooks. Needs proper fix to `Scheduler` type | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const result = await this.fetch<any>(url, params, requestParams); | ||
|
||
// If check connection for source has status 'failed' | ||
if (result.status === Status.FAILED) { | ||
const jobInfo = { | ||
...result.jobInfo, | ||
status: result.status, | ||
}; | ||
|
||
throw new LogsRequestError(jobInfo, jobInfo, result.message); | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
|
||
export { SourceService }; |
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 was deleted.
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
Oops, something went wrong.