Skip to content

Commit

Permalink
Merge pull request #783 from hashmapinc/Tempus-766-Metadata-issue
Browse files Browse the repository at this point in the history
LGTM
  • Loading branch information
akshaymhetre committed Oct 10, 2018
2 parents d3a7de5 + d49d92d commit 2fdfaff
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class MetadataConfigServiceImpl implements MetadataConfigService {
private static final String INCORRECT_CONFIG_ID = "Incorrect metadata config id ";
private static final String INCORRECT_TENANT_ID = "Incorrect tenant id ";

private static final String CONNECTED = "{\"status\": \"CONNECTED\" }";

@Autowired
@Qualifier("clientRestTemplate")
private RestTemplate restTemplate;
Expand Down Expand Up @@ -126,7 +128,7 @@ public Boolean testSource(MetadataConfigId id) {
validateId(id, INCORRECT_CONFIG_ID + id);
String url = serviceUrl + PATH_SEPARATOR + id.getId() + PATH_SEPARATOR + connectPath;
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().equals(HttpStatus.OK)) {
if (response.getBody().equals(CONNECTED)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/locale/locale.constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ export default angular.module('tempus.locale', [])
"trigger-schedule":"Trigger Schedule",
"test-connection":"Test Connection",
"connection-sucessfull":"Connection sucessfull",
"connection-failed":"Connection failed",
"connection-failed":"Connection failed.Invalid Database URL or user credentials.",
"queries-selected":"queries selected",
"query-name":"Query Name",
"no-query-found":"No query found",
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/metadata/metadata-source-fieldset.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
<div translate ng-message="required">metadata.dbPassword-required</div>
</div>
</md-input-container>
<md-button ng-if="metadata.id" class="md-raised md-primary"
style="width:15%;"
<md-button ng-disabled="!isEdit" ng-if="metadata.id" class="md-raised md-primary testbtn"
ng-click="testConnection()"
aria-label="Test Connection">{{ 'metadataConfig.test-connection' | translate }}
</md-button>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/app/metadata/metadata-source.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export default function MetadataSourceDirective($compile, $templateCache, $trans
link: linker,
scope: {
source: "=",
metadata: "="
metadata: "=",
isEdit: '=?',
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions ui/src/app/metadata/metadata.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import addMetadataModel from './add-metadata.tpl.html';

/*@ngInject*/

export default function MetadataController(metadataService, $q,$mdDialog, $document, $state, $translate, types) {
export default function MetadataController(metadataService, $q,$mdDialog, $document, $state, $translate, types, $stateParams) {



Expand Down Expand Up @@ -57,10 +57,20 @@ export default function MetadataController(metadataService, $q,$mdDialog, $docum
itemDetailsText: function() { return $translate.instant('metadataConfig.metadata-details') }
};

if (angular.isDefined($stateParams.items) && $stateParams.items !== null) {
vm.metadataConfig.items = $stateParams.items;
}

if (angular.isDefined($stateParams.topIndex) && $stateParams.topIndex > 0) {
vm.metadataConfig.topIndex = $stateParams.topIndex;
}


function saveMetadataConfig(metadata) {
var deferred = $q.defer();
metadataService.saveMetadata(metadata).then(
function success() {
function success(item) {
deferred.resolve(item);
},
function fail() {
deferred.reject();
Expand Down
20 changes: 18 additions & 2 deletions ui/src/app/metadata/metadata.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
* limitations under the License.
*/

@import "~compass-sass-mixins/lib/compass";
@import '../../scss/constants';

$toolbar-height: 50px;
$fullscreen-toolbar-height: 64px;
$mobile-toolbar-height: 84px;

.setWidth{
width: 25%
width: 30%
}
.btnmargin{
margin-right:20px;
Expand Down Expand Up @@ -49,4 +56,13 @@
font-size: 14px;
color: rgba(255,255,255,0.87);
background-color: rgb(16,108,200);
}
}


md-button.testbtn{
width: 15%;
@media (min-width: $layout-breakpoint-sm) {
width: 35%;
}

}
2 changes: 1 addition & 1 deletion ui/src/app/metadata/metadataConfig-fieldset.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div translate ng-message="required">metadata.source-type-required</div>
</div>
</md-input-container>
<div tb-metadata-source source="metadata.source" metadata="metadata" model="vm.item" ng-if="metadata.source.type && metadata.source.type == types.metadataSourceType.jdbc"></div>
<div tb-metadata-source is-edit="isEdit" source="metadata.source" metadata="metadata" model="vm.item" ng-if="metadata.source.type && metadata.source.type == types.metadataSourceType.jdbc"></div>

<md-input-container class="md-block" md-is-error="theForm.metadataSinkType.$touched && theForm.metadataSinkType.$invalid">
<label translate>metadata.sink-type</label>
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/metadata/metadataConfig.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ export default function MetadataConfigDirective($compile, $templateCache, toast,

});


$compile(element.contents())(scope);
}
return {
restrict: "E",
link: linker,
scope: {
metadata: '=',
isEdit: '=',
isEdit: '=?',
theForm: '=',
onDeleteMetadata: '&'
}
Expand Down

0 comments on commit 2fdfaff

Please sign in to comment.