Skip to content
Permalink
Browse files

Update to support Redmine 3.4. Have a look at README for further details

  • Loading branch information...
Markowski
Markowski committed Aug 3, 2018
1 parent d047eb3 commit 4921745468b47ee900f7ad890d26f8157ef684d7
@@ -6,6 +6,8 @@ A per project requirements tab gives users access to their specification. Users

Redmine RE is compatible with Redmine Versions >= 2.4 and < 3.0.

With the commit From 03.08.2018 the Redmine 3.4 is supportet. The changes are initially tested. The major functions are working now. Still some minor Bugs left. Visualization is currently not working.

== Installation

You can find information about how to install the Redmine RE in the wiki: https://github.com/tmerten/redmine_re/wiki/installation.
@@ -26,7 +26,7 @@ def new
logger.debug("#{@re_artifact_properties.artifact.class} does not implement new hook")
end
@secondary_user_profiles = []
@user_profiles = ReArtifactProperties.find_all_by_artifact_type_and_project_id('ReUserProfile', @project.id)
@user_profiles = ReArtifactProperties.where(artifact_type: 'ReUserProfile', project_id:@project.id)

unless params[:sibling_artifact_id].blank?
sibling = ReArtifactProperties.find(params[:sibling_artifact_id])
@@ -164,7 +164,7 @@ def edit

if @project.enabled_module_names.include? 'diagrameditor'
@relation_to_diagrams = ReArtifactRelationship.find_by_source_id_and_relation_type(@re_artifact_properties.id, 'diagram')
@related_diagrams = ConcreteDiagram.find_all_by_id(@relation_to_diagrams.sink_id) unless @relation_to_diagrams.nil?
@related_diagrams = ConcreteDiagram.where(id: @relation_to_diagrams.sink_id) unless @relation_to_diagrams.nil?
end

begin
@@ -16,14 +16,14 @@ def delete
end

@artifact_properties = ReArtifactProperties.find(params[:re_artifact_properties_id])
@relationships_incoming = ReArtifactRelationship.find_all_by_sink_id(params[:re_artifact_properties_id])
@relationships_incoming = ReArtifactRelationship.where(sink_id: params[:re_artifact_properties_id])
@relationships_incoming.delete_if {|rel| ReArtifactRelationship::SYSTEM_RELATION_TYPES.values.include?(rel.relation_type) }

unless params[:secondary_user_delete].blank?
@relationships_outgoing = ReArtifactRelationship.find_all_by_source_id_and_relation_type(params[:re_artifact_properties_id],ReArtifactRelationship::RELATION_TYPES[:dep])
@relationships_outgoing = ReArtifactRelationship.where(source_id: params[:re_artifact_properties_id], relation_type: ReArtifactRelationship::RELATION_TYPES[:dep])
render :partial => "secondary_user", :project_id => params[:project_id]
else
@relationships_outgoing = ReArtifactRelationship.find_all_by_source_id(params[:re_artifact_properties_id])
@relationships_outgoing = ReArtifactRelationship.where(source_id: params[:re_artifact_properties_id])
@relationships_outgoing.delete_if {|rel| ReArtifactRelationship::SYSTEM_RELATION_TYPES.values.include?(rel.relation_type) }
render :partial => "relationship_links", :project_id => params[:project_id]
end
@@ -60,9 +60,9 @@ def prepare_relationships
logger.debug("tried saving the following relation (errors: #{@new_relation.errors.size}): " + @new_relation.to_yaml)

@artifact_properties = ReArtifactProperties.find(artifact_properties_id)
@relationships_outgoing = ReArtifactRelationship.find_all_by_source_id(artifact_properties_id)
@relationships_outgoing = ReArtifactRelationship.where(source_id: artifact_properties_id)
@relationships_outgoing.delete_if {|rel| ReArtifactRelationship::SYSTEM_RELATION_TYPES.values.include?(rel.relation_type) }
@relationships_incoming = ReArtifactRelationship.find_all_by_sink_id(artifact_properties_id)
@relationships_incoming = ReArtifactRelationship.where(sink_id: artifact_properties_id)
@relationships_incoming.delete_if {|rel| ReArtifactRelationship::SYSTEM_RELATION_TYPES.values.include?(rel.relation_type) }

render :partial => "relationship_links", :layout => false, :project_id => params[:project_id]
@@ -169,8 +169,9 @@ def netmap(artifacts, relations, rootnode)
json << rootnode

artifacts.each do |artifact|

