-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support importing filters/charts from v2
- Loading branch information
1 parent
0667ff6
commit 6b29bf7
Showing
13 changed files
with
275 additions
and
21 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
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 |
---|---|---|
|
@@ -482,7 +482,6 @@ export class Providers { | |
}), | ||
); | ||
}; | ||
|
||
return { | ||
import: (): void => { | ||
bridge | ||
|
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { CancelablePromise } from 'platform/env/promise'; | ||
import { Logger } from 'platform/log'; | ||
|
||
import * as fs from 'fs'; | ||
import * as Requests from 'platform/ipc/request'; | ||
|
||
export const handler = Requests.InjectLogger< | ||
Requests.File.Read.Request, | ||
CancelablePromise<Requests.File.Read.Response> | ||
>( | ||
( | ||
_log: Logger, | ||
request: Requests.File.Read.Request, | ||
): CancelablePromise<Requests.File.Read.Response> => { | ||
return new CancelablePromise((resolve, _reject) => { | ||
if (!fs.existsSync(request.file)) { | ||
return resolve( | ||
new Requests.File.Read.Response({ | ||
text: undefined, | ||
error: `File ${request.file} doesn't exist`, | ||
}), | ||
); | ||
} | ||
fs.promises | ||
.readFile(request.file, { encoding: 'utf-8' }) | ||
.then((text: string) => { | ||
return resolve( | ||
new Requests.File.Read.Response({ | ||
text, | ||
error: undefined, | ||
}), | ||
); | ||
}) | ||
.catch((err: Error) => { | ||
return resolve( | ||
new Requests.File.Read.Response({ | ||
text: undefined, | ||
error: `Fail to read file ${request.file}: ${err.message}`, | ||
}), | ||
); | ||
}); | ||
}); | ||
}, | ||
); |
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
Oops, something went wrong.