Clear the OOM textarea if it gets the focus

Clear the area onfocusin only if this just contains the usage hint.
This commit is contained in:
Carsten Grohmann 2019-11-05 20:45:55 +01:00
parent f8cc21809b
commit 217a0f9ee4
2 changed files with 11 additions and 2 deletions

View File

@ -121,7 +121,7 @@ function goBack() {
<div id="input">
<h2>Step 1 - Enter your OOM message</h2>
<textarea id="textarea_oom" cols="100" rows="20" autocomplete="off" title="OOM input field">Add your OOMhere</textarea>
<textarea autocomplete="off" cols="100" id="textarea_oom" onfocusin="OOMAnalyser.OOMDisplayInstance.empty_textarea_oom()" rows="20" title="OOM input field">Add your OOMhere</textarea>
<br/>
<button onclick="OOMAnalyser.OOMDisplayInstance.analyse_and_show()" title="Analyse the OOM from the input area and show it">Analyse</button>
<button onclick="OOMAnalyser.OOMDisplayInstance.reset_form()" title="Clean the input area">Reset</button>

View File

@ -609,6 +609,9 @@ class OOMAnalyser(object):
class OOMDisplay(object):
"""Display the OOM analysis"""
paste_note = "<paste your OOM here>"
"""Note for the user to paste the OOM to the textarea"""
oom_details = {}
"""Extracted result"""
@ -826,7 +829,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
def set_HTML_defaults(self, clean_oom=True):
"""Reset the whole HTML document"""
if clean_oom:
document.getElementById('textarea_oom').value = "<paste your OOM here>"
document.getElementById('textarea_oom').value = self.paste_note
hide_element('analysis')
show_element('input')
@ -939,6 +942,12 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
def copy_example_to_form(self):
document.getElementById('textarea_oom').value = self.example
def empty_textarea_oom(self):
element = document.getElementById('textarea_oom')
content = element.value
if content == self.paste_note:
element.value = ""
def reset_form(self):
self.set_HTML_defaults()