Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions artemis-console-extension/artemis-extension/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
},
"dependencies": {
"@hawtio/react": "1.12.5",
"@monaco-editor/react": "^4.6.0",
"@patternfly/react-charts": "^7.4.9",
"@patternfly/react-code-editor": "^5.4.18",
"@patternfly/react-core": "^5.4.14",
Expand All @@ -23,7 +22,6 @@
"@patternfly/react-topology": "^5.4.1",
"artemis-console-plugin": "workspace:*",
"d3": "^7.9.0",
"monaco-editor": "^0.52.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.30.3"
Expand All @@ -38,7 +36,6 @@
"css-minimizer-webpack-plugin": "^7.0.2",
"html-webpack-plugin": "^5.6.6",
"mini-css-extract-plugin": "^2.9.4",
"monaco-editor-webpack-plugin": "^7.1.1",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"replace": "^1.2.2",
Expand Down
21 changes: 2 additions & 19 deletions artemis-console-extension/artemis-extension/app/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const TerserPlugin = require("terser-webpack-plugin")
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin")
const { WebpackManifestPlugin } = require("webpack-manifest-plugin")
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const bodyParser = require('body-parser')

const outputPath = path.resolve(__dirname, 'build')
Expand Down Expand Up @@ -128,23 +127,12 @@ module.exports = (webpackEnv, args) => {
singleton: true,
requiredVersion: dependencies['@hawtio/react'],
},
'monaco-editor': {
singleton: true,
requiredVersion: dependencies['monaco-editor'],
},
'@patternfly/react-core': {
singleton: true,
requiredVersion: dependencies['@patternfly/react-core'],
},
}
}),
new MonacoWebpackPlugin({
// 'html' is required as workaround for 'xml'
// https://github.com/microsoft/monaco-editor/issues/1509
languages: ['xml', 'json', 'html'],
publicPath: '',
globalAPI: true
}),
new InvestigationPlugin({})
],
entry: "./src/index.ts",
Expand Down Expand Up @@ -235,6 +223,7 @@ module.exports = (webpackEnv, args) => {
alias: {
'artemis-console-plugin': path.resolve(__dirname, '../packages/artemis-console-plugin/src'),
'@thumbmarkjs/thumbmarkjs': path.join(__dirname, '../node_modules/@thumbmarkjs/thumbmarkjs/dist/thumbmark.esm.js'),
'monaco-editor': false,
},
},
optimization: isEnvProduction ? {
Expand Down Expand Up @@ -284,18 +273,12 @@ module.exports = (webpackEnv, args) => {
return `${cacheGroupKey}-${packageName}`;
}

// Default to the cache group key (e.g., react, patternfly, monaco)
// Default to the cache group key (e.g., react, patternfly)
return cacheGroupKey;
},
priority: 30,
enforce: true,
},
monaco: {
test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/,
name: 'monaco',
priority: 25,
enforce: true,
},
hawtio: {
test: /[\\/]node_modules[\\/]@hawtio[\\/]/,
name: 'hawtio',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
},
"devDependencies": {
"@hawtio/react": "1.12.5",
"@monaco-editor/react": "^4.6.0",
"@patternfly/react-charts": "^7.4.9",
"@patternfly/react-code-editor": "^5.4.18",
"@patternfly/react-core": "^5.4.14",
Expand All @@ -46,7 +45,6 @@
"jest": "^30.2.0",
"jest-environment-jsdom": "^30.2.0",
"jest-fetch-mock": "^3.0.3",
"monaco-editor": "^0.52.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.30.3",
Expand All @@ -59,7 +57,6 @@
},
"peerDependencies": {
"@hawtio/react": "^1.12",
"@monaco-editor/react": "^4",
"@patternfly/react-charts": "^7",
"@patternfly/react-code-editor": "^5",
"@patternfly/react-core": "^5",
Expand All @@ -68,7 +65,6 @@
"@patternfly/react-table": "^5",
"@patternfly/react-tokens": "^5",
"@patternfly/react-topology": "^5",
"monaco-editor": "^0.52",
"react": "^17 || ^18",
"react-dom": "^17 || ^18",
"react-router-dom": "^6.30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,17 @@ import {
Checkbox,
Tooltip,
Popover,
TextContent
TextContent,
TextArea
} from '@patternfly/react-core'
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon'
import { InfoCircleIcon } from '@patternfly/react-icons/dist/esm/icons/info-circle-icon'
import { TrashIcon } from '@patternfly/react-icons/dist/esm/icons/trash-icon'
import { CodeEditor, Language } from '@patternfly/react-code-editor'
import { Language } from '@patternfly/react-code-editor'
import { eventService, jolokiaService } from '@hawtio/react'
import { artemisService } from '../artemis-service'
import { Message } from './MessageView'

import * as monacoEditor from 'monaco-editor'
import { loader } from '@monaco-editor/react'

loader.config({ monaco: monacoEditor })

