Diff
Modified: trunk/app/models/workflow.rb (3178 => 3179)
--- trunk/app/models/workflow.rb 2012-11-05 14:56:05 UTC (rev 3178)
+++ trunk/app/models/workflow.rb 2012-11-07 11:47:31 UTC (rev 3179)
@@ -25,6 +25,8 @@
belongs_to :content_type
belongs_to :license
+ has_many :workflow_processors, :dependent => :destroy
+
before_validation :check_unique_name
before_validation :apply_extracted_metadata
@@ -364,4 +366,8 @@
APIStatistics.statistics(self)
end
+ def wsdl_deprecations
+ WsdlDeprecation.find_all_by_wsdl(workflow_processors.map {|wp| wp.wsdl})
+ end
+
end
Added: trunk/app/models/wsdl_deprecation.rb (0 => 3179)
--- trunk/app/models/wsdl_deprecation.rb (rev 0)
+++ trunk/app/models/wsdl_deprecation.rb 2012-11-07 11:47:31 UTC (rev 3179)
@@ -0,0 +1,9 @@
+class WsdlDeprecation < ActiveRecord::Base
+
+ validates_uniqueness_of :wsdl
+
+ def affected_workflows
+ WorkflowProcessor.find_all_by_wsdl(wsdl, :include => :workflow).uniq.compact
+ end
+
+end
Added: trunk/app/views/workflows/_wsdl_deprecation.html.erb (0 => 3179)
--- trunk/app/views/workflows/_wsdl_deprecation.html.erb (rev 0)
+++ trunk/app/views/workflows/_wsdl_deprecation.html.erb 2012-11-07 11:47:31 UTC (rev 3179)
@@ -0,0 +1,21 @@
+<div class="wsdl_deprecation">
+ <p>
+ <img src="" style="vertical-align: middle;"/>
+ This workflow uses a service that
+ <% if wsdl_deprecation.deprecated_at.past? %>
+ is deprecated as of <strong><%= wsdl_deprecation.deprecated_at.strftime("%d %b %Y") -%></strong>
+ (<%= time_ago_in_words(wsdl_deprecation.deprecated_at) -%> ago), and may no longer function.
+ <% else %>
+ will be deprecated on <strong><%= wsdl_deprecation.deprecated_at.strftime("%d %b %Y") -%></strong>
+ (in <%= time_ago_in_words(wsdl_deprecation.deprecated_at) -%>), and may no longer function after this date.
+ <% end %>
+ </p>
+ <% unless wsdl_deprecation.details.nil? %>
+ <p>
+ <strong>Details:</strong> <%= wsdl_deprecation.details %>
+ </p>
+ <% end %>
+ <p>
+ <strong>Affected service WSDL:</strong> <%= wsdl_deprecation.wsdl %>
+ </p>
+</div>
\ No newline at end of file
Modified: trunk/app/views/workflows/show.rhtml (3178 => 3179)
--- trunk/app/views/workflows/show.rhtml 2012-11-05 14:56:05 UTC (rev 3178)
+++ trunk/app/views/workflows/show.rhtml 2012-11-07 11:47:31 UTC (rev 3179)
@@ -1,5 +1,7 @@
<% t "#{h @workflow.title} (#{h @workflow.contributor_name}) [#{h(@workflow.type_display_name)} Workflow]" -%>
+<%= render :partial => "workflows/wsdl_deprecation", :collection => @workflow.wsdl_deprecations -%>
+
<ul class="sectionIcons">
<% if @authorised_to_edit -%>
<li><%= icon('new', new_version_workflow_path(@workflow), nil, nil, 'Upload New Version')%></li>
Added: trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb (0 => 3179)
--- trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb (rev 0)
+++ trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb 2012-11-07 11:47:31 UTC (rev 3179)
@@ -0,0 +1,14 @@
+class CreateWsdlDeprecations < ActiveRecord::Migration
+ def self.up
+ create_table :wsdl_deprecations do |t|
+ t.string :wsdl
+ t.datetime :deprecated_at
+ t.text :details
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :wsdl_deprecations
+ end
+end
Modified: trunk/public/stylesheets/styles.css (3178 => 3179)
--- trunk/public/stylesheets/styles.css 2012-11-05 14:56:05 UTC (rev 3178)
+++ trunk/public/stylesheets/styles.css 2012-11-07 11:47:31 UTC (rev 3179)
@@ -2381,3 +2381,9 @@
-webkit-border-bottom-right-radius: 6px;
}
+div.wsdl_deprecation {
+ border: 1px solid #e24a3e;
+ background-color: #ffcccc;
+ padding: 0.5em;
+ border-radius: 3px;
+}