Skip to content

Commit

Permalink
merge local
Browse files Browse the repository at this point in the history
  • Loading branch information
hornmo committed Apr 10, 2019
2 parents 70ef826 + 1f7ee90 commit 6359ce1
Show file tree
Hide file tree
Showing 31 changed files with 1,337 additions and 1,166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ window.gokb = {
q: term,
baseClass:$(this).data('domain'),
filter1:$(this).data('filter1'),
addEmpty:'Y'
addEmpty:($(this).data('require') ? 'N' : 'Y')
};
},
results: function (data, page) {
Expand Down Expand Up @@ -293,7 +293,7 @@ window.gokb = {
q: term,
baseClass:dom,
filter1:filter1,
addEmpty:'Y'
addEmpty:($(this).data('required') ? 'N' : 'Y')
}
},
results: function (data, page) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ body .modal-dialog {
}
.form-control {
padding-top: 8px;
display:block;
line-height:normal !important;
}

.form-label {
display:inline-block;
vertical-align:middle;
height:39px;
padding-top:9px;
}

.dt-label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ h1.panel-title {
clear:both;
padding-left:15px;
}

.nav-tab-disabled {
margin-right:2px;
padding:@nav-link-padding;
background-color:@btn-default-bg;
color:@nav-disabled-link-color;
cursor:not-allowed;
border:1px solid transparent;
position:relative;
display:block;
}

