Skip to content

Commit

Permalink
Merge pull request #1002 from MetadataConsulting/MET-1745_Batches_and…
Browse files Browse the repository at this point in the history
…_Actions

Met 1745 batches and actions
  • Loading branch information
amilward authored Jul 25, 2017
2 parents eb7803e + 4c2fbc8 commit f7e9aa4
Show file tree
Hide file tree
Showing 74 changed files with 4,468 additions and 1,564 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,25 @@ angular.module('mc.core.ui.bs.actions', ['mc.util.ui.actions']).config (actionsP
}
]

actionsProvider.registerActionInRole 'delete-suggestions', actionsProvider.ROLE_LIST_ACTION, ['$scope', 'security',
'catalogue', 'modelCatalogueApiRoot', 'enhance', 'rest', 'messages', '$state',
($scope, security, catalogue, modelCatalogueApiRoot, enhance, rest, messages, $state)->
return undefined unless security.isUserLoggedIn()
return undefined unless $scope.list
return undefined unless catalogue.isInstanceOf($scope.list.itemType, 'batch')
{
position: 100
label: 'Delete Suggestions'
icon: 'fa fa-flash'
type: 'primary'
action: ->
messages.prompt('Delete Merged Batch', "Delete current list of suggestions", {type: 'delete-suggestions'}).then ->
$state.go('.', {page: undefined}, {reload: true})

}
]


