PromucFlow_constructor/app/client/src/constants/OmnibarDocumentationConstants.ts
Kaushik Varanasi 9752631103
Bugfix: omnibar issues : fixes #3742 (#3998)
* Added reducers and sagas for cleaning up ui.pageWidgets on creating new application

* Add border and scale to omnibar helpbar on hover

* Added analytics event for omnibar fire on clicking help button

* Linked documentation buttons in API pane and DB query pane to Omnibar

* Added tests to make sure Omnibar has correct styles

* Added margin to make sure border is visible

* Added cypress tests to check that api pane documentation opens the omnibar modal

* Added tests for page widgets reducer reset widget state action

* Added cypress tests to check db documentation opens in global search modal

* remove scale transform

* update recent widgets on selecting widget from omnibar and also clear search when done

* added some documentation links for specific db queries

* added more documentation links, added analytics for omnibar open, set query on opening omnibar from navigation

* remove slicing of 1st option in recent entities, revert previous code and remove console log

* make query syntax better

* add transparent border to remove side effects

* ensure that query is empty upon opening omnibar

* add omnibar documentation helpers to constants

* remove unused files

* added omnibar open and search to readmore button in new query pane

* added analytics event, cleanup and documentation

* removed unused set queries

* Fixed failing cypress tests according to new workflow. Removed invalid comments
2021-04-26 22:15:03 +05:30

59 lines
1.1 KiB
TypeScript

import { includes, some } from "lodash";
const omnibarDocumentationHelper = (linkURL: string) => {
const documentationHeaders = [
{
text: ["mongodb", "mongo-plugin"],
query: "MongoDB",
},
{
text: ["redis"],
query: "redis",
},
{
text: ["redshift"],
query: "redshift",
},
{
text: ["amazon-s3"],
query: "Amazon S3",
},
{
text: ["querying-firestore"],
query: "Firestore",
},
{
text: ["querying-mysql"],
query: "Mysql",
},
{
text: ["querying-mssql"],
query: "Mssql",
},
{
text: ["querying-elasticsearch"],
query: "elasticsearch",
},
{
text: ["querying-postgres", "postgres-plugin"],
query: "postgres",
},
{
text: ["querying-dynamodb"],
query: "dynamodb",
},
];
const doc = documentationHeaders.find((headerItem) =>
some(headerItem.text, (el) =>
includes(linkURL.toLowerCase(), el.toLowerCase()),
),
);
if (doc) {
return doc.query;
} else {
return "";
}
};
export { omnibarDocumentationHelper };