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:
William Chargin 2018-07-28 11:24:06 -07:00 committed by GitHub
parent 3266eb31fa
commit e492965c12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,21 +134,9 @@ export class App extends React.Component<Props, State> {
throw new Error(`Impossible`);
}
const githubPromise = new GithubAdapter()
.load(selectedRepo)
.then((adapter) => {
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 statics = [new GithubAdapter(), new GitAdapter()];
Promise.all(statics.map((a) => a.load(selectedRepo))).then((adapters) => {
const graph = Graph.merge(adapters.map((x) => x.graph()));
const data = {
graphWithMetadata: {
graph,