Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/164928

Change subject: MT health check for the language pairs
......................................................................

MT health check for the language pairs

Simple test to see if the MT backend can respond to
each language pair for which cxserver is configured.
This might also prepare the processing pipelines.
This dos not test whether the machine translation is correct or not.

Change-Id: I0bb7251af8b509aae9a76946a50901337b3fea6e
---
D public/js/mt.js
A public/mt/css/main.css
M public/mt/index.html
3 files changed, 82 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/28/164928/1

diff --git a/public/js/mt.js b/public/js/mt.js
deleted file mode 100644
index 9eca076..0000000
--- a/public/js/mt.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*jshint browser:true, jquery:true */
-( function ( $ ) {
-       'use strict';
-
-       $( document ).ready( function () {
-               $( 'progress' ).hide();
-               $( 'button' ).click( function () {
-                       $( '.targetHtmlRaw' ).text( '' );
-                       $( '.targetHtmlRendered' ).html( '' );
-                       $( 'progress' ).show();
-                       $( '.status' ).text( 'Connecting to server...' );
-                       var sourceHtml = $( 'textarea[name=sourceHtml]' ).val(),
-                               sourceLanguage = $( 
'input[name=sourceLanguage]' ).val(),
-                               targetLanguage = $( 
'input[name=targetLanguage]' ).val(),
-                url = '/mt/' + sourceLanguage + '/' + targetLanguage;
-                       $.post( url, sourceHtml, function ( response ) {
-                               $( '.targetHtmlRaw' ).text( response );
-                               $( '.targetHtmlRendered' ).html( response );
-                       } ).fail( function () {
-                               $( '.targetHtmlRendered' ).html( 
'<h1>Error</h1>' );
-                       } ).always( function () {
-                               $( 'progress' ).hide();
-                       } );
-               } );
-       } );
-}( jQuery ) );
diff --git a/public/mt/css/main.css b/public/mt/css/main.css
new file mode 100644
index 0000000..3608481
--- /dev/null
+++ b/public/mt/css/main.css
@@ -0,0 +1,46 @@
+body {
+       width: 80%;
+       margin-left: 10%;
+       color: #555;
+}
+
+label {
+       width: 20%;
+}
+
+input {
+       width: 40%;
+       padding: 5px;
+}
+
+textarea {
+       width: 100%;
+}
+.lang {
+       width: 5%;
+}
+button {
+       width: 10%;
+       padding: 5px;
+}
+.status {
+       color: grey;
+}
+
+.status.ok {
+       color: green;
+}
+
+.status.fail {
+       color: red;
+}
+
+table {
+       border-collapse: collapse;
+}
+
+table, th, td {
+       border: 1px solid #aaa;
+       width: 20%;
+       padding: 5px;
+}
\ No newline at end of file
diff --git a/public/mt/index.html b/public/mt/index.html
index 523f415..ea09d86 100644
--- a/public/mt/index.html
+++ b/public/mt/index.html
@@ -1,23 +1,38 @@
 <html>
-       <head>
-           <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
-           <title>Apertium Wrapper</title>
-           <link rel="stylesheet" href="../css/main.css" type="text/css" />
-       </head>
-       <body>
-           <h1>Apertium Wrapper</h1>
-           <div class="form">
-               <label for="sourceHtml">Enter some HTML</label><br>
-               <textarea name="sourceHtml" style="width: 100%; height: 
10em"><p><s>Además</s> de Valencia. Un dos <b><a href="3">tres</a> quatre <i><a 
href="5">cinc</a> sis set</i> vuit nou</b> deu</p></textarea><br>
-               <label for="sourceLanguage">from</label>
-               <input class="lang" name="sourceLanguage" value="es" />
-               <label for="targetLanguage">to</label>
-               <input class="lang" name="targetLanguage" value="ca" />
-               <button>Go</button>
-               <progress></progress>
-           </div>
-           <div class="targetHtmlRendered"></div>
-           <div class="targetHtmlRaw"></div>
-           <script src="../js/mt.js"></script>
-       </body>
+
+<head>
+    <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
+    <title>CX Machine Translation</title>
+    <link rel="stylesheet" href="css/main.css" type="text/css" />
+    <script src="js/main.js"></script>
+</head>
+
+<body>
+    <h1>CX Machine Translation</h1>
+    <div class="form">
+        <label for="sourceHtml">Enter some HTML</label>
+        <br>
+        <textarea name="sourceHtml" style="width: 100%; height: 10em">
+            <p><s>Además</s> de Valencia. Un dos <b><a href="3">tres</a> 
quatre <i><a href="5">cinc</a> sis set</i> vuit nou</b> deu</p>
+        </textarea>
+        <br>
+        <label for="sourceLanguage">from</label>
+        <input class="lang" name="sourceLanguage" value="es" />
+        <label for="targetLanguage">to</label>
+        <input class="lang" name="targetLanguage" value="ca" />
+        <button class="translate">Go</button>
+        <progress></progress>
+    </div>
+    <div class="targetHtmlRendered"></div>
+    <div class="targetHtmlRaw"></div>
+    <h2>MT Health check</h2>
+    <p>Simple test to see if the MT backend can respond to each language pair 
for which cxserver is configured. This might also prepare the processing 
pipelines. This dos not test whether the machine translation is correct or 
not.</p>
+    <button class="check">Start</button>
+    <table class='mthealth'></table>
+</body>
+
 </html>
+
+
+
+

-- 
To view, visit https://gerrit.wikimedia.org/r/164928
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bb7251af8b509aae9a76946a50901337b3fea6e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to