-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Duke-GCB/11-cleanup-deliveries
Presentation improvements for delivery browsing
- Loading branch information
Showing
41 changed files
with
398 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
app/components/email-textarea.js → app/components/delivery-email.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import Ember from 'ember'; | ||
import {formatEmailText} from 'datadelivery-ui/utils/email-formatter'; | ||
|
||
export default Ember.Component.extend({ | ||
tagName: 'textarea', | ||
classNames: ['form-control'], | ||
attributeBindings: ['readonly', 'rows'], | ||
readonly: true, | ||
const DeliveryEmail = Ember.Component.extend({ | ||
classNames: ['well', 'well-sm', 'delivery-email'], | ||
value: null, //value to be displayed in the textarea | ||
rows: 2, // number of rows to show | ||
formattedValue: Ember.computed('value', function () { | ||
const value = this.get('value'); | ||
return formatEmailText(value); | ||
}) | ||
}); | ||
|
||
DeliveryEmail.reopenClass({ | ||
positionalParams: ['value'] | ||
}); | ||
|
||
export default DeliveryEmail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,52 @@ | ||
import Ember from 'ember'; | ||
|
||
// Transfer status filter options from | ||
// https://github.com/Duke-Translational-Bioinformatics/duke-data-service/blob/57258f5b44d31ca7f2cc630a14235aff70878f8f/app/models/project_transfer.rb#L24 | ||
|
||
const statusOptions = ['Pending', 'Rejected', 'Accepted', 'Canceled']; | ||
const statusFilterFunction = function(status, selected) { | ||
return status.capitalize() == selected; | ||
}; | ||
|
||
const DeliveryTable = Ember.Component.extend({ | ||
currentDukeDsUser: null, | ||
tagName: 'div', | ||
columns: [ | ||
outgoingTransfers: Ember.computed('transfers.[]', 'currentDukeDsUser', function() { | ||
const currentDukeDsUserId = this.get('currentDukeDsUser.id'); | ||
return this.get('transfers').filterBy('fromUser.id', currentDukeDsUserId); | ||
}), | ||
incomingTransfers: Ember.computed('transfers.[]', 'currentDukeDsUser', function() { | ||
const currentDukeDsUserId = this.get('currentDukeDsUser.id'); | ||
return this.get('transfers').filter(function(transfer) { | ||
return transfer.get('toUsers').mapBy('id').includes(currentDukeDsUserId); | ||
}); | ||
}), | ||
outgoingColumns: [ | ||
{ propertyName: "project.name", title: "Project Name", routeName: "deliveries.show"}, | ||
{ propertyName: "fromUser.fullName", title: "From"}, | ||
{ propertyName: "toUsersNames", title: "To"}, | ||
{ propertyName: "status", title: "State"} | ||
{ propertyName: "status", | ||
title: "State", | ||
component: 'delivery-state', | ||
filterWithSelect: true, | ||
predefinedFilterOptions: statusOptions, | ||
filterFunction: statusFilterFunction | ||
} | ||
], | ||
incomingColumns: [ | ||
{ propertyName: "project.name", title: "Project Name", routeName: "deliveries.show"}, | ||
{ propertyName: "fromUser.fullName", title: "From"}, | ||
{ propertyName: "status", | ||
title: "State", | ||
component: 'delivery-state', | ||
filterWithSelect: true, | ||
predefinedFilterOptions: statusOptions, | ||
filterFunction: statusFilterFunction | ||
} | ||
] | ||
}); | ||
|
||
DeliveryTable.reopenClass({ | ||
positionalParams: ['transfers'] | ||
positionalParams: ['transfers', 'currentDukeDsUser'] | ||
}); | ||
|
||
export default DeliveryTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
tagName: '', | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
classNames: ['row'], | ||
value: null, | ||
readonly: false | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
session: Ember.inject.service('session'), | ||
dukeDsUser: Ember.inject.service('duke-ds-user'), | ||
currentDukeDsUser: null, | ||
authenticatedDidChange: Ember.on('init', Ember.observer('session.isAuthenticated', function () { | ||
if (this.get('session.isAuthenticated')) { | ||
this.get('dukeDsUser').currentDukeDsUser().then(currentDukeDsUser => { | ||
this.set('currentDukeDsUser', currentDukeDsUser); | ||
}); | ||
} else { | ||
this.set('currentDukeDsUser', null); | ||
} | ||
}) | ||
) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
application: Ember.inject.controller(), | ||
currentDukeDsUser: Ember.computed.alias('application.currentDukeDsUser') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
|
||
export function addLineBreaks(params) { | ||
const text = params[0]; | ||
const replaced = text.replace(/\n/g, '<br>'); | ||
return Ember.String.htmlSafe(replaced); | ||
} | ||
|
||
export default Ember.Helper.helper(addLineBreaks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Ember from 'ember'; | ||
|
||
export function formatDeliveryState(params) { | ||
if(params.length > 0) { | ||
return params[0].capitalize(); | ||
} else { | ||
return ''; | ||
} | ||
} | ||
|
||
export default Ember.Helper.helper(formatDeliveryState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
{{row-label-value label="From" value=transfer.fromUser.fullName}} | ||
{{row-label-value label="To" value=toUserNames}} | ||
{{#unless brief}} | ||
{{row-label-value label="Status" value=transfer.status}} | ||
{{#if delivery.declineReason}} | ||
{{row-label-value label="Decline Reason" value=delivery.declineReason}} | ||
{{/if}} | ||
{{#if delivery.performedBy}} | ||
{{row-label-value label="Performed By" value=delivery.performedBy}} | ||
{{/if}} | ||
{{user-message-textarea value=delivery.userMessage readonly=true}} | ||
<div class="row"> | ||
<div class="col-md-12"><label>Delivery Email</label></div> | ||
<div class="col-md-10 small-left-margin"> | ||
{{email-textarea rows="8" value=delivery.deliveryEmailText }} | ||
</div> | ||
</div> | ||
{{/unless}} | ||
{{yield}} | ||
<dl class="dl-horizontal"> | ||
{{#detail-label-value label="From"}}{{transfer.fromUser.fullName}}{{/detail-label-value}} | ||
{{#detail-label-value label="To"}}{{transfer.toUsersNames}}{{/detail-label-value}} | ||
{{#unless brief}} | ||
{{#detail-label-value label="Status"}}{{format-delivery-state transfer.status}}{{/detail-label-value}} | ||
{{#if delivery.declineReason}} | ||
{{#detail-label-value label="Decline Reason"}}{{delivery.declineReason}}{{/detail-label-value}} | ||
{{/if}} | ||
{{#if delivery.performedBy}} | ||
{{#detail-label-value label="Performed By"}}{{delivery.performedBy}}{{/detail-label-value}} | ||
{{/if}} | ||
{{#detail-label-value label="Delivery Email"}} | ||
{{delivery-email delivery.deliveryEmailText}} | ||
{{/detail-label-value}} | ||
{{/unless}} | ||
{{yield}} | ||
</dl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{add-line-breaks formattedValue}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ format-delivery-state record.status }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<dt class="detail-label">{{label}}</dt> | ||
<dd class="detail-value">{{yield}}</dd> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
<div class="col-md-12 col-sm-12"><label>User Message</label></div> | ||
<div class="col-md-10 small-left-margin"> | ||
{{textarea value=value readonly=readonly rows="4" class="form-control"}} | ||
</div> | ||
{{yield}} | ||
{{textarea value=value rows="4" class="form-control"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{{delivery-breadcrumbs selectedRouteName="deliveries.index"}} | ||
<h1>Deliveries</h1> | ||
{{delivery-table model}} | ||
<h2>All Deliveries</h2> | ||
|
||
{{delivery-table model currentDukeDsUser}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.