Skip to content

Commit

Permalink
Added Vorto repository basepath and linked models in the search windo…
Browse files Browse the repository at this point in the history
…w to the repository
  • Loading branch information
shiv12095 committed Aug 15, 2016
1 parent 4252b8e commit dcceac7
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 62 deletions.

This file was deleted.

@@ -0,0 +1,24 @@
package org.eclipse.vorto.server.devtool.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.google.gson.JsonObject;

@RestController
@RequestMapping(value = "/repository")
public class RepositoryController {

@Value("${vorto.repository.base.path}")
String repositoryBasePath;

@RequestMapping(value = "/basepath", method = RequestMethod.GET)
public String getRepoUrl() {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("basepath", repositoryBasePath);
String json = jsonObject.toString();
return json;
}
}
Expand Up @@ -24,7 +24,7 @@
@Component
public class InformationModelEditorRestClient {

@Value("${vorto.repository.base.path}")
@Value("${vorto.repository.rest.path}")
private String basePath;

public ModelResource getModel(ModelId modelId){
Expand Down
3 changes: 2 additions & 1 deletion server/devtool/src/main/resources/application.properties
@@ -1 +1,2 @@
vorto.repository.base.path = http://vorto.eclipse.org//rest/
vorto.repository.rest.path = http://vorto.eclipse.org//rest/
vorto.repository.base.path = http://vorto.eclipse.org/#/
21 changes: 1 addition & 20 deletions server/devtool/src/main/resources/static/dist/js/controllers.js
Expand Up @@ -413,6 +413,7 @@ define(["angular"], function(angular) {
$http.get('./editor/infomodel/search=' + filter).success(
function(data, status, headers, config) {
$scope.models = data;
console.log(data);
}).error(function(data, status, headers, config) {
$scope.models = [];
});
Expand Down Expand Up @@ -498,26 +499,6 @@ define(["angular"], function(angular) {
}
}

$scope.isProjectSelected = function() {
for (i = 0; i < $scope.displayedProjects.length; i++) {
if ($scope.displayedProjects[i]['isSelected']) {
$scope.selectedProject = $scope.displayedProjects[i];
return true;
}
}
$scope.selectedProject = null;
return false;
}

$scope.openProject = function() {
if ($scope.isProjectSelected()) {
$location.path('editor/' + $scope.selectedProject.projectName);
$location.replace();
} else {
window.alert('Please select a project first');
}
}

});

app.controller('AddEditorModalController', function($rootScope, $scope, $uibModalInstance, editorTypes) {
Expand Down
65 changes: 38 additions & 27 deletions server/devtool/src/main/resources/static/dist/js/devtoolApp.js
@@ -1,29 +1,40 @@
define("devtoolApp",["angular","angular-route","angular-animate","angular-aria","angular-bootstrap","angular-bootstrap-templates","smart-table","controllers","directives","jquery"],function(angular) {
define("devtoolApp", ["angular", "angular-route", "angular-animate", "angular-aria", "angular-bootstrap", "angular-bootstrap-templates", "smart-table", "controllers", "directives", "jquery"], function(angular) {

var app = angular.module('devtoolApp', ['ngRoute','apps.controller', 'apps.directive', 'ngAnimate','ui.bootstrap','ui.bootstrap.tpls']);

app.bootstrap = function() {
angular.bootstrap(document,['devtoolApp']);
};

app.config([ '$routeProvider', '$httpProvider',
function($routeProvider, $httpProvider) {
$routeProvider
.when('/editor/:projectName', {
templateUrl : "templates/editor-template.html",
controller : 'EditorController'
})
.when('/project', {
templateUrl : "templates/project-template.html",
controller : 'ProjectController'
})
.otherwise({
redirectTo : '/project'
});

} ]).run(function($location, $http, $rootScope) {
// add global functions here
var app = angular.module('devtoolApp', ['ngRoute', 'apps.controller', 'apps.directive', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);

app.bootstrap = function() {
angular.bootstrap(document, ['devtoolApp']);
};

app.config(['$routeProvider', '$httpProvider',
function($routeProvider, $httpProvider) {
$routeProvider
.when('/editor/:projectName', {
templateUrl: "templates/editor-template.html",
controller: 'EditorController'
})
.when('/project', {
templateUrl: "templates/project-template.html",
controller: 'ProjectController'
})
.otherwise({
redirectTo: '/project'
});

}
]).run(function($location, $http, $rootScope) {

$rootScope.getRepositoryBasePath = function() {
$http.get('./repository/basepath').success(function(data, status, headers, config) {
$rootScope.repoBasePath = data['basepath'];
console.log($rootScope.repoBasePath);
}).error(function(data, status, headers, config) {
$rootScope.repoBasePath = "/";
});
}

$rootScope.getRepositoryBasePath();
});

return app;
});

return app;
});
Expand Up @@ -84,7 +84,11 @@ <h3 class="box-title">
<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" tooltip-placement="top" uib-tooltip="Click for details"></i></a></td>
<td class="action">
<a target="_blank" href="{{ repoBasePath }}details/{{ model.id.namespace }}/{{ model.id.name }}/{{ model.id.version }}">
<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 dcceac7

Please sign in to comment.