mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into development
This commit is contained in:
		@@ -15,7 +15,7 @@ class AdminUserTable(Table):
 | 
			
		||||
    role_id = Col('Role', column_html_attrs={'class': 'role'},
 | 
			
		||||
                  th_html_attrs={'class': 'sort',
 | 
			
		||||
                                 'data-sort': 'role'})
 | 
			
		||||
    confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'},
 | 
			
		||||
    confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'},  # noqa
 | 
			
		||||
                    th_html_attrs={'class': 'sort',
 | 
			
		||||
                                   'data-sort': 'confirmed'})
 | 
			
		||||
    id = Col('User Id', column_html_attrs={'class': 'id'},
 | 
			
		||||
@@ -23,7 +23,8 @@ class AdminUserTable(Table):
 | 
			
		||||
                            'data-sort': 'id'})
 | 
			
		||||
    url = LinkCol('Profile', 'admin.user',
 | 
			
		||||
                  url_kwargs=dict(user_id='id'),
 | 
			
		||||
                  anchor_attrs={'class': 'waves-effect waves-light btn-small'})
 | 
			
		||||
                  anchor_attrs={'class': 'waves-effect waves-light btn-floating'},  # noqa
 | 
			
		||||
                  text_fallback='<i class="material-icons">edit</i>')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AdminUserItem(object):
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ from .. import db
 | 
			
		||||
from ..decorators import admin_required
 | 
			
		||||
from ..models import Role, User
 | 
			
		||||
from ..profile import tasks as profile_tasks
 | 
			
		||||
import html
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@admin.route('/')
 | 
			
		||||
@@ -17,7 +18,7 @@ def index():
 | 
			
		||||
    items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed, u.id)
 | 
			
		||||
             for u in users]
 | 
			
		||||
    # Convert table object to html string
 | 
			
		||||
    table = AdminUserTable(items).__html__()
 | 
			
		||||
    table = html.unescape(AdminUserTable(items).__html__())
 | 
			
		||||
    # Add class "list" to tbody element. Needed for "List.js"
 | 
			
		||||
    table = table.replace('tbody', 'tbody class="list"', 1)
 | 
			
		||||
    return render_template('admin/index.html.j2', table=table,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,9 @@ class JobInputTable(Table):
 | 
			
		||||
    url = LinkCol('Download', 'jobs.download_job_input',
 | 
			
		||||
                  url_kwargs=dict(job_id='job.id',
 | 
			
		||||
                                  job_input_id='input_id'),
 | 
			
		||||
                  anchor_attrs={'class': 'waves-effect waves-light btn-small',
 | 
			
		||||
                                'download': ''})
 | 
			
		||||
                  anchor_attrs={'class': 'waves-effect waves-light btn-floating',
 | 
			
		||||
                                'download': ''},
 | 
			
		||||
                  text_fallback='<i class="material-icons">file_download</i>')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class JobInputItem(object):
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ from . import tasks
 | 
			
		||||
from . tables import JobInputItem, JobInputTable
 | 
			
		||||
from ..models import Job, JobInput, JobResult
 | 
			
		||||
import os
 | 
			
		||||
import html
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@jobs.route('/<int:job_id>')
 | 
			
		||||