outgoing_relationships = ReArtifactRelationship.find_all_relations_for_artifact_id(artifact.id)
drawable_relationships = ReArtifactRelationship.find_all_by_source_id_and_relation_type(artifact.id, relations)
drawable_relationships = ReArtifactRelationship.where(source_id: artifact.id, relation_type: relations)
artifact_ids = @artifacts.collect { |a| a.id }
drawable_relationships.delete_if { |r| ! artifact_ids.include? r.sink_id }
json << add_artifact(artifact, drawable_relationships, outgoing_relationships)
@@ -293,7 +294,7 @@ def sunburst(artifact)
next unless ( ! @done_artifakts_id.include? child.id.to_s)
@done_artifakts_id << artifact.id.to_s
outgoing_relationships = ReArtifactRelationship.find_all_relations_for_artifact_id(child.id)
drawable_relationships = ReArtifactRelationship.find_all_by_source_id(child.id)
drawable_relationships = ReArtifactRelationship.where(source_id: child.id)
json_artifact = add_artifact(child, drawable_relationships, outgoing_relationships)
json_return = sunburst(child)
if (json_return != [])
@@ -326,7 +327,7 @@ def add_issues_sunburst(issue_id)
ReRealization.where("issue_id=?", issue_id.to_s).each do |artifact|
if( ! @done_artifakts_id.include? artifact.re_artifact_properties_id.to_s)
outgoing_relationships = ReArtifactRelationship.find_all_relations_for_artifact_id(artifact.re_artifact_properties_id)
drawable_relationships = ReArtifactRelationship.find_all_by_source_id(artifact.re_artifact_properties_id)
drawable_relationships = ReArtifactRelationship.where(source_id: artifact.re_artifact_properties_id)
child = ReArtifactProperties.find_by_project_id_and_id(@project.id,artifact.re_artifact_properties_id)

json_artifact = add_artifact(child, drawable_relationships, outgoing_relationships)
@@ -354,7 +355,7 @@ def get_all_artifacts_for_graph(artifact,first_run)

if (@max_deep.to_i == 0 || @current_deep.to_i <= @max_deep.to_i)
if ( ! @done_artifakts_id.include? artifact.id.to_s)
ReArtifactRelationship.find_all_by_source_id(artifact.id).each do |source|
ReArtifactRelationship.where(source_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.sink_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)

