<commit_before>/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function RunBrowser(guid, runid, op_url, data_url, template_url) {
	this.guid = guid;
	this.runid = runid;
	this.op_url = op_url;
	this.data_url = data_url;
	this.template_url = template_url;
	
	this.tabPanel;
	this.runList;
}

RunBrowser.prototype.formatRunListItem = function(value, meta, record, rowind, colind, store, view) {
	var d = record.data;
	var tid = getLocalName(d.template_id);
	//var tid = getLocalName(d.id).replace(/^(.+?)\-[0-9a-f]+\-[0-9a-f]+.*$/, '$1');
	var rstat = d.status;
	
	var icon = 'icon-spin6 fa animate-spin fa-grey'
	if(rstat == 'SUCCESS') 
		icon = 'icon-select-alt fa-big fa-green';
	else if(rstat == 'FAILURE')
		icon = 'icon-cancel-alt fa-big fa-red';

	var tmpl = "<i style='float:left;padding:5px' class='"+icon+"'></i>" +
			"<div>" +
			"<div class='runtitle'>{1}</div>" +
			"<div class='runtime'>Run ID:{2}</div>" +
			"</div>";
	return Ext.String.format(tmpl, rstat, tid, getLocalName(d.id));
};

RunBrowser.prototype.formatProgressBar = function(value, meta, record, rowind, colind, store, view) {
	var d = record.data;
	var tmpl = "";
	tmpl += "<div style='width:{0}px;height:{1}px;background-color:#EEE'>";
	tmpl += "<div style='width:{2}px;height:{1}px;background-color:{5}'>";
	tmpl += "<div style='width:{3}px;height:{1}px;background-color:{6}'>";
	tmpl += "<div style='width:{4}px;height:{1}px;background-color:{7}'>";
	tmpl += "&nbsp;</div></div></div></div>";
	if (d.status == "FAILURE")
		tmpl += "<div class='running'>Failed: {8}</div>";
	else if (d.status == "RUNNING")
		tmpl += "<div class='running'>Running: {9}</div>";
	else if (d.status == "SUCCESS")
		tmpl += "<div class='running'>Completed</div>";
	else if (d.status == "QUEUED")
		tmpl += "<div class='running'>Queued</div>";
	var w = 190;
	if (d.status == "SUCCESS")
		d.percent_done = 100;
	return Ext.String.format(tmpl, w, 10, 
			Math.round(w * (d.percent_done + d.percent_failed + d.percent_running) / 100), 
			Math.round(w * (d.percent_done + d.percent_running) / 100),
			Math.round(w * d.percent_done / 100),
			"#F66", "#999", "#6E6",
			d.failed_jobs, d.running_jobs);
};

RunBrowser.prototype.formatBinding = function(b, meta, record, runid) {
	var str = "";
	var This = this;
	if (b.type == 'literal')
		str += "<b style='color:green'>" + b.value + "</b>";
	else if (b.size != -1 && b.location) {
		var href = This.data_url + "/fetch?data_id=" + escape(b.id);
		str += "<a href='" + href + "' target='_blank'>" + getLocalName(b.id)
				+ "</a> ";
		str += "<span style='color:#888'>(";
		str += This.formatSize(b.size);
		str += ")</span>";
	} else
		str += "<b style='color:red'>Not yet available</b>";
	return str;
};

RunBrowser.prototype.formatSave = function(b, meta, record, runid) {
	var str = "";
	if (record.data.type != "Input") {
		str += "<a class='icon-save fa-small fa-grey' href='#'>Save</a>";
	}	
	return str;
};
<commit_msg>Minor fixes<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function RunBrowser(guid, runid, op_url, data_url, template_url) {
	this.guid = guid;
	this.runid = runid;
	this.op_url = op_url;
	this.data_url = data_url;
	this.template_url = template_url;
	
	this.tabPanel;
	this.runList;
}

RunBrowser.prototype.formatRunListItem = function(value, meta, record, rowind, colind, store, view) {
	var d = record.data;
	var tid = getLocalName(d.template_id);
	if(!tid)
		tid = getLocalName(d.id).replace(/^(.+?)\-[0-9a-f]+\-[0-9a-f]+.*$/, '$1');
	var rstat = d.status;
	
	var icon = 'icon-spin6 fa animate-spin fa-grey'
	if(rstat == 'SUCCESS') 
		icon = 'icon-select-alt fa-big fa-green';
	else if(rstat == 'FAILURE')
		icon = 'icon-cancel-alt fa-big fa-red';

	var tmpl = "<i style='float:left;padding:5px' class='"+icon+"'></i>" +
			"<div>" +
			"<div class='runtitle'>{1}</div>" +
			"<div class='runtime'>Run ID:{2}</div>" +
			"</div>";
	return Ext.String.format(tmpl, rstat, tid, getLocalName(d.id));
};

RunBrowser.prototype.formatProgressBar = function(value, meta, record, rowind, colind, store, view) {
	var d = record.data;
	var tmpl = "";
	tmpl += "<div style='width:{0}px;height:{1}px;background-color:#EEE'>";
	tmpl += "<div style='width:{2}px;height:{1}px;background-color:{5}'>";
	tmpl += "<div style='width:{3}px;height:{1}px;background-color:{6}'>";
	tmpl += "<div style='width:{4}px;height:{1}px;background-color:{7}'>";
	tmpl += "&nbsp;</div></div></div></div>";
	if (d.status == "FAILURE")
		tmpl += "<div class='running'>Failed: {8}</div>";
	else if (d.status == "RUNNING")
		tmpl += "<div class='running'>Running: {9}</div>";
	else if (d.status == "SUCCESS")
		tmpl += "<div class='running'>Completed</div>";
	else if (d.status == "QUEUED")
		tmpl += "<div class='running'>Queued</div>";
	var w = 190;
	if (d.status == "SUCCESS")
		d.percent_done = 100;
	return Ext.String.format(tmpl, w, 10, 
			Math.round(w * (d.percent_done + d.percent_failed + d.percent_running) / 100), 
			Math.round(w * (d.percent_done + d.percent_running) / 100),
			Math.round(w * d.percent_done / 100),
			"#F66", "#999", "#6E6",
			d.failed_jobs, d.running_jobs);
};

RunBrowser.prototype.formatBinding = function(b, meta, record, runid) {
	var str = "";
	var This = this;
	if (b.type == 'literal')
		str += "<b style='color:green'>" + b.value + "</b>";
	else if (b.size != -1 && b.location) {
		var href = This.data_url + "/fetch?data_id=" + escape(b.id);
		str += "<a href='" + href + "' target='_blank'>" + getLocalName(b.id)
				+ "</a> ";
		str += "<span style='color:#888'>(";
		str += This.formatSize(b.size);
		str += ")</span>";
	} else
		str += "<b style='color:red'>Not available</b>";
	return str;
};

RunBrowser.prototype.formatSave = function(b, meta, record, runid) {
	var str = "";
	if (record.data.type != "Input") {
		str += "<a class='icon-save fa-small fa-grey' href='#'>Save</a>";
	}	
	return str;
};

{'fraction_non_alphanumeric': 0.1921877119218771, 'fraction_numerical': 0.014648040146480402, 'mean_word_length': 4.203952011291461, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3006848', 'n_tokens_mistral': 2746, 'n_tokens_neox': 2595, 'n_words': 682}