Skip to content
Snippets Groups Projects
Commit 66f200cf authored by a.croix's avatar a.croix
Browse files

Add functionnal copy to clipboard button on Wowa Show pages

parent ea54f5e4
No related branches found
No related tags found
1 merge request!2New Log system
Pipeline #6332 passed
......@@ -52,6 +52,6 @@ class User extends Authenticatable
public static function findUserNameById(Wowa $wowa)
{
$user = self::where("id", "=", $wowa->user_id)->pluck('name');
return $user;
return str_replace(array('[', ']', '"'), '', $user);
}
}
......@@ -52,16 +52,18 @@ class Wowa extends Model
}
}
public function weightsP()
public function weightsP() : array
{
$P = $this->p_weights;
return str_replace(array('[', ']'), '', $P);
//$P = implode(',', $this->p_weights);
//return str_replace(array('[', ']'), '', $P);
return $this->p_weights;
}
public function weightsW()
public function weightsW() : array
{
$W = $this->w_weights();
return str_replace(array('[', ']'), '', $W);
//$W = implode(',', $this->w_weights);
//return str_replace(array('[', ']'), '', $W);
return $this->w_weights;
}
//Method to get the path for the log file. Name linked to the Wowa id in sqlite DB
......
This diff is collapsed.
This diff is collapsed.
......@@ -11,41 +11,63 @@
<div class="form-inline">
{!! $wowa->statusBadge() !!}
</div>
<div id="id">
<p>
<i class="fas fa-hashtag"></i>
<b>Id</b> : {{ $wowa->id }}
</p>
</div>
<div id="user">
<p>
<i class="fas fa-user"></i>
<b>User</b> : {{ \App\User::findUserNameById($wowa) }}
</p>
</div>
<div id="score">
<p>
<b>Score</b> : {{ $wowa->score }}
</p>
</div>
<div id="population">
<p>
<b>Population number</b> : {{ $wowa->population }}
</p>
</div>
<div id="crossover">
<p>
<b>Crossover Rate</b> : {{ $wowa->crossover_rate }}
<b>Crossover Rate</b> : {{ $wowa->crossover_rate }}
</p>
</div>
<div id="mutation">
<p>
<b>Mutation Rate</b> : {{ $wowa->mutation_rate }}
</p>
</div>
<div id="generation">
<p>
<b>Generation number</b> : {{ $wowa->generation_number }}
</p>
<p>
<b>Weights W Vector</b> : @json($wowa->w_weights)
</p>
<p>
<b>Weights P Vector</b> : @json($wowa->p_weights)
</p>
</div>
<div id="weights_w">
<p><b>Weights W Vector</b> : <br> <span id="w_weights_value">@json($wowa->weightsW())</span></p>
<button class="btn btn-info" id="w_weights_button">Copy Weights W to clipboard</button>
</div>
<div id="weights_p">
<p><b>Weights P Vector</b> : <br> <span id="p_weights_value">@json($wowa->weightsP())</span></p>
<button class="btn btn-info" id="p_weights_button">Copy Weights P to clipboard</button>
</div>
<div id="roc">
<p>
<b>AUC Roc curve</b> : {{ $wowa->roc }}
</p>
</div>
<div id="pr">
<p>
<b>AUC P-R curve</b> : {{ $wowa->pr }}
</p>
</div>
<div>
<form method="POST"
action="{{ action('WowaController@destroy', ['wowa' => $wowa]) }}"
......@@ -62,4 +84,19 @@
</div>
</div>
</div>
<script type="text/javascript">
document.getElementById("w_weights_button").addEventListener("click", function() {
var cb = navigator.clipboard;
var w = document.getElementById("w_weights_value");
cb.writeText(w.innerText.replace(/\[|\]/g, ''));
document.getElementById("w_weights_button").innerHTML = "Copied!";
});
document.getElementById("p_weights_button").addEventListener("click", function() {
var cb = navigator.clipboard;
var p = document.getElementById("p_weights_value");
cb.writeText(p.innerText.replace(/\[|\]/g, ''));
document.getElementById("p_weights_button").innerHTML = "Copied!";
});
</script>
@endsection
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment