samvera-deprecated / curation_concerns

A Hydra-based Rails Engine that extends an application, adding the ability to Create, Read, Update and Destroy (CRUD) objects (based on Hydra::Works) and providing a generator for defining object types with custom workflows, views, access controls, etc.
Other
15 stars 27 forks source link

Null workflow stategy = current New Work without workflow #1035

Closed elrayle closed 7 years ago

elrayle commented 7 years ago

Descriptive summary

Define workflow that can be used as default for current process used to create a New Work.

Expected behavior

When on the New Work UI, user can upload, set metadata, set relationships, and save without having to transition through states.

New Work

scholarworks commented 7 years ago

Since workflows aren't picked up unless manually loaded into the DB, no workflow is the default behavior. Do we need this ticket?

jcoyne commented 7 years ago

It would be better if we could always depend on a workflow and never had to do a null check.

mjgiarlo commented 7 years ago

@scholarworks @jcoyne Should this PR include then some way to automatically load the default workflow, e.g., when a curation concern is created?

scholarworks commented 7 years ago

@jcoyne @mjgiarlo - confirmed that a null workflow (i.e., has the work type name but zero actions) throws an error on load. I do have a very basic single step ("submitting") workflow outlined that may be sufficient.

https://github.com/scholarworks/curation_concerns/blob/workflow/lib/generators/curation_concerns/work/templates/workflow.json.erb

If this looks OK, I'll do a PR. Otherwise, I can keep cleaning it up.

mjgiarlo commented 7 years ago

@jcoyne @scholarworks Fair warning: I care more about names than I should, sometimes. ;)

My only questions about your json are related to naming. The names that are conventionally used for states in Sipity are words or phrases that can complete the sentence "The work is ____." So how about something like "new" as the initial state and "deposited" as the final state? If those are the states, I might also rename the "complete" action to "deposit" it to align with the state names, and rename the role to "depositing". So like:

{
  "work_types": [
    {
      "name": "<%= file_name %>",
        "actions": [{
          "name": "deposit",
          "from_states": [{"names": ["new"], "roles": ["depositing"]}],
          "transition_to": "deposited",
          "notifications": [
             {
               "notification_type": "email",
               "name": "confirmation_of_submitted_to_ulra_committee",
               "to": ["creating_user"],
               "cc": ["advising"]
             }
           ],
           "methods": [
             "CurationConcerns::Workflow::ActivateObject"
           ]
        }]
    }
  ]
}
mjgiarlo commented 7 years ago

@jcoyne @scholarworks My other question (more for @jcoyne and @vantuyls) is whether we should keep the work_types jazz in there given other discussions about moving away from work types as a way to assign and manage workflows.

Thanks, @scholarworks!

jcoyne commented 7 years ago

Yeah, we should remove work_types and we should add a label and description field. As far as what you call the states, I DGAF, @jeremyf seemed to have strong feelings though.

mjgiarlo commented 7 years ago

I suspect my suggested names are @jeremyf -friendly, but I'll let him be the judge! :+1: to your suggested changes, @jcoyne.

scholarworks commented 7 years ago

@mjgiarlo I have no strong feelings on names, so I totally welcome these.

@jcoyne - at what level will the label and description field go? Same as name?

jcoyne commented 7 years ago

@scholarworks yes, at top level of the workflow.

scholarworks commented 7 years ago

Something like this:

{
  "label": "Default Workflow",
  "description": "A single submission step, default workflow",
  "actions": [{
    "name": "deposit",
    "from_states": [{"names": ["new"], "roles": ["depositing"]}],
    "transition_to": "deposited",
    "notifications": [{
      "notification_type": "email",
      "name": "confirmation_of_submitted_to_ulra_committee",
      "to": ["creating_user"],
      "cc": ["advising"]
    }],
    "methods": [
      "CurationConcerns::Workflow::ActivateObject"
    ]
  }]
}
jcoyne commented 7 years ago

@scholarworks We still need a "name" at the top level, and I think we should keep the "work_types" too, but change it to something like "workflows"

mjgiarlo commented 7 years ago
{
  "workflows": [
    {
      "name": "default",
      "label": "Default Workflow",
      "description": "A single submission step, default workflow",
      "actions": [{
        "name": "deposit",
        "from_states": [{"names": ["new"], "roles": ["depositing"]}],
        "transition_to": "deposited",
        "methods": [
          "CurationConcerns::Workflow::ActivateObject"
        ]
      }]
    }
  ]
}
jcoyne commented 7 years ago

@mjgiarlo shoudn't the from_states for deposit be []? See https://github.com/projecthydra/curation_concerns/blob/82b079eac450f5d7317d941dfdc880fc60f7bd0d/lib/generators/curation_concerns/templates/workflow.json.erb#L10

mjgiarlo commented 7 years ago

@jcoyne yep. just fixed that, in fact, after I ran into errors. ;)