## Description This PR adds a property pane control through which we can browse the datsource, tables and columns. This will be used later in the one click feature. Fixes #21504 ## Type of change - Chore (housekeeping or task changes that don't impact user perception ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { error } from "loglevel";
|
|
|
|
export default class WidgetQueryGeneratorRegistry {
|
|
private static queryGeneratorMap = new Map();
|
|
|
|
static register(id: string, queryGenerator: any) {
|
|
if (WidgetQueryGeneratorRegistry.queryGeneratorMap.has(id)) {
|
|
error("There is already a widget query generator with the given id:", id);
|
|
|
|
return;
|
|
}
|
|
|
|
WidgetQueryGeneratorRegistry.queryGeneratorMap.set(id, queryGenerator);
|
|
}
|
|
|
|
static clear() {
|
|
WidgetQueryGeneratorRegistry.queryGeneratorMap.clear();
|
|
}
|
|
|
|
static get(id: string) {
|
|
const queryAdaptor = WidgetQueryGeneratorRegistry.queryGeneratorMap.get(id);
|
|
|
|
if (!queryAdaptor) {
|
|
error("Couldn't find the query generator with the given id:", id);
|
|
return;
|
|
}
|
|
|
|
return queryAdaptor;
|
|
}
|
|
|
|
static has(id: string) {
|
|
return WidgetQueryGeneratorRegistry.queryGeneratorMap.has(id);
|
|
}
|
|
}
|
|
|
|
//testing coder
|
|
WidgetQueryGeneratorRegistry.register("5e687c18fb01e64e6a3f873f", {});
|
|
WidgetQueryGeneratorRegistry.register("5c9f512f96c1a50004819786", {});
|
|
WidgetQueryGeneratorRegistry.register("6080f9266b8cfd602957ba72", {});
|
|
//
|