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

Galen consultations prj 27 add ref number wkflw step #4905

Merged
merged 20 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4087328
re consultations-prj #27, adds a workflow step template for adding re…
whatisgalen May 29, 2019
d4267de
re consultations-prj #27, adds a ref-number workflow step viewmodel
whatisgalen May 29, 2019
b01c2b2
adds foreach for observable array of ref number tiles, re consultatio…
whatisgalen May 30, 2019
be897d8
sets basic styling for consultations-prj #27
whatisgalen Jun 6, 2019
1a2e2c6
save generates new TileViewModel instead of TileModel, re#27
whatisgalen Jun 7, 2019
c584216
adds parallel array mostly for testing, re #27
whatisgalen Jun 10, 2019
1350e7b
adds selectedTile computed, re #27
whatisgalen Jun 11, 2019
8dba301
adds additional conditional for provisionalTileViewModel, improves fu…
whatisgalen Jun 11, 2019
0dea5b8
fixed merge conflict in resource-instance-select, merging lastest mas…
whatisgalen Jun 11, 2019
26434d3
saving additional merge changes
whatisgalen Jun 11, 2019
c45e1c5
updates multi-tile template to adapt to any/all widgets using card co…
whatisgalen Jun 13, 2019
52af706
cleans up new-multi, removes unnecessary alterations to new-tile-step…
whatisgalen Jun 13, 2019
5ca56e9
fixes linting errors found by stickler, re consultations-prj #27
whatisgalen Jun 13, 2019
ef6ce72
fixes last linting error, re consultations-prj #27
whatisgalen Jun 13, 2019
1e3b303
updates styling for generic names, re consultations-prj #27
whatisgalen Jun 13, 2019
9fd4300
rm DS_Store files, rm commented code in card.js, rm unused imports fr…
whatisgalen Jun 14, 2019
696ff1b
adds deleteTile method to remove method in new multi tile, updates cs…
whatisgalen Jun 14, 2019
087080e
adds alert message onFail for tile.deleteTile, re consultations-prj #27
whatisgalen Jun 14, 2019
4505603
fixes linting error on indent spacing, re consultations-prj #27
whatisgalen Jun 14, 2019
10a73cc
Merge remote-tracking branch 'origin/master' into galen_consultations…
robgaston Jun 14, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ jsdoc.json
migrate_graphs.py
djcp.sh
.vscode
.DS_Store
75 changes: 73 additions & 2 deletions arches/app/media/css/arches.css
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,15 @@ input[type="checkbox"] {
background-color: white;
}

