added revision graph to the code file view.
made revision graph resizable
This commit is contained in:
parent
dd619e2e19
commit
7fb63d8e94
@ -1123,10 +1123,8 @@ class SubversionModel extends Model
|
|||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr (
|
$fileinfo['fullpath'] = substr ($info1[0]['url'], strlen($info1[0]['repos']));
|
||||||
$info1[0]['url'], strlen($info1[0]['repos']));
|
$fileinfo['against']['fullpath'] = substr ($info2[0]['url'], strlen($info2[0]['repos']));
|
||||||
$fileinfo['against']['fullpath'] = substr (
|
|
||||||
$info2[0]['url'], strlen($info2[0]['repos']));
|
|
||||||
|
|
||||||
fclose($errors);
|
fclose($errors);
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@
|
|||||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
|
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
|
||||||
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
|
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
|
||||||
|
|
||||||
|
<script type="text/javascript" src="<?php print base_url_make('/js/vis.min.js')?>"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/vis.min.css')?>" />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@ -231,6 +233,88 @@ function showRawCode()
|
|||||||
}
|
}
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
var revision_network = null;
|
||||||
|
|
||||||
|
function show_revision_graph (response)
|
||||||
|
{
|
||||||
|
var data = $.parseJSON(response);
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
show_alert ('Invalid data received', "<?php print $this->lang->line('Error')?>");
|
||||||
|
}
|
||||||
|
else if (data.nodes.length <= 0)
|
||||||
|
{
|
||||||
|
show_alert ('No data to show', "<?php print $this->lang->line('Info')?>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var options = {
|
||||||
|
autoResize: false,
|
||||||
|
height: '500px',
|
||||||
|
width: '100%',
|
||||||
|
clickToUse: true,
|
||||||
|
layout: {
|
||||||
|
hierarchical: {
|
||||||
|
enabled: true,
|
||||||
|
//levelSeparation: 150,
|
||||||
|
//nodeSpacing: 200,
|
||||||
|
//treeSpacing: 300,
|
||||||
|
direction: 'LR', //'LR' 'UD', 'DU', 'RL'
|
||||||
|
sortMethod: 'directed' // 'hubsize'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
edges: {
|
||||||
|
smooth: {
|
||||||
|
type: 'cubicBezier',
|
||||||
|
forceDirection: 'horizontal', // 'vertical',
|
||||||
|
roundness: 0.4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
physics: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var i, j;
|
||||||
|
|
||||||
|
j = data.nodes.length;
|
||||||
|
for (i = 0; i < j; i++)
|
||||||
|
{
|
||||||
|
data.nodes[i].shape = 'box';
|
||||||
|
}
|
||||||
|
|
||||||
|
j = data.edges.length;
|
||||||
|
for (i = 0; i < j; i++)
|
||||||
|
{
|
||||||
|
data.edges[i].length = 60;
|
||||||
|
data.edges[i].width = 1;
|
||||||
|
data.edges[i].arrows = 'to';
|
||||||
|
data.edges[i].font = { color: 'red' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (revision_network === null)
|
||||||
|
{
|
||||||
|
revision_network = new vis.Network(document.getElementById('code_file_result_revision_graph'), data, options);
|
||||||
|
$('#code_file_result_revision_graph').resizable({
|
||||||
|
create: function (event, ui) {
|
||||||
|
revision_network.setSize (ui.size.width - 10, ui.size.height - 10);
|
||||||
|
revision_network.redraw();
|
||||||
|
},
|
||||||
|
resize: function (event, ui) {
|
||||||
|
revision_network.setSize (ui.size.width - 10, ui.size.height - 10);
|
||||||
|
revision_network.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
revision_network.setData (data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#code_file_revision_graph_button").button("enable");
|
||||||
|
$("#code_file_revision_graph_spin" ).removeClass ("fa-cog fa-spin");
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
@ -241,7 +325,7 @@ $(function () {
|
|||||||
|
|
||||||
<?php if (!$is_special_stream): ?>
|
<?php if (!$is_special_stream): ?>
|
||||||
$("#code_file_loc_info").hide();
|
$("#code_file_loc_info").hide();
|
||||||
btn = $("#code_file_mainarea_loc_button").button().click (function () {
|
btn = $("#code_file_loc_button").button().click (function () {
|
||||||
if ($("#code_file_loc_info").is(":visible"))
|
if ($("#code_file_loc_info").is(":visible"))
|
||||||
{
|
{
|
||||||
$("#code_file_loc_info").hide("blind",{},200);
|
$("#code_file_loc_info").hide("blind",{},200);
|
||||||
@ -255,9 +339,28 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#code_file_mainarea_edit_button").button();
|
$("#code_file_edit_button").button();
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
$("#code_file_revision_graph_button").button().click (function () {
|
||||||
|
$("#code_file_revision_graph_button").button("disable");
|
||||||
|
$("#code_file_revision_graph_spin").addClass ("fa-cog fa-spin");
|
||||||
|
var ajax_req = $.ajax ({
|
||||||
|
url: codepot_merge_path (
|
||||||
|
"<?php print site_url(); ?>",
|
||||||
|
"/graph/enjson_revision_graph/<?php print $project->id; ?>/<?php print $hex_headpath;?><?php print $revreq?>"),
|
||||||
|
context: document.body,
|
||||||
|
success: show_revision_graph,
|
||||||
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
|
show_alert (xhr.status + ' ' + thrownError, "<?php print $this->lang->line('Error')?>");
|
||||||
|
$("#code_file_revision_graph_button").button("enable");
|
||||||
|
$("#code_file_revision_graph_spin" ).removeClass ("fa-cog fa-spin");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
<?php if ($file['created_rev'] != $file['head_rev']): ?>
|
<?php if ($file['created_rev'] != $file['head_rev']): ?>
|
||||||
$("#code_file_headrev_button").button().click (function() {
|
$("#code_file_headrev_button").button().click (function() {
|
||||||
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}"; ?>'));
|
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}"; ?>'));
|
||||||
@ -474,9 +577,9 @@ $this->load->view (
|
|||||||
if ((isset($login['id']) && $login['id'] != '') )
|
if ((isset($login['id']) && $login['id'] != '') )
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print anchor ("code/edit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_file_mainarea_edit_button"');
|
print anchor ("code/edit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_file_edit_button"');
|
||||||
}
|
}
|
||||||
print anchor ("#", "LOC", "id=code_file_mainarea_loc_button");
|
print anchor ("#", "LOC", "id=code_file_loc_button");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -514,6 +617,12 @@ $this->load->view (
|
|||||||
//print anchor ('', $download_anchor_text, 'id="code_file_download_button"');
|
//print anchor ('', $download_anchor_text, 'id="code_file_download_button"');
|
||||||
print anchor ("code/fetch/{$project->id}/${hex_headpath}{$revreq}", $download_anchor_text, 'id="code_file_download_button"');
|
print anchor ("code/fetch/{$project->id}/${hex_headpath}{$revreq}", $download_anchor_text, 'id="code_file_download_button"');
|
||||||
if (!$is_special_stream) print anchor ('#', $this->lang->line('Enstyle'), 'id="code_file_style_button"');
|
if (!$is_special_stream) print anchor ('#', $this->lang->line('Enstyle'), 'id="code_file_style_button"');
|
||||||
|
|
||||||
|
print '<a id="code_file_revision_graph_button" href="#">';
|
||||||
|
print '<i id="code_file_revision_graph_spin" class="fa"></i>';
|
||||||
|
print $this->lang->line('CODE_REVISION_GRAPH');
|
||||||
|
print '</a>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="metadata-commit-date">';
|
print '<div class="metadata-commit-date">';
|
||||||
@ -550,6 +659,10 @@ $this->load->view (
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="code_folder_graph" class="graph">
|
||||||
|
<div id="code_file_result_revision_graph"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="display:none">
|
<div style="display:none">
|
||||||
<pre id="code_file_result_raw">
|
<pre id="code_file_result_raw">
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -201,6 +201,8 @@ function show_loc_by_file_graph (response)
|
|||||||
$("#code_folder_loc_by_file_spin" ).removeClass ("fa-cog fa-spin");
|
$("#code_folder_loc_by_file_spin" ).removeClass ("fa-cog fa-spin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var revision_network = null;
|
||||||
|
|
||||||
function show_revision_graph (response)
|
function show_revision_graph (response)
|
||||||
{
|
{
|
||||||
var data = $.parseJSON(response);
|
var data = $.parseJSON(response);
|
||||||
@ -215,15 +217,16 @@ function show_revision_graph (response)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var options = {
|
var options = {
|
||||||
autoResize: true,
|
autoResize: false,
|
||||||
height: '500px',
|
height: '500px',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
clickToUse: true,
|
||||||
layout: {
|
layout: {
|
||||||
hierarchical: {
|
hierarchical: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
levelSeparation: 150,
|
//levelSeparation: 150,
|
||||||
nodeSpacing: 200,
|
//nodeSpacing: 200,
|
||||||
treeSpacing: 400,
|
//treeSpacing: 300,
|
||||||
direction: 'LR', //'LR' 'UD', 'DU', 'RL'
|
direction: 'LR', //'LR' 'UD', 'DU', 'RL'
|
||||||
sortMethod: 'directed' // 'hubsize'
|
sortMethod: 'directed' // 'hubsize'
|
||||||
}
|
}
|
||||||
@ -235,7 +238,9 @@ function show_revision_graph (response)
|
|||||||
roundness: 0.4
|
roundness: 0.4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
physics: true
|
physics: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var i, j;
|
var i, j;
|
||||||
@ -255,7 +260,24 @@ function show_revision_graph (response)
|
|||||||
data.edges[i].font = { color: 'red' };
|
data.edges[i].font = { color: 'red' };
|
||||||
}
|
}
|
||||||
|
|
||||||
var network = new vis.Network(document.getElementById('code_folder_result_revision_graph'), data, options);
|
if (revision_network === null)
|
||||||
|
{
|
||||||
|
revision_network = new vis.Network(document.getElementById('code_folder_result_revision_graph'), data, options);
|
||||||
|
$('#code_folder_result_revision_graph').resizable({
|
||||||
|
create: function (event, ui) {
|
||||||
|
revision_network.setSize (ui.size.width - 10, ui.size.height - 10);
|
||||||
|
revision_network.redraw();
|
||||||
|
},
|
||||||
|
resize: function (event, ui) {
|
||||||
|
revision_network.setSize (ui.size.width - 10, ui.size.height - 10);
|
||||||
|
revision_network.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
revision_network.setData (data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#code_folder_revision_graph_button").button("enable");
|
$("#code_folder_revision_graph_button").button("enable");
|
||||||
|
Loading…
Reference in New Issue
Block a user