.navbar-right {
margin-right:0 !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ class UserDetailsInterceptor {
}
}
// Add if creatable.
if ( tc.isTypeCreatable() && displayTemplateService.getTemplateInfo(d.dcName)?.size() > 0) {
if ( d.dcName == 'org.gokb.cred.TitleInstancePackagePlatform' ) {
// Suppress for now.
log.error ("TitleInstancePackagePlatform.isTypeCreatable() is testing true!!")
if ( tc.isTypeCreatable() ) {
def display_template = displayTemplateService.getTemplateInfo(d.dcName)

if ( display_template && !display_template.noCreate) {
menus["create"]["${d.type.value}"] << [
text : d.displayName,
link : ['controller' : 'create', 'action' : 'index', 'params' : [tmpl:d.dcName]],
attr : ['title' : "New ${d.displayName}"]
]
}
menus["create"]["${d.type.value}"] << [
text : d.displayName,
link : ['controller' : 'create', 'action' : 'index', 'params' : [tmpl:d.dcName]],
attr : ['title' : "New ${d.displayName}"]
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class AdminController {

def ensureUuids() {

Job j = concurrencyManagerService.createJob {
cleanupService.ensureUuids()
Job j = concurrencyManagerService.createJob { Job j ->
cleanupService.ensureUuids(j)
}.startOrQueue()

j.description = "Ensure UUIDs for components"
Expand All @@ -151,8 +151,8 @@ class AdminController {
}

def ensureTipls() {
Job j = concurrencyManagerService.createJob {
cleanupService.ensureTipls()
Job j = concurrencyManagerService.createJob { Job j ->
cleanupService.ensureTipls(j)
}.startOrQueue()

j.description = "Ensure TIPLs for all TIPPs"
Expand All @@ -162,8 +162,8 @@ class AdminController {
}

def convertTippCoverages() {
Job j = concurrencyManagerService.createJob {
cleanupService.addMissingCoverageObjects()
Job j = concurrencyManagerService.createJob { Job j ->
cleanupService.addMissingCoverageObjects(j)
}.startOrQueue()

j.description = "Generate missing TIPPCoverageStatements"
Expand Down Expand Up @@ -302,6 +302,18 @@ class AdminController {
result
}

def cleanJobList() {
log.debug("clean job list..")
def jobs = concurrencyManagerService.jobs
def maxId = jobs.max { it.key }.key

jobs.each { k, j ->
if ( k < maxId - 5 && j.isDone()) {
jobs.remove(k)
}
}
redirect(url: request.getHeader('referer'))
}

def cancelJob() {
Job j = concurrencyManagerService.getJob(params.int('id'))
Expand All @@ -312,9 +324,8 @@ class AdminController {

@Deprecated
def housekeeping() {
Job j = concurrencyManagerService.createJob {
def et = cleanupService.housekeeping()
return et
Job j = concurrencyManagerService.createJob { Job j ->
cleanupService.housekeeping(j)
}.startOrQueue()

j.description = "Housekeeping"
Expand Down Expand Up @@ -352,8 +363,8 @@ class AdminController {
}

def cleanupOrphanedTipps() {
Job j = concurrencyManagerService.createJob {
cleanupService.deleteOrphanedTipps()
Job j = concurrencyManagerService.createJob { Job j ->
cleanupService.deleteOrphanedTipps(j)
}.startOrQueue()

log.debug("Triggering cleanup task. Started job #${j.id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.gokb

import grails.converters.JSON
import java.text.SimpleDateFormat
import java.text.MessageFormat

import com.k_int.ClassUtils

Expand Down Expand Up @@ -108,6 +109,10 @@ class AjaxSupportController {
query_params,
[max:params.iDisplayLength?:400,offset:params.iDisplayStart?:0]);

if (!config.required) {
result.add([id:'', text:'', value:'']);
}

rq.each { it ->
def o = ClassUtils.deproxy(it)
result.add([id:"${o.class.name}:${o.id}", text: o[config.cols[0]], value:"${o.class.name}:${o.id}"]);
Expand Down Expand Up @@ -153,11 +158,22 @@ class AjaxSupportController {
// rowQry:"select rdv from RefdataValue as rdv where rdv.owner.desc='KBComponent.Status' and rdv.value !='${KBComponent.STATUS_DELETED}'",
countQry:"select count(rdv) from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
rowQry:"select rdv from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
required:true,
qryParams:[],
rdvCat: "KBComponent.Status",
cols:['value'],
format:'simple'
],
'KBComponent.EditStatus' : [
domain:'RefdataValue',
countQry:"select count(rdv) from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
rowQry:"select rdv from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
required:true,
qryParams:[],
rdvCat: "KBComponent.EditStatus",
cols:['value'],
format:'simple'
],
'VariantNameType' : [
domain:'RefdataValue',
countQry:"select count(rdv) from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
Expand Down Expand Up @@ -195,7 +211,17 @@ class AjaxSupportController {
rdvCat: "ReviewRequest.Status",
cols:['value'],
format:'simple'
]
],
'TitleInstance.Medium' : [
domain:'RefdataValue',
countQry:"select count(rdv) from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
rowQry:"select rdv from RefdataValue as rdv where rdv.useInstead is null and rdv.owner.desc=?",
required:true,
qryParams:[],
rdvCat: "TitleInstance.Medium",
cols:['value'],
format:'simple'
],
]


Expand Down Expand Up @@ -399,7 +425,7 @@ class AjaxSupportController {

withFormat {
html {
if( params.showNew && errors.size() == 0) {
if( params.__showNew && errors.size() == 0) {
redirect(controller:'resource', action:'show', id:"${new_obj.class.name}:${new_obj.id}");
}
else {
Expand Down Expand Up @@ -441,10 +467,11 @@ class AjaxSupportController {
log.debug("addToStdCollection(${params})");
// Adds a link to a collection that is not mapped through a join object
def contextObj = resolveOID2(params.__context)
def relatedObj = resolveOID2(params.__relatedObject)
def result = ['result': 'OK', 'params': params]
if ( contextObj && (contextObj.isEditable() || springSecurityService.currentUser == contextObj)) {
if (!contextObj["${params.__property}"].contains(resolveOID2(params.__relatedObject))) {
contextObj["${params.__property}"].add (resolveOID2(params.__relatedObject))
if (relatedObj != null && contextObj != null && (contextObj.isEditable() || springSecurityService.currentUser == contextObj)) {
if (!contextObj["${params.__property}"].contains(relatedObj)) {
contextObj["${params.__property}"].add (relatedObj)
contextObj.save(flush:true, failOnError:true)
log.debug("Saved: ${contextObj.id}");
result.context = contextObj
Expand All @@ -460,6 +487,11 @@ class AjaxSupportController {
result.result = 'ERROR'
result.error = "Context object could not be found!"
}
else if (!relatedObj) {
flash.error = "Item to add could not be found!"
result.result = 'ERROR'
result.error = "Item to add could not be found!"
}
else {
flash.error = "Permission to add to this list was denied."
log.debug("context object not editable.")
Expand Down Expand Up @@ -645,16 +677,21 @@ class AjaxSupportController {
def domain_class=null;
domain_class = grailsApplication.getArtefact('Domain',oid_components[0])
if ( domain_class ) {
if ( oid_components[1]=='__new__' ) {
result = domain_class.getClazz().refdataCreate(oid_components)
log.debug("Result of create ${oid} is ${result}");
if (oid_components.size() == 2 ) {
if ( oid_components[1]=='__new__' ) {
result = domain_class.getClazz().refdataCreate(oid_components)
log.debug("Result of create ${oid} is ${result}");
}
else {
result = domain_class.getClazz().get(oid_components[1])
}
}
else {
result = domain_class.getClazz().get(oid_components[1])
log.debug("Could not retrieve object. No ID provided.")
}
}
else {
log.error("resolve OID failed to identify a domain class. Input was ${oid_components}");
log.debug("resolve OID failed to identify a domain class. Input was ${oid_components}");
}
result
}
Expand Down Expand Up @@ -686,9 +723,9 @@ class AjaxSupportController {
// [id:'Person:22',text:'Jimmy'],
// [id:'Person:3',text:'JimBob']]

if ( params.addEmpty=='Y' || params.addEmpty=='y' ) {
result.values.add(0, [id:'', text:'']);
}
// if ( params.addEmpty=='Y' || params.addEmpty=='y' ) {
// result.values.add(0, [id:'', text:'']);
// }

render result as JSON
}
Expand Down Expand Up @@ -762,15 +799,24 @@ class AjaxSupportController {

errors.each { eo ->

String[] messageArgs = eo.getArguments()

def resolvedArgs = []
def errorMessage = null

log.debug("Found error with args: ${messageArgs}")
eo.getArguments().each { ma ->
log.debug("${ma.class.name}")
String[] emptyArgs = []
def arg = messageSource.resolveCode(ma, request.locale).format(emptyArgs)

resolvedArgs.add(arg)
}

String[] messageArgs = resolvedArgs

eo.getCodes().each { ec ->

if (!errorMessage) {
log.debug("testing code -> ${ec}")
// log.debug("testing code -> ${ec}")

def msg = messageSource.resolveCode(ec, request.locale)?.format(messageArgs)

Expand All @@ -779,7 +825,7 @@ class AjaxSupportController {
}

if(!errorMessage) {
log.debug("Could not resolve message")
// log.debug("Could not resolve message")
}else{
log.debug("found message: ${msg}")
}
Expand All @@ -789,7 +835,9 @@ class AjaxSupportController {
if (errorMessage) {
result.add(errorMessage)
}else{
result.add("Error code ${eo}")
log.debug("No message found for ${eo.codes}")
log.debug("Default: ${MessageFormat.format(eo.defaultMessage, messageArgs)}")
result.add("${MessageFormat.format(eo.defaultMessage, messageArgs)}")
}
}
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class CreateController {
eo.getCodes().each { ec ->

if (!errorMessage) {
log.debug("testing code -> ${ec}")
// log.debug("testing code -> ${ec}")

def msg = messageSource.resolveCode(ec, request.locale)?.format(messageArgs)

Expand All @@ -166,7 +166,7 @@ class CreateController {
}

if(!errorMessage) {
log.debug("Could not resolve message")
// log.debug("Could not resolve message")
}else{
log.debug("found message: ${msg}")
}
Expand All @@ -176,7 +176,7 @@ class CreateController {
if (errorMessage) {
flash.error.add(errorMessage)
}else{
log.debug("Found no message for error code ${eo}")
log.debug("No message found for ${eo.getCodes()}")
}
}

Expand Down
15 changes: 9 additions & 6 deletions server/gokbg3/grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,17 @@ command.password.error.strength=Password must be at least 6 characters
# Components
component.label = component
component.notFound.label = No component found for id {0}.
component.create.idMissing.label = Please finish the creation process to view or edit this information.

curatoryGroup.name.label=Curatory Group
org.gokb.cred.CuratoryGroup.label=Curatory Group
org.gokb.cred.CuratoryGroup.name.label=name
curatoryGroup.name.label=name
CuratoryGroup.label=Curatory Group

curatoryGroup.name.notUnique=A Curatory Group with this name already exists!
curatoryGroup.name.notNull=Please provide a name for the Curatory Group!

org.gokb.cred.ReviewRequest.label = Request for Review
org.gokb.cred.ReviewRequest.reviewRequest.nullable.error.org.gokb.cred.ReviewRequest.reviewRequest=Please provide a request
org.gokb.cred.ReviewRequest.componentToReview.nullable.error.org.gokb.cred.ReviewRequest.componentToReview=Please provide the component to review
ReviewRequest.label = Request for Review
reviewRequest.reviewRequest.nullable.error=Please provide a request
reviewRequest.componentToReview.nullable.error=Please provide the component to review

tipp.coverage.empty = No coverage defined.
tipp.hostPlatform.nullable = No TIPP platform provided!
Expand All @@ -324,6 +324,9 @@ tipp.url.nullable = No TIPP url provided!
identifierNamespace.value.unique.error=A Namespace with this name already exists!

variantName.value.notUnique=This title is already a variant name!
KBComponentVariantName.variantName.label=Variant Name
KBComponentVariantName.label=Component Variant Name
KBComponentVariantName.variantName.nullable.error=Please provide a name for the variant.

notNull.name=Please provide a name for this component!
notUnique.name=A component with this name already exists!
Expand Down
Loading

0 comments on commit 6359ce1

Please sign in to comment.