add - перенос из hg в git
This commit is contained in:
commit
c3d2b804e3
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
.mvn
|
||||||
|
/HELP.md
|
55
README.MD
Normal file
55
README.MD
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Инвентаризация (ESPD)
|
||||||
|
|
||||||
|
Кроссплатформенное приложение для инвентаризации.
|
||||||
|
|
||||||
|
> Использованные библиотеки/фреймворки:
|
||||||
|
> - [JavaFX](https://openjfx.io) - фреймворк для создания UI-приложений
|
||||||
|
> - [oshi](https://github.com/oshi/oshi) - получение информации об аппаратной и системной части компьютера.
|
||||||
|
> - [JSpeedTest](https://github.com/bertrandmartel/speed-test-lib) - замеры скорости интернета
|
||||||
|
|
||||||
|
> Для запуска приложения потребуется установить **JDK 17 или выше**. Скачать
|
||||||
|
> можно [здесь](https://www.oracle.com/java/technologies/downloads/).
|
||||||
|
|
||||||
|
> Для формирования приложения воспользуйтесь командой `mvn clean package`
|
||||||
|
|
||||||
|
## Содержание формы
|
||||||
|
|
||||||
|
- **Код учреждения** (int) - вводится пользователем;
|
||||||
|
- **Наименование ОО** (string) - после нахождения в БД при помощи кода ОО автоматически заполняется;
|
||||||
|
- **Номер здания** (int) - выбирается элемент в списке;
|
||||||
|
- **Адрес** (string) - отображается после выбора элемента в списке номеров зданий;
|
||||||
|
- **Помещение** (string) - выбирается элемент в списке;
|
||||||
|
- **Label с GIF** - показ того, что сейчас происходит в форме
|
||||||
|
- **Отправить** - активируется при наличии всех заполненных полей;
|
||||||
|
- **Статус необходимости обновить приложение**.
|
||||||
|
|
||||||
|
> ### После нажатия кнопки "сохранить" собирается следующее
|
||||||
|
> - данные из полей в форме;
|
||||||
|
> - конфигурация компьютера с учетом списка выше;
|
||||||
|
> - Замеры скорости интернета
|
||||||
|
>> При каких-либо ошибках `output.log` отправляется на сервер.
|
||||||
|
|
||||||
|
> ### Перед закрытием приложения
|
||||||
|
> - **Дата начала работы (datetime)** - выводится после открытия приложения;
|
||||||
|
> - **Дата окончания работы (datetime)** - высчитывается перед закрытием приложения.
|
||||||
|
|
||||||
|
### Список отправляемой конфигурации при успешном заполнении формы и нажатии "Отправить"
|
||||||
|
|
||||||
|
- **Операционная система** (справочник) - Windows, Linux или MACos;
|
||||||
|
- **Версия операционной системы** (string) - 11.2, 18.03 и т.д.
|
||||||
|
- **Устройство** (справочник) - ноутбук или ПК;
|
||||||
|
- **Модель процессора** (string) - Название модели процессора;
|
||||||
|
- **Частота процессора** (float) - измеряется в ГГц;
|
||||||
|
- **Объем ОЗУ** (float) - 0.5, если 512МБ, 16 - если 16ГБ;
|
||||||
|
- **Диски** (список):
|
||||||
|
- **Тип диска** - SSD / HDD / Nvm.2 (_справочник_)
|
||||||
|
- **Модель диска** - название модели диска;
|
||||||
|
- **Скорость интернета** (String) - в какой форме?
|
||||||
|
|
||||||
|
> Нужно учесть пару моментов при реализации:
|
||||||
|
> 1. защиту от **посторонних пользователей**;
|
||||||
|
> 2. автоматический запуск приложения **при запуске ОС**;
|
||||||
|
> 3. автоматическое заполнение поля окончания работы и сохранение **при выключении компьютера**;
|
||||||
|
> 4. как будет обновляться приложение - **вручную ссылкой с проверкой актуальности версии или автоматическое обновление
|
||||||
|
приложения**;
|
||||||
|
> 5. Попробовать вложить JDK в проект для избежания лишних установок для пользователя.
|
308
mvnw
vendored
Normal file
308
mvnw
vendored
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
#!/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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# 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 /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||||
|
else
|
||||||
|
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=$(java-config --jre-home)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||||
|
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="$(\unset -f command 2>/dev/null; \command -v 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
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
# Remove \r in case we run on Windows within Git Bash
|
||||||
|
# and check out the repository with auto CRLF management
|
||||||
|
# enabled. Otherwise, we may read lines that are delimited with
|
||||||
|
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||||
|
# splitting rules.
|
||||||
|
tr -s '\r\n' ' ' < "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
printf '%s\n' "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||||
|
log "$MAVEN_PROJECTBASEDIR"
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if [ -r "$wrapperJarPath" ]; then
|
||||||
|
log "Found $wrapperJarPath"
|
||||||
|
else
|
||||||
|
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||||
|
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
else
|
||||||
|
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||||
|
safeValue=$(echo "$value" | tr -d '\r')
|
||||||
|
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
log "Downloading from: $wrapperUrl"
|
||||||
|
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
log "Found wget ... using wget"
|
||||||
|
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
log "Found curl ... using curl"
|
||||||
|
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "Falling back to using Java to download"
|
||||||
|
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaSource=$(cygpath --path --windows "$javaSource")
|
||||||
|
javaClass=$(cygpath --path --windows "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$javaSource" ]; then
|
||||||
|
if [ ! -e "$javaClass" ]; then
|
||||||
|
log " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
log " - Running MavenWrapperDownloader.java ..."
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||||
|
wrapperSha256Sum=""
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||||
|
esac
|
||||||
|
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ -n "$wrapperSha256Sum" ]; then
|
||||||
|
wrapperSha256Result=false
|
||||||
|
if command -v sha256sum > /dev/null; then
|
||||||
|
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||||
|
wrapperSha256Result=true
|
||||||
|
fi
|
||||||
|
elif command -v shasum > /dev/null; then
|
||||||
|
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||||
|
wrapperSha256Result=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||||
|
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $wrapperSha256Result = false ]; then
|
||||||
|
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||||
|
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||||
|
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086 # safe args
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
205
mvnw.cmd
vendored
Normal file
205
mvnw.cmd
vendored
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
@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 https://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 Apache Maven Wrapper startup batch script, version 3.2.0
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@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 keystroke 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 set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by 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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\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
|
||||||
|
|
||||||
|
@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="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %WRAPPER_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||||
|
SET WRAPPER_SHA_256_SUM=""
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||||
|
)
|
||||||
|
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||||
|
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||||
|
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||||
|
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||||
|
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||||
|
" exit 1;"^
|
||||||
|
"}"^
|
||||||
|
"}"
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
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 "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\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%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
109
pom.xml
Normal file
109
pom.xml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.1.5</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>ru.integrics</groupId>
|
||||||
|
<artifactId>espd-client</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<name>espd</name>
|
||||||
|
<description>espd-client-new</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
<version>6.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-graphics</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
<classifier>win</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-graphics</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
<classifier>linux</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-graphics</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
<classifier>mac</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core</artifactId>
|
||||||
|
<version>6.4.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>fr.bmartel</groupId>
|
||||||
|
<artifactId>jspeedtest</artifactId>
|
||||||
|
<version>1.32.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.16.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
11
src/main/java/espd/EspdClientApplication.java
Normal file
11
src/main/java/espd/EspdClientApplication.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package espd;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class EspdClientApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Application.launch(JavaFxApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
51
src/main/java/espd/JavaFxApplication.java
Normal file
51
src/main/java/espd/JavaFxApplication.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package espd;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.application.HostServices;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.context.ApplicationContextInitializer;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
|
|
||||||
|
public class JavaFxApplication extends Application {
|
||||||
|
private ConfigurableApplicationContext context;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
ApplicationContextInitializer<GenericApplicationContext> initializer = applicationContext -> {
|
||||||
|
applicationContext.registerBean(Application.class, () -> JavaFxApplication.this);
|
||||||
|
applicationContext.registerBean(Parameters.class, this::getParameters);
|
||||||
|
applicationContext.registerBean(HostServices.class, this::getHostServices);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.context = new SpringApplicationBuilder().sources(EspdClientApplication.class).initializers(initializer).run(getParameters().getRaw().toArray(new String[0]));
|
||||||
|
|
||||||
|
context.getBean(HostServices.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) {
|
||||||
|
this.context.publishEvent(new StageReadyEvent(stage));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
this.context.close();
|
||||||
|
Platform.exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StageReadyEvent extends ApplicationEvent {
|
||||||
|
|
||||||
|
Stage getStage() {
|
||||||
|
return (Stage) getSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StageReadyEvent(Stage source) {
|
||||||
|
super(source);
|
||||||
|
}
|
||||||
|
}
|
51
src/main/java/espd/StageListener.java
Normal file
51
src/main/java/espd/StageListener.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package espd;
|
||||||
|
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class StageListener implements ApplicationListener<StageReadyEvent> {
|
||||||
|
|
||||||
|
private final String applicationTitle;
|
||||||
|
private final Resource fxml;
|
||||||
|
private final ApplicationContext context;
|
||||||
|
|
||||||
|
public StageListener(@Value("${spring.application.ui.title}") String applicationTitle, @Value("classpath:/ui.fxml") Resource resource, ApplicationContext context) {
|
||||||
|
this.applicationTitle = applicationTitle;
|
||||||
|
this.fxml = resource;
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(StageReadyEvent event) {
|
||||||
|
try {
|
||||||
|
URL url = this.fxml.getURL();
|
||||||
|
FXMLLoader loader = new FXMLLoader(url);
|
||||||
|
loader.setControllerFactory(context::getBean);
|
||||||
|
|
||||||
|
Parent root = loader.load();
|
||||||
|
Scene scene = new Scene(root, 400, 580);
|
||||||
|
Stage stage = event.getStage();
|
||||||
|
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.getIcons().add(new Image(Objects.requireNonNull(StageListener.class.getResourceAsStream("/img/icon.png"))));
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.setTitle(this.applicationTitle);
|
||||||
|
stage.show();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
src/main/java/espd/controllers/HttpController.java
Normal file
65
src/main/java/espd/controllers/HttpController.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package espd.controllers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import espd.jsonObj.FullConfig;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Controller
|
||||||
|
public class HttpController {
|
||||||
|
|
||||||
|
private static final HttpClient client = HttpClient.newHttpClient();
|
||||||
|
private static String apiUrl;
|
||||||
|
|
||||||
|
@Value("${spring.application.api.url}")
|
||||||
|
public void setApiUrl(String apiUrl) {
|
||||||
|
HttpController.apiUrl = apiUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String makeGetRequest(String path) throws IOException, InterruptedException {
|
||||||
|
String fullUrl = apiUrl + path;
|
||||||
|
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(fullUrl))
|
||||||
|
.GET()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
return getResponseBody(response, fullUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String makePostRequest(String path, FullConfig config) throws IOException, InterruptedException {
|
||||||
|
|
||||||
|
String fullUrl = apiUrl + path;
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
String requestBody = objectMapper.writeValueAsString(config);
|
||||||
|
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(fullUrl))
|
||||||
|
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());;
|
||||||
|
return getResponseBody(response, fullUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getResponseBody(HttpResponse<String> response, String url) {
|
||||||
|
if (response.statusCode() == 200) {
|
||||||
|
return response.body();
|
||||||
|
} else {
|
||||||
|
log.atError().log("Ошибка получения ответа по адресу: {}", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
45
src/main/java/espd/controllers/JsonController.java
Normal file
45
src/main/java/espd/controllers/JsonController.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package espd.controllers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import espd.jsonObj.School;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class JsonController {
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
private final Map<String, Object> data = new HashMap<>();
|
||||||
|
|
||||||
|
public void addData(String key, Object value) {
|
||||||
|
data.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNestedData(String parentKey, String childKey, Object childValue) {
|
||||||
|
if (data.containsKey(parentKey)) {
|
||||||
|
Map<String, Object> nestedData = (Map<String, Object>) data.get(parentKey);
|
||||||
|
nestedData.put(childKey, childValue);
|
||||||
|
} else {
|
||||||
|
Map<String, Object> nestedData = new HashMap<>();
|
||||||
|
nestedData.put(childKey, childValue);
|
||||||
|
data.put(parentKey, nestedData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> createDiskData(String type, String size) {
|
||||||
|
Map<String, Object> diskData = new HashMap<>();
|
||||||
|
diskData.put("type", type);
|
||||||
|
diskData.put("size", size);
|
||||||
|
return diskData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJson() throws JsonProcessingException {
|
||||||
|
return objectMapper.writeValueAsString(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public School fromJson(String jsonString) throws JsonProcessingException {
|
||||||
|
return objectMapper.readValue(jsonString, School.class);
|
||||||
|
}
|
||||||
|
}
|
206
src/main/java/espd/controllers/UiController.java
Normal file
206
src/main/java/espd/controllers/UiController.java
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
package espd.controllers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import espd.itemsFxml.BuildingItem;
|
||||||
|
import espd.itemsFxml.DeviceTypeItem;
|
||||||
|
import espd.itemsFxml.RoomItem;
|
||||||
|
import espd.jsonObj.*;
|
||||||
|
import espd.utils.Fxml;
|
||||||
|
import espd.utils.SystemInfoProvider;
|
||||||
|
import javafx.application.HostServices;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class UiController {
|
||||||
|
|
||||||
|
private boolean needUpdate = false; // TODO: исправить, когда можно будет отслеживать обновления
|
||||||
|
private LocalDate dateStart; // дата запуска приложения
|
||||||
|
private final HostServices hostServices;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldCodeEdu; // текстовое поле кода организации
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldNameEdu; // поле наименования образовательной организации
|
||||||
|
@FXML
|
||||||
|
private ComboBox<BuildingItem> comboBoxBuilding; // список номеров здания
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldAddress; // текстовое поле адреса
|
||||||
|
@FXML
|
||||||
|
private ComboBox<RoomItem> comboBoxRoom; // список помещений
|
||||||
|
@FXML
|
||||||
|
private ComboBox<DeviceTypeItem> comboBoxDeviceType; // список устройств
|
||||||
|
@FXML
|
||||||
|
private Hyperlink linkNewVersion; // кнопка ссылки на скачивание новой версии
|
||||||
|
@FXML
|
||||||
|
private Label labelSearch; // текст статуса выполнения
|
||||||
|
@FXML
|
||||||
|
private Button buttonSubmit; // кнопка отправки данных
|
||||||
|
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
UiController(HostServices hostServices) {
|
||||||
|
this.hostServices = hostServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
// Заполнение типов устройства
|
||||||
|
Map<String, String> enRuDeviceTypeMap = new HashMap<>();
|
||||||
|
|
||||||
|
enRuDeviceTypeMap.put("Laptop", "Ноутбук");
|
||||||
|
enRuDeviceTypeMap.put("PC", "ПК");
|
||||||
|
enRuDeviceTypeMap.put("Tablet", "Планшет");
|
||||||
|
|
||||||
|
for (Map.Entry<String, String> entry : enRuDeviceTypeMap.entrySet()) {
|
||||||
|
comboBoxDeviceType.getItems().add(new DeviceTypeItem(entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверка новой версии
|
||||||
|
this.dateStart = SystemInfoProvider.getCurrentDateAndTime();
|
||||||
|
|
||||||
|
if (needUpdate) {
|
||||||
|
linkNewVersion.setText("Доступна новая версия");
|
||||||
|
} else {
|
||||||
|
linkNewVersion.getStyleClass().add("not-link");
|
||||||
|
linkNewVersion.setText("Установлена актуальная версия приложения");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обработка кнопки кода образовательной организации при нажатии
|
||||||
|
*/
|
||||||
|
@FXML
|
||||||
|
private void handleCodeEduButtonClick() throws IOException, InterruptedException {
|
||||||
|
String codeEdu = textFieldCodeEdu.getText().replaceAll(" ", "");
|
||||||
|
textFieldCodeEdu.setText(codeEdu);
|
||||||
|
|
||||||
|
Fxml.deactivateAndClearInput(textFieldNameEdu);
|
||||||
|
Fxml.deactivateAndClearComboBox(comboBoxBuilding);
|
||||||
|
Fxml.deactivateAndClearInput(textFieldAddress);
|
||||||
|
Fxml.deactivateAndClearComboBox(comboBoxRoom);
|
||||||
|
Fxml.deactivateComboBox(comboBoxDeviceType);
|
||||||
|
|
||||||
|
Fxml.activateOrDeactivateButton(buttonSubmit, false);
|
||||||
|
|
||||||
|
// проверка на пустоту и наличие других символов, кроме чисел
|
||||||
|
if (codeEdu.isEmpty()) {
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, true, "Заполните код ОО и запустите проверку");
|
||||||
|
} else if (!codeEdu.matches("\\d+")) {
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, true,"Код ОО должен состоять только из чисел");
|
||||||
|
} else {
|
||||||
|
Fxml.showOrHideMessage(labelSearch, true, false, null);
|
||||||
|
|
||||||
|
School school = objectMapper.readValue(HttpController.makeGetRequest("school=" + codeEdu), School.class);
|
||||||
|
textFieldNameEdu.setText(school.getShortAddress());
|
||||||
|
|
||||||
|
// Получаем информацию о зданиях
|
||||||
|
Map<String, Building> buildings = school.getBuildings();
|
||||||
|
|
||||||
|
if (buildings != null) {
|
||||||
|
buildings.values().forEach(building -> comboBoxBuilding.getItems().add(new BuildingItem(
|
||||||
|
building.getActualAddress(),
|
||||||
|
building.getName(),
|
||||||
|
building.getSysGuid()
|
||||||
|
)));
|
||||||
|
|
||||||
|
Fxml.openComboBox(comboBoxBuilding);
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, false, "Выберите наименование здания");
|
||||||
|
} else {
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, true, "Список зданий отсутствует. Заполните данные для отображения");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обработка событий списка наименований здания
|
||||||
|
*/
|
||||||
|
@FXML
|
||||||
|
private void handleItemsComboBoxBuildingClick() throws IOException, InterruptedException {
|
||||||
|
BuildingItem selectedValue = comboBoxBuilding.getValue();
|
||||||
|
|
||||||
|
Fxml.deactivateAndClearInput(textFieldAddress);
|
||||||
|
Fxml.deactivateAndClearComboBox(comboBoxRoom);
|
||||||
|
Fxml.deactivateComboBox(comboBoxDeviceType);
|
||||||
|
|
||||||
|
Fxml.showOrHideMessage(labelSearch, true, false, null);
|
||||||
|
Fxml.activateOrDeactivateButton(buttonSubmit, false);
|
||||||
|
|
||||||
|
Map<String, Room> rooms = objectMapper.readValue(HttpController.makeGetRequest("rooms=" + selectedValue.sysGuid()), Rooms.class).getRooms();
|
||||||
|
|
||||||
|
if (rooms != null) {
|
||||||
|
textFieldAddress.setText(selectedValue.shortAddress());
|
||||||
|
rooms.values().forEach(roomInfo -> comboBoxRoom.getItems().add(new RoomItem(roomInfo.getNumber(), roomInfo.getSysGuid())));
|
||||||
|
|
||||||
|
Fxml.openComboBox(comboBoxRoom);
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, false, "Выберите помещение");
|
||||||
|
} else {
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, true, "Список помещений отсутствует. Заполните данные для отображения");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обработка событий списка номеров помещений
|
||||||
|
*/
|
||||||
|
@FXML
|
||||||
|
private void handleItemsComboBoxRoomClick() {
|
||||||
|
Fxml.openComboBox(comboBoxDeviceType);
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, false, "Выберите тип устройства");
|
||||||
|
Fxml.activateOrDeactivateButton(buttonSubmit, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleItemsComboBoxDeviceTypeClick() {
|
||||||
|
Fxml.activateOrDeactivateButton(buttonSubmit, true);
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, false, "Форма готова к отправке");
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleSubmitClick() throws IOException, InterruptedException {
|
||||||
|
if (Fxml.buttonHasClassActive(buttonSubmit)) {
|
||||||
|
FullConfig config = getFullConfig();
|
||||||
|
Status status = objectMapper.readValue(HttpController.makePostRequest("configs", config), Status.class);
|
||||||
|
|
||||||
|
Fxml.showOrHideMessage(labelSearch, false, status.getStatus() != 200, status.getStatusMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FullConfig getFullConfig() {
|
||||||
|
String osName = SystemInfoProvider.getPlatformName();
|
||||||
|
Map<String, String> ipMacAddressMap = SystemInfoProvider.getIpAndMacAddress(osName);
|
||||||
|
Map<String, Integer> capacityMap = SystemInfoProvider.getHddAndSsdCapacity();
|
||||||
|
// TODO: добавить измерение интернета
|
||||||
|
|
||||||
|
return new FullConfig(
|
||||||
|
comboBoxRoom.getValue().sysGuid(),
|
||||||
|
comboBoxDeviceType.getValue().deviceTypeEn(),
|
||||||
|
SystemInfoProvider.getProcessorName(),
|
||||||
|
SystemInfoProvider.getProcessorMaxFrequencyInMHz(),
|
||||||
|
SystemInfoProvider.getAmountGbRam(osName),
|
||||||
|
osName,
|
||||||
|
SystemInfoProvider.getPlatformVersion(),
|
||||||
|
capacityMap.get("hdd"),
|
||||||
|
capacityMap.get("ssd"),
|
||||||
|
ipMacAddressMap.get("ipAddress"),
|
||||||
|
ipMacAddressMap.get("macAddress"),
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обработка ссылки обновления
|
||||||
|
*/
|
||||||
|
@FXML
|
||||||
|
private void openInBrowser() {
|
||||||
|
if (needUpdate) {
|
||||||
|
hostServices.showDocument("https://www.google.com"); // TODO: установить другую ссылку
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
src/main/java/espd/itemsFxml/BuildingItem.java
Normal file
9
src/main/java/espd/itemsFxml/BuildingItem.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package espd.itemsFxml;
|
||||||
|
|
||||||
|
public record BuildingItem(String shortAddress, String name, String sysGuid) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
8
src/main/java/espd/itemsFxml/DeviceTypeItem.java
Normal file
8
src/main/java/espd/itemsFxml/DeviceTypeItem.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package espd.itemsFxml;
|
||||||
|
|
||||||
|
public record DeviceTypeItem(String deviceTypeEn, String deviceTypeRu) {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return deviceTypeRu;
|
||||||
|
}
|
||||||
|
}
|
9
src/main/java/espd/itemsFxml/RoomItem.java
Normal file
9
src/main/java/espd/itemsFxml/RoomItem.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package espd.itemsFxml;
|
||||||
|
|
||||||
|
public record RoomItem(Integer roomNumber, String sysGuid) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(roomNumber);
|
||||||
|
}
|
||||||
|
}
|
12
src/main/java/espd/jsonObj/Building.java
Normal file
12
src/main/java/espd/jsonObj/Building.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Building {
|
||||||
|
private String actualAddress;
|
||||||
|
private String name;
|
||||||
|
private String sysGuid;
|
||||||
|
}
|
24
src/main/java/espd/jsonObj/FullConfig.java
Normal file
24
src/main/java/espd/jsonObj/FullConfig.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FullConfig {
|
||||||
|
private String sysGuidRoom;
|
||||||
|
private String deviceType;
|
||||||
|
private String cpuModel;
|
||||||
|
private Integer cpuFrequency;
|
||||||
|
private Integer ramSize;
|
||||||
|
private String osName;
|
||||||
|
private String osVersion;
|
||||||
|
private Integer hddCapacity;
|
||||||
|
private Integer ssdCapacity;
|
||||||
|
private String ipAddress;
|
||||||
|
private String macAddress;
|
||||||
|
private String uploadSpeed;
|
||||||
|
private String downloadSpeed;
|
||||||
|
}
|
11
src/main/java/espd/jsonObj/Room.java
Normal file
11
src/main/java/espd/jsonObj/Room.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Room {
|
||||||
|
private Integer number;
|
||||||
|
private String sysGuid;
|
||||||
|
}
|
13
src/main/java/espd/jsonObj/Rooms.java
Normal file
13
src/main/java/espd/jsonObj/Rooms.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class Rooms {
|
||||||
|
private Map<String, Room> rooms;
|
||||||
|
private String error;
|
||||||
|
}
|
14
src/main/java/espd/jsonObj/School.java
Normal file
14
src/main/java/espd/jsonObj/School.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class School {
|
||||||
|
private String shortAddress;
|
||||||
|
private Map<String, Building> buildings;
|
||||||
|
private String error;
|
||||||
|
}
|
19
src/main/java/espd/jsonObj/Status.java
Normal file
19
src/main/java/espd/jsonObj/Status.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package espd.jsonObj;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Status {
|
||||||
|
private Integer status;
|
||||||
|
private String statusMsg;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public Status(@JsonProperty("status") Integer status, @JsonProperty("statusMsg") String statusMsg) {
|
||||||
|
this.status = status;
|
||||||
|
this.statusMsg = statusMsg;
|
||||||
|
}
|
||||||
|
}
|
65
src/main/java/espd/utils/DiskDrive.java
Normal file
65
src/main/java/espd/utils/DiskDrive.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package espd.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import oshi.hardware.HWDiskStore;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class DiskDrive {
|
||||||
|
HWDiskStore diskStore;
|
||||||
|
public DiskDrive(HWDiskStore store) {
|
||||||
|
this.diskStore = store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDiskDriveSizeGb() {
|
||||||
|
return findNextValueSizeGb(bytesToGB(diskStore.getSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiskType getDiskType() {
|
||||||
|
String diskStoreModel = diskStore.getModel().trim().toLowerCase();
|
||||||
|
|
||||||
|
if (diskStoreModel.contains("nvme")) {
|
||||||
|
return DiskType.NVMe;
|
||||||
|
} else if (diskStoreModel.contains("ssd")) {
|
||||||
|
return DiskType.SSD;
|
||||||
|
} else if (diskStoreModel.contains("hdd")) {
|
||||||
|
return DiskType.HDD;
|
||||||
|
} else if (diskStoreModel.contains("накопители") || diskStoreModel.contains("drive")) {
|
||||||
|
return DiskType.UNDEFINED;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int bytesToGB(long bytes) {
|
||||||
|
return (int) (bytes / (1024 * 1024 * 1024));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Получение размера производителя на этикетке
|
||||||
|
* @param actualSize фактический размер, взятый из системы
|
||||||
|
* @return размер с этикетки
|
||||||
|
*/
|
||||||
|
private int findNextValueSizeGb(int actualSize) {
|
||||||
|
return Arrays.stream(new int[]{32, 64, 128, 256, 512, 1024, 2048, 4096})
|
||||||
|
.filter(size -> actualSize < size)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(actualSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum DiskType {
|
||||||
|
HDD("HDD"),
|
||||||
|
SSD("SSD"),
|
||||||
|
NVMe("NVMe"),
|
||||||
|
UNDEFINED("Undefined");
|
||||||
|
|
||||||
|
private final String typeName;
|
||||||
|
|
||||||
|
DiskType(String typeName) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
54
src/main/java/espd/utils/Fxml.java
Normal file
54
src/main/java/espd/utils/Fxml.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package espd.utils;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ComboBox;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
|
public abstract class Fxml {
|
||||||
|
public static boolean buttonHasClassActive(Button button) {
|
||||||
|
return button.getStyleClass().contains("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void activateOrDeactivateButton(Button button, boolean isActivate) {
|
||||||
|
if (isActivate) {
|
||||||
|
button.getStyleClass().add("active");
|
||||||
|
} else {
|
||||||
|
button.getStyleClass().remove("active");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showOrHideMessage(Label label, boolean isHide, boolean isRed, String message) {
|
||||||
|
if (isHide && !label.getStyleClass().contains("hide")) {
|
||||||
|
label.getStyleClass().add("hide");
|
||||||
|
} else {
|
||||||
|
label.getStyleClass().remove("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRed && !label.getStyleClass().contains("red")) {
|
||||||
|
label.getStyleClass().add("red");
|
||||||
|
} else {
|
||||||
|
label.getStyleClass().remove("red");
|
||||||
|
}
|
||||||
|
|
||||||
|
label.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deactivateComboBox(ComboBox<?> comboBox) {
|
||||||
|
comboBox.setDisable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deactivateAndClearComboBox(ComboBox<?> comboBox) {
|
||||||
|
comboBox.getItems().clear();
|
||||||
|
comboBox.setDisable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deactivateAndClearInput(TextField field) {
|
||||||
|
field.setText("");
|
||||||
|
field.setDisable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openComboBox(ComboBox<?> comboBox) {
|
||||||
|
comboBox.setDisable(false);
|
||||||
|
}
|
||||||
|
}
|
37
src/main/java/espd/utils/SpeedTest.java
Normal file
37
src/main/java/espd/utils/SpeedTest.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package espd.utils;
|
||||||
|
|
||||||
|
import fr.bmartel.speedtest.SpeedTestReport;
|
||||||
|
import fr.bmartel.speedtest.SpeedTestSocket;
|
||||||
|
import fr.bmartel.speedtest.inter.ISpeedTestListener;
|
||||||
|
import fr.bmartel.speedtest.model.SpeedTestError;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class SpeedTest {
|
||||||
|
static SpeedTestSocket socket = new SpeedTestSocket();
|
||||||
|
|
||||||
|
public static void checkSpeedTest() {
|
||||||
|
socket.addSpeedTestListener(new ISpeedTestListener() {
|
||||||
|
@Override
|
||||||
|
public void onCompletion(SpeedTestReport report) {
|
||||||
|
BigDecimal speed = report.getTransferRateBit();
|
||||||
|
BigDecimal speedMbps = speed.divide(new BigDecimal(1000000));
|
||||||
|
|
||||||
|
System.out.println("Speed: " + speedMbps + " mbps");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(float percent, SpeedTestReport report) {
|
||||||
|
System.out.println(percent + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(SpeedTestError speedTestError, String s) {
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// socket.startDownload("https://github.com/obsidianmd/obsidian-releases/releases/download/v1.5.3/Obsidian.1.5.3.exe");
|
||||||
|
// socket.startUpload("http://ipv4.ikoula.testdebit.info/", 1000000);
|
||||||
|
}
|
||||||
|
}
|
168
src/main/java/espd/utils/SystemInfoProvider.java
Normal file
168
src/main/java/espd/utils/SystemInfoProvider.java
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
package espd.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.converter.json.GsonBuilderUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import oshi.SystemInfo;
|
||||||
|
import oshi.hardware.HWDiskStore;
|
||||||
|
import oshi.hardware.NetworkIF;
|
||||||
|
import oshi.hardware.PhysicalMemory;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class SystemInfoProvider {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SystemInfoProvider.class);
|
||||||
|
public static SystemInfo systemInfo = new SystemInfo();
|
||||||
|
|
||||||
|
public static String getPlatformName() {
|
||||||
|
return SystemInfo.getCurrentPlatform().getName().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlatformVersion() {
|
||||||
|
return systemInfo.getOperatingSystem().getVersionInfo().getVersion().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getProcessorName() {
|
||||||
|
return systemInfo.getHardware().getProcessor().getProcessorIdentifier().getName().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getProcessorMaxFrequencyInMHz() {
|
||||||
|
return (int) (systemInfo.getHardware().getProcessor().getMaxFreq() / 1_000_000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getAmountGbRam(String osName) {
|
||||||
|
osName = osName.trim().toLowerCase();
|
||||||
|
List<PhysicalMemory> physicalMemoryList = systemInfo.getHardware().getMemory().getPhysicalMemory();
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
if (!physicalMemoryList.isEmpty()) {
|
||||||
|
result = (int) (systemInfo.getHardware().getMemory().getPhysicalMemory().stream()
|
||||||
|
.mapToLong(PhysicalMemory::getCapacity)
|
||||||
|
.sum() / 1073741824L);
|
||||||
|
} else {
|
||||||
|
if (osName.contains("linux")) {
|
||||||
|
result = getMemoryInfoLinux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Integer> getHddAndSsdCapacity() {
|
||||||
|
Map<String, Integer> capacityMap = new HashMap<>();
|
||||||
|
|
||||||
|
int hddCount = 0;
|
||||||
|
int ssdCount = 0;
|
||||||
|
int nvmeCount = 0;
|
||||||
|
int undefinedCount = 0;
|
||||||
|
|
||||||
|
for (HWDiskStore diskStore : systemInfo.getHardware().getDiskStores()) {
|
||||||
|
DiskDrive diskDrive = new DiskDrive(diskStore);
|
||||||
|
int diskSizeGb = diskDrive.getDiskDriveSizeGb();
|
||||||
|
|
||||||
|
if (diskDrive.getDiskType() == DiskDrive.DiskType.HDD) {
|
||||||
|
hddCount += diskSizeGb;
|
||||||
|
} else if (diskDrive.getDiskType() == DiskDrive.DiskType.SSD) {
|
||||||
|
ssdCount += diskSizeGb;
|
||||||
|
} else if (diskDrive.getDiskType() == DiskDrive.DiskType.UNDEFINED) {
|
||||||
|
undefinedCount += diskSizeGb;
|
||||||
|
} else if (diskDrive.getDiskType() == DiskDrive.DiskType.NVMe) {
|
||||||
|
nvmeCount += diskSizeGb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
capacityMap.put("hdd", hddCount);
|
||||||
|
capacityMap.put("ssd", ssdCount);
|
||||||
|
capacityMap.put("undefined", undefinedCount);
|
||||||
|
capacityMap.put("nvme", nvmeCount);
|
||||||
|
|
||||||
|
System.out.println(capacityMap);
|
||||||
|
|
||||||
|
return capacityMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> getIpAndMacAddress(String osName) {
|
||||||
|
osName = osName.trim().toLowerCase();
|
||||||
|
Map<String, String> ipMacAddressMap = new HashMap<>();
|
||||||
|
List<NetworkIF> networkInterfaces = new ArrayList<>(systemInfo.getHardware().getNetworkIFs());
|
||||||
|
|
||||||
|
NetworkIF networkIF = null;
|
||||||
|
|
||||||
|
if (osName.contains("linux")) {
|
||||||
|
for (NetworkIF ni : networkInterfaces) {
|
||||||
|
if (ni.getName().equalsIgnoreCase("wlp1s0") && ni.getIPv4addr().length != 0) {
|
||||||
|
networkIF = ni;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Находим wlan соединения. Если таковых нет - берем net соединение
|
||||||
|
networkIF = networkInterfaces.stream()
|
||||||
|
.filter(ni -> ni.getName().contains("wlan") && ni.getIPv4addr().length != 0)
|
||||||
|
.findFirst()
|
||||||
|
.orElseGet(() -> networkInterfaces.stream()
|
||||||
|
.filter(ni -> ni.getName().contains("net") && ni.getIPv4addr().length != 0)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// костыль (если совсем ничего не найдено - начинает бегать по всем соединениям)
|
||||||
|
if (networkIF == null) {
|
||||||
|
for (NetworkIF ni : networkInterfaces) {
|
||||||
|
String[] ipAddresses = ni.getIPv4addr();
|
||||||
|
String macAddress = ni.getMacaddr();
|
||||||
|
|
||||||
|
if (ipAddresses.length != 0 && macAddress != null && !macAddress.isEmpty()) {
|
||||||
|
networkIF = ni;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (networkIF != null) {
|
||||||
|
ipMacAddressMap.put("ipAddress", networkIF.getIPv4addr()[0]); // TODO: Может не существовать адрес, т.е. пустышка. Поправить
|
||||||
|
ipMacAddressMap.put("macAddress", networkIF.getMacaddr());
|
||||||
|
} else {
|
||||||
|
log.atInfo().log("No network interface found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipMacAddressMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDate getCurrentDateAndTime() {
|
||||||
|
return LocalDate.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getMemoryInfoLinux() {
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader("/proc/meminfo"));
|
||||||
|
String line;
|
||||||
|
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
if (line.startsWith("MemTotal:")) {
|
||||||
|
String[] parts = line.split("\\s+");
|
||||||
|
long totalMemoryKB = Long.parseLong(parts[1]);
|
||||||
|
result = (int) (totalMemoryKB / (1024 * 1024));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
3
src/main/resources/application.properties
Normal file
3
src/main/resources/application.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
spring.application.ui.title = Inventory
|
||||||
|
spring.application.api.url = http://213.145.5.42:38085/espd/
|
||||||
|
#spring.application.api.url = http://localhost:8085/espd/
|
BIN
src/main/resources/fonts/inter-bold.ttf
Normal file
BIN
src/main/resources/fonts/inter-bold.ttf
Normal file
Binary file not shown.
0
src/main/resources/fonts/inter-extralight.ttf
Normal file
0
src/main/resources/fonts/inter-extralight.ttf
Normal file
BIN
src/main/resources/fonts/inter-light.ttf
Normal file
BIN
src/main/resources/fonts/inter-light.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/fonts/inter-regular.ttf
Normal file
BIN
src/main/resources/fonts/inter-regular.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/fonts/inter-semibold.ttf
Normal file
BIN
src/main/resources/fonts/inter-semibold.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/img/icon.png
Normal file
BIN
src/main/resources/img/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
src/main/resources/img/rcit-logo.png
Normal file
BIN
src/main/resources/img/rcit-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/resources/img/wait.png
Normal file
BIN
src/main/resources/img/wait.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
26
src/main/resources/logback.spring.xml
Normal file
26
src/main/resources/logback.spring.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<property name="LOG_FILE" value="appLog"/>
|
||||||
|
<property name="LOG_DIR" value="logs"/>
|
||||||
|
<appender name="SAVE-TO-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_DIR}/app.log</file>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} [%thread{20}] %-5level - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_DIR}/archived/app_%d{dd-MM-yyyy}.log</fileNamePattern>
|
||||||
|
<maxHistory>100</maxHistory>
|
||||||
|
<totalSizeCap>200MB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
</appender>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} %magenta([%-20.20thread]) %highlight(%-5level) - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<root>
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="SAVE-TO-FILE"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
150
src/main/resources/styles.css
Normal file
150
src/main/resources/styles.css
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
@keyframes rotateAnimation {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
-fx-padding: 30px;
|
||||||
|
-fx-background-color: #EAEAEA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
-fx-opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
-fx-spacing: 52px;
|
||||||
|
-fx-alignment: CENTER_LEFT;
|
||||||
|
-fx-padding: 0 0 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header__text {
|
||||||
|
/*-fx-font-family: 'Inter Bold';*/
|
||||||
|
-fx-font-weight: 700;
|
||||||
|
-fx-font-size: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
-fx-padding: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle__text {
|
||||||
|
/*-fx-font-family: 'Inter ExtraLight';*/
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
-fx-padding: 0 0 8px;
|
||||||
|
-fx-alignment: center-right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row.center {
|
||||||
|
-fx-alignment: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row.with-button {
|
||||||
|
-fx-padding: 0 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row.margin {
|
||||||
|
-fx-padding: 0 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__input {
|
||||||
|
-fx-pref-width: Infinity;
|
||||||
|
-fx-padding: 10px 10px 10px 20px;
|
||||||
|
-fx-font-size: 15px;
|
||||||
|
-fx-border-color: #B8B8B8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__input.right {
|
||||||
|
-fx-padding: 10px 120px 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__link.not-link {
|
||||||
|
-fx-text-fill: inherit;
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-border-color: transparent;
|
||||||
|
-fx-border-width: 0;
|
||||||
|
-fx-padding: 0;
|
||||||
|
-fx-text-decoration: none;
|
||||||
|
-fx-underline: false;
|
||||||
|
-fx-cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__link.not-link:hover {
|
||||||
|
-fx-cursor: default;
|
||||||
|
-fx-underline: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__input.not-active {
|
||||||
|
-fx-background-color: #DDDDDD;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__combo-box {
|
||||||
|
-fx-font-size: 15px;
|
||||||
|
-fx-pref-width: Infinity;
|
||||||
|
-fx-hgrow: "ALWAYS";
|
||||||
|
-fx-padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button {
|
||||||
|
/*-fx-font-family: "inter-semibold";*/
|
||||||
|
-fx-font-size: 12px;
|
||||||
|
-fx-font-weight: 700;
|
||||||
|
-fx-padding: 13px;
|
||||||
|
-fx-text-fill: #FFFFFF;
|
||||||
|
-fx-background-color: #747474;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button.inline {
|
||||||
|
-fx-pref-width: Infinity;
|
||||||
|
-fx-hgrow: "ALWAYS";
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button.inline.submit.active {
|
||||||
|
-fx-background-color: #56B665;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button.inline.submit.active:hover {
|
||||||
|
-fx-background-color: #499855;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button.active {
|
||||||
|
-fx-background-color: #285BBD;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__button.active:hover {
|
||||||
|
-fx-background-color: #224c9e;
|
||||||
|
-fx-cursor: hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row__text {
|
||||||
|
/*-fx-font-family: 'Inter Light';*/
|
||||||
|
-fx-font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
-fx-alignment: center;
|
||||||
|
-fx-padding: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status__icon {
|
||||||
|
-fx-max-width: 20px;
|
||||||
|
-fx-max-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status__text {
|
||||||
|
-fx-padding: 0 0 13px;
|
||||||
|
/*-fx-font-family: "Inter SemiBold";*/
|
||||||
|
-fx-font-weight: 700;
|
||||||
|
-fx-font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status__text.red {
|
||||||
|
-fx-text-fill: #d51e1e;
|
||||||
|
}
|
52
src/main/resources/ui.fxml
Normal file
52
src/main/resources/ui.fxml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.image.Image?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<VBox xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="espd.controllers.UiController"
|
||||||
|
stylesheets="@styles.css" styleClass="body">
|
||||||
|
<HBox styleClass="header">
|
||||||
|
<Label styleClass="header__text" text="Инвентаризация"/>
|
||||||
|
<ImageView>
|
||||||
|
<Image url="@img/rcit-logo.png"/>
|
||||||
|
</ImageView>
|
||||||
|
</HBox>
|
||||||
|
<HBox styleClass="subtitle">
|
||||||
|
<Label styleClass="subtitle__text" text="Заполните следующие поля для отправки данных:"/>
|
||||||
|
</HBox>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<TextField styleClass="row__input, right" promptText="Код ОО" fx:id="textFieldCodeEdu"/>
|
||||||
|
<Button styleClass="row__button, active" text="Проверить" onAction="#handleCodeEduButtonClick"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<TextField styleClass="row__input, not-active" promptText="Наименование ОО" fx:id="textFieldNameEdu" disable="true"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<ComboBox styleClass="row__combo-box" disable="true" promptText="Наименование здания" fx:id="comboBoxBuilding"
|
||||||
|
onAction="#handleItemsComboBoxBuildingClick"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<TextField styleClass="row__input, not-active" promptText="Адрес здания" fx:id="textFieldAddress" disable="true"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<ComboBox styleClass="row__combo-box" disable="true" promptText="Помещение" fx:id="comboBoxRoom"
|
||||||
|
onAction="#handleItemsComboBoxRoomClick"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row">
|
||||||
|
<ComboBox styleClass="row__combo-box" disable="true" promptText="Тип устройства" fx:id="comboBoxDeviceType"
|
||||||
|
onAction="#handleItemsComboBoxDeviceTypeClick" />
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row, center">
|
||||||
|
<Label styleClass="status__text, hide" fx:id="labelSearch"/>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane styleClass="row, margin">
|
||||||
|
<Button styleClass="row__button, inline, submit, not-active" text="Отправить" fx:id="buttonSubmit"
|
||||||
|
onAction="#handleSubmitClick"/>
|
||||||
|
</StackPane>
|
||||||
|
<VBox styleClass="row, center">
|
||||||
|
<Hyperlink styleClass="row__link" onAction="#openInBrowser" fx:id="linkNewVersion"/>
|
||||||
|
</VBox>
|
||||||
|
</VBox>
|
@ -0,0 +1,9 @@
|
|||||||
|
package espd.client;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class EspdClientApplicationTests {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user