.workflow-step-icon {
border-radius: 50%;
.workflowstep-nav.workflow-step-icon {
display: block;
margin: 0 auto;
}

.workflow-step-icon {
border-radius: 50%;
/* display: block;
margin: 0 auto; */
height: 56px;
line-height: 56px;
text-align: center;
Expand Down Expand Up @@ -506,6 +511,72 @@ input[type="checkbox"] {
overflow-y: auto;
}

.wf-multi-tile-step-container {
display: flex;
flex-direction: row;
}

.wf-multi-tile-step-form {
display: flex;
flex-direction: column;
flex-grow: 3;
}

.wf-multi-tile-step-list {
display: flex;
flex-direction: column;
flex-grow: 1;
padding: 24px 24px 0 24px;
}

.wf-multi-tile-step-card {
border: 1px solid #e8e8e8;
border-radius: 2px;
background-color: white;
padding: 15px 5px 15px 15px;
display: flex;
flex-direction: row;
}

.wf-multi-tile-card-info {
display: flex;
flex-direction: row;
}

div.wf-multi-tile-card-info div {
margin-left: 12px;
}

.wf-multi-tile-card-info-details {
color: #5d768f;
padding-left: 12px;
}

.wf-multi-tile-card-info-details > h4 {
margin-bottom: 2px;
/* margin-left: 12px; */
}



.wf-multi-tile-step-card div div {
margin: 0;
}

.wf-multi-tile-step-card > div.wf-multi-tile-card-info ~ div {
display: flex;
flex-direction: row;
color: #4f9ce9;
font-size: 14px;
cursor: pointer;
height: 32px;
/* align-self: flex-end; */
}

.wf-multi-tile-step-card > div.wf-multi-tile-card-info ~ div span {
margin-right: 6px;
}

.workflow-nav-controls {
width: 60px;
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions arches/app/media/js/viewmodels/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ define([
save: function(onFail, onSuccess) {
loading(true);
delete self.formData.data;
if (params.provisionalTileViewModel.selectedProvisionalEdit()) {
if (params.provisionalTileViewModel && params.provisionalTileViewModel.selectedProvisionalEdit()) {
self.formData.append('accepted_provisional', JSON.stringify(params.provisionalTileViewModel.selectedProvisionalEdit()));
params.provisionalTileViewModel.acceptProvisionalEdit();
}
Expand Down Expand Up @@ -241,7 +241,7 @@ define([
if (selected) this.expanded(true);
}, this);
this.expanded.subscribe(function(expanded) {
if (expanded && this.parent) this.parent.expanded(true);
if (expanded && this.parent && typeof this.parent != "function") this.parent.expanded(true);
}, this);
this.isChildSelected = ko.pureComputed(function() {
return isChildSelected(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
define([
whatisgalen marked this conversation as resolved.
Show resolved Hide resolved
'knockout',
'views/components/workflows/new-tile-step',
'viewmodels/alert'
], function(ko, NewTileStepViewModel, AlertViewModel) {

/**
* A generic viewmodel for workflow steps that can add multiple tiles
* @name NewMultiTileStepViewModel
**/

function NewMultiTileStepViewModel(params) {
NewTileStepViewModel.apply(this, [params]);
var self = this;

this.remove = function(tile) {
whatisgalen marked this conversation as resolved.
Show resolved Hide resolved
tile.deleteTile( function(response) {
self.alert(new AlertViewModel(
'ep-alert-red',
response.responseJSON.message[0],
response.responseJSON.message[1],
null,
function(){ return; }
));
});
};

this.edit = function(tile) {
self.tile(tile);
};

self.saveTile = function(tile, callback) {
self.loading(true);
tile.save(function(response) {
self.loading(false);
self.alert(
new AlertViewModel(
'ep-alert-red',
response.responseJSON.message[0],
response.responseJSON.message[1],
null,
function(){ return; }
)
);
}, function(tile) {
params.resourceid(tile.resourceinstance_id);
params.tileid(tile.tileid);
self.resourceId(tile.resourceinstance_id);
self.complete(true);
if (typeof callback === 'function') {
callback.apply(null, arguments);
}
self.tile(self.card().getNewTile());
self.tile().reset();
setTimeout(function() {
self.tile().reset();
}, 1);
self.loading(false);
});
};

var updateTileOnInit = self.tile.subscribe(function() {
updateTileOnInit.dispose();
self.tile(self.card().getNewTile());
});
}
ko.components.register('new-multi-tile-step', {
viewModel: NewMultiTileStepViewModel,
template: {
require: 'text!templates/views/components/workflows/new-multi-tile-step.htm'
}
});
return NewMultiTileStepViewModel;
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define([
this.tile = ko.observable();
this.loading = params.loading || ko.observable(false);
this.alert = params.alert || ko.observable(null);
this.resourceId = params.resourceid;
this.resourceId = params.resourceid || ko.observable();
this.complete = params.complete || ko.observable();

this.loading(true);
Expand Down
2 changes: 1 addition & 1 deletion arches/app/templates/views/components/cards/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}">
<li role="treeitem" class="jstree-node" data-bind="css: {'jstree-open': (cards.length > 0 && expanded), 'jstree-closed' : (cards.length > 0 && !expanded()), 'jstree-leaf': cards.length === 0}, event: {'dragstart': function () { console.log('dragging...') }}">
<i class="jstree-icon jstree-ocl" role="presentation" data-bind="click: function(){expanded(!expanded())}"></i>
<a class="jstree-anchor" href="#" tabindex="-1" data-bind="click: function () { self.form.selection($data)}, css:{'jstree-clicked': selected, 'child-selected': isChildSelected(), 'filtered-leaf': card.highlight()}">
<a class="jstree-anchor" href="#" tabindex="-1" data-bind="click: function () { self.form.selection($data);}, css:{'jstree-clicked': selected, 'child-selected': isChildSelected(), 'filtered-leaf': card.highlight()}">
<i class="fa fa-file" role="presentation" data-bind="css:{'has-provisional-edits': doesChildHaveProvisionalEdits() || $data.hasprovisionaledits()}"></i>
<strong style="margin-right: 10px;">
{% block editor_tree_node_content %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- ko let: { self: $data } -->
<!-- ko if: !loading() -->
<div data-bind="" class="wf-multi-tile-step-container">
<!-- ko if: tile() && card() -->
<div class="wf-multi-tile-step-form">
<h3>Add Reference Number</h3>
<div data-bind="component: {
name: cardComponentLookup[card().model.component_id()].componentname,
params: {
card: card(),
tile: tile(),
provisionalTileViewModel: provisionalTileViewModel,
reviewer: reviewer,
loading: loading,
form: $data
}
}"></div>
</div>
<div class="wf-multi-tile-step-list">
<!-- ko foreach: {data: card().tiles, as: 'tile'} -->
<div class="wf-multi-tile-step-card">
<div class="wf-multi-tile-card-info">
<div class="workflow-step-icon complete"><span><i class="fa fa-hashtag"></i></span></div>
<div class="wf-multi-tile-card-info-details">
<!-- ko foreach: {data: $parent.card().widgets(), as: 'widget'} -->
<!-- ko component: {
name: widget.widgetLookup[widget.get("widget_id")()].name,
params: {
config: widget.configJSON,
label: widget.label(),
node: widget.node,
value: $parent.data[widget.node_id()],
state: "report"
}
} --><!-- /ko -->
<!-- /ko -->
</div>
</div>
<div>
<div data-bind="click: function(){$parent.remove(tile)}"><span><i class="fa fa-times-circle"></i></span><span>Remove</span></div>
<div data-bind="click: function(){$parent.edit(tile);}"><span><i class="fa fa-pencil"></i></span><span>Edit</span></div>
</div>
</div>
<!-- /ko -->
</div>
<!-- /ko -->
</div>
<!-- /ko -->
<!-- /ko -->