Skip to content

Commit

Permalink
Issues #6 and #7 addressed. Hopefully resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
changhaitravis committed Dec 1, 2015
1 parent 3b93706 commit 06b93d5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.appbox.jira</groupId>
<artifactId>foresight</artifactId>
<version>0.9.3-jira6</version>
<version>0.9.4-jira6</version>
<organization>
<name>Solutions Appbox inc.</name>
<url>http://www.appbox.ca/</url>
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<resource type="download" name="d3.v3.min.js" location="/js/d3.v3.min.js" />
<resource type="download" name="foresight.js" location="/js/foresight.js" />
<resource type="download" name="images/" location="/images" />
<context>atl.general</context>
<context>jira.view.issue</context>
<context>jira.browse.project</context>
<context>jira.navigator.simple</context>
<context>jira.navigator.advanced</context>
</web-resource>

<servlet name="Foresight Dependency Graph Servlet"
Expand Down
57 changes: 30 additions & 27 deletions src/main/resources/js/foresight.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,37 +302,40 @@ function show_legend(){
}
}

AJS.toInit(function(){
AJS.$(document).ready(function(){
//TODO Better way of determining viewType
if(JIRA.API !== undefined){
if(JIRA.API.IssueSearch !== undefined && JIRA.ViewIssueTabs !== undefined){
//issue navigator
viewType = 'issueNav';
//JIRA.ViewIssueTabs.onTabReady(function() {
JIRA.ViewIssueTabs.onTabReady(function() {
//run foresight_show if this is the first time loading an issue, or loading a new issue.
if(AJS.$('div#foresight, canvas#foresight-legend').length == 2){
foresight_show();
}
});
}else if(JIRA.API.Projects !== undefined){
//project tab
viewType = 'projectTab';
AJS.$('input#includeOutward, input#includeInward').parent().hide();
foresight_show();
}
}else if(JIRA.Issue !== undefined){
//issue view
viewType = 'issue';
//AJS.toInit(function(){
// AJS.$(document).ready(function(){
// //TODO Better way of determining viewType
// if(JIRA.API !== undefined){
// if(JIRA.API.IssueSearch !== undefined && JIRA.ViewIssueTabs !== undefined){
// //issue navigator
// viewType = 'issueNav';
// foresight_show_onTabReady();
// }else if(JIRA.API.Projects !== undefined){
// //project tab
// viewType = 'projectTab';
// AJS.$('input#includeOutward, input#includeInward').parent().hide();
// foresight_show();
// }
// }else if(JIRA.Issue !== undefined){
// //issue view
// viewType = 'issue';
// foresight_show();
// foresight_show_onTabReady();
// }
//
// });
//});

function foresight_show_onTabReady(){
JIRA.ViewIssueTabs.onTabReady(function() {
//run foresight_show if this is the first time loading an issue, or loading a new issue.
if(AJS.$('div#foresight, canvas#foresight-legend').length == 2){
foresight_show();
}

}
});
});
}

function foresight_show(){

if(!pluginSettings){
init_plugin_settings();
}else{
Expand Down
25 changes: 25 additions & 0 deletions src/main/resources/templates/dependency-graph-panel.vm
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,28 @@
<div id="issue-dependency-viewer-graph-container"></div>
<canvas id="foresight-legend" width="848" height="200"></canvas>
</div>
<script>
AJS.toInit(function(){
AJS.$(document).ready(function(){
//TODO Better way of determining viewType
if(JIRA.API !== undefined){
if(JIRA.API.IssueSearch !== undefined && JIRA.ViewIssueTabs !== undefined){
//issue navigator
viewType = 'issueNav';
foresight_show_onTabReady();
}else if(JIRA.API.Projects !== undefined){
//project tab
viewType = 'projectTab';
AJS.$('input#includeOutward, input#includeInward').parent().hide();
foresight_show();
}
}else if(JIRA.Issue !== undefined){
//issue view
viewType = 'issue';
foresight_show();
foresight_show_onTabReady();
}

});
});
</script>

0 comments on commit 06b93d5

Please sign in to comment.