Remove middleware singletons, remove typescript getters/setters from explorer interface
[arvados-workbench2.git] / src / store / data-explorer / data-explorer-middleware-service.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { getDataExplorer } from "./data-explorer-reducer";
6 import { MiddlewareAPI } from "redux";
7 import { DataColumns } from "../../components/data-table/data-table";
8
9 export abstract class DataExplorerMiddlewareService {
10     protected api: MiddlewareAPI;
11     protected readonly id: string;
12
13     protected constructor(id: string) {
14         this.id = id;
15     }
16
17     public getId() {
18         return this.id;
19     }
20
21     abstract getColumns(): DataColumns<any>;
22     abstract requestItems(api: MiddlewareAPI): void;
23
24     setApi(api: MiddlewareAPI) {
25         this.api = api;
26     }
27     getDataExplorer() {
28         return getDataExplorer(this.api.getState(), this.id);
29     }
30 }