@@ -382,7 +383,7 @@ def get_all_artifacts_for_graph(artifact,first_run)
@source_artifakts_id << source.source_id
end
end
ReArtifactRelationship.find_all_by_sink_id(artifact.id).each do |source|
ReArtifactRelationship.where(sink_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.source_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
if (@current_deep.to_i == @max_deep.to_i)
@@ -520,7 +521,7 @@ def get_all_artifacts_for_graph(artifact,first_run)
@done_artifakts_id << artifact.id.to_s
end

ReArtifactRelationship.find_all_by_source_id(artifact.id).each do |source|
ReArtifactRelationship.where(source_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.sink_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
next unless ( ! @done_artifakts_id.include? source.sink_id.to_s)
@@ -537,7 +538,7 @@ def get_all_artifacts_for_graph(artifact,first_run)
end
end

ReArtifactRelationship.find_all_by_sink_id(artifact.id).each do |source|
ReArtifactRelationship.where(sink_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.source_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
next unless ( ! @done_artifakts_id.include? source.source_id.to_s)
@@ -775,13 +776,13 @@ def find_all_artifacts_for_netmap(artifact)
@found_artifakts << artifact
@done_artifakts_id << artifact.id.to_s
end
ReArtifactRelationship.find_all_by_source_id(artifact.id).each do |source|
ReArtifactRelationship.where(source_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.sink_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
next unless ( ! @done_artifakts_id.include? source.sink_id.to_s)
find_all_artifacts_for_netmap(ReArtifactProperties.find_by_project_id_and_id(@project.id, source.sink_id))
end
ReArtifactRelationship.find_all_by_sink_id(artifact.id).each do |source|
ReArtifactRelationship.where(sink_id: artifact.id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.source_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
next unless ( ! @done_artifakts_id.include? source.source_id.to_s)
@@ -1076,7 +1077,7 @@ def build_json_according_to_user_choice
@max_deep = ReVisualizationConfig.get_max_deep(@project.id, session[:visualization_type]).to_i

if(@visualization_type!= "graph_issue" )
@artifacts = ReArtifactProperties.find_all_by_project_id_and_artifact_type(@project.id, @chosen_artifacts, :order => "artifact_type, name")
@artifacts = ReArtifactProperties.where(project_id: @project.id, artifact_type: @chosen_artifacts).order("artifact_type, name")
else
@artifacts = ""
end
@@ -1087,7 +1088,7 @@ def build_json_according_to_user_choice

def min_dis_artifact(artifact_id)
@current_deep = @current_deep + 1
ReArtifactRelationship.find_all_by_source_id(artifact_id).each do |source|
ReArtifactRelationship.where(source_id: artifact_id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.sink_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)

@@ -1100,7 +1101,7 @@ def min_dis_artifact(artifact_id)
end
end
if(@visualization_type != "sunburst")
ReArtifactRelationship.find_all_by_sink_id(artifact_id).each do |source|
ReArtifactRelationship.where(sink_id: artifact_id).each do |source|
next unless (@chosen_artifacts.include? ReArtifactProperties.find_by_id(source.source_id).artifact_type.to_s)
next unless (@chosen_relations.include? ReArtifactRelationship.find_by_id(source.id).relation_type.to_s)
if (@min_dis_artifact_arr[source.source_id] == nil || @min_dis_artifact_arr[source.source_id] > @current_deep)
@@ -100,12 +100,12 @@ def suggest_artifacts
conditions << params[:except_types] unless params[:except_types].blank?

artifacts = ReArtifactProperties.of_project(@project).without_projects
artifacts = artifacts.all(:conditions => conditions, :order => 'name ASC')
artifacts.map! do |artifact|
artifacts = artifacts.where(conditions).order('name ASC')
artifacts_information = artifacts.map do |artifact|
artifact_to_json(artifact).merge({:highlighted_name => highlight_letters(artifact.name, params[:query])})
end
end
render :json => artifacts
render :json => artifacts_information
end

def suggest_issues
@@ -117,12 +117,12 @@ def suggest_issues
conditions = [sql, @project.id, "%#{params[:query]}%"]
conditions << params[:except_ids] unless params[:except_ids].blank?

issues = Issue.all(:conditions => conditions, :order => 'subject ASC')
issues.map! do |issue|
issues = Issue.where(conditions).order('subject ASC')
issues_information = issues.map do |issue|
issue_to_json(issue).merge({:highlighted_name => highlight_letters(issue.subject, params[:query])})
end
end
render :json => issues
render :json => issues_information
end

def suggest_diagrams
@@ -134,12 +134,12 @@ def suggest_diagrams
conditions = [sql, @project.id, "%#{params[:query]}%"]
conditions << params[:except_ids] unless params[:except_ids].blank?

diagrams = ConcreteDiagram.all(:conditions => conditions, :order => 'name ASC')
diagrams.map! do |diagram|
diagrams = ConcreteDiagram.where(conditions).order('name ASC')
diagrams_information = diagrams.map do |diagram|
diagram_to_json(diagram).merge({:highlighted_name => highlight_letters(diagram.name, params[:query])})
end
end
render :json => diagrams
render :json => diagrams_information
end

def suggest_users
@@ -152,14 +152,14 @@ def suggest_users
conditions = [sql, User::STATUS_ACTIVE, preformatted_query, preformatted_query, preformatted_query]
conditions << params[:except_ids] unless params[:except_ids].blank?

users = User.all(:conditions => conditions, :order => 'lastname ASC, firstname ASC, login ASC')
users.map! do |user|
users = User.where(conditions).order('lastname ASC, firstname ASC, login ASC')
users_information = users.map do |user|
full_name = "#{user.firstname} #{user.lastname}"
user_to_json(user).merge({:highlighted_full_name => highlight_letters(full_name, params[:query]),
:highlighted_login => highlight_letters(user.login, params[:query])})
end
end
render :json => users
render :json => users_information
end

##
@@ -47,7 +47,7 @@ def configure
end

@re_relation_configs = {}
@re_relation_types = ReRelationtype.find_all_by_project_id(@project.id)
@re_relation_types = ReRelationtype.where(project_id: @project.id)
logger.debug @re_relation_types.inspect
@re_settings = {}
@re_settings["visualization_size"] = ReSetting.get_plain("visualization_size", @project.id)
@@ -166,7 +166,7 @@ def save_user_config
r.relation_type = v[:alias_name] # on i the type was created the alias name will be set
r.is_system_relation = 0
else
r = ReRelationtype.find_or_create_by_id(v['id'])
r = ReRelationtype.find_or_create_by(id: v['id'])
end

if r.is_system_relation == 0
@@ -184,7 +184,7 @@ def save_user_config
else
if v[:destroy] == "1"

n = ReArtifactRelationship.find_all_by_relation_type(r.relation_type)
n = ReArtifactRelationship.where(relation_type: r.relation_type)
n.each do |relation|
artifact = ReArtifactProperties.find(relation.source_id)
if (artifact.project_id == r.project_id)
Oops, something went wrong.

0 comments on commit 4921745

Please sign in to comment.
You can’t perform that action at this time.