mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-05 09:14:50 +00:00
Treat plugin adapters generically in App
(#560)
Test Plan: Unit tests pass, and manual testing indicates that graph loading works. wchargin-branch: generic-plugin-adapters
This commit is contained in:
parent
3266eb31fa
commit
e492965c12
@ -134,21 +134,9 @@ export class App extends React.Component<Props, State> {
|
|||||||
throw new Error(`Impossible`);
|
throw new Error(`Impossible`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const githubPromise = new GithubAdapter()
|
const statics = [new GithubAdapter(), new GitAdapter()];
|
||||||
.load(selectedRepo)
|
Promise.all(statics.map((a) => a.load(selectedRepo))).then((adapters) => {
|
||||||
.then((adapter) => {
|
const graph = Graph.merge(adapters.map((x) => x.graph()));
|
||||||
const graph = adapter.graph();
|
|
||||||
return {graph, adapter};
|
|
||||||
});
|
|
||||||
|
|
||||||
const gitPromise = new GitAdapter().load(selectedRepo).then((adapter) => {
|
|
||||||
const graph = adapter.graph();
|
|
||||||
return {graph, adapter};
|
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all([gitPromise, githubPromise]).then((graphsAndAdapters) => {
|
|
||||||
const graph = Graph.merge(graphsAndAdapters.map((x) => x.graph));
|
|
||||||
const adapters = graphsAndAdapters.map((x) => x.adapter);
|
|
||||||
const data = {
|
const data = {
|
||||||
graphWithMetadata: {
|
graphWithMetadata: {
|
||||||
graph,
|
graph,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user