automatic project update
This commit is contained in:
parent
484ccbb7f1
commit
392818363b
5
.gitignore
vendored
5
.gitignore
vendored
@ -121,3 +121,8 @@ Desktop.ini
|
||||
# Gradle Wrapper
|
||||
######################
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
######################
|
||||
# Maven Wrapper
|
||||
######################
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
1
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
1
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1 @@
|
||||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
|
@ -1,4 +1,4 @@
|
||||
// Generated on 2015-10-23 using generator-jhipster 2.23.0
|
||||
// Generated on 2015-11-02 using generator-jhipster 2.23.0
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Developing sampleApplication
|
||||
|
||||
This application was generated using JHipster, you can find documentation and help at [https://jhipster.gitub.io][].
|
||||
This application was generated using JHipster, you can find documentation and help at [https://jhipster.github.io](https://jhipster.github.io).
|
||||
|
||||
Before you can build this project, you must install and configure the following dependencies on your machine:
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
"angular-dynamic-locale": "0.1.27",
|
||||
"angular-i18n": "1.4.5",
|
||||
"angular-local-storage": "0.2.2",
|
||||
"angular-loading-bar": "0.8.0",
|
||||
"angular-resource": "1.4.5",
|
||||
"angular-sanitize": "1.4.5",
|
||||
"angular-translate": "2.7.2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
jhipster-prod-mysql:
|
||||
container_name: sampleApplication-prod-mysql
|
||||
image: mysql
|
||||
image: mysql:5.7.9
|
||||
# volumes:
|
||||
# - ~/volumes/jhipster/sampleApplication/prod-mysql/:/var/lib/mysql/
|
||||
environment:
|
||||
@ -9,5 +9,5 @@ jhipster-prod-mysql:
|
||||
- MYSQL_DATABASE=sampleapplication
|
||||
ports:
|
||||
- "3306:3306"
|
||||
command: mysqld --lower_case_table_name=1
|
||||
command: mysqld --lower_case_table_names=1
|
||||
|
||||
|
233
mvnw
vendored
Executable file
233
mvnw
vendored
Executable file
@ -0,0 +1,233 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven2 Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
#
|
||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||
# for the new JDKs provided by Oracle.
|
||||
#
|
||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
||||
#
|
||||
# Oracle JDKs
|
||||
#
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=`/usr/libexec/java_home`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Migwn, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
# TODO classpath?
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`which java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
local basedir=$(pwd)
|
||||
local wdir=$(pwd)
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
wdir=$(cd "$wdir/.."; pwd)
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} "$@"
|
145
mvnw.cmd
vendored
Normal file
145
mvnw.cmd
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven2 Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
|
||||
set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||
|
||||
exit /B %ERROR_CODE%
|
@ -82,6 +82,7 @@ public class DatabaseConfiguration {
|
||||
* Open the TCP port for the H2 database, so it is available remotely.
|
||||
*/
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
|
||||
public Server h2TCPServer() throws SQLException {
|
||||
return Server.createTcpServer("-tcp","-tcpAllowOthers");
|
||||
}
|
||||
|
@ -1,73 +0,0 @@
|
||||
package com.mycompany.myapp.config.metrics;
|
||||
|
||||
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SpringBoot Actuator HealthIndicator check for the Database.
|
||||
*/
|
||||
public class DatabaseHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static Map<String, String> queries = new HashMap<>();
|
||||
|
||||
static {
|
||||
queries.put("HSQL Database Engine",
|
||||
"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_USERS");
|
||||
queries.put("Oracle", "SELECT 'Hello' from DUAL");
|
||||
queries.put("Apache Derby", "SELECT 1 FROM SYSIBM.SYSDUMMY1");
|
||||
queries.put("MySQL", "SELECT 1");
|
||||
queries.put("PostgreSQL", "SELECT 1");
|
||||
queries.put("Microsoft SQL Server", "SELECT 1");
|
||||
}
|
||||
|
||||
private static String DEFAULT_QUERY = "SELECT 1";
|
||||
|
||||
private String query = null;
|
||||
|
||||
public DatabaseHealthIndicator(DataSource dataSource) {
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||
String product = getProduct();
|
||||
builder.up().withDetail("database", product);
|
||||
String query = detectQuery(product);
|
||||
if (StringUtils.hasText(query)) {
|
||||
try {
|
||||
builder.withDetail("hello",
|
||||
this.jdbcTemplate.queryForObject(query, Object.class));
|
||||
} catch (Exception ex) {
|
||||
builder.down(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getProduct() {
|
||||
return this.jdbcTemplate.execute((Connection connection) -> connection.getMetaData().getDatabaseProductName());
|
||||
}
|
||||
|
||||
protected String detectQuery(String product) {
|
||||
String query = this.query;
|
||||
if (!StringUtils.hasText(query)) {
|
||||
query = queries.get(product);
|
||||
}
|
||||
if (!StringUtils.hasText(query)) {
|
||||
query = DEFAULT_QUERY;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.mycompany.myapp.config.metrics;
|
||||
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class JHipsterHealthIndicatorConfiguration {
|
||||
|
||||
@Inject
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public HealthIndicator dbHealthIndicator() {
|
||||
return new DatabaseHealthIndicator(dataSource);
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* Health and Metrics specific code.
|
||||
*/
|
||||
package com.mycompany.myapp.config.metrics;
|
@ -24,6 +24,8 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
|
||||
Optional<User> findOneByLogin(String login);
|
||||
|
||||
Optional<User> findOneById(Long userId);
|
||||
|
||||
@Override
|
||||
void delete(User t);
|
||||
|
||||
|
@ -82,9 +82,8 @@ public final class SecurityUtils {
|
||||
/**
|
||||
* If the current user has a specific authority (security role).
|
||||
*
|
||||
* <p> The name of this method comes from the isUserInRole() method in the Servlet API</p>
|
||||
*/
|
||||
public static boolean isUserInRole(String authority) {
|
||||
public static boolean isCurrentUserInRole(String authority) {
|
||||
SecurityContext securityContext = SecurityContextHolder.getContext();
|
||||
Authentication authentication = securityContext.getAuthentication();
|
||||
if (authentication != null) {
|
||||
|
@ -74,7 +74,7 @@ public class UserService {
|
||||
|
||||
public Optional<User> requestPasswordReset(String mail) {
|
||||
return userRepository.findOneByEmail(mail)
|
||||
.filter(user -> user.getActivated())
|
||||
.filter(User::getActivated)
|
||||
.map(user -> {
|
||||
user.setResetKey(RandomUtil.generateResetKey());
|
||||
user.setResetDate(ZonedDateTime.now());
|
||||
@ -109,7 +109,7 @@ public class UserService {
|
||||
}
|
||||
|
||||
public void updateUserInformation(String firstName, String lastName, String email, String langKey) {
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u -> {
|
||||
userRepository.findOneById(SecurityUtils.getCurrentUserId()).ifPresent(u -> {
|
||||
u.setFirstName(firstName);
|
||||
u.setLastName(lastName);
|
||||
u.setEmail(email);
|
||||
@ -120,7 +120,7 @@ public class UserService {
|
||||
}
|
||||
|
||||
public void changePassword(String password) {
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u-> {
|
||||
userRepository.findOneById(SecurityUtils.getCurrentUserId()).ifPresent(u -> {
|
||||
String encryptedPassword = passwordEncoder.encode(password);
|
||||
u.setPassword(encryptedPassword);
|
||||
userRepository.save(u);
|
||||
@ -145,7 +145,7 @@ public class UserService {
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public User getUserWithAuthorities() {
|
||||
User user = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).get();
|
||||
User user = userRepository.findOneById(SecurityUtils.getCurrentUserId()).get();
|
||||
user.getAuthorities().size(); // eagerly load the association
|
||||
return user;
|
||||
}
|
||||
|
@ -123,8 +123,7 @@ public class AccountResource {
|
||||
@Timed
|
||||
public ResponseEntity<String> saveAccount(@RequestBody UserDTO userDTO) {
|
||||
return userRepository
|
||||
.findOneByLogin(userDTO.getLogin())
|
||||
.filter(u -> u.getLogin().equals(SecurityUtils.getCurrentUserLogin()))
|
||||
.findOneById(SecurityUtils.getCurrentUserId())
|
||||
.map(u -> {
|
||||
userService.updateUserInformation(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
|
||||
userDTO.getLangKey());
|
||||
@ -156,7 +155,7 @@ public class AccountResource {
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Timed
|
||||
public ResponseEntity<List<PersistentToken>> getCurrentSessions() {
|
||||
return userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin())
|
||||
return userRepository.findOneById(SecurityUtils.getCurrentUserId())
|
||||
.map(user -> new ResponseEntity<>(
|
||||
persistentTokenRepository.findByUser(user),
|
||||
HttpStatus.OK))
|
||||
@ -181,7 +180,7 @@ public class AccountResource {
|
||||
@Timed
|
||||
public void invalidateSession(@PathVariable String series) throws UnsupportedEncodingException {
|
||||
String decodedSeries = URLDecoder.decode(series, "UTF-8");
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u -> {
|
||||
userRepository.findOneById(SecurityUtils.getCurrentUserId()).ifPresent(u -> {
|
||||
persistentTokenRepository.findByUser(u).stream()
|
||||
.filter(persistentToken -> StringUtils.equals(persistentToken.getSeries(), decodedSeries))
|
||||
.findAny().ifPresent(t -> persistentTokenRepository.delete(decodedSeries));
|
||||
|
@ -98,8 +98,8 @@ public class UserResource {
|
||||
@Secured(AuthoritiesConstants.ADMIN)
|
||||
public ResponseEntity<ManagedUserDTO> updateUser(@RequestBody ManagedUserDTO managedUserDTO) throws URISyntaxException {
|
||||
log.debug("REST request to update User : {}", managedUserDTO);
|
||||
return Optional.of(userRepository
|
||||
.findOne(managedUserDTO.getId()))
|
||||
return userRepository
|
||||
.findOneById(managedUserDTO.getId())
|
||||
.map(user -> {
|
||||
user.setLogin(managedUserDTO.getLogin());
|
||||
user.setFirstName(managedUserDTO.getFirstName());
|
||||
@ -148,7 +148,7 @@ public class UserResource {
|
||||
public ResponseEntity<ManagedUserDTO> getUser(@PathVariable String login) {
|
||||
log.debug("REST request to get User : {}", login);
|
||||
return userService.getUserWithAuthoritiesByLogin(login)
|
||||
.map(user -> new ManagedUserDTO(user))
|
||||
.map(ManagedUserDTO::new)
|
||||
.map(managedUserDTO -> new ResponseEntity<>(managedUserDTO, HttpStatus.OK))
|
||||
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#H2 Server Properties
|
||||
0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:jhipster|
|
||||
0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:sampleapplication|
|
||||
webAllowOthers=true
|
||||
webPort=8082
|
||||
webSSL=false
|
||||
|
@ -20,7 +20,7 @@ spring:
|
||||
enabled: false # we use Grunt + BrowserSync for livereload
|
||||
datasource:
|
||||
driver-class-name: org.h2.jdbcx.JdbcDataSource
|
||||
url: jdbc:h2:mem:jhipster;DB_CLOSE_DELAY=-1
|
||||
url: jdbc:h2:mem:sampleapplication;DB_CLOSE_DELAY=-1
|
||||
name:
|
||||
username:
|
||||
password:
|
||||
|
@ -111,14 +111,13 @@ only screen and ( min-resolution: 2dppx) {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.alert .popover pre {
|
||||
font-size: 10px;
|
||||
}
|
||||
/*Custom alerts for notification*/
|
||||
/* ==========================================================================
|
||||
Custom alerts for notification
|
||||
========================================================================== */
|
||||
|
||||
.alerts .alert{
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.alert pre{
|
||||
background: none;
|
||||
border: none;
|
||||
@ -128,6 +127,39 @@ only screen and ( min-resolution: 2dppx) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.alert .popover pre {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.alerts .toast {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.alerts .toast.left {
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
.alerts .toast.right {
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.alerts .toast.top {
|
||||
top: 55px;
|
||||
}
|
||||
|
||||
.alerts .toast.bottom {
|
||||
bottom: 55px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 480px) {
|
||||
.alerts .toast {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* end of Custom alerts for notification */
|
||||
|
||||
.voffset { margin-top: 2px; }
|
||||
.voffset1 { margin-top: 5px; }
|
||||
.voffset2 { margin-top: 10px; }
|
||||
|
39
src/main/webapp/bower_components/angular-loading-bar/.bower.json
vendored
Normal file
39
src/main/webapp/bower_components/angular-loading-bar/.bower.json
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "angular-loading-bar",
|
||||
"main": [
|
||||
"build/loading-bar.js",
|
||||
"build/loading-bar.css"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"components",
|
||||
"test",
|
||||
"example"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular": "^1.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular": "~1.2.23",
|
||||
"angular-1.3": "angular#1.3",
|
||||
"angular-mocks": "~1.2.9",
|
||||
"angular-mocks-1.3": "angular-mocks#1.3",
|
||||
"angular-animate": "~1.2.9",
|
||||
"angular-animate-1.3": "angular-animate#1.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": "~1.2.23"
|
||||
},
|
||||
"homepage": "https://github.com/chieffancypants/angular-loading-bar",
|
||||
"version": "0.8.0",
|
||||
"_release": "0.8.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.8.0",
|
||||
"commit": "2582b44eca8c515635d1f667842a0e5b79fab405"
|
||||
},
|
||||
"_source": "git://github.com/chieffancypants/angular-loading-bar.git",
|
||||
"_target": "0.8.0",
|
||||
"_originalSource": "angular-loading-bar"
|
||||
}
|
67
src/main/webapp/bower_components/angular-loading-bar/CHANGELOG.md
vendored
Normal file
67
src/main/webapp/bower_components/angular-loading-bar/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
Changelog
|
||||
==========
|
||||
## 0.8.0
|
||||
- auto incrementing is now configurable
|
||||
([#209](https://github.com/chieffancypants/angular-loading-bar/pull/209))
|
||||
- removed `version` from bower.json
|
||||
([#207](https://github.com/chieffancypants/angular-loading-bar/pull/207))
|
||||
- added support for webpack and browserify
|
||||
([#200](https://github.com/chieffancypants/angular-loading-bar/pull/200))
|
||||
- spinner border radius 10px -> 50%
|
||||
([#184](https://github.com/chieffancypants/angular-loading-bar/issues/184))
|
||||
|
||||
|
||||
## 0.7.1
|
||||
- Merge correct PR for broken interceptor detection ([#133](https://github.com/chieffancypants/angular-loading-bar/pull/133), [#50](https://github.com/chieffancypants/angular-loading-bar/pull/50))
|
||||
|
||||
## 0.7.0
|
||||
- Changes for animate.enter compatibility for 1.2 and 1.3 ([#170](https://github.com/chieffancypants/angular-loading-bar/pull/170))
|
||||
- Detect errors with other interceptors ([#133](https://github.com/chieffancypants/angular-loading-bar/pull/133), [#50](https://github.com/chieffancypants/angular-loading-bar/pull/50))
|
||||
- Provide more detail on response/responseError events ([#128](https://github.com/chieffancypants/angular-loading-bar/pull/128))
|
||||
- Change angular dependency in bower ([#126](https://github.com/chieffancypants/angular-loading-bar/issues/126))
|
||||
|
||||
## 0.6.0
|
||||
- Customize progress bar template: ([#111](https://github.com/chieffancypants/angular-loading-bar/pull/111))
|
||||
- Only append bar to first parent found ([#108](https://github.com/chieffancypants/angular-loading-bar/pull/108))
|
||||
|
||||
## 0.5.2:
|
||||
Fixes for Angular 1.3 breaking changes:
|
||||
- Circular dependencies: ([#98](https://github.com/chieffancypants/angular-loading-bar/issues/98)), ([#101](https://github.com/chieffancypants/angular-loading-bar/pull/101))
|
||||
- $animate no longer accepts callbacks: ([#102](https://github.com/chieffancypants/angular-loading-bar/pull/102))
|
||||
|
||||
## 0.5.1
|
||||
- Reworked cache logic to allow cache:true ([#96](https://github.com/chieffancypants/angular-loading-bar/pull/96))
|
||||
|
||||
## 0.5.0
|
||||
- Added spinner template configuration ([#82](https://github.com/chieffancypants/angular-loading-bar/pull/82))
|
||||
- $timeout was not canceled properly ([#79](https://github.com/chieffancypants/angular-loading-bar/pull/79))
|
||||
|
||||
## 0.4.3
|
||||
- update z-index to work with other css frameworks ([#69](https://github.com/chieffancypants/angular-loading-bar/pull/69))
|
||||
- ignoreLoadingBar not ignored when calculating percentage complete ([#70](https://github.com/chieffancypants/angular-loading-bar/pull/70))
|
||||
|
||||
## 0.4.2
|
||||
- Split loading bar into different modules so they can be included separately ([#46](https://github.com/chieffancypants/angular-loading-bar/issues/46))
|
||||
|
||||
## 0.4.1
|
||||
- Fix for route views defined on body where loading bar is also attached ([#56](https://github.com/chieffancypants/angular-loading-bar/issues/56))
|
||||
|
||||
## 0.4.0
|
||||
- Initial load percentage is now configurable ([#47](https://github.com/chieffancypants/angular-loading-bar/issues/47))
|
||||
- Peg graphic reworked so the loadingbar does not require CSS changes when not at the very top of the page ([#42](https://github.com/chieffancypants/angular-loading-bar/issues/42), [#45](https://github.com/chieffancypants/angular-loading-bar/issues/45), [#10](https://github.com/chieffancypants/angular-loading-bar/issues/10))
|
||||
- z-index of spinner increased to work with Bootstrap 3 z-indexes ([#53](https://github.com/chieffancypants/angular-loading-bar/issues/53))
|
||||
|
||||
## 0.3.0
|
||||
- Loading bar only appears on XHR requests with high latency ([#27](https://github.com/chieffancypants/angular-loading-bar/issues/27))
|
||||
|
||||
## 0.2.0
|
||||
- Progression bar not calculated correctly for consecutive calls within the 500ms delay ([#29](https://github.com/chieffancypants/angular-loading-bar/issues/29), [#32](https://github.com/chieffancypants/angular-loading-bar/issues/32))
|
||||
- Event broadcasts when loading (#31)
|
||||
|
||||
## 0.1.1
|
||||
- Alias chieffancypants.loadingbar to angular-loading-bar (#25, #19)
|
||||
|
||||
## 0.1.0
|
||||
- Fixed issues with Angular 1.2-rc3+
|
||||
- Ability to ignore particular XHR requests (#21)
|
||||
- Broadcasting of events (#18)
|
94
src/main/webapp/bower_components/angular-loading-bar/Gruntfile.js
vendored
Normal file
94
src/main/webapp/bower_components/angular-loading-bar/Gruntfile.js
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
/*global module:false*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
|
||||
// Metadata.
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
banner: '/*! \n * <%= pkg.title || pkg.name %> v<%= pkg.version %>\n' +
|
||||
' * <%= pkg.homepage %>\n' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
|
||||
' * License: <%= pkg.license %>\n' +
|
||||
' */\n',
|
||||
|
||||
// Task configuration.
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '<%= banner %>',
|
||||
report: 'gzip'
|
||||
},
|
||||
build: {
|
||||
src: 'src/loading-bar.js',
|
||||
dest: 'build/loading-bar.min.js'
|
||||
}
|
||||
},
|
||||
|
||||
cssmin: {
|
||||
options: {
|
||||
banner: '<%= banner %>',
|
||||
report: 'gzip'
|
||||
},
|
||||
minify: {
|
||||
src: 'src/loading-bar.css',
|
||||
dest: 'build/loading-bar.min.css'
|
||||
}
|
||||
},
|
||||
|
||||
karma: {
|
||||
unit: {
|
||||
configFile: 'test/karma-angular-1.2.conf.js',
|
||||
singleRun: true,
|
||||
coverageReporter: {
|
||||
type: 'text',
|
||||
dir: 'coverage/'
|
||||
}
|
||||
},
|
||||
unit13: {
|
||||
configFile: 'test/karma-angular-1.3.conf.js',
|
||||
singleRun: true,
|
||||
coverageReporter: {
|
||||
type: 'text',
|
||||
dir: 'coverage/'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
configFile: 'test/karma-angular-1.2.conf.js',
|
||||
singleRun: false,
|
||||
reporters: ['progress'] // Don't display coverage
|
||||
}
|
||||
},
|
||||
|
||||
jshint: {
|
||||
jshintrc: '.jshintrc',
|
||||
gruntfile: {
|
||||
src: 'Gruntfile.js'
|
||||
},
|
||||
src: {
|
||||
src: ['src/*.js']
|
||||
}
|
||||
},
|
||||
|
||||
concat: {
|
||||
build: {
|
||||
options: {
|
||||
banner: '<%= banner %>'
|
||||
},
|
||||
files: {
|
||||
'build/loading-bar.css': 'src/loading-bar.css',
|
||||
'build/loading-bar.js': 'src/loading-bar.js',
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-karma');
|
||||
|
||||
grunt.registerTask('default', ['jshint', 'karma:unit', 'karma:unit13', 'uglify', 'cssmin', 'concat:build']);
|
||||
grunt.registerTask('test', ['karma:watch']);
|
||||
grunt.registerTask('build', ['default']);
|
||||
|
||||
};
|
20
src/main/webapp/bower_components/angular-loading-bar/LICENSE
vendored
Normal file
20
src/main/webapp/bower_components/angular-loading-bar/LICENSE
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2014 Wes Cruver
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
180
src/main/webapp/bower_components/angular-loading-bar/README.md
vendored
Normal file
180
src/main/webapp/bower_components/angular-loading-bar/README.md
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
angular-loading-bar
|
||||
===================
|
||||
|
||||
The idea is simple: Add a loading bar / progress bar whenever an XHR request goes out in angular. Multiple requests within the same time period get bundled together such that each response increments the progress bar by the appropriate amount.
|
||||
|
||||
This is mostly cool because you simply include it in your app, and it works. There's no complicated setup, and no need to maintain the state of the loading bar; it's all handled automatically by the interceptor.
|
||||
|
||||
**Requirements:** AngularJS 1.2+
|
||||
|
||||
**File Size:** 2.4Kb minified, 0.5Kb gzipped
|
||||
|
||||
|
||||
## Usage:
|
||||
|
||||
1. include the loading bar as a dependency for your app. If you want animations, include `ngAnimate` as well. *note: ngAnimate is optional*
|
||||
|
||||
```js
|
||||
angular.module('myApp', ['angular-loading-bar', 'ngAnimate'])
|
||||
```
|
||||
|
||||
2. include the supplied JS and CSS file (or create your own CSS to override defaults).
|
||||
|
||||
```html
|
||||
<link rel='stylesheet' href='build/loading-bar.min.css' type='text/css' media='all' />
|
||||
<script type='text/javascript' src='build/loading-bar.min.js'></script>
|
||||
```
|
||||
|
||||
3. That's it -- you're done!
|
||||
|
||||
#### via bower:
|
||||
```
|
||||
$ bower install angular-loading-bar
|
||||
```
|
||||
#### via npm:
|
||||
```
|
||||
$ npm install angular-loading-bar
|
||||
```
|
||||
|
||||
#### via CDN:
|
||||
```html
|
||||
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/angular-loading-bar/0.7.1/loading-bar.min.css' type='text/css' media='all' />
|
||||
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/angular-loading-bar/0.7.1/loading-bar.min.js'></script>
|
||||
```
|
||||
|
||||
## Why I created this
|
||||
There are a couple projects similar to this out there, but none were ideal for me. All implementations I've seen require that you maintain state on behalf of the loading bar. In other words, you're setting the value of the loading/progress bar manually from potentially many different locations. This becomes complicated when you have a very large application with several services all making independant XHR requests. It becomes even more complicated if you want these services to be loosly coupled.
|
||||
|
||||
Additionally, Angular was created as a highly testable framework, so it pains me to see Angular modules without tests. That is not the case here as this loading bar ships with 100% code coverage.
|
||||
|
||||
|
||||
**Goals for this project:**
|
||||
|
||||
1. Make it automatic
|
||||
2. Unit tests, 100% coverage
|
||||
3. Must work well with ngAnimate
|
||||
4. Must be styled via external CSS (not inline)
|
||||
5. No jQuery dependencies
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
#### Turn the spinner on or off:
|
||||
The insertion of the spinner can be controlled through configuration. It's on by default, but if you'd like to turn it off, simply configure the service:
|
||||
|
||||
```js
|
||||
angular.module('myApp', ['angular-loading-bar'])
|
||||
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
|
||||
cfpLoadingBarProvider.includeSpinner = false;
|
||||
}])
|
||||
```
|
||||
|
||||
#### Turn the loading bar on or off:
|
||||
Like the spinner configuration above, the loading bar can also be turned off for cases where you only want the spinner:
|
||||
|
||||
```js
|
||||
angular.module('myApp', ['angular-loading-bar'])
|
||||
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
|
||||
cfpLoadingBarProvider.includeBar = false;
|
||||
}])
|
||||
```
|
||||
|
||||
#### Latency Threshold
|
||||
By default, the loading bar will only display after it has been waiting for a response for over 100ms. This helps keep things feeling snappy, and avoids the annoyingness of showing a loading bar every few seconds on really chatty applications. This threshold is totally configurable:
|
||||
|
||||
```js
|
||||
angular.module('myApp', ['angular-loading-bar'])
|
||||
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
|
||||
cfpLoadingBarProvider.latencyThreshold = 500;
|
||||
}])
|
||||
```
|
||||
|
||||
#### Ignoring particular XHR requests:
|
||||
The loading bar can also be forced to ignore certain requests, for example, when long-polling or periodically sending debugging information back to the server.
|
||||
|
||||
```js
|
||||
// ignore a particular $http GET:
|
||||
$http.get('/status', {
|
||||
ignoreLoadingBar: true
|
||||
});
|
||||
|
||||
// ignore a particular $http POST. Note: POST and GET have different
|
||||
// method signatures:
|
||||
$http.post('/save', data, {
|
||||
ignoreLoadingBar: true
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
|
||||
```js
|
||||
// ignore particular $resource requests:
|
||||
.factory('Restaurant', function($resource) {
|
||||
return $resource('/api/restaurant/:id', {id: '@id'}, {
|
||||
query: {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
ignoreLoadingBar: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## How it works:
|
||||
This library is split into two modules, an $http `interceptor`, and a `service`:
|
||||
|
||||
**Interceptor**
|
||||
The interceptor simply listens for all outgoing XHR requests, and then instructs the loadingBar service to start, stop, and increment accordingly. There is no public API for the interceptor. It can be used stand-alone by including `cfp.loadingBarInterceptor` as a dependency for your module.
|
||||
|
||||
**Service**
|
||||
The service is responsible for the presentation of the loading bar. It injects the loading bar into the DOM, adjusts the width whenever `set()` is called, and `complete()`s the whole show by removing the loading bar from the DOM.
|
||||
|
||||
## Service API (advanced usage)
|
||||
Under normal circumstances you won't need to use this. However, if you wish to use the loading bar without the interceptor, you can do that as well. Simply include the loading bar service as a dependency instead of the main `angular-loading-bar` module:
|
||||
|
||||
```js
|
||||
angular.module('myApp', ['cfp.loadingBar'])
|
||||
```
|
||||
|
||||
|
||||
```js
|
||||
|
||||
cfpLoadingBar.start();
|
||||
// will insert the loading bar into the DOM, and display its progress at 1%.
|
||||
// It will automatically call `inc()` repeatedly to give the illusion that the page load is progressing.
|
||||
|
||||
cfpLoadingBar.inc();
|
||||
// increments the loading bar by a random amount.
|
||||
// It is important to note that the auto incrementing will begin to slow down as
|
||||
// the progress increases. This is to prevent the loading bar from appearing
|
||||
// completed (or almost complete) before the XHR request has responded.
|
||||
|
||||
cfpLoadingBar.set(0.3) // Set the loading bar to 30%
|
||||
cfpLoadingBar.status() // Returns the loading bar's progress.
|
||||
// -> 0.3
|
||||
|
||||
cfpLoadingBar.complete()
|
||||
// Set the loading bar's progress to 100%, and then remove it from the DOM.
|
||||
|
||||
```
|
||||
|
||||
## Events
|
||||
The loading bar broadcasts the following events over $rootScope allowing further customization:
|
||||
|
||||
**`cfpLoadingBar:loading`** triggered upon each XHR request that is not already cached
|
||||
|
||||
**`cfpLoadingBar:loaded`** triggered each time an XHR request recieves a response (either successful or error)
|
||||
|
||||
**`cfpLoadingBar:started`** triggered once upon the first XHR request. Will trigger again if another request goes out after `cfpLoadingBar:completed` has triggered.
|
||||
|
||||
**`cfpLoadingBar:completed`** triggered once when the all XHR requests have returned (either successfully or not)
|
||||
|
||||
## Credits:
|
||||
Credit goes to [rstacruz](https://github.com/rstacruz) for his excellent [nProgress](https://github.com/rstacruz/nprogress).
|
||||
|
||||
## License:
|
||||
Licensed under the MIT license
|
28
src/main/webapp/bower_components/angular-loading-bar/bower.json
vendored
Normal file
28
src/main/webapp/bower_components/angular-loading-bar/bower.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "angular-loading-bar",
|
||||
"main": [
|
||||
"build/loading-bar.js",
|
||||
"build/loading-bar.css"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"components",
|
||||
"test",
|
||||
"example"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular": "^1.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular": "~1.2.23",
|
||||
"angular-1.3": "angular#1.3",
|
||||
"angular-mocks": "~1.2.9",
|
||||
"angular-mocks-1.3": "angular-mocks#1.3",
|
||||
"angular-animate": "~1.2.9",
|
||||
"angular-animate-1.3": "angular-animate#1.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": "~1.2.23"
|
||||
}
|
||||
}
|
110
src/main/webapp/bower_components/angular-loading-bar/build/loading-bar.css
vendored
Normal file
110
src/main/webapp/bower_components/angular-loading-bar/build/loading-bar.css
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* angular-loading-bar v0.8.0
|
||||
* https://chieffancypants.github.io/angular-loading-bar
|
||||
* Copyright (c) 2015 Wes Cruver
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
/* Make clicks pass-through */
|
||||
#loading-bar,
|
||||
#loading-bar-spinner {
|
||||
pointer-events: none;
|
||||
-webkit-pointer-events: none;
|
||||
-webkit-transition: 350ms linear all;
|
||||
-moz-transition: 350ms linear all;
|
||||
-o-transition: 350ms linear all;
|
||||
transition: 350ms linear all;
|
||||
}
|
||||
|
||||
#loading-bar.ng-enter,
|
||||
#loading-bar.ng-leave.ng-leave-active,
|
||||
#loading-bar-spinner.ng-enter,
|
||||
#loading-bar-spinner.ng-leave.ng-leave-active {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#loading-bar.ng-enter.ng-enter-active,
|
||||
#loading-bar.ng-leave,
|
||||
#loading-bar-spinner.ng-enter.ng-enter-active,
|
||||
#loading-bar-spinner.ng-leave {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#loading-bar .bar {
|
||||
-webkit-transition: width 350ms;
|
||||
-moz-transition: width 350ms;
|
||||
-o-transition: width 350ms;
|
||||
transition: width 350ms;
|
||||
|
||||
background: #29d;
|
||||
position: fixed;
|
||||
z-index: 10002;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
border-bottom-right-radius: 1px;
|
||||
border-top-right-radius: 1px;
|
||||
}
|
||||
|
||||
/* Fancy blur effect */
|
||||
#loading-bar .peg {
|
||||
position: absolute;
|
||||
width: 70px;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 2px;
|
||||
opacity: .45;
|
||||
-moz-box-shadow: #29d 1px 0 6px 1px;
|
||||
-ms-box-shadow: #29d 1px 0 6px 1px;
|
||||
-webkit-box-shadow: #29d 1px 0 6px 1px;
|
||||
box-shadow: #29d 1px 0 6px 1px;
|
||||
-moz-border-radius: 100%;
|
||||
-webkit-border-radius: 100%;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
#loading-bar-spinner {
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 10002;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#loading-bar-spinner .spinner-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
|
||||
border: solid 2px transparent;
|
||||
border-top-color: #29d;
|
||||
border-left-color: #29d;
|
||||
border-radius: 50%;
|
||||
|
||||
-webkit-animation: loading-bar-spinner 400ms linear infinite;
|
||||
-moz-animation: loading-bar-spinner 400ms linear infinite;
|
||||
-ms-animation: loading-bar-spinner 400ms linear infinite;
|
||||
-o-animation: loading-bar-spinner 400ms linear infinite;
|
||||
animation: loading-bar-spinner 400ms linear infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes loading-bar-spinner {
|
||||
0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
|
||||
100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
|
||||
}
|
||||
@-moz-keyframes loading-bar-spinner {
|
||||
0% { -moz-transform: rotate(0deg); transform: rotate(0deg); }
|
||||
100% { -moz-transform: rotate(360deg); transform: rotate(360deg); }
|
||||
}
|
||||
@-o-keyframes loading-bar-spinner {
|
||||
0% { -o-transform: rotate(0deg); transform: rotate(0deg); }
|
||||
100% { -o-transform: rotate(360deg); transform: rotate(360deg); }
|
||||
}
|
||||
@-ms-keyframes loading-bar-spinner {
|
||||
0% { -ms-transform: rotate(0deg); transform: rotate(0deg); }
|
||||
100% { -ms-transform: rotate(360deg); transform: rotate(360deg); }
|
||||
}
|
||||
@keyframes loading-bar-spinner {
|
||||
0% { transform: rotate(0deg); transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); transform: rotate(360deg); }
|
||||
}
|
329
src/main/webapp/bower_components/angular-loading-bar/build/loading-bar.js
vendored
Normal file
329
src/main/webapp/bower_components/angular-loading-bar/build/loading-bar.js
vendored
Normal file
@ -0,0 +1,329 @@
|
||||
/*!
|
||||
* angular-loading-bar v0.8.0
|
||||
* https://chieffancypants.github.io/angular-loading-bar
|
||||
* Copyright (c) 2015 Wes Cruver
|
||||
* License: MIT
|
||||
*/
|
||||
/*
|
||||
* angular-loading-bar
|
||||
*
|
||||
* intercepts XHR requests and creates a loading bar.
|
||||
* Based on the excellent nprogress work by rstacruz (more info in readme)
|
||||
*
|
||||
* (c) 2013 Wes Cruver
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Alias the loading bar for various backwards compatibilities since the project has matured:
|
||||
angular.module('angular-loading-bar', ['cfp.loadingBarInterceptor']);
|
||||
angular.module('chieffancypants.loadingBar', ['cfp.loadingBarInterceptor']);
|
||||
|
||||
|
||||
/**
|
||||
* loadingBarInterceptor service
|
||||
*
|
||||
* Registers itself as an Angular interceptor and listens for XHR requests.
|
||||
*/
|
||||
angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
|
||||
.config(['$httpProvider', function ($httpProvider) {
|
||||
|
||||
var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', '$log', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, $log, cfpLoadingBar) {
|
||||
|
||||
/**
|
||||
* The total number of requests made
|
||||
*/
|
||||
var reqsTotal = 0;
|
||||
|
||||
/**
|
||||
* The number of requests completed (either successfully or not)
|
||||
*/
|
||||
var reqsCompleted = 0;
|
||||
|
||||
/**
|
||||
* The amount of time spent fetching before showing the loading bar
|
||||
*/
|
||||
var latencyThreshold = cfpLoadingBar.latencyThreshold;
|
||||
|
||||
/**
|
||||
* $timeout handle for latencyThreshold
|
||||
*/
|
||||
var startTimeout;
|
||||
|
||||
|
||||
/**
|
||||
* calls cfpLoadingBar.complete() which removes the
|
||||
* loading bar from the DOM.
|
||||
*/
|
||||
function setComplete() {
|
||||
$timeout.cancel(startTimeout);
|
||||
cfpLoadingBar.complete();
|
||||
reqsCompleted = 0;
|
||||
reqsTotal = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the response has already been cached
|
||||
* @param {Object} config the config option from the request
|
||||
* @return {Boolean} retrns true if cached, otherwise false
|
||||
*/
|
||||
function isCached(config) {
|
||||
var cache;
|
||||
var defaultCache = $cacheFactory.get('$http');
|
||||
var defaults = $httpProvider.defaults;
|
||||
|
||||
// Choose the proper cache source. Borrowed from angular: $http service
|
||||
if ((config.cache || defaults.cache) && config.cache !== false &&
|
||||
(config.method === 'GET' || config.method === 'JSONP')) {
|
||||
cache = angular.isObject(config.cache) ? config.cache
|
||||
: angular.isObject(defaults.cache) ? defaults.cache
|
||||
: defaultCache;
|
||||
}
|
||||
|
||||
var cached = cache !== undefined ?
|
||||
cache.get(config.url) !== undefined : false;
|
||||
|
||||
if (config.cached !== undefined && cached !== config.cached) {
|
||||
return config.cached;
|
||||
}
|
||||
config.cached = cached;
|
||||
return cached;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
'request': function(config) {
|
||||
// Check to make sure this request hasn't already been cached and that
|
||||
// the requester didn't explicitly ask us to ignore this request:
|
||||
if (!config.ignoreLoadingBar && !isCached(config)) {
|
||||
$rootScope.$broadcast('cfpLoadingBar:loading', {url: config.url});
|
||||
if (reqsTotal === 0) {
|
||||
startTimeout = $timeout(function() {
|
||||
cfpLoadingBar.start();
|
||||
}, latencyThreshold);
|
||||
}
|
||||
reqsTotal++;
|
||||
cfpLoadingBar.set(reqsCompleted / reqsTotal);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
|
||||
'response': function(response) {
|
||||
if (!response || !response.config) {
|
||||
$log.error('Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50');
|
||||
return response;
|
||||
}
|
||||
|
||||
if (!response.config.ignoreLoadingBar && !isCached(response.config)) {
|
||||
reqsCompleted++;
|
||||
$rootScope.$broadcast('cfpLoadingBar:loaded', {url: response.config.url, result: response});
|
||||
if (reqsCompleted >= reqsTotal) {
|
||||
setComplete();
|
||||
} else {
|
||||
cfpLoadingBar.set(reqsCompleted / reqsTotal);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
|
||||
'responseError': function(rejection) {
|
||||
|