Skip to content

Commit

Permalink
Added editor valid status to tab
Browse files Browse the repository at this point in the history
Signed-off-by: shiv12095 <shiv12095@iiitd.ac.in>
  • Loading branch information
shiv12095 committed Jul 25, 2016
1 parent 7759cea commit dfba0ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
17 changes: 11 additions & 6 deletions server/devtool/src/main/resources/static/dist/js/controllers.js
Expand Up @@ -142,21 +142,26 @@ define(["angular"], function(angular) {
return false;
}

$scope.isValidModel = function() {
console.log('Checking model');
console.log($scope.selectedEditor);
if ($scope.selectedEditor.xtextServices.editorContext._annotations.length !== 0) {
$scope.isValidEditorTab = function(index) {
return $scope.isValidModel($scope.editors[index]);
}

$scope.isValidModel = function(editor) {
if(editor == null){
return false;
}
if (editor.xtextServices.editorContext._annotations.length !== 0) {
return false;
} else {
return true;
}
}

$scope.importModel = function() {
if ($scope.isValidModel()) {
if ($scope.isValidModel($scope.selectedEditor)) {
if ($scope.isModelSelected()) {
if ($scope.tabs[$scope.selectedTabIndex]['language'] == 'infomodel') {
$http.get('./editor/infomodel/link/fbmodel/' + $scope.selectedEditor.xtextServices.validationService._encodedResourceId + '/' + $scope.selectedModelId['namespace'] + '/' + $scope.selectedModelId['name'] + '/' + $scope.selectedModelId['version']).success(
$http.get('./editor/infomodel/link/functionblock/' + $scope.selectedEditor.xtextServices.validationService._encodedResourceId + '/' + $scope.selectedModelId['namespace'] + '/' + $scope.selectedModelId['name'] + '/' + $scope.selectedModelId['version']).success(
function(data, status, headers, config) {
$scope.selectedEditor.setValue(data);
}).error(function(data, status, headers, config) {
Expand Down
Expand Up @@ -17,7 +17,12 @@ <h3 class="box-title"><i class="fa fa-edit"></i> Describe your Vorto Model</h3>
<div role="tabpanel">
<ul class="nav nav-tabs editor-ul" role="tablist">
<li role="presentation" ng-repeat="tab in tabs" ng-click="selectTab($index)" ng-class="{'active':selectedTabIndex == $index}">
<a data-target="#tab" aria-controls="home" role="tab" data-toggle="tab">Tab {{tab.id}} <span ng-click="deleteTab($index)" class="glyphicon glyphicon-remove"></span></a>
<a data-target="#tab" aria-controls="home" role="tab" data-toggle="tab">
<i class="fa fa-check-circle" aria-hidden="true" ng-show="isValidEditorTab($index)" style="color:green;"></i>
<i class="fa fa-exclamation-circle" aria-hidden="true" ng-hide="isValidEditorTab($index)" style="color:red;"></i>
Tab {{tab.id}}
<span ng-click="deleteTab($index)" class="glyphicon glyphicon-remove"></span>
</a>
</li>
<li role="presentation">
<a aria-controls="home" role="tab" data-toggle="tab" ng-click="openModal()"><i class="fa fa-plus" aria-hidden="true"></i></a>
Expand Down Expand Up @@ -67,7 +72,7 @@ <h3 class="box-title"><i class="fa fa-edit"></i> Describe your Vorto Model</h3>
<tbody>
<tr st-select-row="model" ng-repeat="model in displayedModels">
<td>{{ model.id.name }}</td>
<td class="action"><a class="action"><i class="fa fa-info-circle"></i></a></td>
<td class="action"><a class="action"><i class="fa fa-info-circle" tooltip-placement="top" uib-tooltip="Click for details"></i></a></td>
</tr>
</tbody>
<tfoot>
Expand Down

0 comments on commit dfba0ca

Please sign in to comment.