From f890015e553d2d1af8da520a0aa51b912230c4ad Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 14 Nov 2022 15:38:36 +0100 Subject: [PATCH] change(ui) - tooltip replacement --- .../components/Announcements/Announcements.js | 6 +- .../Client/Integrations/IntegrationItem.tsx | 13 +- .../Client/Integrations/Integrations.js_ | 633 ------------------ 3 files changed, 7 insertions(+), 645 deletions(-) delete mode 100644 frontend/app/components/Client/Integrations/Integrations.js_ diff --git a/frontend/app/components/Announcements/Announcements.js b/frontend/app/components/Announcements/Announcements.js index b17e44982..55306e643 100644 --- a/frontend/app/components/Announcements/Announcements.js +++ b/frontend/app/components/Announcements/Announcements.js @@ -2,7 +2,7 @@ import React from 'react'; import stl from './announcements.module.css'; import ListItem from './ListItem'; import { connect } from 'react-redux'; -import { SlideModal, Icon, NoContent, Popup } from 'UI'; +import { SlideModal, Icon, NoContent, Tooltip } from 'UI'; import { fetchList, setLastRead } from 'Duck/announcements'; import withToggle from 'Components/hocs/withToggle'; import { withRouter } from 'react-router-dom'; @@ -45,14 +45,14 @@ class Announcements extends React.Component { return (
- +
{ unReadNotificationsCount }
-
+ {
props.onClick(e)}> {integrated && (
- + - +
)} {integration.icon.length ? integration : ( @@ -33,9 +33,4 @@ const IntegrationItem = (props: Props) => { ); }; -export default connect((state: any, props: Props) => { - const list = state.getIn([props.integration.slug, 'list']) || []; - return { - // integrated: props.integration.slug === 'issues' ? !!(list.first() && list.first().token) : list.size > 0, - }; -})(IntegrationItem); +export default IntegrationItem; diff --git a/frontend/app/components/Client/Integrations/Integrations.js_ b/frontend/app/components/Client/Integrations/Integrations.js_ deleted file mode 100644 index b4a421980..000000000 --- a/frontend/app/components/Client/Integrations/Integrations.js_ +++ /dev/null @@ -1,633 +0,0 @@ -import React from "react"; -import { connect } from "react-redux"; -import withPageTitle from "HOCs/withPageTitle"; -import { Loader, IconButton, SlideModal } from "UI"; -import { fetchList as fetchListSlack } from "Duck/integrations/slack"; -import { remove as removeIntegrationConfig } from "Duck/integrations/actions"; -import { fetchList, init } from "Duck/integrations/actions"; -import cn from "classnames"; - -import IntegrationItem from "./IntegrationItem"; -import SentryForm from "./SentryForm"; -import GithubForm from "./GithubForm"; -import SlackForm from "./SlackForm"; -import DatadogForm from "./DatadogForm"; -import StackdriverForm from "./StackdriverForm"; -import RollbarForm from "./RollbarForm"; -import NewrelicForm from "./NewrelicForm"; -import BugsnagForm from "./BugsnagForm"; -import CloudwatchForm from "./CloudwatchForm"; -import ElasticsearchForm from "./ElasticsearchForm"; -import SumoLogicForm from "./SumoLogicForm"; -import JiraForm from "./JiraForm"; -import styles from "./integrations.module.css"; -import ReduxDoc from "./ReduxDoc"; -import VueDoc from "./VueDoc"; -import GraphQLDoc from "./GraphQLDoc"; -import NgRxDoc from "./NgRxDoc/NgRxDoc"; -import SlackAddForm from "./SlackAddForm"; -import FetchDoc from "./FetchDoc"; -import MobxDoc from "./MobxDoc"; -import ProfilerDoc from "./ProfilerDoc"; -import AssistDoc from "./AssistDoc"; -import AxiosDoc from "./AxiosDoc/AxiosDoc"; - -const NONE = -1; -const SENTRY = 0; -const DATADOG = 1; -const STACKDRIVER = 2; -const ROLLBAR = 3; -const NEWRELIC = 4; -const BUGSNAG = 5; -const CLOUDWATCH = 6; -const ELASTICSEARCH = 7; -const SUMOLOGIC = 8; -const JIRA = 9; -const GITHUB = 10; -const REDUX = 11; -const VUE = 12; -const GRAPHQL = 13; -const NGRX = 14; -const SLACK = 15; -const FETCH = 16; -const MOBX = 17; -const PROFILER = 18; -const ASSIST = 19; -const AXIOS = 20; - -const TITLE = { - [SENTRY]: "Sentry", - [SLACK]: "Slack", - [DATADOG]: "Datadog", - [STACKDRIVER]: "Stackdriver", - [ROLLBAR]: "Rollbar", - [NEWRELIC]: "New Relic", - [BUGSNAG]: "Bugsnag", - [CLOUDWATCH]: "CloudWatch", - [ELASTICSEARCH]: "Elastic Search", - [SUMOLOGIC]: "Sumo Logic", - [JIRA]: "Jira", - [GITHUB]: "Github", - [REDUX]: "Redux", - [VUE]: "VueX", - [GRAPHQL]: "GraphQL", - [NGRX]: "NgRx", - [FETCH]: "Fetch", - [MOBX]: "MobX", - [PROFILER]: "Profiler", - [ASSIST]: "Assist", - [AXIOS]: "Axios", -}; - -const DOCS = [REDUX, VUE, GRAPHQL, NGRX, FETCH, MOBX, PROFILER, ASSIST]; - -const integrations = [ - "sentry", - "datadog", - "stackdriver", - "rollbar", - "newrelic", - "bugsnag", - "cloudwatch", - "elasticsearch", - "sumologic", - "issues", -]; - -@connect( - (state) => { - const props = {}; - integrations.forEach((name) => { - props[`${name}Integrated`] = - name === "issues" - ? !!( - state.getIn([name, "list"]).first() && - state.getIn([name, "list"]).first().token - ) - : state.getIn([name, "list"]).size > 0; - props.loading = - props.loading || state.getIn([name, "fetchRequest", "loading"]); - }); - const site = state.getIn(["site", "instance"]); - return { - ...props, - issues: state.getIn(["issues", "list"]).first() || {}, - slackChannelListExists: state.getIn(["slack", "list"]).size > 0, - tenantId: state.getIn(["user", "account", "tenantId"]), - jwt: state.get("jwt"), - projectKey: site ? site.projectKey : "", - }; - }, - { - fetchList, - init, - fetchListSlack, - removeIntegrationConfig, - } -) -@withPageTitle("Integrations - OpenReplay Preferences") -export default class Integrations extends React.PureComponent { - state = { - modalContent: NONE, - showDetailContent: false, - }; - - componentWillMount() { - integrations.forEach((name) => this.props.fetchList(name)); - this.props.fetchListSlack(); - } - - onClickIntegrationItem = (e, url) => { - e.preventDefault(); - window.open(url); - }; - - closeModal = () => - this.setState({ modalContent: NONE, showDetailContent: false }); - - onOauthClick = (source) => { - if (source === GITHUB) { - const githubUrl = `https://auth.openreplay.com/oauth/login?provider=github&back_url=${document.location.href}`; - const options = { - method: "GET", - credentials: "include", - headers: new Headers({ - Authorization: "Bearer " + this.props.jwt.toString(), - }), - }; - fetch(githubUrl, options).then((resp) => - resp.text().then((txt) => window.open(txt, "_self")) - ); - } - }; - - renderDetailContent() { - switch (this.state.modalContent) { - case SLACK: - return ( - - this.setState({ showDetailContent: false }) - } - /> - ); - } - } - - renderModalContent() { - const { projectKey } = this.props; - - switch (this.state.modalContent) { - case SENTRY: - return ; - case GITHUB: - return ; - case SLACK: - return ( - - this.setState({ showDetailContent: true }) - } - /> - ); - case DATADOG: - return ; - case STACKDRIVER: - return ; - case ROLLBAR: - return ; - case NEWRELIC: - return ; - case BUGSNAG: - return ; - case CLOUDWATCH: - return ; - case ELASTICSEARCH: - return ; - case SUMOLOGIC: - return ; - case JIRA: - return ; - case REDUX: - return ( - - ); - case VUE: - return ( - - ); - case GRAPHQL: - return ( - - ); - case NGRX: - return ( - - ); - case FETCH: - return ( - - ); - case MOBX: - return ( - - ); - case PROFILER: - return ( - - ); - case ASSIST: - return ( - - ); - case AXIOS: - return ( - - ); - default: - return null; - } - } - - deleteHandler = (name) => { - this.props.removeIntegrationConfig(name, null).then( - function () { - this.props.fetchList(name); - }.bind(this) - ); - }; - - showIntegrationConfig = (type) => { - this.setState({ modalContent: type }); - }; - - render() { - const { - loading, - sentryIntegrated, - stackdriverIntegrated, - datadogIntegrated, - rollbarIntegrated, - newrelicIntegrated, - bugsnagIntegrated, - cloudwatchIntegrated, - elasticsearchIntegrated, - sumologicIntegrated, - hideHeader = false, - plugins = false, - jiraIntegrated, - issuesIntegrated, - tenantId, - slackChannelListExists, - issues, - } = this.props; - const { modalContent, showDetailContent } = this.state; - return ( -
- -
{TITLE[modalContent]}
- {modalContent === SLACK && ( - - this.setState({ - showDetailContent: true, - }) - } - /> - )} -
- } - isDisplayed={modalContent !== NONE} - onClose={this.closeModal} - size={ - DOCS.includes(this.state.modalContent) - ? "middle" - : "small" - } - content={this.renderModalContent()} - detailContent={ - showDetailContent && this.renderDetailContent() - } - /> - - {!hideHeader && ( -
-

- {"Integrations"} -

-

- Power your workflow with your favourite tools. -

-
-
- )} - - {plugins && ( -
-
- Use plugins to better debug your application's - store, monitor queries and track performance issues. -
-
- - this.showIntegrationConfig(REDUX) - } - // integrated={ sentryIntegrated } - /> - this.showIntegrationConfig(VUE)} - // integrated={ sentryIntegrated } - /> - - this.showIntegrationConfig(GRAPHQL) - } - // integrated={ sentryIntegrated } - /> - this.showIntegrationConfig(NGRX)} - // integrated={ sentryIntegrated } - /> - this.showIntegrationConfig(MOBX)} - // integrated={ sentryIntegrated } - /> - - this.showIntegrationConfig(FETCH) - } - // integrated={ sentryIntegrated } - /> - - this.showIntegrationConfig(PROFILER) - } - // integrated={ sentryIntegrated } - /> - - this.showIntegrationConfig(AXIOS) - } - // integrated={ sentryIntegrated } - /> - - this.showIntegrationConfig(ASSIST) - } - // integrated={ sentryIntegrated } - /> -
-
- )} - - {!plugins && ( - -
-
-
- How are you monitoring errors and crash - reporting? -
-
- {(!issues.token || - issues.provider !== "github") && ( - - this.showIntegrationConfig(JIRA) - } - integrated={issuesIntegrated} - /> - )} - {(!issues.token || - issues.provider !== "jira") && ( - - this.showIntegrationConfig( - GITHUB - ) - } - integrated={issuesIntegrated} - deleteHandler={ - issuesIntegrated - ? () => - this.deleteHandler( - "issues" - ) - : null - } - /> - )} - - - this.showIntegrationConfig(SLACK) - } - integrated={sentryIntegrated} - /> - - this.showIntegrationConfig(SENTRY) - } - integrated={sentryIntegrated} - /> - - - this.showIntegrationConfig(BUGSNAG) - } - integrated={bugsnagIntegrated} - /> - - - this.showIntegrationConfig(ROLLBAR) - } - integrated={rollbarIntegrated} - /> - - - this.showIntegrationConfig( - ELASTICSEARCH - ) - } - integrated={elasticsearchIntegrated} - /> - - - this.showIntegrationConfig(DATADOG) - } - integrated={datadogIntegrated} - /> - - this.showIntegrationConfig( - SUMOLOGIC - ) - } - integrated={sumologicIntegrated} - /> - - this.showIntegrationConfig( - STACKDRIVER - ) - } - integrated={stackdriverIntegrated} - /> - - - this.showIntegrationConfig( - CLOUDWATCH - ) - } - integrated={cloudwatchIntegrated} - /> - - - this.showIntegrationConfig(NEWRELIC) - } - integrated={newrelicIntegrated} - /> -
-
-
-
- )} -
- ); - } -}