Skip to content

Commit

Permalink
Merge pull request #505 from MetadataRegistry/develop
Browse files Browse the repository at this point in the history
Release to master 2015-11-03
  • Loading branch information
amilward committed Nov 3, 2015
2 parents b2cb223 + 081a0d2 commit 241f742
Show file tree
Hide file tree
Showing 80 changed files with 3,748 additions and 498 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**.iml
**/web-app/*
**/.idea/*
**/.idea/**/*
**/atlassian-ide-plugin.xml
ModelCatalogueCorePlugin/test/unit/resources/SACT/Breast_XMLSchema.xsd
ModelCatalogueCorePlugin/test/unit/resources/SACT/XMLDataTypes.xsd
Expand All @@ -10,7 +10,7 @@ ModelCatalogueCorePluginTestApp/test/integration/resources/DataTemplateChangeDat
ModelCatalogueCorePluginTestApp/test/integration/resources/DataTemplateChangeDataItems.xls
ModelCatalogueCorePluginTestApp/test/integration/resources/example.xls
ModelCatalogueCorePluginTestApp/test/integration/resources/rare_diseases_combined.umlj
out/**/*
**/out/**/*
**/target/**/*
**/target-eclipse/**/*
**/*.class
Expand Down
23 changes: 20 additions & 3 deletions ModelCatalogueCorePlugin/ModelCatalogueCoreGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ Model catalogue core plugin (metadata registry)
creates asset
title { "Export All Elements of ${it.name} to Excel XSLX" }
type Model
when { Model model ->
model.countContains() > 0
}
link controller: 'dataArchitect', action: 'getSubModelElements', params: [format: 'xlsx', report:'NHIC'], id: true
}

Expand All @@ -319,9 +322,23 @@ Model catalogue core plugin (metadata registry)

reportsRegistry.register {
creates link
title { "GE Inventory Report Docx" }
type Classification
link controller: 'classificationReports', action: 'gereportDoc', id: true
title { "Inventory Report Document" }
type Model
link controller: 'model', action: 'inventoryDoc', id: true
}

reportsRegistry.register {
creates link
title { "Inventory Report Spreadsheet" }
type Model
link controller: 'model', action: 'inventorySpreadsheet', id: true
}

reportsRegistry.register {
creates link
title { "Changelog Document" }
type Model
link controller: 'model', action: 'changelogDoc', id: true
}

reportsRegistry.register {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config ['actions
}
]

annotate = ['$scope', 'messages', ($scope, messages) -> {
label: "Annotate Letter"
action: ->
messages.prompt('Annotate Letter', '', type: 'annotate-letter')
}]
actionsProvider.registerChildAction 'new-import', 'annotate-letter', annotate
actionsProvider.registerActionInRole 'global-annotate-letter', actionsProvider.ROLE_GLOBAL_ACTION, annotate


loincImport = ['$scope', 'messages', ($scope, messages) -> {
label: "Import Loinc"
action: ->
Expand Down Expand Up @@ -355,6 +364,7 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config ['actions
label: report.title
url: report.url
type: report.type
watches: 'element'
action: ->
if @type == 'LINK'
$window.open(@url, '_blank')
Expand All @@ -370,6 +380,7 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config ['actions
position: 1000
label: "#{$scope.element.name} Reports"
disabled: not $scope.element?.availableReports?.length
watches: 'element.availableReports'
generator: (action) ->
action.createActionsFrom 'element.availableReports', generateReports($scope, $window, enhance, rest)
}
Expand All @@ -380,6 +391,7 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config ['actions
position: 2000
label: "Other Reports"
disabled: not $scope.reports?.length
watches: 'reports'
generator: (action) ->
action.createActionsFrom 'reports', generateReports($scope, $window, enhance, rest)
}
Expand All @@ -392,6 +404,7 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config ['actions
position: 5000
label: "Current Reports"
disabled: not $scope.list.availableReports?.length
watches: 'list.availableReports'
generator: (action) ->
action.createActionsFrom 'list.availableReports', generateReports($scope, $window, enhance, rest)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ angular.module('mc.core.ui.bs.catalogueElementActions', ['mc.util.ui.actions']).
label: ''
icon: 'glyphicon glyphicon-remove'
type: 'danger'
watches: 'element.inherited'
disabled: $scope.element.inherited
action: ->
rel = $scope.element
deferred = $q.defer()
Expand Down Expand Up @@ -271,6 +273,8 @@ angular.module('mc.core.ui.bs.catalogueElementActions', ['mc.util.ui.actions']).
label: ''
icon: 'glyphicon glyphicon-edit'
type: 'primary'
watches: 'element.inherited'
disabled: $scope.element.inherited
action: ->
rel = getRelationship()
rel.element.refresh().then (element) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ angular.module('mc.core.ui.bs.catalogueElementProperties', []).config ['catalogu
dataType = relationship?.relation?.valueDomain?.dataType
if dataType?.enumerations?.values
ext = dataType?.enumerations?.values ? []
for e in ext
for e, i in ext
if i == 10
result += "..."
break
result += "#{e.key} \n"
else if dataType
result = dataType?.name
Expand Down Expand Up @@ -332,6 +335,7 @@ angular.module('mc.core.ui.bs.catalogueElementProperties', []).config ['catalogu
catalogueElementPropertiesProvider.configureProperty 'type:date', tabDefinition: hideTab
catalogueElementPropertiesProvider.configureProperty 'type:string', tabDefinition: hideTab

catalogueElementPropertiesProvider.configureProperty '$$href', hidden: true
catalogueElementPropertiesProvider.configureProperty 'version', hidden: true
catalogueElementPropertiesProvider.configureProperty 'name', hidden: true
catalogueElementPropertiesProvider.configureProperty 'classifiedName', hidden: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ angular.module('mc.core.ui.bs.catalogueElementTreeview', ['mc.core.ui.catalogueE
<div class="catalogue-element-treeview-list-container">
<ul class="catalogue-element-treeview-list-root catalogue-element-treeview-root-list-root catalogue-element-treeview-list" ng-switch="mode">
<span ng-if="!element.elementType &amp;&amp; !list.total"><a class="btn btn-link"><span class="glyphicon glyphicon-ban-circle"></span></a> No Data</span>
<catalogue-element-treeview-item element="item" descend="descend" root-id="id" repeat="repeat" ng-repeat="item in list.$$children"></catalogue-element-treeview-item>
<catalogue-element-treeview-item element="item" descend="descend" treeview="treeview" repeat="repeat" ng-repeat="item in list.$$children"></catalogue-element-treeview-item>
<li ng-if="list.total > list.$$children.length" class="catalogue-element-treeview-item">
<span class="catalogue-element-treeview-labels" ng-click="showMore()">
<a class="catalogue-element-treeview-icon btn btn-link catalogue-element-treeview-root-show-more catalogue-element-treeview-show-more"><span class="fa fa-fw fa-chevron-down"></span></a> <a class="text-muted">Show more</a>
</span>
</li>
<catalogue-element-treeview-item element="element" descend="descend" root-id="id" repeat="repeat" ng-switch-when="element"></catalogue-element-treeview-item>
<catalogue-element-treeview-item element="element" descend="descend" treeview="treeview" repeat="repeat" ng-switch-when="element"></catalogue-element-treeview-item>
</ul>
</div>
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ cetiModule.run [ '$templateCache', ($templateCache) ->
<span ng-class="element.getIcon()"></span>
</a>
<span class="catalogue-element-treeview-name" ng-class="{'text-warning': element.status == 'DRAFT', 'text-info': element.status == 'PENDING', 'text-danger': (element.status == 'DEPRECATED' || element.undone)}" ng-click="select(element)">{{element.$$localName || element.name}}<small class="text-muted" ng-if="element.$$localName"> {{element.name}}</small><small class="text-muted"> <span ng-if="element.latestVersionId" class="catalogue-element-treeview-version-number">{{element.latestVersionId}}.{{element.versionNumber}}</span></small></span>
<small class="text-muted" ng-if="element.href"> <a class="catalogue-element-treeview-link" ng-href="{{element.href()}}" title="{{element.$$localName || element.name}}" target="_blank"><span class="fa fa-external-link"></span></a></small>
<small class="text-muted" ng-if="element.$$href"> <a class="catalogue-element-treeview-link" ng-href="{{element.$$href}}" title="{{element.$$localName || element.name}}" target="_blank"><span class="fa fa-external-link"></span></a></small>
</span>
</div>
<ul ng-if="element.$$children" ng-hide="element.$$collapsed" class="catalogue-element-treeview-list">
<catalogue-element-treeview-item element="child" descend="nextDescend" repeat="repeat" ng-repeat="child in element.$$children track by $index" root-id="rootId"></catalogue-element-treeview-item>
<catalogue-element-treeview-item element="child" descend="nextDescend" repeat="repeat" treeview="treeview" ng-repeat="child in element.$$children track by $index"></catalogue-element-treeview-item>
<li ng-if="element.$$numberOfChildren > element.$$children.length" class="catalogue-element-treeview-item">
<span class="catalogue-element-treeview-labels" ng-click="element.$$showMore()">
<a class="catalogue-element-treeview-icon btn btn-link catalogue-element-treeview-show-more"><span class="fa fa-fw fa-chevron-down"></span></a> <a class="text-muted">Show more</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ angular.module('mc.core.ui.bs.columns', ['mc.util.names']).config ['columnsProvi
return enumeratedType.description if not enumeratedType.enumerations
return enumeratedType.description if not enumeratedType.enumerations.values
enumerations = []
enumerations.push "#{enumeration.key}: #{enumeration.value}" for enumeration in enumeratedType.enumerations.values
for enumeration, i in enumeratedType.enumerations.values
if i == 10
enumerations.push('...')
break
enumerations.push "#{enumeration.key}: #{enumeration.value}"
enumerations.join('\n')

getStatusClass = (status) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ angular.module('mc.core.ui.bs', [
'mc.core.ui.bs.modalPromptRelationshipTypeEdit'
'mc.core.ui.bs.modalPromptGenerateSuggestions'
'mc.core.ui.bs.modalPromptDataElementEdit'
'mc.core.ui.bs.modalPromptAnnotateLetter'
'mc.core.ui.bs.saveOrUpdatePublishedElementCtrl'
'mc.core.ui.bs.saveAndCreateAnotherCtrlMixin'
'mc.core.ui.bs.modalPromptConvert'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
angular.module('mc.core.ui.bs.modalPromptAnnotateLetter', ['mc.util.messages', 'angularFileUpload']).config ['messagesProvider', (messagesProvider)->
factory = [ '$modal', ($modal) ->
(title, body, args) ->
dialog = $modal.open {
windowClass: 'basic-edit-modal-prompt'
backdrop: 'static'
keyboard: false
resolve:
args: -> args
template: '''
<div class="modal-header">
<h4>Annotate Letter</h4>
</div>
<div class="modal-body">
<messages-panel messages="messages"></messages-panel>
<form role="form" ng-submit="saveElement()">
<div class="form-group">
<label for="classifications"> Classifications</label>
<elements-as-tags elements="copy.classifications"></elements-as-tags>
<input id="classifications" placeholder="Classification" ng-model="pending.classification" catalogue-element-picker="classification" label="el.name" typeahead-on-select="addClassification()">
</div>
<div class="form-group">
<label for="name" class="">Annotated File Name</label>
<input type="text" class="form-control" id="name" placeholder="Annotated File Name (leave blank to use filename)" ng-model="copy.name">
</div>
<div class="form-group">
<label for="asset" class="">File</label>
<input ng-hide="uploading &amp;&amp; progress" type="file" accept="text/plain" class="form-control" id="asset" placeholder="File" ng-model="copy.asset" ng-file-select="onFileSelect($files)">
<progressbar value="progress" ng-show="uploading &amp;&amp; progress">{{progress}} %</progressbar>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-success" ng-click="saveElement()" ng-disabled="uploading"><span class="glyphicon glyphicon-ok"></span> Save</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
'''
controller: ['$scope', 'messages', 'names', 'modelCatalogueDataArchitect', '$modalInstance', '$upload', 'modelCatalogueApiRoot', 'enhance', 'catalogue', 'args', ($scope, messages, names, modelCatalogueDataArchitect, $modalInstance, $upload, modelCatalogueApiRoot, enhance, catalogue, args) ->
$scope.copy =
classifications = []
$scope.messages = messages.createNewMessages()

$scope.addClassification = ->
$scope.copy = {classifications: []} unless $scope.copy
$scope.copy.classifications = [] unless $scope.copy.classifications
$scope.copy.classifications.push($scope.pending.classification)
delete $scope.pending.classification

$scope.cancel = ->
$scope.progress = undefined
if $scope.upload
$scope.upload.abort()

$modalInstance.dismiss('Upload Canceled')

$scope.onFileSelect = ($files) ->
$scope.copy.file = $files[0]
if $scope.copy.name == $scope.copy.originalFileName or $scope.nameFromFile
$scope.nameFromFile = true
$scope.copy.name = $scope.copy.file.name

$scope.saveElement = ->
$scope.messages.clearAllMessages()
if not $scope.copy.name and not $scope.copy.file
$scope.messages.error 'Empty Name', 'Please fill the name'
return

if $scope.copy.classifications.length == 0
$scope.messages.error 'Empty Classifications', 'Please select at least one classification'
return


$scope.uploading = true
$scope.upload = $upload.upload({
params: {name: $scope.copy.name, classifications: (c.id for c in $scope.copy.classifications).join(',')}
url: "#{modelCatalogueApiRoot}/dataArchitect/imports/annotate"
file: $scope.copy.file
fileFormDataName: 'file'
}).progress((evt) ->
$scope.progress = parseInt(100.0 * evt.loaded / evt.total)
).success((result) ->
result = enhance result
$scope.uploading = false
if result.errors
for err in result.errors
$scope.messages.error err.message
else
messages.success('Created ' + result.getElementTypeName(), "You have created #{result.getElementTypeName()} #{result.name}.")
$modalInstance.close(result)
if catalogue.isInstanceOf result.elementType, 'asset'
result.show()
).error((data) ->
for err in data.errors
if angular.isString(err)
$scope.messages.error err
else if err.message
$scope.messages.error err.message
$scope.uploading = false
$scope.progress = 0
$modalInstance.close()
)
]

}

dialog.result
]
messagesProvider.setPromptFactory 'annotate-letter', factory
]
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ angular.module('mc.core.ui.bs.navigationActions', ['mc.util.ui.actions', 'mc.uti
action.label = getLabel(user)
security.getCurrentUser().classifications = user.classifications
$state.go '.', $stateParams, reload: true
$scope.$broadcast 'redrawContextualActions'
}

action
Expand Down
Loading

0 comments on commit 241f742

Please sign in to comment.