diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs index 8ae4393a8f..9d9edd0c53 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs @@ -36,9 +36,11 @@
-
+
+ data-errormsg="{{groupNameRegExViolationErrorMsg}}" class="form-control"> + +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js index b2a5598c0f..a4fcc5ab25 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js @@ -35,12 +35,10 @@ $(function () { var description = $("input#description").val(); if (!name) { - $('.wr-validation-summary strong').text("Group Name is a required field. It cannot be empty."); - $('.wr-validation-summary').removeClass("hidden"); + triggerError($("input#name"),"Group Name is a required field. It cannot be empty."); return false; } else if (!inputIsValid($("input#name").data("regex"), name)) { - $('.wr-validation-summary strong').text($("input#name").data("errormsg")); - $('.wr-validation-summary').removeClass("hidden"); + triggerError($("input#name"),$("input#name").data("errormsg")); return false; } else { var group = {"name": name, "description": description}; @@ -69,6 +67,61 @@ $(function () { }); }); +/** + * @param el + * @param errorMsg + * + * Triggers validation error for provided element. + * Note : the basic jQuery validation elements should be present in the markup + * + */ +function triggerError(el,errorMsg){ + var parent = el.parents('.form-group'), + errorSpan = parent.find('span'), + errorMsgContainer = parent.find('label'); + + errorSpan.on('click',function(event){ + event.stopPropagation(); + removeErrorStyling($(this)); + el.unbind('.errorspace'); + }); + + el.bind('focusin.errorspace',function(){ + removeErrorStyling($(this)) + }).bind('focusout.errorspace',function(){ + addErrorStyling($(this)); + }).bind('keypress.errorspace',function(){ + $(this).unbind('.errorspace'); + removeErrorStyling($(this)); + }); + + errorMsgContainer.text(errorMsg); + + parent.addClass('has-error has-feedback'); + errorSpan.removeClass('hidden'); + errorMsgContainer.removeClass('hidden'); + + function removeErrorStyling(el){ + var parent = el.parents('.form-group'), + errorSpan = parent.find('span'), + errorMsgContainer = parent.find('label'); + + parent.removeClass('has-error has-feedback'); + errorSpan.addClass('hidden'); + errorMsgContainer.addClass('hidden'); + } + + function addErrorStyling(el){ + var parent = el.parents('.form-group'), + errorSpan = parent.find('span'), + errorMsgContainer = parent.find('label'); + + parent.addClass('has-error has-feedback'); + errorSpan.removeClass('hidden'); + errorMsgContainer.removeClass('hidden'); + } +} + function displayErrors(message) { $('#error-msg').html(message.responseText); modalDialog.header('Unexpected error occurred!'); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index 1a89379d3f..0f440ddf2a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -6510,4 +6510,14 @@ select > option:hover { /* Adding style for required fields */ .required:before { content: "*"; +} + +.table.list-table:not(.grid-view){ + margin: 0px !important; +} +.table.list-table:not(.grid-view) > thead, .table.list-table:not(.grid-view) > tbody, .table.list-table:not(.grid-view) > tfoot{ + margin-bottom: 10px !important; +} +.table.list-table:not(.grid-view) tbody{ + margin: 0px !important; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4857061e10..74f2193206 100644 --- a/pom.xml +++ b/pom.xml @@ -921,6 +921,10 @@ xerces xercesImpl + + io.swagger + swagger-annotations +