type SendBodyMessageProps = {
onBodyChange: (body: string) => void
body?: string
Expand All @@ -67,24 +63,16 @@ const MessageBody: React.FunctionComponent<SendBodyMessageProps> = props => {
const [messageBody, setMessageBody] = useState<string>(props.body?props.body:'')
const [selectedFormat, setSelectedFormat] = useState<Language>(Language.xml)
const [isDropdownOpen, setDropdownOpen] = useState(false)
const editorRef = useRef<monacoEditor.editor.IStandaloneCodeEditor | null>(null)

const editorDidMount = (editor: monacoEditor.editor.IStandaloneCodeEditor) => {
editorRef.current = editor
}

const handleAutoFormat = () => {
if (editorRef.current) {
const model = editorRef.current.getModel()
if (model) {
if (selectedFormat === Language.xml) {
//monaco doesn't have built in xml formatter
updateMessageBody(xmlFormat(messageBody))
} else {
const range = model.getFullModelRange()
editorRef.current.trigger('', 'editor.action.formatDocument', { range })
}
}
try {
if (selectedFormat === Language.xml) {
updateMessageBody(xmlFormat(messageBody))
} else if (selectedFormat === Language.json) {
updateMessageBody(JSON.stringify(JSON.parse(messageBody), null, 2))
}
} catch {
// ignore formatting errors
}
}

Expand All @@ -104,13 +92,11 @@ const MessageBody: React.FunctionComponent<SendBodyMessageProps> = props => {
return (
<>
<FormGroup label='Message'>
<CodeEditor
code={messageBody}
onEditorDidMount={editorDidMount}
language={selectedFormat}
height={'300px'}
onChange={updateMessageBody}
/>
<TextArea
value={messageBody}
onChange={(_event, value) => updateMessageBody(value)}
rows={12}
/>
</FormGroup>
<FormGroup>
<Flex>
Expand Down Expand Up @@ -292,61 +278,85 @@ export const SendMessage: React.FunctionComponent<SendMessageProps> = (props: Se
return (
<PageSection variant='light'>
<Title headingLevel='h2'>Send Message to {props.isAddress ? 'Address' : 'Queue'} {props.address}{' '}
<Popover bodyContent={Hint}><OutlinedQuestionCircleIcon /></Popover></Title>
<Text component='p'> <br /></Text>
<Popover bodyContent={Hint}>
<OutlinedQuestionCircleIcon />
</Popover>
</Title>

<Text component='p'><br /></Text>

<Form onSubmit={handleSubmit}>
<FormGroup
label="Durable"
labelIcon={<Tooltip content='Mark the message as persistent and write it to the broker journal if the destination queue is durable.'><InfoCircleIcon /></Tooltip>}
>
<Checkbox
isChecked={isDurableChecked}
onChange={() => setIsDurableChecked(!isDurableChecked)}
id="durable" />

</FormGroup>
<FormGroup label="Create Message ID"
labelIcon={
<Tooltip content='Select to request that the broker generates a universally unique identifier (UUID) on the message before it is routed. For a JMS client, the UUID is the JMS Message ID of the message. Normally, not required if you are using a non-JMS client.'><InfoCircleIcon />
</Tooltip>}>
<Checkbox
isChecked={isCreateIDChecked}
onChange={() => setIsCreateIDChecked(!isCreateIDChecked)}
id="createid" />
</FormGroup>
<FormGroup label="Use Current Logged in User"
labelIcon={<Tooltip content='Use the credentials of the user that is currently logged in to the console to send a message. If you want to use a different user, clear the checkbox and specify a username and password.'><InfoCircleIcon /></Tooltip>}
<Flex
direction={{ default: 'column', md: 'row' }}
gap={{ default: 'gapMd' }}
alignItems={{ default: 'alignItemsFlexEnd' }}
>
<Checkbox
isChecked={isUseLogonChecked}
onChange={() => setIsUselogonChecked(!isUseLogonChecked)}
id="uselogon" />
</FormGroup>
{!isUseLogonChecked &&
<><FormGroup label="Username">
<TextInput
value={username}
type='text'
onChange={handleUsernameChange}
id="username"
name="username" />
</FormGroup><FormGroup label="Password">
<FlexItem>
<FormGroup
label="Durable"
labelIcon={<Tooltip content='Mark the message as persistent and write it to the broker journal if the destination queue is durable.'><InfoCircleIcon /></Tooltip>}>
<Checkbox
isChecked={isDurableChecked}
onChange={() => setIsDurableChecked(!isDurableChecked)}
id="durable"/>
</FormGroup>
</FlexItem>

<FlexItem>
<FormGroup
label="Create Message ID"
labelIcon={<Tooltip content='Select to request that the broker generates a universally unique identifier (UUID) on the message before it is routed.'><InfoCircleIcon /></Tooltip>}>
<Checkbox
isChecked={isCreateIDChecked}
onChange={() => setIsCreateIDChecked(!isCreateIDChecked)}
id="createid"/>
</FormGroup>
</FlexItem>

<FlexItem>
<FormGroup
label="Use Current Logged in User"
labelIcon={<Tooltip content='Use the credentials of the user that is currently logged in to the console.'><InfoCircleIcon /></Tooltip>}>
<Checkbox
isChecked={isUseLogonChecked}
onChange={() => setIsUselogonChecked(!isUseLogonChecked)}
id="uselogon"/>
</FormGroup>
</FlexItem>
</Flex>

{!isUseLogonChecked && (
<>
<FormGroup label="Username">
<TextInput
value={username}
type='text'
onChange={handleUsernameChange}
id="username"
name="username"/>
</FormGroup>

<FormGroup label="Password">
<TextInput
value={password}
type='password'
onChange={handlePasswordChange}
id="password"
name="password" />
</FormGroup></>
}
name="password"/>
</FormGroup>
</>
)}

<MessageHeaders onHeadersChange={updateHeaders} headers={props.message?.StringProperties}/>
<MessageBody onBodyChange={updateTheMessageBody} body={props.message?.text} />
<FormGroup>
<MessageBody onBodyChange={updateTheMessageBody} body={props.message?.text}/>

<FormGroup>
<Button type='submit' className='pf-m-1-col'>
Send
</Button>
</FormGroup>

</Form>
</PageSection>
)
Expand Down
Loading