@@ -16,8 +17,8 @@ def job(job_id):
 | 
			
		||||
        abort(403)
 | 
			
		||||
    items = [JobInputItem(input.filename, job, input.id)
 | 
			
		||||
             for input in job.inputs]
 | 
			
		||||
    # Convert table object to html string
 | 
			
		||||
    job_input_table = JobInputTable(items).__html__()
 | 
			
		||||
    # Convert table object to html string and unescape <>& for al little hack to use icons in buttons
 | 
			
		||||
    job_input_table = html.unescape(JobInputTable(items).__html__())
 | 
			
		||||
    # Add class "list" to tbody element. Needed for "List.js"
 | 
			
		||||
    job_input_table = job_input_table.replace('tbody', 'tbody class="list"', 1)
 | 
			
		||||
    return render_template('jobs/job.html.j2',
 | 
			
		||||
 
 | 
			
		||||
@@ -106,12 +106,27 @@
 | 
			
		||||
          <p>Processed result files.</p>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col s12 m10">
 | 
			
		||||
          <div class="results row">
 | 
			
		||||
            <div class="show-if-only-child">
 | 
			
		||||
              <span class="card-title"><i class="left material-icons" style="font-size: inherit;">file_download</i>Nothing here...</span>
 | 
			
		||||
              <p>No results available (yet). Is the job already completed?</p>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <table class="highlight responsive-table">
 | 
			
		||||
            <thead>
 | 
			
		||||
              <tr>
 | 
			
		||||
                <th>Result Type</th>
 | 
			
		||||
                <th>Archive Name</th>
 | 
			
		||||
                <th>Download</th>
 | 
			
		||||
              </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody class="results">
 | 
			
		||||
              <tr class="show-if-only-child">
 | 
			
		||||
                <td colspan="3">
 | 
			
		||||
                  <span class="card-title">
 | 
			
		||||
                    <i class="left material-icons" style="font-size: inherit;">file_download</i>Nothing here...
 | 
			
		||||
                  </span>
 | 
			
		||||
                  <p>
 | 
			
		||||
                    No results available (yet). Is the job already completed?
 | 
			
		||||
                  </p>
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
          </table>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@@ -214,27 +229,37 @@ var options = {page: 5,
 | 
			
		||||
        if (a.filename > b.filename) {return 1;}
 | 
			
		||||
        return 0;
 | 
			
		||||
      });
 | 
			
		||||
      resultsHTML = "";
 | 
			
		||||
      resultsHTML = ``;
 | 
			
		||||
      for (let result of resultsArray) {
 | 
			
		||||
        if (result.filename.endsWith(".pdf.zip")) {
 | 
			
		||||
          resultType = "PDF";
 | 
			
		||||
          resultType = "PDF file with text layer";
 | 
			
		||||
        } else if (result.filename.endsWith(".txt.zip")) {
 | 
			
		||||
          resultType = "TXT";
 | 
			
		||||
          resultType = "Raw text files";
 | 
			
		||||
        } else if (result.filename.endsWith(".vrt.zip")) {
 | 
			
		||||
          resultType = "VRT";
 | 
			
		||||
          resultType = "VRT(XML dialect) files holding the NLP data";
 | 
			
		||||
        } else if (result.filename.endsWith(".xml.zip")) {
 | 
			
		||||
          resultType = "XML";
 | 
			
		||||
          resultType = "XML files";
 | 
			
		||||
        } else if (result.filename.endsWith(".poco.zip")) {
 | 
			
		||||
          resultType = "POCO";
 | 
			
		||||
          resultType = "HCOR und image files needed for Post correction(PoCo)";
 | 
			
		||||
        } else {
 | 
			
		||||
          resultType = "ALL";
 | 
			
		||||
          resultType = "All result files created during this job";
 | 
			
		||||
        }
 | 
			
		||||
        resultsHTML += `<div class="col s4 m3 l2">
 | 
			
		||||
                          <a class="btn waves-effect waves-light" download href="/jobs/${result.job_id}/results/${result.id}/download">
 | 
			
		||||
                            <i class="material-icons left">file_download</i>${resultType}
 | 
			
		||||
                          </a>
 | 
			
		||||
                        </div>`;
 | 
			
		||||
      }
 | 
			
		||||
        resultsHTML += `
 | 
			
		||||
                        <tr>
 | 
			
		||||
                          <td>${resultType}</td>
 | 
			
		||||
                          <td>${result.filename}</td>
 | 
			
		||||
                          <td>
 | 
			
		||||
                            <a class="btn-floating waves-effect waves-light" download href="/jobs/${result.job_id}/results/${result.id}/download">
 | 
			
		||||
                              <i class="material-icons left">file_download</i>
 | 
			
		||||
                            </a>
 | 
			
		||||
                          </td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                       `;
 | 
			
		||||
      };
 | 
			
		||||
      resultsHTML += `
 | 
			
		||||
                      </tbody>
 | 
			
		||||
                      </table>
 | 
			
		||||
                     `;
 | 
			
		||||
      resultsElements = document.querySelectorAll(".results");
 | 
			
		||||
      for (let resultsElement of resultsElements) {
 | 
			
		||||
        resultsElement.innerHTML += resultsHTML;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user