Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added optional resource name for workflows #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def render_condor_jobs_table(self, request, session, workflow, current_step, pre
# Get the current app
step_url_name = self.get_step_url_name(request, workflow)


context = {
'workflow': workflow,
'steps': steps,
Expand All @@ -131,6 +132,7 @@ def render_condor_jobs_table(self, request, session, workflow, current_step, pre
'back_url': self.back_url,
'nav_title': workflow.name,
'nav_subtitle': workflow.DISPLAY_TYPE_SINGULAR,
'description': workflow.description,
'jobs_table': jobs_table,
'base_template': self.base_template
}
Expand Down
5 changes: 4 additions & 1 deletion tethysext/workflows/controllers/workflows/workflow_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ def get_context(self, request, session, context, workflow_id, step_id, *args, **
# Get the current app
step_url_name = self.get_step_url_name(request, workflow)


context.update({
'workflow': workflow,
'steps': steps,
'current_step': current_step,
'previous_step': previous_step,
'next_step': next_step,
'step_url_name': step_url_name,
'nav_title': 'Replacement Resource Name: replacement workflow name',
'nav_title': workflow.name,
'description': workflow.description,
'nav_subtitle': workflow.DISPLAY_TYPE_SINGULAR,
'previous_title': self.previous_title,
'next_title': self.next_title,
Expand Down Expand Up @@ -426,3 +428,4 @@ def get_step_specific_context(self, request, session, context, current_step, pre
dict: key-value pairs to add to context.
"""
return {}

1 change: 1 addition & 0 deletions tethysext/workflows/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TethysWorkflow(WorkflowsBase, AttributesMixin, ResultsMixin):
name = Column(String)
date_created = Column(DateTime, default=dt.datetime.utcnow)
_attributes = Column(String)
description = Column(String, nullable=True)

steps = relationship('Step', order_by='Step.order', backref='workflow',
cascade='all,delete')
Expand Down
7 changes: 7 additions & 0 deletions tethysext/workflows/public/css/nav_header.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@

#nav-header #nav-title .subtitle {
font-size: 12pt;
}

#nav-header #nav-title .description {
/* Prevent text from wrapping and add ellipsis at the end of line for overlap*/
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
4 changes: 4 additions & 0 deletions tethysext/workflows/templates/gizmos/new_workflow_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ <h4 class="modal-title" id="new-workflow-modal-label">New Workflow</h4>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="new-workflow-description-input">Description (Optional)</label>
<input type="text" class="form-control" id="new-workflow-description-input" name="description">
</div>
</form>
</div>
<div class="modal-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
nav_title(str): Title to show at the top of the nav.
nav_subtitle(str, optional): Sub-title to show below the title.

Optional Context Variables:
description(str): Description to show below the subtitle.

Required CSS:
<link href="{% static 'workflows/css/nav_header.css' %}" rel="stylesheet"/>
Optional CSS:
Expand All @@ -32,6 +35,9 @@
{% if nav_subtitle %}
<p class="subtitle">{{ nav_subtitle }}</p>
{% endif %}
{% if description %}
<p class="description" title="{{ description }}">{{ description }}</p>
{% endif %}
</div>
{% endblock %}
</div>
Expand Down
2 changes: 2 additions & 0 deletions tethysext/workflows/views/layouts/workflow_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def post(self, request, *args, **kwargs):
if 'new-workflow' in params:
workflow_name = params.get('workflow-name')
workflow_type = params.get('workflow-type')
description = params.get('description', None)

if not workflow_name:
messages.error(request, 'Unable to create new workflow: no name given.')
Expand All @@ -173,6 +174,7 @@ def post(self, request, *args, **kwargs):
workflow = workflow_model.new(
app=self.app,
name=workflow_name,
description=description,
creator_id = request.user.id,
creator_name = request.user.username,
geoserver_name = self.app.GEOSERVER_NAME,
Expand Down