diff --git a/package.json b/package.json index b2ddf1235..1a3fd76e2 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": { @@ -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/components/confirm_dialog/index.tsx b/src/js/components/confirm_dialog/index.tsx index 0f6580a92..28eb0c4b6 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} - - - - - - - - - -); +Props) => { + const getAndIncreaseZIndex = useReqoreProperty('getAndIncreaseZIndex'); + + return ( + { + onConfirm(); + }} + zIndex={getAndIncreaseZIndex()} + > + + + + + + {children} + + + + + + + + + + ); +}; export default compose(pure(['children']), injectIntl)(ConfirmDialog); diff --git a/src/js/components/modal/index.tsx b/src/js/components/modal/index.tsx index 9019251d2..ab4c71a31 100644 --- a/src/js/components/modal/index.tsx +++ b/src/js/components/modal/index.tsx @@ -1,4 +1,5 @@ /* @flow */ +import { ReqoreBackdrop } from '@qoretechnologies/reqore'; import React, { Component } from 'react'; import _Draggable from 'react-draggable'; import ResizeHandle from '../resize/handle'; @@ -7,7 +8,6 @@ import Body from './body'; import Footer from './footer'; import Header from './header'; import Manager from './manager'; -import { ReqoreBackdrop } from '@qoretechnologies/reqore'; const Draggable: any = _Draggable; @@ -156,7 +156,7 @@ export default class Modal extends Component { // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message render() { return ( - + { if (canModify) { return ( - + {slas.length > 0 ? ( // @ts-ignore ts-migrate(2769) FIXME: No overload matches this call. - - {/* @ts-ignore ts-migrate(2739) FIXME: Type '{ children: string; small: true; }' is missi... Remove this comment to see the full error message */} - {slavalue || 'None'} - {slas.map( - // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message - (sla: any) => ( - - ) - )} - + ({ + label: sla.name, + value: sla.name, + selected: slavalue === sla.name, + }))} + onItemSelect={({ label }) => { + handleSlaChange(null, label); + }} + label={slavalue || 'None'} + /> ) : ( {slavalue || 'None'} )} {slavalue && slavalue !== 'None' && ( - )} - + ); } diff --git a/src/js/components/topbar/index.tsx b/src/js/components/topbar/index.tsx index aba4fb059..4e26785ae 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()} /> + + + > + )} + (Component) => { + return (props) => { + const property = useReqoreProperty(reqoreProperty); + + return ; + }; + }; diff --git a/src/js/hocomponents/modal.tsx b/src/js/hocomponents/modal.tsx index fa90c6385..aa3eeef5c 100644 --- a/src/js/hocomponents/modal.tsx +++ b/src/js/hocomponents/modal.tsx @@ -13,18 +13,14 @@ export default (): Function => (Component) => { const removeModal = useReqoreProperty('removeModal'); const handleOpenModal = (Modal) => { - console.log(addModal); const id = addModal(Modal); setModalId(id); }; - console.log(modalId); - return ( { - console.log(modalId); removeModal(modalId); }} {...props} diff --git a/src/js/views/root.tsx b/src/js/views/root.tsx index 971e5a42b..e7acb253a 100644 --- a/src/js/views/root.tsx +++ b/src/js/views/root.tsx @@ -397,7 +397,7 @@ export default class Root extends Component { {!isMaximized && ( ( - - - {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} - Source code for {method.name} - - - {/* @ts-ignore ts-migrate(2769) FIXME: No overload matches this call. */} - {method.body} - - -); +Props) => { + const getAndIncreaseZIndex = useReqoreProperty('getAndIncreaseZIndex'); + return ( + + + {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} + Source code for {method.name} + + + {/* @ts-ignore ts-migrate(2769) FIXME: No overload matches this call. */} + {method.body} + + + ); +}; export default ServiceMethodModal; diff --git a/src/js/views/services/tabs/methods/modal_run.tsx b/src/js/views/services/tabs/methods/modal_run.tsx index 538d35c26..f449bd1fc 100644 --- a/src/js/views/services/tabs/methods/modal_run.tsx +++ b/src/js/views/services/tabs/methods/modal_run.tsx @@ -1,16 +1,18 @@ // @flow import yaml from 'js-yaml'; -import React, { Component } from 'react'; +import { Component } from 'react'; import { connect } from 'react-redux'; import Box from '../../../../components/box'; import { Control as Button, Controls as ButtonGroup } from '../../../../components/controls'; import Dropdown, { Control, Item } from '../../../../components/dropdown'; import Modal from '../../../../components/modal'; import PaneItem from '../../../../components/pane_item'; +import injectReqore from '../../../../hocomponents/injectReqore'; import settings from '../../../../settings'; import { fetchJson, fetchWithNotifications } from '../../../../store/api/utils'; @connect() +@injectReqore('getAndIncreaseZIndex') export default class ModalRun extends Component { props: { method: any; @@ -136,7 +138,11 @@ export default class ModalRun extends Component { const { service } = this.props; return ( - + {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} Method execution for {service.name} service diff --git a/src/js/views/services/tabs/methods/row.tsx b/src/js/views/services/tabs/methods/row.tsx index 451307ae3..8cba509ef 100644 --- a/src/js/views/services/tabs/methods/row.tsx +++ b/src/js/views/services/tabs/methods/row.tsx @@ -1,5 +1,4 @@ // @flow -import React from 'react'; import compose from 'recompose/compose'; import mapProps from 'recompose/mapProps'; import pure from 'recompose/onlyUpdateForKeys'; @@ -7,7 +6,7 @@ import withHandlers from 'recompose/withHandlers'; import { ActionColumn } from '../../../../components/ActionColumn'; import ContentByType from '../../../../components/ContentByType'; // @ts-ignore ts-migrate(2306) FIXME: File '/workspace/qorus-webapp/src/js/components/co... Remove this comment to see the full error message -import { Control as Button, Controls } from '../../../../components/controls'; +import { ReqoreButton, ReqoreControlGroup } from '@qoretechnologies/reqore'; import NameColumn from '../../../../components/NameColumn'; import { Td, Tr } from '../../../../components/new_table'; import SLAControl from '../../../../components/sla_control'; @@ -55,10 +54,10 @@ Props) => ( {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} - - - - + + + + {/* @ts-ignore ts-migrate(2339) FIXME: Property 'locktype' does not exist on type 'Object... Remove this comment to see the full error message */} diff --git a/src/js/views/system/connections/controls.tsx b/src/js/views/system/connections/controls.tsx index a3ccd187c..12cebcc7f 100644 --- a/src/js/views/system/connections/controls.tsx +++ b/src/js/views/system/connections/controls.tsx @@ -1,12 +1,49 @@ -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`, { + body: JSON.stringify({ + redirect_uri, + }), + }); + + return data; + }); + + useEffect(() => { + if (value) { + window.location.href = value; + } + }, [value]); + + return ( + + {loading && Loading...} + {value && Redirecting...} + + ); +}; + const RemoteControls = ({ intl, enabled, @@ -31,6 +68,11 @@ const RemoteControls = ({ ...rest }) => { const confirmAction = useReqoreProperty('confirmAction'); + const addModal = useReqoreProperty('addModal'); + + const handleOauthClick = () => { + addModal(); + }; return ( @@ -91,9 +133,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 79e308534..d46ec3130 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 7bd73836e..df87fa726 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'; @@ -24,6 +25,7 @@ import PaneItem from '../../../components/pane_item'; import LogContainer from '../../../containers/log'; import { attrsSelector } from '../../../helpers/remotes'; import { getDependencyObjectLink } from '../../../helpers/system'; +import queryControl from '../../../hocomponents/queryControl'; import showIfPassed from '../../../hocomponents/show-if-passed'; import withDispatch from '../../../hocomponents/withDispatch'; import settings from '../../../settings'; @@ -40,6 +42,7 @@ const viewSelector = createSelector([remoteSelector, attrsSelector], (remote, at editable: attrs.editable, })); +@withRouter class ConnectionsPane extends Component { props: { remote: any; @@ -66,6 +69,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() { @@ -154,7 +161,7 @@ class ConnectionsPane extends Component { 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,30 @@ class ConnectionsPane extends Component { }, ]} > + {status && ( + { + this.props.changeStatusQuery(undefined); + this.props.changeMessageQuery(undefined); + this.props.changeMessageTitleQuery(undefined); + this.props.changeMessageDurationQuery(undefined); + + this.setState({ + status: null, + message: null, + messageTitle: null, + messageDuration: null, + }); + }} + > + {message} + + )} {this.state.error && ( @@ -326,5 +357,9 @@ export default compose( remote: { ...remote, url: settings.IS_HTTP ? remote.url : remote.safeUrl }, ...rest, })), + queryControl('status'), + queryControl('message'), + queryControl('messageTitle'), + queryControl('messageDuration'), injectIntl )(ConnectionsPane); diff --git a/src/js/views/system/slas/detail/events/view.tsx b/src/js/views/system/slas/detail/events/view.tsx index 03da0601b..0f5abf188 100644 --- a/src/js/views/system/slas/detail/events/view.tsx +++ b/src/js/views/system/slas/detail/events/view.tsx @@ -1,5 +1,4 @@ // @flow -import React from 'react'; import { connect } from 'react-redux'; import compose from 'recompose/compose'; import lifecycle from 'recompose/lifecycle'; @@ -46,7 +45,7 @@ const EventsView: Function = ({ collection, }: // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message Props) => ( - + {collection.length ? ( ( ) : ( )} - {canLoadMore && ( - - )} + {canLoadMore && } ); diff --git a/src/js/views/system/slas/detail/index.tsx b/src/js/views/system/slas/detail/index.tsx index 827f1556c..22d906eb9 100644 --- a/src/js/views/system/slas/detail/index.tsx +++ b/src/js/views/system/slas/detail/index.tsx @@ -1,16 +1,14 @@ // @flow import moment from 'moment'; -import React from 'react'; import { connect } from 'react-redux'; import compose from 'recompose/compose'; import mapProps from 'recompose/mapProps'; import pure from 'recompose/onlyUpdateForKeys'; import { createSelector } from 'reselect'; -import Box from '../../../../components/box'; -import { Breadcrumbs, Crumb, CrumbTabs } from '../../../../components/breadcrumbs'; import Flex from '../../../../components/Flex'; -import Headbar from '../../../../components/Headbar'; import { SimpleTab, SimpleTabs } from '../../../../components/SimpleTabs'; +import Box from '../../../../components/box'; +import { Breadcrumbs, Crumb, CrumbTabs } from '../../../../components/breadcrumbs'; import { DATE_FORMATS } from '../../../../constants/dates'; import patch from '../../../../hocomponents/patchFuncArgs'; import queryControl from '../../../../hocomponents/queryControl'; @@ -47,16 +45,14 @@ const SLADetail: Function = ({ }: // @ts-ignore ts-migrate(2724) FIXME: 'React' has no exported member named 'Element'. Di... Remove this comment to see the full error message Props) => ( - - - SLAs - - {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} - {sla.name} ({sla.slaid}) - - - - + + SLAs + + {/* @ts-ignore ts-migrate(2339) FIXME: Property 'name' does not exist on type 'Object'. */} + {sla.name} ({sla.slaid}) + + + @@ -121,7 +117,7 @@ export default compose( patch('load', ['fetchParams', 'id']), sync('meta'), // @ts-ignore ts-migrate(2554) FIXME: Expected 3 arguments, but got 1. - withTabs('events'), + withTabs('performance'), pure(['location', 'children']), unsync() )(SLADetail); diff --git a/yarn.lock b/yarn.lock index 02fd70dd5..74a4ea0e7 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"
{slavalue || 'None'}