Skip to content

Commit

Permalink
Remove the ability to register a workflow definition
Browse files Browse the repository at this point in the history
We don't keep workflow definitions in Fedora
  • Loading branch information
jcoyne committed May 13, 2020
1 parent aa10c50 commit 452e526
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 54 deletions.
7 changes: 0 additions & 7 deletions app/helpers/registration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ def apo_list(permission_keys)
end
end

def valid_object_types
[
%w[Item item],
['Workflow Definition', 'workflow']
]
end

def valid_content_types
[
'Book (ltr)',
Expand Down
10 changes: 2 additions & 8 deletions app/javascript/registration/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import pathTo from './pathTo'
export default function DorRegistration(initOpts) {
var $t = {
defaultValues: {
objectType: 'item',
projectName: '',
apoId: 'druid:hv992ry2431', // TODO: uber APO druid must be pulled from config, not hardcoded
workflowId: null,
Expand Down Expand Up @@ -32,7 +31,6 @@ export default function DorRegistration(initOpts) {

register : function(rowid, progressFunction) {
var apo = $t.apoId;
var sourcePrefix = $t.metadataSource;
progressFunction = progressFunction || function() {}

// Grab list of tags from textarea, split, and reject blanks
Expand All @@ -46,11 +44,9 @@ export default function DorRegistration(initOpts) {
data.id = rowid

var params = {
'object_type' : $t.objectType,
'admin_policy' : apo,
'project' : $t.projectName,
'workflow_id' : $('#workflow_id').val(),
'metadata_source' : ($t.metadataSource !== 'label') ? null : $t.metadataSource,
'label' : data.label || ':auto',
'tag' : tags,
'rights' : $('#rights').val(),
Expand All @@ -61,7 +57,7 @@ export default function DorRegistration(initOpts) {
params.source_id = data.source_id;
}

params.other_id = sourcePrefix + ':' + data.metadata_id;
params.other_id = $t.metadataSource + ':' + data.metadata_id;

if (data.druid) {
params.pid = 'druid:' + data.druid;
Expand Down Expand Up @@ -131,8 +127,7 @@ export default function DorRegistration(initOpts) {
return false;
}
}
var sourcePrefix = $t.metadataSource;
if (sourcePrefix === 'symphony') {
if ($t.metadataSource === 'symphony') {
if ($.grep(mdIds,function(id) { return id.trim() === '' }).length > 0) {
$t.displayRequirements('Metadata source was detected as "symphony", which requires metadata IDs for all items.');
return false
Expand All @@ -158,7 +153,6 @@ export default function DorRegistration(initOpts) {

registerAll : function() {
var apo = $t.apoId;
var sourcePrefix = $t.metadataSource;
if (this.validate()) {
var ids = $t.getDataIds();
$t.progress(true);
Expand Down
50 changes: 25 additions & 25 deletions app/views/items/register.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
var dor_path = "<%= fedora_base %>";
</script>
<% end %>

<div id='properties' class="ui-widget" style="display: none">
<div class="property-item"><label for="object_type">Type of Object</label><%= select_tag :object_type, options_for_select(valid_object_types), 'data-rcparam': 'objectType' %></div>
<div class="property-item"><label for='apo_id'>Admin Policy</label><%= select_tag :apo_id, options_for_select(apo_list(@perm_keys)), 'data-rcparam': 'apoId' %></div>
<div class="property-item"><label for='collection'>Collection</label><%= select_tag :collection, '', 'data-rcparam': 'collection' %></div>
<div class="property-item"><label for='apo_id'>Admin Policy</label><%= select_tag :apo_id, options_for_select(apo_list(@perm_keys)), 'data-rcparam': 'apoId' %></div>
<div class="property-item"><label for='collection'>Collection</label><%= select_tag :collection, '', 'data-rcparam': 'collection' %></div>

<div class="property-item"><label for="rights">Rights</label><%= select_tag :rights, options_for_select(Constants::REGISTRATION_RIGHTS_OPTIONS), 'data-tagname': 'Process : Rights' %></div>
<div class="property-item"><label for='workflow_id'>Initial Workflow</label><%= select_tag :workflow_id, '', 'data-rcparam': 'workflowId' %></div>
<div class="property-item"><label for='content_type'>Content Type</label><%= select_tag :content_type, options_for_select(valid_content_types), class: 'tag-field', 'data-tagname': 'Process : Content Type' %></div>
<div class="property-item break"><label for='project'>Project Name</label><%= text_field_tag :project, nil, 'data-rcparam': 'projectName' %></div>
<div class="property-item wide"><label for='tag_1'>Tags</label>
<span id="tags" style="width: auto">
<%= text_field_tag :'tags[]', nil, id: 'tags_0', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_1', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_2', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_3', class: 'free tag-field' %>
</span>
<div class="break"></div>
<label for='tag_4'>&nbsp;</label>
<span id="tags" style="width: auto">
<%= text_field_tag :'tags[]', nil, id: 'tags_4', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_5', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_6', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_7', class: 'free tag-field' %>
<%= hidden_field_tag :registered_by, current_user.login, class: 'tag-field ', 'data-tagname': 'Registered By' %>
</span>
</div>
<div class="break"></div>
<div class="property-item"><label for="rights">Rights</label><%= select_tag :rights, options_for_select(Constants::REGISTRATION_RIGHTS_OPTIONS), 'data-tagname': 'Process : Rights' %></div>
<div class="property-item"><label for='workflow_id'>Initial Workflow</label><%= select_tag :workflow_id, '', 'data-rcparam': 'workflowId' %></div>
<div class="property-item"><label for='content_type'>Content Type</label><%= select_tag :content_type, options_for_select(valid_content_types), class: 'tag-field', 'data-tagname': 'Process : Content Type' %></div>
<div class="property-item break"><label for='project'>Project Name</label><%= text_field_tag :project, nil, 'data-rcparam': 'projectName' %></div>
<div class="property-item wide"><label for='tag_1'>Tags</label>
<span id="tags" style="width: auto">
<%= text_field_tag :'tags[]', nil, id: 'tags_0', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_1', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_2', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_3', class: 'free tag-field' %>
</span>
<div class="break"></div>
<label for='tag_4'>&nbsp;</label>
<span id="tags" style="width: auto">
<%= text_field_tag :'tags[]', nil, id: 'tags_4', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_5', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_6', class: 'free tag-field' %>
<%= text_field_tag :'tags[]', nil, id: 'tags_7', class: 'free tag-field' %>
<%= hidden_field_tag :registered_by, current_user.login, class: 'tag-field ', 'data-tagname': 'Registered By' %>
</span>
</div>
<div class="break"></div>
</div>

<div id='dialogs'>
Expand Down
12 changes: 0 additions & 12 deletions spec/controllers/dor/objects_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
context 'when source_id is not provided' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Book (ltr)',
'Registered By : jcoyne85'],
Expand All @@ -48,11 +46,9 @@
context 'when register is successful with default rights' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Document',
'Registered By : jcoyne85'],
Expand Down Expand Up @@ -95,11 +91,9 @@
context 'when register is successful with explicit rights' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Image',
'Registered By : jcoyne85'],
Expand Down Expand Up @@ -144,11 +138,9 @@
context 'when register is successful with location access' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Book (ltr)',
'Registered By : jcoyne85'],
Expand Down Expand Up @@ -193,11 +185,9 @@
context 'when register is successful with no-download' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Image',
'Registered By : jcoyne85'],
Expand Down Expand Up @@ -242,11 +232,9 @@
context 'when register is successful with dark' do
let(:submitted) do
{
object_type: 'item',
admin_policy: 'druid:hv992ry2431',
collection: 'druid:hv992ry7777',
workflow_id: 'registrationWF',
metadata_source: 'label',
label: 'test parameters for registration',
tag: ['Process : Content Type : Image',
'Registered By : jcoyne85'],
Expand Down
2 changes: 0 additions & 2 deletions spec/features/item_registration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@
# to check the params below.
expect(page).to have_css('span.glyphicon-exclamation-sign', visible: true)
expect(registration_params).to include(
'object_type' => 'item',
'admin_policy' => 'druid:hv992ry2431',
'workflow_id' => 'goobiWF',
'metadata_source' => 'label',
'label' => 'object title',
'tag' => ['Process : Content Type : Book (ltr)', 'tag : test', "Registered By : #{user.sunetid}"],
'rights' => 'default',
Expand Down

0 comments on commit 452e526

Please sign in to comment.