@@ -4,38 +4,27 @@ import { PauseIcon } from '@heroicons/react/outline';
4
4
import { ExclamationCircleIcon } from '@heroicons/react/outline' ;
5
5
import { ClockIcon } from '@heroicons/react/solid' ;
6
6
import { Modal , Button } from 'react-bootstrap' ;
7
- import { CopyBlock , atomOneLight } from 'react-code-blocks' ;
8
7
import moment from 'moment' ;
9
8
import { useState } from 'react' ;
9
+ import ReactMarkdown from 'react-markdown' ;
10
+ import CodeBlock from '../components/CodeBlock' ;
10
11
11
12
const getInstructionBody = ( name , machineName ) => {
12
- if ( name === 'Bastion' ) {
13
- return (
14
- < >
15
- < CopyBlock
16
- text = { `ssh <username>@bastion.watonomous.ca` }
17
- language = "shell"
18
- theme = { atomOneLight }
19
- showLineNumbers = { false }
20
- codeBlock
21
- />
22
- </ >
23
- ) ;
24
- } else {
25
- return (
26
- < >
27
- < div >
28
- < CopyBlock
29
- text = { `ssh -i </path/to/ssh_key> -J <username>@bastion.watonomous.ca <username>@${ machineName } ` }
30
- language = "shell"
31
- theme = { atomOneLight }
32
- showLineNumbers = { false }
33
- codeBlock
34
- />
35
- </ div >
36
- </ >
37
- ) ;
38
- }
13
+ const sshInstructions =
14
+ name === 'Bastion'
15
+ ? `ssh <username>@bastion.watonomous.ca`
16
+ : `ssh -i </path/to/ssh_key> -J <username>@bastion.watonomous.ca <username>@${ machineName } ` ;
17
+ const instructionBody = `
18
+ Access ${ name } ${
19
+ name !== 'Bastion'
20
+ ? ' by using Bastion as an [SSH jumphost](https://www.tecmint.com/access-linux-server-using-a-jump-host/)'
21
+ : ''
22
+ } :
23
+ ~~~shell
24
+ ${ sshInstructions }
25
+ ~~~
26
+ ` ;
27
+ return instructionBody ;
39
28
} ;
40
29
41
30
const Check = ( { name, checksData, FQDN , machineName } ) => {
@@ -121,15 +110,9 @@ const Check = ({ name, checksData, FQDN, machineName }) => {
121
110
< Modal . Title > { name } </ Modal . Title >
122
111
</ Modal . Header >
123
112
< Modal . Body >
124
- Access { name } by using Bastion as an{ ' ' }
125
- < a
126
- className = "text-blue-500"
127
- href = "https://www.tecmint.com/access-linux-server-using-a-jump-host/"
128
- >
129
- SSH jumphost
130
- </ a >
131
- : < br /> < br />
132
- { getInstructionBody ( name , machineName ) }
113
+ < ReactMarkdown components = { { code : CodeBlock } } >
114
+ { getInstructionBody ( name , machineName ) }
115
+ </ ReactMarkdown >
133
116
</ Modal . Body >
134
117
< Modal . Footer >
135
118
< Button variant = "secondary" onClick = { handleClose } >
0 commit comments