actionsProvider.registerActionInRole 'refresh-batches', actionsProvider.ROLE_LIST_ACTION, ['$state', '$scope',
'security', 'catalogue', ($state, $scope, security, catalogue)->
return undefined unless security.isUserLoggedIn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ angular.module('mc.core.ui.bs', [
'mc.core.ui.bs.modalPromptRelationshipTypeEdit'
'mc.core.ui.bs.modalPromptDatModelPolicyEdit'
'mc.core.ui.bs.modalPromptGenerateSuggestions'
'mc.core.ui.bs.modalPromptDeleteSuggestions'
'mc.core.ui.bs.modalPromptDataElementEdit'
'mc.core.ui.bs.modalAbout'
'mc.core.ui.bs.saveOrUpdatePublishedElementCtrl'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
angular.module('mc.core.ui.bs.modalPromptDeleteSuggestions', ['mc.util.messages', 'mc.util.ui.focusMe']).config ['messagesProvider', (messagesProvider)->
messagesProvider.setPromptFactory 'delete-suggestions', [ '$uibModal', ($uibModal) ->
(title, body) ->
dialog = $uibModal.open {
windowClass: 'messages-modal-prompt'
template: '''
<div class="modal-header">
<h4>''' + title + '''</h4>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="close()">OK</button>
<button class="btn btn-warning" ng-click="$dismiss()">Cancel</button>
</div>
'''
resolve:
suggestionsNames: ['$http', 'modelCatalogueApiRoot', ($http, modelCatalogueApiRoot) ->
$http.get("#{modelCatalogueApiRoot}/dataArchitect/suggestionsNames").then (response) -> response.data
]
controller: ['$scope', 'suggestionsNames', '$uibModalInstance', 'rest', 'modelCatalogueApiRoot', 'messages', ($scope, suggestionsNames, $uibModalInstance, rest, modelCatalogueApiRoot, messages) ->
$scope.suggestionsNames = suggestionsNames
$scope.close = ->
rest(method: 'POST', url: "#{modelCatalogueApiRoot}/dataArchitect/deleteSuggestions", params: {suggestion: $scope.suggestion}).then ->
messages.success "Deleting are suggestions in the background. Refresh batch list to see the generated results."
$uibModalInstance.close()
]
}

dialog.result
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,41 @@ angular.module('mc.core.ui.bs.modalPromptGenerateSuggestions', ['mc.util.message
<h4>''' + title + '''</h4>
</div>
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="data-model-1" class="">Data Model 1</label>
<elements-as-tags elements="dataModels"></elements-as-tags>
<div class="input-group">
<input type="text" class="form-control" id="data-model-1" placeholder="Name" ng-model="dataModel1" catalogue-element-picker="dataModel" typeahead-on-select="push('dataModels', 'dataModel')">
</div>
</div>
</form>
<form role="form">
<div class="form-group">
<label for="data-model-2" class="">Data Model 2</label>
<elements-as-tags elements="dataModels"></elements-as-tags>
<div class="input-group">
<input type="text" class="form-control" id="data-model-2" placeholder="Name" ng-model="dataModel2" catalogue-element-picker="dataModel" typeahead-on-select="push('dataModels', 'dataModel')">
</div>
</div>
</form>
<form role="form">
<div class="form-group">
<label for="elements">''' + body + '''</label>
<select class="form-control" ng-options="name for name in suggestionsNames" ng-model="suggestion"/>
</div>
</form>
<form role="form">
<div class="form-group">
<label for="min-score"> Min Search Score (default is 10) </label>
<input type="number " class="form-control" max="90" id="min-score" placeholder="Min Score: 10" ng-model="minScore" >
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="close()">OK</button>
<button class="btn btn-primary" ng-click="close()" ng-disabled="isEmpty(dataModel1)||isEmpty(dataModel2)||isEmpty(suggestion)">OK</button>
<button class="btn btn-warning" ng-click="$dismiss()">Cancel</button>
</div>
'''
Expand All @@ -27,9 +53,12 @@ angular.module('mc.core.ui.bs.modalPromptGenerateSuggestions', ['mc.util.message
controller: ['$scope', 'suggestionsNames', '$uibModalInstance', 'rest', 'modelCatalogueApiRoot', 'messages', ($scope, suggestionsNames, $uibModalInstance, rest, modelCatalogueApiRoot, messages) ->
$scope.suggestionsNames = suggestionsNames
$scope.close = ->
rest(method: 'POST', url: "#{modelCatalogueApiRoot}/dataArchitect/generateSuggestions", params: {suggestion: $scope.suggestion}).then ->
rest(method: 'POST', url: "#{modelCatalogueApiRoot}/dataArchitect/generateSuggestions", params: {suggestion: $scope.suggestion, dataModel1: $scope.dataModel1.id, dataModel2: $scope.dataModel2.id, minScore: $scope.minScore}).then ->
messages.success "Suggestions are generating in the background. Refresh batch list to see the generated results."
$uibModalInstance.close()
$scope.isEmpty = (object) ->
return true if not object
angular.equals object, {}
]
}

Expand Down
163 changes: 91 additions & 72 deletions ModelCatalogueCorePluginTestApp/grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,23 @@ class BootStrap {
initSecurity(false)
setupDevTestStuff()
}
// modelCatalogueSearchService.reindex(true).all { it }.toBlocking().subscribe {
// System.out.println "Reindexed"
// }

} else {
initCatalogueService.initDefaultRelationshipTypes()
initPoliciesAndTags()
initSecurity(!System.getenv('MC_BLANK_DEV'))
}

modelCatalogueSearchService.reindex(true).all { it }.toBlocking().subscribe {
System.out.println "Reindexed"
}

initCatalogueService.setupStoredProcedures()

if (Environment.current == Environment.PRODUCTION) {
userService.inviteAdmins()
}


//register custom json Marshallers
//ctx.domainModellerService.modelDomains()
grailsApplication.mainContext.getBean('modelCatalogueCorePluginCustomObjectMarshallers').register()
Expand All @@ -90,7 +92,7 @@ class BootStrap {
reportsRegistry.register {
creates asset
title { "Inventory Report Spreadsheet" }
defaultName { "${it.name} report as MS Excel Document" }
defaultName { "${it.name} report as MS Excel Document Inventory" }
depth 3
type DataModel
when { DataModel dataModel ->
Expand All @@ -99,6 +101,18 @@ class BootStrap {
link controller: 'dataModel', action: 'inventorySpreadsheet', id: true
}

reportsRegistry.register {
creates asset
title { "Grid Report Spreadsheet" }
defaultName { "${it.name} report as MS Excel Document Grid" }
depth 3
type DataModel
when { DataModel dataModel ->
dataModel.countDeclares() > 0
}
link controller: 'dataModel', action: 'gridSpreadsheet', id: true
}

reportsRegistry.register {
creates asset
title { "Inventory Report Document" }
Expand Down Expand Up @@ -129,16 +143,6 @@ class BootStrap {
link controller: 'dataClass', action: 'inventorySpreadsheet', id: true
}

// needs more work
// reportsRegistry.register {
// creates asset
// title { "Changelog Document" }
// defaultName { "${it.name} changelog as MS Word Document" }
// depth 3
// includeMetadata true
// type DataClass
// link controller: 'dataClass', action: 'changelogDoc', id: true
// }

reportsRegistry.register {
creates link
Expand Down Expand Up @@ -169,29 +173,6 @@ class BootStrap {
link controller: 'genomics', action: 'exportAllRareDiseaseReports', id: true
}

// needs more work
// reportsRegistry.register {
// creates asset
// title { "GEL Changelog (Word Doc)" }
// defaultName { "${it.name} changelog as MS Word Document" }
// depth 3
// includeMetadata true
// type DataModel
// when { DataModel dataModel ->
// dataModel.ext.get(Metadata.HPO_REPORT_AVAILABLE) == 'true'
// }
// link controller: 'genomics', action: 'exportChangeLogDocument', id: true
// }

// reportsRegistry.register {
// creates asset
// title { "GEL Data Specification Report (Word Doc)" }
// defaultName { "${it.name} report as MS Word Document" }
// depth 3
// type DataModel
// link controller: 'genomics', action: 'exportGelSpecification', id: true
// }

reportsRegistry.register {
creates link
title { "Rare Diseases Disorder List (CSV)" }
Expand All @@ -212,6 +193,10 @@ class BootStrap {
link controller: 'genomics', action: 'exportRareDiseaseEligibilityDoc', id: true
}





reportsRegistry.register {
creates link
title { "Rare Diseases Phenotypes and Clinical Tests Report (Word Doc)" }
Expand All @@ -222,6 +207,17 @@ class BootStrap {
link controller: 'genomics', action: 'exportRareDiseasePhenotypesAndClinicalTestsDoc', id: true
}


reportsRegistry.register {
creates link
title { "Rare Diseases Eligibility Phenotypes Split Docs" }
type DataModel
when { DataModel dataModel ->
dataModel.ext.get(Metadata.HPO_REPORT_AVAILABLE) == 'true'
}
link controller: 'genomics', action: 'exportRareDiseaseSplitDocs', id: true
}

reportsRegistry.register {
creates link
title { "Rare Diseases HPO And Clinical Tests (JSON)" }
Expand Down Expand Up @@ -275,27 +271,17 @@ class BootStrap {
link controller: 'genomics', action: 'exportRareDiseaseEligibilityCsv', id: true
}

reportsRegistry.register {
creates link
title { "Rare Diseases Static Website" }
type DataModel
when { DataModel dataModel ->
dataModel.ext.get('Rare Disease Report Available') == 'true' || dataModel.ext.get("All Rare Disease Conditions Reports") == 'true' || dataModel.ext.get(Metadata.ALL_RD_REPORTS) == 'true' || dataModel.ext.get(Metadata.HPO_REPORT_AVAILABLE) == 'true'
}
link controller: 'genomics', action: 'exportRareDiseasesWebsite', id: true
}


// needs work before we can release
// reportsRegistry.register {
// creates link
// title { "Cancer Types (JSON)" }
// type DataModel
// when { DataModel dataModel ->
// dataModel.ext.get(Metadata.CANCER_TYPES_AVAILABLE) == 'true'
// }
// link controller: 'genomics', action: 'exportCancerTypesAsJson', id: true
// }
//
// reportsRegistry.register {
// creates link
// title { "Cancer Types (CSV)" }
// type DataModel
// when { DataModel dataModel ->
// dataModel.ext.get(Metadata.CANCER_TYPES_AVAILABLE) == 'true'
// }
// link controller: 'genomics', action: 'exportCancerTypesAsCsv', id: true
// }
// needs work before we can release
// reportsRegistry.register {
// creates link
Expand All @@ -322,17 +308,43 @@ class BootStrap {
// title { "GEL Data Specification Change Log (Excel)" }
// type DataModel
// link controller: 'genomics', action: 'exportDataSpecChangeLogAsXls', id: true
// }
// needs more work
// reportsRegistry.register {
// creates asset
// title { "Changelog Document" }
// defaultName { "${it.name} changelog as MS Word Document" }
// depth 3
// includeMetadata true
// type DataClass
// link controller: 'dataClass', action: 'changelogDoc', id: true
// }

reportsRegistry.register {
creates link
title { "Rare Diseases Static Website" }
type DataModel
when { DataModel dataModel ->
dataModel.ext.get('Rare Disease Report Available') == 'true' || dataModel.ext.get("All Rare Disease Conditions Reports") == 'true' || dataModel.ext.get(Metadata.ALL_RD_REPORTS) == 'true' || dataModel.ext.get(Metadata.HPO_REPORT_AVAILABLE) == 'true'
}
link controller: 'genomics', action: 'exportRareDiseasesWebsite', id: true
}
// needs more work
// reportsRegistry.register {
// creates asset
// title { "GEL Changelog (Word Doc)" }
// defaultName { "${it.name} changelog as MS Word Document" }
// depth 3
// includeMetadata true
// type DataModel
// when { DataModel dataModel ->
// dataModel.ext.get(Metadata.HPO_REPORT_AVAILABLE) == 'true'
// }
// link controller: 'genomics', action: 'exportChangeLogDocument', id: true
// }

// reportsRegistry.register {
// creates asset
// title { "GEL Data Specification Report (Word Doc)" }
// defaultName { "${it.name} report as MS Word Document" }
// depth 3
// type DataModel
// link controller: 'genomics', action: 'exportGelSpecification', id: true
// }



}

private static void initSecurity(boolean production) {
Expand Down Expand Up @@ -395,6 +407,7 @@ class BootStrap {
'/login', '/login.*', '/login/*',
'/logout', '/logout.*', '/logout/*',
'/register/*', '/errors', '/errors/*',
'/load',
'/index.gsp'
]) {
createRequestmapIfMissing(url, 'permitAll', null)
Expand Down Expand Up @@ -428,11 +441,6 @@ class BootStrap {
createRequestmapIfMissing('/monitoring/**', 'ROLE_SUPERVISOR')
createRequestmapIfMissing('/plugins/console-1.5.0/**', 'ROLE_SUPERVISOR')

// createRequestmapIfMissing('/api/modelCatalogue/core/dataClass/**', 'IS_AUTHENTICATED_ANONYMOUSLY')
// createRequestmapIfMissing('/api/modelCatalogue/core/dataElement/**', 'ROLE_METADATA_CURATOR')
// createRequestmapIfMissing('/api/modelCatalogue/core/dataType/**', 'ROLE_USER')
// createRequestmapIfMissing('/api/modelCatalogue/core/*/**', 'ROLE_METADATA_CURATOR')
// createRequestmapIfMissing('/api/modelCatalogue/core/relationshipTypes/**', 'ROLE_ADMIN')
}

def initPoliciesAndTags() {
Expand Down Expand Up @@ -533,14 +541,25 @@ class BootStrap {
dataElement(name: 'Test Element 1') {
dataType(name: 'Same Name')
}
dataElement(name: 'Test Element 2') {
dataType(name: 'Same Name')
}
}

}

catalogueBuilder.build {
dataModel(name: 'Test 2') {
automatic dataType
policy 'Unique of Kind'
dataElement(name: 'Test Element 2') {
dataType(name: 'Same Name')
}
}
}

catalogueBuilder.build {
automatic dataType
dataModel(name: 'Test 3') {
dataElement(name: "data element with orphaned data type")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ grails.project.dependency.resolution = {
compile "org.modelcatalogue:mc-builder-api:$mcToolkitVersion"
compile "org.modelcatalogue:mc-datatype-validation:$mcToolkitVersion"

compile 'me.xdrop:fuzzywuzzy:1.1.7'

compile 'com.craigburke.document:word:0.5.0'

compile 'org.jsoup:jsoup:1.8.3'
Expand Down
Loading

0 comments on commit f7e9aa4

Please sign in to comment.