From 41fe6617b7f218e9a23da3ada8dda559d71d5bb1 Mon Sep 17 00:00:00 2001 From: Foxhoundn Date: Wed, 20 Sep 2023 06:24:27 +0000 Subject: [PATCH 1/5] Do not leak header content to the main content when screen gets narrow. Closes #76 --- package.json | 2 +- src/js/components/topbar/index.tsx | 36 +++++++++++++++++------------- src/js/views/root.tsx | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index b2ddf123..bc0f5670 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qorus-ui", - "version": "1.1.10", + "version": "1.1.11", "description": "Qorus UI", "author": "Qore Technologies", "repository": { diff --git a/src/js/components/topbar/index.tsx b/src/js/components/topbar/index.tsx index aba4fb05..4e26785a 100644 --- a/src/js/components/topbar/index.tsx +++ b/src/js/components/topbar/index.tsx @@ -163,7 +163,7 @@ class Topbar extends Component { const [countryCode] = this.props.locale.split('-'); return ( - + on @@ -186,21 +186,25 @@ class Topbar extends Component { )} - - this.setState({ quickSearchValue: e.target.value })} - /> - {this.renderSearchMenu()} - this.handleSubmit()} /> - - + {!this.props.isTablet && ( + <> + + this.setState({ quickSearchValue: e.target.value })} + /> + {this.renderSearchMenu()} + this.handleSubmit()} /> + + + + )} {!isMaximized && ( Date: Wed, 20 Sep 2023 14:15:44 +0000 Subject: [PATCH 2/5] Connection updates --- package.json | 2 +- src/js/views/system/connections/controls.tsx | 46 ++++++- src/js/views/system/connections/options.tsx | 124 ++++++++----------- src/js/views/system/connections/pane.tsx | 28 ++++- yarn.lock | 8 +- 5 files changed, 129 insertions(+), 79 deletions(-) diff --git a/package.json b/package.json index bc0f5670..1a3fd76e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@blueprintjs/datetime": "^3.15.2", "@blueprintjs/select": "^3.11.2", "@monaco-editor/react": "^4.5.2", - "@qoretechnologies/reqore": "^0.37.3", + "@qoretechnologies/reqore": "^0.37.6", "@types/jest": "^27.0.1", "@types/lodash": "^4.14.197", "@types/node": "^16.7.13", diff --git a/src/js/views/system/connections/controls.tsx b/src/js/views/system/connections/controls.tsx index a3ccd187..151012f1 100644 --- a/src/js/views/system/connections/controls.tsx +++ b/src/js/views/system/connections/controls.tsx @@ -1,12 +1,47 @@ -import { ReqoreButton, ReqoreControlGroup, useReqoreProperty } from '@qoretechnologies/reqore'; +import { + ReqoreButton, + ReqoreControlGroup, + ReqoreModal, + ReqoreSpinner, + useReqoreProperty, +} from '@qoretechnologies/reqore'; +import { useEffect } from 'react'; import { injectIntl } from 'react-intl'; +import { useAsyncRetry } from 'react-use'; import compose from 'recompose/compose'; import withHandlers from 'recompose/withHandlers'; import { WebIDEButton } from '../../../components/WebIDEButton'; import withModal from '../../../hocomponents/modal'; +import settings from '../../../settings'; import actions from '../../../store/api/actions'; +import { put } from '../../../store/api/utils'; import PingModal from './modals/ping'; +const OAuth2Modal = ({ name, closeModal, ...rest }: any) => { + const redirect_uri = window.location.href; + const { loading, value } = useAsyncRetry(async () => { + const data = await put( + `${settings.REST_BASE_URL}/connections/${name}/oauth2AuthRequestUri?redirect_uri=${redirect_uri}` + ); + + return data; + }); + + useEffect(() => { + if (value) { + //console.log(value); + window.location.href = value; + } + }, [value]); + + return ( + + {loading && Loading...} + {value && Redirecting...} + + ); +}; + const RemoteControls = ({ intl, enabled, @@ -31,6 +66,11 @@ const RemoteControls = ({ ...rest }) => { const confirmAction = useReqoreProperty('confirmAction'); + const addModal = useReqoreProperty('addModal'); + + const handleOauthClick = () => { + addModal(); + }; return ( @@ -91,9 +131,7 @@ const RemoteControls = ({ icon="RemoteControlLine" tooltip="Grant OAuth2 Access" intent="info" - onClick={() => { - window.location.href = redirectUri; - }} + onClick={handleOauthClick} /> )} diff --git a/src/js/views/system/connections/options.tsx b/src/js/views/system/connections/options.tsx index 79e30853..d46ec313 100644 --- a/src/js/views/system/connections/options.tsx +++ b/src/js/views/system/connections/options.tsx @@ -11,10 +11,12 @@ import { ReqoreInput, ReqoreKeyValueTable, ReqoreMessage, + ReqoreP, ReqorePanel, ReqoreVerticalSpacer, } from '@qoretechnologies/reqore'; import { ReqoreTextEffect } from '@qoretechnologies/reqore/dist/components/Effect'; +import ReactMarkdown from 'react-markdown'; import settings from '../../../settings'; import { get } from '../../../store/api/utils'; @@ -33,56 +35,6 @@ const StyledSensitive = styled.span` background-color: #000; `; -const Option: Function = ({ - // @ts-ignore ts-migrate(2339) FIXME: Property 'objKey' does not exist on type 'Object'. - objKey, - // @ts-ignore ts-migrate(2339) FIXME: Property 'value' does not exist on type 'Object'. - value, - // @ts-ignore ts-migrate(2339) FIXME: Property 'onEdit' does not exist on type 'Object'. - onEdit, - // @ts-ignore ts-migrate(2339) FIXME: Property 'onDelete' does not exist on type 'Object... Remove this comment to see the full error message - onDelete, - // @ts-ignore ts-migrate(2339) FIXME: Property 'canEdit' does not exist on type 'Object'... Remove this comment to see the full error message - canEdit, - // @ts-ignore ts-migrate(2339) FIXME: Property 'sensitive' does not exist on type 'Objec... Remove this comment to see the full error message - sensitive, -}: // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message -Object) => { - const [isShown, setIsShown] = useState(false); - - const handleEditClick = (): void => { - onEdit('key', objKey); - onEdit('originalKey', objKey); - onEdit('value', typeof value === 'object' ? JSON.stringify(value) : value.toString()); - }; - - const handleDeleteClick = (): void => { - onDelete(objKey); - }; - - const renderValue = () => { - if (typeof value === 'object' || !sensitive || isShown) { - return JSON.stringify(value); - } - - return setIsShown(!isShown)} />; - }; - - return ( -
- "{objKey}": {renderValue()}{' '} - {canEdit && ( -
- - - - -
- )} -
- ); -}; - export const ConnectionOptionValue = ({ sensitive, DefaultComponent, value }: any) => { const [show, setShow] = useState(!sensitive); @@ -105,7 +57,7 @@ export const ConnectionOptionValue = ({ sensitive, DefaultComponent, value }: an ); }; -export default class ConnectionOptions extends Component { +class ConnectionOptions extends Component { props: Props = this.props; state: { @@ -218,7 +170,17 @@ export default class ConnectionOptions extends Component { headerSize={3} keyIcon="Settings4Line" keyAlign="right" + keyTooltip={(key) => ({ + content: ( + + {this.state.optionsData[this.props.urlProtocol][key]?.desc} + + ), + delay: 300, + maxWidth: '300px', + })} valueIcon="PriceTagLine" + valueTooltip={(value) => JSON.stringify(value)} valueRenderer={(data, DefaultComponent) => ( )} - rowActions={(option, value) => [ - { - icon: 'EditLine', - onClick: () => { - this.changeData('key', option); - this.changeData('originalKey', option); - this.changeData( - 'value', - typeof value === 'object' ? JSON.stringify(value) : value.toString() - ); + rowActions={{ + width: 120, + actions: (option, value) => [ + { + icon: 'InformationLine', + tooltip: { + title: option, + handler: 'click', + placement: 'left', + + content: ( + <> + {JSON.stringify(value)} + + + {this.state.optionsData[this.props.urlProtocol][option]?.desc} + + + + ), + }, }, - }, - { - icon: 'DeleteBinLine', - intent: 'danger', - onClick: () => { - this.handleDelete(option); + { + icon: 'EditLine', + onClick: () => { + this.changeData('key', option); + this.changeData('originalKey', option); + this.changeData( + 'value', + typeof value === 'object' ? JSON.stringify(value) : value.toString() + ); + }, }, - }, - ]} + { + icon: 'DeleteBinLine', + intent: 'danger', + onClick: () => { + this.handleDelete(option); + }, + }, + ], + }} /> ) : ( @@ -304,3 +288,5 @@ export default class ConnectionOptions extends Component { ); } } + +export default ConnectionOptions; diff --git a/src/js/views/system/connections/pane.tsx b/src/js/views/system/connections/pane.tsx index 7bd73836..e1cf628a 100644 --- a/src/js/views/system/connections/pane.tsx +++ b/src/js/views/system/connections/pane.tsx @@ -10,6 +10,7 @@ import { includes, lowerCase, size } from 'lodash'; import { Component } from 'react'; import { injectIntl } from 'react-intl'; import { connect } from 'react-redux'; +import { withRouter } from 'react-router'; import { compose } from 'recompose'; import mapProps from 'recompose/mapProps'; import { createSelector } from 'reselect'; @@ -40,6 +41,7 @@ const viewSelector = createSelector([remoteSelector, attrsSelector], (remote, at editable: attrs.editable, })); +@withRouter class ConnectionsPane extends Component { props: { remote: any; @@ -66,6 +68,10 @@ class ConnectionsPane extends Component { } = { error: null, options: null, + status: this.props.location?.query?.status, + messageTitle: this.props.location?.query?.messageTitle, + message: this.props.location?.query?.message, + messageDuration: this.props.location?.query?.messageDuration, }; componentDidMount() { @@ -150,11 +156,12 @@ class ConnectionsPane extends Component { }; render() { + console.log(this.props); // @ts-ignore ts-migrate(2339) FIXME: Property 'deps' does not exist on type 'Object'. const { deps, alerts, locked, url_hash } = this.props.remote; // @ts-ignore ts-migrate(2339) FIXME: Property 'paneTab' does not exist on type '{ remot... Remove this comment to see the full error message const { paneTab, paneId, remoteType, dispatchAction } = this.props; - const { isPassLoaded } = this.state; + const { isPassLoaded, status, message, messageTitle, messageDuration } = this.state; const canEdit = !locked && this.props.canEdit; // @ts-ignore ts-migrate(2339) FIXME: Property 'canDelete' does not exist on type '{ rem... Remove this comment to see the full error message @@ -199,6 +206,25 @@ class ConnectionsPane extends Component { }, ]} > + {status && ( + { + this.setState({ + status: null, + message: null, + messageTitle: null, + messageDuration: null, + }); + }} + > + {message} + + )} {this.state.error && ( diff --git a/yarn.lock b/yarn.lock index 02fd70dd..74a4ea0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2130,10 +2130,10 @@ chokidar "^3.5.3" fs-extra "^10.0.1" -"@qoretechnologies/reqore@^0.37.3": - version "0.37.3" - resolved "https://registry.yarnpkg.com/@qoretechnologies/reqore/-/reqore-0.37.3.tgz#b6a77a5acde0d4ab75728127ed7b6292b7802279" - integrity sha512-PB33Vi7q8K7cx+5oSf/10tmk55D74tfYbK/E58AjSK59d0TITusqtaJ29AeK3AbVMxSAHBAeVTtqtft4vUeFxw== +"@qoretechnologies/reqore@^0.37.6": + version "0.37.6" + resolved "https://registry.yarnpkg.com/@qoretechnologies/reqore/-/reqore-0.37.6.tgz#ac2ecbcddfd116f60ffe442893038c290d00551e" + integrity sha512-YeryfvQruN45DrXpSYOyBQ23lP/nmUd+j/U7c4N9YvsG+CvUgSOStPfUzNm5BBf9tilNt1SP4c4GhMxsixjTcA== dependencies: "@popperjs/core" "^2.11.6" "@react-spring/web" "^9.6.1" From 964f3139988074a98d8315a02b4efb3ecf7962a6 Mon Sep 17 00:00:00 2001 From: Foxhoundn Date: Thu, 21 Sep 2023 07:17:43 +0000 Subject: [PATCH 3/5] Closes #81, Closes #80 --- src/js/components/confirm_dialog/index.tsx | 73 ++++++++++--------- src/js/components/modal/index.tsx | 4 +- src/js/components/sla_control/index.tsx | 42 +++++------ src/js/hocomponents/injectReqore.tsx | 21 ++++++ src/js/views/services/pane/index.tsx | 14 ++-- .../services/tabs/methods/modal_code.tsx | 29 ++++---- .../views/services/tabs/methods/modal_run.tsx | 10 ++- src/js/views/services/tabs/methods/row.tsx | 11 ++- .../views/system/slas/detail/events/view.tsx | 7 +- src/js/views/system/slas/detail/index.tsx | 26 +++---- 10 files changed, 128 insertions(+), 109 deletions(-) create mode 100644 src/js/hocomponents/injectReqore.tsx diff --git a/src/js/components/confirm_dialog/index.tsx b/src/js/components/confirm_dialog/index.tsx index 0f6580a9..28eb0c4b 100644 --- a/src/js/components/confirm_dialog/index.tsx +++ b/src/js/components/confirm_dialog/index.tsx @@ -1,5 +1,5 @@ // @flow -import React from 'react'; +import { useReqoreProperty } from '@qoretechnologies/reqore'; import { FormattedMessage, injectIntl } from 'react-intl'; import compose from 'recompose/compose'; import pure from 'recompose/onlyUpdateForKeys'; @@ -21,38 +21,43 @@ const ConfirmDialog: Function = ({ // @ts-ignore ts-migrate(2339) FIXME: Property 'intl' does not exist on type 'Props'. intl, }: // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message -Props) => ( - { - onConfirm(); - }} - > - - - - - - {children} - - - - -