Skip to content

Commit

Permalink
Swagger slowness and scrolling issue. closes eclipse-vorto#56, closes e…
Browse files Browse the repository at this point in the history
…clipse-vorto#57, closes

eclipse-vorto#56 and eclipse-vorto#57

Signed-off-by: Nagavijay Sivakumar <[email protected]>

Removed iframe resizer javascript. No longer used.
  • Loading branch information
Nagavijay Sivakumar committed Mar 24, 2016
1 parent 55c56a9 commit e624a7a
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 185 deletions.
27 changes: 21 additions & 6 deletions server/repo/repo-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@
<artifactId>swagger-models</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.1.4</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
Expand All @@ -96,6 +91,26 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>angular-swagger-ui</artifactId>
<version>0.2.7</version>
<exclusions>
<exclusion>
<groupId>org.webjars.bower</groupId>
<artifactId>jquery</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bower</groupId>
<artifactId>bootstrap-less-only</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bower</groupId>
<artifactId>angular</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Database -->

Expand Down Expand Up @@ -129,4 +144,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* The Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* Contributors:
* Bosch Software Innovations GmbH - Please refer to git log
*******************************************************************************/
Expand Down Expand Up @@ -60,7 +60,7 @@
@EnableSwagger2
@EnableJpaRepositories
public class VortoRepository {

public static void main(String[] args) {
SpringApplication.run(VortoRepository.class, args);
}
Expand Down Expand Up @@ -90,29 +90,29 @@ private ApiInfo apiInfo() {
+ "These information models can be managed and shared within the Vorto Information Model Repository. <br/>"
+ " Code Generators for Information Models let you integrate devices into different platforms."
+ "<br/>",
"1.0.0", "", "", "", "");
"1.0.0", "", "", "EPL", "https://eclipse.org/org/documents/epl-v10.php");
}

@Autowired
private UserRepository userRepository;

@Bean
public static PasswordEncoder encoder() {
return new BCryptPasswordEncoder(11);
}

@PostConstruct
public void createAdminIfNotExists() throws Exception {
if (userRepository.findByUsername("admin") == null){

User user = new User();

user.setUsername("admin".toLowerCase());
user.setPassword( encoder().encode("!v0rt0admin"));
user.setHasWatchOnRepository(false);
user.setEmail("[email protected]");
user.setRoles(Role.ADMIN);

userRepository.save(user);
}
}
Expand All @@ -127,10 +127,10 @@ protected static class SecurityConfiguration extends WebSecurityConfigurerAdapte

@Autowired
private RESTAuthenticationEntryPoint authenticationEntryPoint;

@Autowired
private PasswordEncoder passwordEncoder;

@Override
protected void configure(HttpSecurity http) throws Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.swagger-validator {
display: none;
}

.swagger-section .swagger-ui-wrap {
font-family: Droid Sans",​sans-serif;
font: inherit;
line-height: 1;
margin-left: auto;
margin-right: auto;
max-width: 960px;

}
#swagger-ui-container .btn {
border: 0 none;
border-radius: 2px;
font-weight: bold;
}

#swagger-ui-container .btn-default{
background-color: #337ab7;
border-color: #ccc;
color: #333;
}
#swagger-ui-container .api-name {
font-size: 25px;
font-weight: bold;
padding-bottom: 10px;

}

.api-description {
font-size: 15px;
padding-bottom: 10px;
}
22 changes: 12 additions & 10 deletions server/repo/repo-ui/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,33 @@
<!-- Custom styles for this template -->
<link href="css/dashboard.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- Font Awesome Icons -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" href="webjars/angular-swagger-ui/0.2.7/dist/css/swagger-ui.min.css">

<!-- JQuery 2.1.1-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Bootstrap 3.3.1 JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>

<!-- Angular JS -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular-route.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular-cookies.min.js"></script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.6/smart-table.min.js"></script>

<script type="text/javascript" src="webjars/angular-swagger-ui/0.2.7/dist/scripts/swagger-ui.min.js"></script>

<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/controllers.js"></script>
<script type="text/javascript" src="js/directives.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.1/iframeResizer.min.js"></script>


</head>

<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
Expand All @@ -50,7 +52,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</button>
<a class="navbar-brand" href="./#/">Vorto Repository</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
Expand Down Expand Up @@ -80,4 +82,4 @@
</div>
</div>
</body>
</html>
</html>
30 changes: 15 additions & 15 deletions server/repo/repo-ui/src/main/resources/static/js/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var repository = angular.module('repository', ['ngRoute','repositoryControllers', 'repositoryDirectives', 'smart-table']);
var repository = angular.module('repository', ['ngRoute', 'repositoryControllers', 'repositoryDirectives', 'swaggerUi', 'smart-table']);

repository.config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {

$routeProvider
.when('/', {
templateUrl: "partials/search-template.html",
Expand Down Expand Up @@ -30,29 +30,29 @@ repository.config(['$routeProvider', '$httpProvider', function ($routeProvider,
.when('/login', {
templateUrl: "partials/login-template.html",
controller: 'AuthenticateController'
})
})
.when('/signup', {
templateUrl: "partials/signup-template.html",
controller: 'SignUpController'
})
.otherwise({redirectTo: '/'});
$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';

$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';

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

// register listener to watch route changes
$rootScope.$on("$locationChangeStart", function(event, next, current) {

if($location.path() === "/upload" && $rootScope.authenticated === false) {
$location.path('/login');
if($location.path() === "/upload" && $rootScope.authenticated === false) {
$location.path('/login');
}
if($location.path() === "/settings" && $rootScope.authenticated === false) {

if($location.path() === "/settings" && $rootScope.authenticated === false) {
$location.path('/login');
}
});

$rootScope.user = [];
$rootScope.getUser = function() {
$http.get('./user').success(
Expand All @@ -64,11 +64,11 @@ repository.config(['$routeProvider', '$httpProvider', function ($routeProvider,
}
}).error(function(data, status, headers, config) {
$rootScope.authenticated = false;
});
});
};

$rootScope.getUser();

$rootScope.logout = function() {
$http.post('logout', {}).success(function() {
$rootScope.authenticated = false;
Expand Down
Loading

0 comments on commit e624a7a

Please sign in to comment.