<commit_before>const vscode = require('vscode');

class SendHl7MessagePanel {


	//currentPanel = SendHl7MessagePanel | undefined;

	// constructor
	//constructor(hl7Message, extensionUri) {
		//this._panel = panel;
//		this._extensionUri = extensionUri;
//		this._message = hl7Message;
//	}

	// render the panel
	static render(hl7Message, extensionUri){
		this._message = hl7Message;
		if (this._panel) {
			this._panel.reveal(vscode.ViewColumn.Two);
		} 
		else {
			var panel = vscode.window.createWebviewPanel("SendHL7Message", "Send HL7 Message", vscode.ViewColumn.Two, {
			});
			this._panel = panel
			panel.webview.html = this.getHtmlForWebview(this._panel.webview, extensionUri);
		}
	}

	// _getHtmlForWebview(webview, extensionUri) {
	static getHtmlForWebview(webview, extensionUri) {
		const nonce = this.getNonce();
		const stylesPathMainPath = vscode.Uri.joinPath(extensionUri, 'media', 'stylesheet.css');
		const stylesMainUri = webview.asWebviewUri(stylesPathMainPath);

		return `<!DOCTYPE html>
		<html lang="en">
		<head>
			<meta charset="UTF-8">
			<!--
				Use a content security policy to only allow loading images from https or from our extension directory,
				and only allow scripts that have a specific nonce.
			-->
			<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}';">
			
			<meta name="viewport" content="width=device-width, initial-scale=1.0">
			<title>Send HL7 Message</title>
			<link href="${stylesMainUri}" rel="stylesheet">
		</head>
		<body>
			Send the HL7 message to the following remote host:<br><br>
  				<label for="hostname">Hostname or IP:</label>
  				<input type="text" id="hostname" name="hostname"><br>
  				<label for="port">Port:</label>
  				<input type="text" id="port" name="port"><br>
				<label for="useTls">Use TLS:</label>
				<input type="checkbox" id="useTls" name = "useTls"> <br><br>
  				<input type="button" value="Send Message" onclick = "sendHL7Message();"</input><br><br>
				<label for="hl7Message">Message:</label>
				<textarea name="hl7Message" wrap='off'>
${this._message} 
				</textarea>
		</body>
		</html>`;
	}

	static getNonce() {
		let text = '';
		const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		for (let i = 0; i < 32; i++) {
			text += possible.charAt(Math.floor(Math.random() * possible.length));
		}
		return text;
	}

}

module.exports = SendHl7MessagePanel;<commit_msg>more updates to webview panel for SendMessage - still not close to functional<commit_after>const vscode = require('vscode');

class SendHl7MessagePanel {


	//currentPanel = SendHl7MessagePanel | undefined;

	// constructor
	//constructor(hl7Message, extensionUri) {
		//this._panel = panel;
//		this._extensionUri = extensionUri;
//		this._message = hl7Message;
//	}

	// render the panel
	static render(hl7Message, extensionUri){
		this._message = hl7Message;
		if (this._panel) {
			this._panel.reveal(vscode.ViewColumn.Two);
		} 
		else {
			var panel = vscode.window.createWebviewPanel("SendHL7Message", "Send HL7 Message", vscode.ViewColumn.Two, {
				enableScripts: true
			});
			this._panel = panel
			panel.webview.html = this.getHtmlForWebview(this._panel.webview, extensionUri);
		}
	}

	// _getHtmlForWebview(webview, extensionUri) {
	static getHtmlForWebview(webview, extensionUri) {
		const nonce = this.getNonce();
		const stylesPathMainPath = vscode.Uri.joinPath(extensionUri, 'media', 'stylesheet.css');
		const stylesMainUri = webview.asWebviewUri(stylesPathMainPath);


		return `<!DOCTYPE html>
		<html lang="en">
		<head>
			<meta charset="UTF-8">
			<!--
				Use a content security policy to only allow loading images from https or from our extension directory,
				and only allow scripts that have a specific nonce.
			-->
			
			<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}';">
			<meta name="viewport" content="width=device-width, initial-scale=1.0">
			<title>Send HL7 Message</title>
			<link href="${stylesMainUri}" rel="stylesheet">

		</head>
		<body>
			<script nonce="${nonce}">
			function sendHL7Message() {
				document.getElementById("result").value = "test";
			}
			</script>

			Send the HL7 message to the following remote host:<br><br>
  				<label for="hostname">Hostname or IP:</label>
  				<input type="text" id="hostname" name="hostname"><br>
  				<label for="port">Port:</label>
  				<input type="text" id="port" name="port"><br>
				<label for="useTls">Use TLS:</label>
				<input type="checkbox" id="useTls" name = "useTls"> <br><br>
  				<button onclick="sendHL7Message()">Send Message</button><br><br>
				<label for="hl7Message">Message:</label>
				<textarea name="hl7Message" wrap='off'>
${this._message} 
				</textarea><br><br>
				<label for="result">Result:</label>
				<textarea name="result" wrap='off'>
result
				</textarea>
		</body>
		</html>`;
	}

	static getNonce() {
		let text = '';
		const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		for (let i = 0; i < 32; i++) {
			text += possible.charAt(Math.floor(Math.random() * possible.length));
		}
		return text;
	}

}

module.exports = SendHl7MessagePanel;
{'fraction_non_alphanumeric': 0.15449280777134317, 'fraction_numerical': 0.011395479170558566, 'mean_word_length': 4.223414634146342, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 84, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7474278', 'n_tokens_mistral': 2064, 'n_tokens_neox': 1807, 'n_words': 387}