├── README.md ├── dbml.sql ├── mml-server ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── log │ ├── mml-server-2018-01-01.log │ ├── mml-server-2018-01-02.log │ ├── mml-server-2018-01-03.log │ ├── mml-server-2018-01-04.log │ ├── mml-server-2018-01-09.log │ └── mml-server-2018-01-10.log ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── mml │ │ │ ├── MmlServerApplication.java │ │ │ ├── SpringBootStartApplication.java │ │ │ ├── configs │ │ │ ├── Constant.java │ │ │ └── CorsConfig.java │ │ │ ├── controller │ │ │ ├── AppController.java │ │ │ ├── InitController.java │ │ │ ├── TaskController.java │ │ │ └── UserController.java │ │ │ ├── dao │ │ │ ├── AppMenuDao.java │ │ │ ├── ComponentDao.java │ │ │ ├── ComponentDirDao.java │ │ │ ├── ComponentPortDao.java │ │ │ ├── CustomDao.java │ │ │ ├── DataDao.java │ │ │ ├── ExperimentDao.java │ │ │ ├── ExperimentDirDao.java │ │ │ ├── LoggingEventDao.java │ │ │ ├── NodeDao.java │ │ │ ├── NodeDataDao.java │ │ │ ├── NodeLinkDao.java │ │ │ ├── NodePortDao.java │ │ │ ├── NodeStateDao.java │ │ │ ├── PortDao.java │ │ │ ├── UserDao.java │ │ │ └── impl │ │ │ │ └── CustomDaoImpl.java │ │ │ ├── domain │ │ │ ├── Dir.java │ │ │ ├── TResponse.java │ │ │ ├── TableData.java │ │ │ └── jpa │ │ │ │ ├── AppMenu.java │ │ │ │ ├── Component.java │ │ │ │ ├── ComponentDir.java │ │ │ │ ├── ComponentPort.java │ │ │ │ ├── Experiment.java │ │ │ │ ├── ExperimentDir.java │ │ │ │ ├── ExperimentMember.java │ │ │ │ ├── ExperimentRole.java │ │ │ │ ├── LastOperation.java │ │ │ │ ├── LoggingEvent.java │ │ │ │ ├── LoggingEventException.java │ │ │ │ ├── LoggingEventProperty.java │ │ │ │ ├── Model.java │ │ │ │ ├── Node.java │ │ │ │ ├── NodeData.java │ │ │ │ ├── NodeInPort.java │ │ │ │ ├── NodeLink.java │ │ │ │ ├── NodeOutPort.java │ │ │ │ ├── NodeState.java │ │ │ │ ├── Port.java │ │ │ │ ├── StudentData.java │ │ │ │ ├── SystemRole.java │ │ │ │ ├── Team.java │ │ │ │ ├── TeamMember.java │ │ │ │ ├── TeamRole.java │ │ │ │ └── User.java │ │ │ ├── exceptions │ │ │ ├── DataException.java │ │ │ └── MlException.java │ │ │ ├── service │ │ │ ├── AppService.java │ │ │ ├── ComponentService.java │ │ │ ├── DataService.java │ │ │ ├── ExperimentService.java │ │ │ ├── NodeService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── AppServiceImpl.java │ │ │ │ ├── ComponentServiceImpl.java │ │ │ │ ├── DataServiceImpl.java │ │ │ │ ├── ExperimentServiceImpl.java │ │ │ │ ├── NodeServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ └── utils │ │ │ ├── ObjectListType.java │ │ │ ├── SystemUtil.java │ │ │ └── ToolUtil.java │ └── resources │ │ ├── application.properties │ │ ├── logback-spring.xml │ │ └── logging.sql │ └── test │ └── java │ └── com │ └── mml │ ├── MmlServerApplicationTests.java │ └── service │ └── impl │ └── ComponentServiceImplTest.java └── mml-ui ├── .babelrc ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── api │ └── api.js ├── assets │ ├── favicon.ico │ ├── icon │ │ ├── demo.css │ │ ├── demo_fontclass.html │ │ ├── demo_symbol.html │ │ ├── demo_unicode.html │ │ ├── iconfont.css │ │ ├── iconfont.eot │ │ ├── iconfont.js │ │ ├── iconfont.svg │ │ ├── iconfont.ttf │ │ └── iconfont.woff │ ├── logo.png │ └── outicon.png ├── components │ ├── dataview │ │ └── DataView.vue │ ├── dragtree │ │ ├── MlTree.vue │ │ └── defs.vue │ ├── fieldsdialog │ │ └── FieldsDialog.vue │ ├── mlitem │ │ └── MlItem.vue │ ├── mllabel │ │ └── MlLabel.vue │ ├── selectdir │ │ └── SelectDir.vue │ ├── submain │ │ └── SubMain.vue │ └── svgmain │ │ └── SvgMain.vue ├── css.css ├── main.js ├── router │ └── index.js ├── tools │ └── webApp.js ├── utils │ ├── HTTP.js │ └── util.http.js └── views │ ├── home │ └── Home.vue │ ├── index │ └── Index.vue │ └── login │ └── Login.vue ├── static └── .gitkeep └── test ├── e2e ├── custom-assertions │ └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs │ └── test.js └── unit ├── .eslintrc ├── jest.conf.js ├── setup.js └── specs └── HelloWorld.spec.js /README.md: -------------------------------------------------------------------------------- 1 | # mml机器学习平台 2 | mml是类似于阿里云的机器学习平台,系统由两部分组成 3 | 4 | 前端(mml-ul)使用vue+webPack构建和 5 | 6 | 后端(mml-server)使用SpringBoot+MySQL构建 7 | 8 | 访问地址:http://vidanao.com/ml 9 | 10 | 项目周期:未完成 11 | 12 | 之前忘记将SQL上传了,现在已经上传 13 | 14 | 项目:https://my.oschina.net/u/2937897/blog/1843757 15 | 16 | 🧐此项目之后我开发了节点绘制插件: 17 | http://vidanao.com 18 | github:https://github.com/Liwengbin/vue-task-node 19 | -------------------------------------------------------------------------------- /mml-server/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | build/ 21 | nbbuild/ 22 | dist/ 23 | nbdist/ 24 | .nb-gradle/ -------------------------------------------------------------------------------- /mml-server/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-server/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /mml-server/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip 2 | -------------------------------------------------------------------------------- /mml-server/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Migwn, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 204 | echo $MAVEN_PROJECTBASEDIR 205 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 206 | 207 | # For Cygwin, switch paths to Windows format before running java 208 | if $cygwin; then 209 | [ -n "$M2_HOME" ] && 210 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 211 | [ -n "$JAVA_HOME" ] && 212 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 213 | [ -n "$CLASSPATH" ] && 214 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 215 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 216 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 217 | fi 218 | 219 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 220 | 221 | exec "$JAVACMD" \ 222 | $MAVEN_OPTS \ 223 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 224 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 225 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 226 | -------------------------------------------------------------------------------- /mml-server/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /mml-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | com.mml 8 | mml-server 9 | 0.0.1-SNAPSHOT 10 | war 11 | 12 | mml-server 13 | Demo project for Spring Boot 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-parent 18 | 1.5.9.RELEASE 19 | 20 | 21 | 22 | 23 | UTF-8 24 | UTF-8 25 | 1.8 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-web-services 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-tomcat 36 | 37 | 38 | 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-test 43 | test 44 | 45 | 46 | 47 | 48 | mysql 49 | mysql-connector-java 50 | 5.1.38 51 | 52 | 53 | 54 | 55 | org.springframework.boot 56 | spring-boot-starter-data-jpa 57 | 58 | 59 | 60 | 61 | org.json 62 | json 63 | 20160810 64 | 65 | 66 | 67 | javax.servlet 68 | javax.servlet-api 69 | 3.1.0 70 | provided 71 | 72 | 73 | 74 | 75 | 76 | 77 | org.springframework.boot 78 | spring-boot-maven-plugin 79 | 80 | 81 | mlService 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/MmlServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.mml; 2 | import org.springframework.boot.SpringApplication; 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | 5 | @SpringBootApplication 6 | public class MmlServerApplication { 7 | public static void main(String[] args) { 8 | SpringApplication.run(MmlServerApplication.class, args); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/SpringBootStartApplication.java: -------------------------------------------------------------------------------- 1 | package com.mml; 2 | 3 | 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.boot.web.support.SpringBootServletInitializer; 6 | 7 | public class SpringBootStartApplication extends SpringBootServletInitializer { 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { 10 | // 注意这里要指向原先用main方法执行的Application启动类 11 | return builder.sources(MmlServerApplication.class); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/configs/Constant.java: -------------------------------------------------------------------------------- 1 | package com.mml.configs; 2 | 3 | /** 4 | * jwt配置类 5 | * @author liwenbing 6 | * @create 2017/12/25/025 14:18 7 | **/ 8 | public class Constant { 9 | /** 10 | * 数据请求返回码 11 | */ 12 | public static final int RESCODE_SUCCESS = 1000; //成功 13 | public static final int RESCODE_SUCCESS_MSG = 1001; //成功(有返回信息) 14 | public static final int RESCODE_EXCEPTION = 1002; //请求抛出异常 15 | public static final int RESCODE_NOLOGIN = 1003; //未登陆状态 16 | public static final int RESCODE_NOEXIST = 1004; //查询结果为空 17 | public static final int RESCODE_NOAUTH = 1005; //无操作权限 18 | 19 | /** 20 | * jwt配置 21 | */ 22 | public static final String JWT_ID = "jwt"; 23 | public static final String JWT_SECRET = "7786df7fc3a34e26a61c034d5ec8245d"; 24 | public static final int JWT_TTL = 60*60*1000; //millisecond 25 | public static final int JWT_REFRESH_INTERVAL = 55*60*1000; //millisecond 26 | public static final int JWT_REFRESH_TTL = 12*60*60*1000; //millisecond 27 | } 28 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/configs/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.mml.configs; 2 | 3 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.cors.CorsConfiguration; 7 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 8 | import org.springframework.web.filter.CorsFilter; 9 | /** 10 | * 跨域请求配置 11 | * @author liwenbing 12 | * @create 2018/1/7/007 0:05 13 | **/ 14 | @Configuration 15 | public class CorsConfig { 16 | @Bean 17 | public FilterRegistrationBean corsFilter() { 18 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 19 | CorsConfiguration config = new CorsConfiguration(); 20 | config.setAllowCredentials(true); 21 | // 设置你要允许的网站域名,如果全允许则设为 * 22 | config.addAllowedOrigin("*"); 23 | // 如果要限制 HEADER 或 METHOD 请自行更改 24 | config.addAllowedHeader("*"); 25 | config.addAllowedMethod("*"); 26 | source.registerCorsConfiguration("/**", config); 27 | FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); 28 | // 这个顺序很重要哦,为避免麻烦请设置在最前 29 | bean.setOrder(0); 30 | return bean; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/controller/AppController.java: -------------------------------------------------------------------------------- 1 | package com.mml.controller; 2 | 3 | import com.mml.domain.TResponse; 4 | import com.mml.service.impl.AppServiceImpl; 5 | import com.mml.service.impl.ExperimentServiceImpl; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.util.Date; 15 | 16 | @RestController 17 | @EnableAutoConfiguration 18 | @RequestMapping("app.json") 19 | public class AppController { 20 | 21 | Logger logger = LoggerFactory.getLogger(this.getClass()); 22 | 23 | private static Date now = new Date(System.currentTimeMillis()); 24 | 25 | private static TResponse tResponse = new TResponse(); 26 | 27 | @Autowired 28 | private ExperimentServiceImpl experimentService; 29 | 30 | @Autowired 31 | private AppServiceImpl appService; 32 | 33 | @RequestMapping(value = "menu",method = RequestMethod.GET) 34 | @ResponseBody 35 | public TResponse module(HttpServletRequest request, HttpServletResponse response){//@RequestParam("method") String method 36 | 37 | tResponse = appService.findAppMenu(); 38 | return tResponse; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/controller/InitController.java: -------------------------------------------------------------------------------- 1 | package com.mml.controller; 2 | 3 | import com.mml.domain.TResponse; 4 | import com.mml.exceptions.MlException; 5 | import com.mml.service.impl.ComponentServiceImpl; 6 | import com.mml.service.impl.ExperimentServiceImpl; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | 16 | @RestController 17 | @EnableAutoConfiguration 18 | @RequestMapping("init.json") 19 | public class InitController { 20 | Logger logger = LoggerFactory.getLogger(this.getClass()); 21 | 22 | private static TResponse tResponse = new TResponse(); 23 | 24 | @Autowired 25 | private ExperimentServiceImpl experimentService; 26 | 27 | @Autowired 28 | private ComponentServiceImpl componentService; 29 | 30 | @RequestMapping(value = "experiment/{method}",method = RequestMethod.GET) 31 | @ResponseBody 32 | public TResponse experiment(HttpServletRequest request, HttpServletResponse response, @PathVariable String method, @RequestParam("ID") String ID){//@RequestParam("method") String method 33 | try{ 34 | Long L_ID = Long.valueOf(ID); 35 | switch (method) 36 | { 37 | case "getExperiment": 38 | tResponse = experimentService.findById(L_ID); 39 | break; 40 | case "getExperimentDir": 41 | tResponse = experimentService.findExperiment(L_ID); 42 | break; 43 | case "getDir": 44 | tResponse = experimentService.findExperimentDir(L_ID); 45 | break; 46 | default: 47 | tResponse.getTResponse("oxs-pai-Info","zh_CN","method Parameters are empty or no corresponding values! ",false); 48 | logger.info("method Parameters are empty or no corresponding values!"); 49 | break; 50 | } 51 | }catch (MlException e){ 52 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 53 | logger.error(e.getMessage()); 54 | } 55 | 56 | return tResponse; 57 | } 58 | 59 | @RequestMapping(value = "component/{method}",method = RequestMethod.GET) 60 | @ResponseBody 61 | public TResponse component(HttpServletRequest request, HttpServletResponse response, @PathVariable String method, @RequestParam("ID") String ID){//@RequestParam("method") String method 62 | try{ 63 | Long L_ID = Long.valueOf(ID); 64 | switch (method) 65 | { 66 | case "getComponent": 67 | tResponse = componentService.findById(L_ID); 68 | break; 69 | case "getComponentDir": 70 | tResponse = componentService.findComponent(L_ID); 71 | break; 72 | default: 73 | tResponse.getTResponse("oxs-pai-Info","zh_CN","method Parameters are empty or no corresponding values! ",false); 74 | logger.info("method Parameters are empty or no corresponding values!"); 75 | break; 76 | } 77 | }catch (MlException e){ 78 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 79 | logger.error(e.getMessage()); 80 | } 81 | return tResponse; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/controller/TaskController.java: -------------------------------------------------------------------------------- 1 | package com.mml.controller; 2 | 3 | import com.mml.domain.TResponse; 4 | import com.mml.exceptions.MlException; 5 | import com.mml.service.impl.NodeServiceImpl; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.util.Date; 15 | 16 | @RestController 17 | @EnableAutoConfiguration 18 | @RequestMapping("task.json") 19 | public class TaskController { 20 | 21 | Logger logger = LoggerFactory.getLogger(this.getClass()); 22 | 23 | private static TResponse tResponse; 24 | 25 | @Autowired 26 | private NodeServiceImpl nodeService; 27 | 28 | @RequestMapping(value = "run/{id}",method = RequestMethod.POST) 29 | @ResponseBody 30 | public TResponse Run(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { 31 | return null; 32 | } 33 | 34 | @RequestMapping(value = "norun/addNode",method = RequestMethod.POST) 35 | @ResponseBody 36 | public TResponse registerNode(HttpServletRequest request, HttpServletResponse response,@RequestParam("ID") String ID,@RequestParam("nodeX") String X,@RequestParam("nodeY") String Y,@RequestParam("experimentId") String experimentId){ 37 | try{ 38 | tResponse = nodeService.registerNode(Long.valueOf(ID),Double.valueOf(X).intValue(),Double.valueOf(Y).intValue(),Long.valueOf(experimentId)); 39 | }catch (MlException e){ 40 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 41 | logger.error(e.getMessage()); 42 | } 43 | return tResponse; 44 | } 45 | 46 | @RequestMapping(value = "norun/addNodeLink",method = RequestMethod.POST) 47 | @ResponseBody 48 | public TResponse registerNodeLink(HttpServletRequest request, HttpServletResponse response,@RequestParam("Target") String Target ,@RequestParam("Source") String Source,@RequestParam("outputPortId") String outputPortId,@RequestParam("inputPortId") String inputPortId,@RequestParam("experimentId") String experimentId){ 49 | try{ 50 | tResponse = nodeService.registerNodeLink(Long.valueOf(Source), Long.valueOf(outputPortId), Long.valueOf(Target), Long.valueOf(inputPortId), "ready", Long.valueOf(experimentId)); 51 | }catch (MlException e){ 52 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 53 | logger.error(e.getMessage()); 54 | } 55 | return tResponse; 56 | } 57 | 58 | @RequestMapping(value = "norun/loadNode",method = RequestMethod.POST) 59 | @ResponseBody 60 | public TResponse getNode(HttpServletRequest request, HttpServletResponse response, @RequestParam("ID") String ID) { 61 | try{ 62 | tResponse = nodeService.findNode(Long.valueOf(ID)); 63 | }catch (MlException e){ 64 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 65 | logger.error(e.getMessage()); 66 | } 67 | return tResponse; 68 | } 69 | 70 | @RequestMapping(value = "norun/{method}",method = RequestMethod.GET) 71 | @ResponseBody 72 | public TResponse noRun(HttpServletRequest request, HttpServletResponse response, @PathVariable String method,@RequestParam("ID") String ID) { 73 | switch (method){ 74 | case "getNodeState": 75 | tResponse = nodeService.getNodeState(Long.valueOf(ID)); 76 | break; 77 | case "loadNodeAll": 78 | tResponse = nodeService.findNodeAll(Long.valueOf(ID)); 79 | break; 80 | case "deleteNode": 81 | tResponse = nodeService.deleteNode(Long.valueOf(ID)); 82 | break; 83 | case "loadNodeLinkAll": 84 | tResponse = nodeService.findNodeLinkAll(Long.valueOf(ID)); 85 | break; 86 | case "deleteNodeLink": 87 | tResponse = nodeService.deleteNodeLink(Long.valueOf(ID)); 88 | break; 89 | } 90 | return tResponse; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.mml.controller; 2 | 3 | import com.mml.domain.TResponse; 4 | import com.mml.exceptions.MlException; 5 | import com.mml.service.impl.DataServiceImpl; 6 | import com.mml.service.impl.ExperimentServiceImpl; 7 | import com.mml.service.impl.NodeServiceImpl; 8 | import com.mml.service.impl.UserServiceImpl; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 13 | import org.springframework.data.domain.PageRequest; 14 | import org.springframework.data.domain.Pageable; 15 | import org.springframework.data.domain.Sort; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | @RestController 22 | @EnableAutoConfiguration 23 | @RequestMapping("user.json") 24 | public class UserController { 25 | 26 | Logger logger = LoggerFactory.getLogger(this.getClass()); 27 | 28 | private static TResponse tResponse = new TResponse(); 29 | 30 | @Autowired 31 | private ExperimentServiceImpl experimentService; 32 | 33 | @Autowired 34 | private UserServiceImpl userService; 35 | 36 | @Autowired 37 | private DataServiceImpl dataService; 38 | 39 | @Autowired 40 | private NodeServiceImpl nodeService; 41 | 42 | @RequestMapping(value = "experiment/addExperiment",method = RequestMethod.POST) 43 | @ResponseBody 44 | public TResponse registerExperiment(HttpServletRequest request, HttpServletResponse response, @RequestParam("Name") String Name, @RequestParam("Region") String Region, @RequestParam("Desc") String Desc, @RequestParam("Address") String Address){ 45 | try{ 46 | tResponse = experimentService.registerExperiment(Name,Region,Desc,Long.valueOf(Address)); 47 | }catch (MlException e){ 48 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 49 | logger.error(e.getMessage()); 50 | } 51 | return tResponse; 52 | } 53 | 54 | @RequestMapping(value = "data/getData",method = RequestMethod.POST) 55 | @ResponseBody 56 | public TResponse getData(HttpServletRequest request, HttpServletResponse response, @RequestParam("className") String className, @RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "15") Integer size) { 57 | try{ 58 | Sort sort = new Sort(Sort.Direction.DESC, "id"); 59 | Pageable pageable = new PageRequest(page, size, sort); 60 | tResponse = dataService.findStudentData(className,pageable); 61 | }catch (MlException e){ 62 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 63 | logger.error(e.getMessage()); 64 | } 65 | return tResponse; 66 | } 67 | 68 | @RequestMapping(value = "data/getNodeTableData",method = RequestMethod.POST) 69 | @ResponseBody 70 | public TResponse getNodeTableData(HttpServletRequest request, HttpServletResponse response, @RequestParam("nodeId") Integer nodeId,@RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "15") Integer size) { 71 | try{ 72 | Sort sort = new Sort(Sort.Direction.DESC, "id"); 73 | Pageable pageable = new PageRequest(page, size, sort); 74 | tResponse = nodeService.getNodeTableData(Long.valueOf(nodeId),pageable); 75 | }catch (MlException e){ 76 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 77 | logger.error(e.getMessage()); 78 | } 79 | return tResponse; 80 | } 81 | 82 | @RequestMapping(value = "data/getNodeRadarData",method = RequestMethod.POST) 83 | @ResponseBody 84 | public TResponse getNodeRadarData(HttpServletRequest request, HttpServletResponse response, @RequestParam("nodeId") Integer nodeId,@RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "15") Integer size) { 85 | try{ 86 | Sort sort = new Sort(Sort.Direction.DESC, "id"); 87 | Pageable pageable = new PageRequest(page, size, sort); 88 | tResponse = nodeService.getNodeRadarData(Long.valueOf(nodeId),pageable); 89 | }catch (MlException e){ 90 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 91 | logger.error(e.getMessage()); 92 | } 93 | return tResponse; 94 | } 95 | 96 | @RequestMapping(value = "data/getNodeLineBarData",method = RequestMethod.POST) 97 | @ResponseBody 98 | public TResponse getNodeLineBarData(HttpServletRequest request, HttpServletResponse response, @RequestParam("nodeId") Integer nodeId,@RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "15") Integer size) { 99 | try{ 100 | Sort sort = new Sort(Sort.Direction.DESC, "id"); 101 | Pageable pageable = new PageRequest(page, size, sort); 102 | tResponse = nodeService.getNodeLineBarData(Long.valueOf(nodeId),pageable); 103 | }catch (MlException e){ 104 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 105 | logger.error(e.getMessage()); 106 | } 107 | return tResponse; 108 | } 109 | @RequestMapping(value = "user/getUserInformation",method = RequestMethod.POST) 110 | @ResponseBody 111 | public TResponse getUserInformation(HttpServletRequest request, HttpServletResponse response, @RequestParam("ID") String ID){ 112 | try{ 113 | tResponse = userService.findById(Long.valueOf(ID)); 114 | }catch (MlException e){ 115 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 116 | logger.error(e.getMessage()); 117 | } 118 | return tResponse; 119 | } 120 | 121 | @RequestMapping(value = "log/getLogging",method = RequestMethod.POST) 122 | @ResponseBody 123 | public TResponse getLogging(HttpServletRequest request, HttpServletResponse response, @RequestParam("callerMethod") String callerMethod,@RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "15") Integer size) { 124 | try{ 125 | Sort sort = new Sort(Sort.Direction.DESC, "event_id"); 126 | Pageable pageable = new PageRequest(page, size, sort); 127 | tResponse = userService.getLogging(callerMethod,pageable); 128 | }catch (MlException e){ 129 | tResponse.getTResponse("oxs-pai-MlException","zh_CN",e.getMessage(),false); 130 | logger.error(e.getMessage()); 131 | } 132 | return tResponse; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/AppMenuDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.AppMenu; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface AppMenuDao extends JpaRepository{ 11 | @Override 12 | List findAll(); 13 | } 14 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/ComponentDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.Component; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | @Repository 9 | public interface ComponentDao extends JpaRepository { 10 | Component findById(Long id); 11 | 12 | List findByParentId(Long parentId); 13 | } 14 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/ComponentDirDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.ComponentDir; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | @Repository 9 | public interface ComponentDirDao extends JpaRepository { 10 | List findByParentId(Long parentId); 11 | } 12 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/ComponentPortDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.NodeInPort; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface ComponentPortDao extends JpaRepository { 9 | public NodeInPort save(NodeInPort nodePort); 10 | public NodeInPort findById(Long id); 11 | } 12 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/CustomDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | import java.util.List; 3 | import java.util.Map; 4 | 5 | public interface CustomDao { 6 | Map getNodeState(Long experimentId); 7 | List getLogging(); 8 | } 9 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/DataDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.StudentData; 4 | import org.springframework.data.domain.Pageable; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface DataDao extends JpaRepository { 12 | 13 | List findByClassNameIn(String class_name, Pageable pageable); 14 | } 15 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/ExperimentDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.Experiment; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | @Repository 9 | public interface ExperimentDao extends JpaRepository{ 10 | Experiment findById(Long id); 11 | 12 | List findByParentId(Long parentId); 13 | 14 | Experiment save(Experiment experiment); 15 | } 16 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/ExperimentDirDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.ExperimentDir; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | @Repository 9 | public interface ExperimentDirDao extends JpaRepository { 10 | List findByParentId(Long parentId); 11 | } 12 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/LoggingEventDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.LoggingEvent; 4 | import org.springframework.data.domain.Pageable; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | @Repository 12 | public interface LoggingEventDao extends JpaRepository { 13 | @Query(nativeQuery = true, value = "select * from logging_event where caller_method like %?1% ORDER BY ?#{#pageable}", 14 | countQuery = "select count(*) from logging_event where caller_method like %?1%") 15 | List findByCallerMethod(String caller_method,Pageable pageable); 16 | } 17 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/NodeDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.Node; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface NodeDao extends JpaRepository { 11 | List findByExperimentId(Long experimentId); 12 | Node findById(Long id); 13 | Node save(Node node); 14 | Node deleteById(Node node); 15 | } 16 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/NodeDataDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.Node; 4 | import com.mml.domain.jpa.NodeData; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.data.repository.query.Param; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import java.util.List; 12 | 13 | @Repository 14 | public interface NodeDataDao extends JpaRepository { 15 | 16 | List findByNode(Node node, Pageable pageable); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/NodeLinkDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.NodeLink; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface NodeLinkDao extends JpaRepository { 11 | NodeLink save(NodeLink nodeLink); 12 | NodeLink findById(Long id); 13 | NodeLink deleteAllBySource(Long sourceId); 14 | NodeLink deleteAllByTarget(Long targetId); 15 | NodeLink deleteById(Long id); 16 | NodeLink deleteAllByExperimentId(Long experimentId); 17 | List findByExperimentId(Long experimentId); 18 | } 19 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/NodePortDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.NodeInPort; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface NodePortDao extends JpaRepository { 9 | public NodeInPort save(NodeInPort nodePort); 10 | } 11 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/NodeStateDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.NodeState; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface NodeStateDao extends JpaRepository { 9 | NodeState save(NodeState nodeState); 10 | } 11 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/PortDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.Port; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface PortDao extends JpaRepository { 9 | public Port save(Port port); 10 | } 11 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao; 2 | 3 | import com.mml.domain.jpa.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface UserDao extends JpaRepository{ 9 | User findById(Long id); 10 | } 11 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/dao/impl/CustomDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.dao.impl; 2 | 3 | import com.mml.dao.CustomDao; 4 | import com.mml.domain.jpa.NodeState; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.persistence.EntityManager; 9 | import javax.persistence.PersistenceContext; 10 | import javax.persistence.TypedQuery; 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | @Repository 16 | public class CustomDaoImpl implements CustomDao { 17 | 18 | @PersistenceContext 19 | private EntityManager entityManager; 20 | 21 | 22 | @Override 23 | public Map getNodeState(Long experimentId) { 24 | String sql = "select t.node_id, t.inst_status from t_node_state t where t.experiment_id = ?1"; 25 | TypedQuery query = (TypedQuery) entityManager.createNativeQuery(sql); 26 | query.setParameter(1, experimentId); 27 | 28 | List value= query.getResultList(); 29 | Map map = new HashMap(); 30 | for(int i=0;i value= query.getResultList(); 41 | 42 | return value; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/Dir.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain; 2 | 3 | import java.util.List; 4 | 5 | public class Dir { 6 | private Long value; 7 | private String label; 8 | private List children; 9 | 10 | public Dir() { 11 | super(); 12 | } 13 | 14 | public Dir(Long value, String label, List children) { 15 | this.value = value; 16 | this.label = label; 17 | this.children = children; 18 | } 19 | 20 | public Long getValue() { 21 | return value; 22 | } 23 | 24 | public void setValue(Long value) { 25 | this.value = value; 26 | } 27 | 28 | public String getLabel() { 29 | return label; 30 | } 31 | 32 | public void setLabel(String label) { 33 | this.label = label; 34 | } 35 | 36 | public List getChildren() { 37 | return children; 38 | } 39 | 40 | public void setChildren(List children) { 41 | this.children = children; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/TResponse.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain; 2 | 3 | public class TResponse { 4 | public String etag; 5 | public String lang; 6 | public Object data; 7 | public boolean success; 8 | 9 | public TResponse(String etag, String lang, Object data, boolean success) { 10 | this.etag = etag; 11 | this.lang = lang; 12 | this.data = data; 13 | this.success = success; 14 | } 15 | 16 | public TResponse() { 17 | super(); 18 | } 19 | 20 | /** 21 | * 初始化TResponse 22 | * @param etag 23 | * @param lang 24 | * @param data 25 | * @param success 26 | * @return 27 | */ 28 | public TResponse getTResponse(String etag, String lang, Object data, boolean success){ 29 | this.etag = etag; 30 | this.lang = lang; 31 | this.data = data; 32 | this.success = success; 33 | return this; 34 | } 35 | 36 | public String getEtag() { 37 | return etag; 38 | } 39 | 40 | public void setEtag(String etag) { 41 | this.etag = etag; 42 | } 43 | 44 | public String getLang() { 45 | return lang; 46 | } 47 | 48 | public void setLang(String lang) { 49 | this.lang = lang; 50 | } 51 | 52 | public Object getData() { 53 | return data; 54 | } 55 | 56 | public void setData(Object data) { 57 | this.data = data; 58 | } 59 | 60 | public boolean isSuccess() { 61 | return success; 62 | } 63 | 64 | public void setSuccess(boolean success) { 65 | this.success = success; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "TResponse{" + 71 | "etag='" + etag + '\'' + 72 | ", lang='" + lang + '\'' + 73 | ", data=" + data + 74 | ", success=" + success + 75 | '}'; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/TableData.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain; 2 | 3 | import java.util.List; 4 | 5 | public class TableData { 6 | private List tableHeader; 7 | private List tableContext; 8 | 9 | public TableData() { 10 | super(); 11 | } 12 | 13 | public List getTableHeader() { 14 | return tableHeader; 15 | } 16 | 17 | public void setTableHeader(List tableHeader) { 18 | this.tableHeader = tableHeader; 19 | } 20 | 21 | public List getTableContext() { 22 | return tableContext; 23 | } 24 | 25 | public void setTableContext(List tableContext) { 26 | this.tableContext = tableContext; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/AppMenu.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | /** 6 | * app导航栏工具类 7 | * @author liwenbing 8 | * @create 2018/1/6/006 14:43 9 | **/ 10 | @Entity 11 | @Table(name = "t_app_menu") 12 | public class AppMenu{ 13 | @Id 14 | @GeneratedValue 15 | @Column(length = 20) 16 | private Long id; 17 | private String name; 18 | private String dex; 19 | private String icon; 20 | 21 | //没有默认构造会报错 22 | public AppMenu() { 23 | super(); 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | public String getDex() { 43 | return dex; 44 | } 45 | 46 | public void setDex(String dex) { 47 | this.dex = dex; 48 | } 49 | 50 | public String getIcon() { 51 | return icon; 52 | } 53 | 54 | public void setIcon(String icon) { 55 | this.icon = icon; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Component.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | /** 8 | * 实验组件 9 | * @author liwenbing 10 | * @create 2017/12/25/025 15:18 11 | **/ 12 | @Entity 13 | @Table(name = "t_component") 14 | public class Component extends Model { 15 | private String author;//创建者 16 | private Date createdTime; 17 | private String docUrl; 18 | private String iconType;//图类型 19 | private String defSource;//数据源类型 20 | private String owner;//拥有者 21 | private Date lastModifyTime;//最后一次的修改时间 22 | private String category;//类型 23 | private String ioType; 24 | private Long parentId;//父目录 25 | private Integer inNumber; 26 | private Integer outNumber; 27 | //指定一对多的关系 指明学生对象为关系的被维护端 使用grade对象中的student属性进行维护 28 | //并且级联所有的更新操作 29 | @OneToMany(cascade = CascadeType.ALL) 30 | @JoinColumn(name = "component_id") 31 | private List Ports; 32 | 33 | public Component() { 34 | super(); 35 | } 36 | 37 | public String getAuthor() { 38 | return author; 39 | } 40 | 41 | public void setAuthor(String author) { 42 | this.author = author; 43 | } 44 | 45 | public Date getCreatedTime() { 46 | return createdTime; 47 | } 48 | 49 | public void setCreatedTime(Date createdTime) { 50 | this.createdTime = createdTime; 51 | } 52 | 53 | public String getDocUrl() { 54 | return docUrl; 55 | } 56 | 57 | public void setDocUrl(String docUrl) { 58 | this.docUrl = docUrl; 59 | } 60 | 61 | public String getIconType() { 62 | return iconType; 63 | } 64 | 65 | public void setIconType(String iconType) { 66 | this.iconType = iconType; 67 | } 68 | 69 | public String getDefSource() { 70 | return defSource; 71 | } 72 | 73 | public void setDefSource(String defSource) { 74 | this.defSource = defSource; 75 | } 76 | 77 | public String getOwner() { 78 | return owner; 79 | } 80 | 81 | public void setOwner(String owner) { 82 | this.owner = owner; 83 | } 84 | 85 | public Date getLastModifyTime() { 86 | return lastModifyTime; 87 | } 88 | 89 | public void setLastModifyTime(Date lastModifyTime) { 90 | this.lastModifyTime = lastModifyTime; 91 | } 92 | 93 | public String getCategory() { 94 | return category; 95 | } 96 | 97 | public void setCategory(String category) { 98 | this.category = category; 99 | } 100 | 101 | public String getIoType() { 102 | return ioType; 103 | } 104 | 105 | public void setIoType(String ioType) { 106 | this.ioType = ioType; 107 | } 108 | 109 | 110 | public Long getParentId() { 111 | return parentId; 112 | } 113 | 114 | public void setParentId(Long parentId) { 115 | this.parentId = parentId; 116 | } 117 | 118 | public Integer getInNumber() { 119 | return inNumber; 120 | } 121 | 122 | public void setInNumber(Integer inNumber) { 123 | this.inNumber = inNumber; 124 | } 125 | 126 | public Integer getOutNumber() { 127 | return outNumber; 128 | } 129 | 130 | public void setOutNumber(Integer outNumber) { 131 | this.outNumber = outNumber; 132 | } 133 | 134 | public List getPorts() { 135 | return Ports; 136 | } 137 | 138 | public void setPorts(List ports) { 139 | Ports = ports; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/ComponentDir.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Table; 5 | 6 | /** 7 | * 组件目录 8 | * @author liwenbing 9 | * @create 2018/1/12/012 19:18 10 | **/ 11 | @Entity 12 | @Table(name = "t_component_dir") 13 | public class ComponentDir extends Model { 14 | private Long parentId;//父目录 15 | 16 | public ComponentDir() { 17 | super(); 18 | } 19 | 20 | public Long getParentId() { 21 | return parentId; 22 | } 23 | 24 | public void setParentId(Long parentId) { 25 | this.parentId = parentId; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/ComponentPort.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_component_port") 7 | public class ComponentPort { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | @OneToOne 13 | @JoinColumn(name="port_id") 14 | private Port port; 15 | private String type; 16 | private Integer sequence;//排列序号 17 | 18 | public ComponentPort() { 19 | super(); 20 | } 21 | 22 | public Long getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Long id) { 27 | this.id = id; 28 | } 29 | 30 | public Port getPort() { 31 | return port; 32 | } 33 | 34 | public void setPort(Port port) { 35 | this.port = port; 36 | } 37 | 38 | public Integer getSequence() { 39 | return sequence; 40 | } 41 | 42 | public void setSequence(Integer sequence) { 43 | this.sequence = sequence; 44 | } 45 | 46 | public String getType() { 47 | return type; 48 | } 49 | 50 | public void setType(String type) { 51 | this.type = type; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Experiment.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Table; 5 | import java.util.Date; 6 | 7 | /** 8 | * 实验实体类 9 | * @author liwenbing 10 | * @create 2018/1/12/012 11:24 11 | **/ 12 | @Entity 13 | @Table(name = "t_experiment") 14 | public class Experiment extends Model{ 15 | private String projectName;//项目名称 16 | private Date createdTime; 17 | private Date lastUpdateTime; 18 | private boolean isDeleted; 19 | private Long parentId;//父目录 20 | 21 | public Experiment() { 22 | super(); 23 | } 24 | 25 | 26 | public String getProjectName() { 27 | return projectName; 28 | } 29 | 30 | public void setProjectName(String projectName) { 31 | this.projectName = projectName; 32 | } 33 | 34 | public Date getCreatedTime() { 35 | return createdTime; 36 | } 37 | 38 | public void setCreatedTime(Date createdTime) { 39 | this.createdTime = createdTime; 40 | } 41 | 42 | public Date getLastUpdateTime() { 43 | return lastUpdateTime; 44 | } 45 | 46 | public void setLastUpdateTime(Date lastUpdateTime) { 47 | this.lastUpdateTime = lastUpdateTime; 48 | } 49 | 50 | public boolean isDeleted() { 51 | return isDeleted; 52 | } 53 | 54 | public void setDeleted(boolean deleted) { 55 | isDeleted = deleted; 56 | } 57 | 58 | public Long getParentId() { 59 | return parentId; 60 | } 61 | 62 | public void setParentId(Long parentId) { 63 | this.parentId = parentId; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/ExperimentDir.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Table; 5 | 6 | @Entity 7 | @Table(name = "t_experiment_dir") 8 | public class ExperimentDir extends Model{ 9 | private Long parentId;//父目录 10 | public ExperimentDir() { 11 | super(); 12 | } 13 | 14 | public Long getParentId() { 15 | return parentId; 16 | } 17 | 18 | public void setParentId(Long parentId) { 19 | this.parentId = parentId; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/ExperimentMember.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | @Entity 5 | @Table(name = "t_experiment_member") 6 | public class ExperimentMember { 7 | @Id 8 | @GeneratedValue 9 | @Column(length = 20) 10 | private Long id; 11 | @OneToOne 12 | @JoinColumn(name="team_id") 13 | private Team team; 14 | @OneToOne 15 | @JoinColumn(name="user_id") 16 | private User user; 17 | @OneToOne 18 | @JoinColumn(name="experiment_role_id") 19 | ExperimentRole experimentRole; 20 | 21 | public ExperimentMember() { 22 | super(); 23 | } 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public Team getTeam() { 34 | return team; 35 | } 36 | 37 | public void setTeam(Team team) { 38 | this.team = team; 39 | } 40 | 41 | public User getUser() { 42 | return user; 43 | } 44 | 45 | public void setUser(User user) { 46 | this.user = user; 47 | } 48 | 49 | public ExperimentRole getExperimentRole() { 50 | return experimentRole; 51 | } 52 | 53 | public void setExperimentRole(ExperimentRole experimentRole) { 54 | this.experimentRole = experimentRole; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/ExperimentRole.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | @Entity 5 | @Table(name = "t_experiment_role") 6 | public class ExperimentRole { 7 | @Id 8 | @GeneratedValue 9 | @Column(length = 20) 10 | private Long id; 11 | private Long roleID;//角色编号 12 | private String name; 13 | private boolean removeExperiment;//删除实验 14 | private boolean updateExperiment;//编辑实验 15 | private boolean memberRegister;//成员注册 16 | private boolean updateMemberRole;//修改成员角色 17 | private boolean removeMember;//删除成员 18 | private boolean runningExperiment;//运行实验 19 | private boolean checkExperimentRecord;//查看实验记录 20 | private boolean onlineExperiment;//上线实验 21 | private boolean offlineExperiment;//下线实验 22 | 23 | public ExperimentRole() { 24 | super(); 25 | } 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Long id) { 32 | this.id = id; 33 | } 34 | 35 | public Long getRoleID() { 36 | return roleID; 37 | } 38 | 39 | public void setRoleID(Long roleID) { 40 | this.roleID = roleID; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public boolean isRemoveExperiment() { 52 | return removeExperiment; 53 | } 54 | 55 | public void setRemoveExperiment(boolean removeExperiment) { 56 | this.removeExperiment = removeExperiment; 57 | } 58 | 59 | public boolean isUpdateExperiment() { 60 | return updateExperiment; 61 | } 62 | 63 | public void setUpdateExperiment(boolean updateExperiment) { 64 | this.updateExperiment = updateExperiment; 65 | } 66 | 67 | public boolean isMemberRegister() { 68 | return memberRegister; 69 | } 70 | 71 | public void setMemberRegister(boolean memberRegister) { 72 | this.memberRegister = memberRegister; 73 | } 74 | 75 | public boolean isUpdateMemberRole() { 76 | return updateMemberRole; 77 | } 78 | 79 | public void setUpdateMemberRole(boolean updateMemberRole) { 80 | this.updateMemberRole = updateMemberRole; 81 | } 82 | 83 | public boolean isRemoveMember() { 84 | return removeMember; 85 | } 86 | 87 | public void setRemoveMember(boolean removeMember) { 88 | this.removeMember = removeMember; 89 | } 90 | 91 | public boolean isRunningExperiment() { 92 | return runningExperiment; 93 | } 94 | 95 | public void setRunningExperiment(boolean runningExperiment) { 96 | this.runningExperiment = runningExperiment; 97 | } 98 | 99 | public boolean isCheckExperimentRecord() { 100 | return checkExperimentRecord; 101 | } 102 | 103 | public void setCheckExperimentRecord(boolean checkExperimentRecord) { 104 | this.checkExperimentRecord = checkExperimentRecord; 105 | } 106 | 107 | public boolean isOnlineExperiment() { 108 | return onlineExperiment; 109 | } 110 | 111 | public void setOnlineExperiment(boolean onlineExperiment) { 112 | this.onlineExperiment = onlineExperiment; 113 | } 114 | 115 | public boolean isOfflineExperiment() { 116 | return offlineExperiment; 117 | } 118 | 119 | public void setOfflineExperiment(boolean offlineExperiment) { 120 | this.offlineExperiment = offlineExperiment; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/LastOperation.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_last_operation") 7 | public class LastOperation { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | private Long last_experiment_id;//最后一次打开过的实验 13 | private String lastLanguage; 14 | private String theme;//最后一次更改过的主题 15 | 16 | public LastOperation() { 17 | super(); 18 | } 19 | 20 | public Long getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Long id) { 25 | this.id = id; 26 | } 27 | 28 | public Long getLast_experiment_id() { 29 | return last_experiment_id; 30 | } 31 | 32 | public void setLast_experiment_id(Long last_experiment_id) { 33 | this.last_experiment_id = last_experiment_id; 34 | } 35 | 36 | public String getLastLanguage() { 37 | return lastLanguage; 38 | } 39 | 40 | public void setLastLanguage(String lastLanguage) { 41 | this.lastLanguage = lastLanguage; 42 | } 43 | 44 | public String getTheme() { 45 | return theme; 46 | } 47 | 48 | public void setTheme(String theme) { 49 | this.theme = theme; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/LoggingEvent.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "logging_event") 7 | public class LoggingEvent { 8 | @Id 9 | @GeneratedValue 10 | @Column(columnDefinition="BIGINT NOT NULL") 11 | private Long eventId; 12 | @Column(columnDefinition="BIGINT NOT NULL") 13 | private Long timestmp; 14 | @Column(columnDefinition="TEXT NOT NULL") 15 | private String formattedMessage; 16 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 17 | private String loggerName; 18 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 19 | private String levelString; 20 | @Column(columnDefinition="VARCHAR(254)") 21 | private String threadName; 22 | @Column(columnDefinition="SMALLINT") 23 | private int referenceFlag; 24 | @Column(columnDefinition="VARCHAR(254)") 25 | private String arg0; 26 | @Column(columnDefinition="VARCHAR(254)") 27 | private String arg1; 28 | @Column(columnDefinition="VARCHAR(254)") 29 | private String arg2; 30 | @Column(columnDefinition="VARCHAR(254)") 31 | private String arg3; 32 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 33 | private String callerFilename; 34 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 35 | private String callerClass; 36 | 37 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 38 | private String callerMethod; 39 | @Column(columnDefinition="CHAR(4) NOT NULL") 40 | private String callerLine; 41 | 42 | public LoggingEvent() { 43 | super(); 44 | } 45 | 46 | public Long getEventId() { 47 | return eventId; 48 | } 49 | 50 | public void setEventId(Long eventId) { 51 | this.eventId = eventId; 52 | } 53 | 54 | public Long getTimestmp() { 55 | return timestmp; 56 | } 57 | 58 | public void setTimestmp(Long timestmp) { 59 | this.timestmp = timestmp; 60 | } 61 | 62 | public void setReferenceFlag(int referenceFlag) { 63 | this.referenceFlag = referenceFlag; 64 | } 65 | 66 | public String getFormattedMessage() { 67 | return formattedMessage; 68 | } 69 | 70 | public void setFormattedMessage(String formattedMessage) { 71 | this.formattedMessage = formattedMessage; 72 | } 73 | 74 | public String getLoggerName() { 75 | return loggerName; 76 | } 77 | 78 | public void setLoggerName(String loggerName) { 79 | this.loggerName = loggerName; 80 | } 81 | 82 | public String getLevelString() { 83 | return levelString; 84 | } 85 | 86 | public void setLevelString(String levelString) { 87 | this.levelString = levelString; 88 | } 89 | 90 | public String getThreadName() { 91 | return threadName; 92 | } 93 | 94 | public void setThreadName(String threadName) { 95 | this.threadName = threadName; 96 | } 97 | 98 | public int getReferenceFlag() { 99 | return referenceFlag; 100 | } 101 | 102 | public String getArg0() { 103 | return arg0; 104 | } 105 | 106 | public void setArg0(String arg0) { 107 | this.arg0 = arg0; 108 | } 109 | 110 | public String getArg1() { 111 | return arg1; 112 | } 113 | 114 | public void setArg1(String arg1) { 115 | this.arg1 = arg1; 116 | } 117 | 118 | public String getArg2() { 119 | return arg2; 120 | } 121 | 122 | public void setArg2(String arg2) { 123 | this.arg2 = arg2; 124 | } 125 | 126 | public String getArg3() { 127 | return arg3; 128 | } 129 | 130 | public void setArg3(String arg3) { 131 | this.arg3 = arg3; 132 | } 133 | 134 | public String getCallerFilename() { 135 | return callerFilename; 136 | } 137 | 138 | public void setCallerFilename(String callerFilename) { 139 | this.callerFilename = callerFilename; 140 | } 141 | 142 | public String getCallerClass() { 143 | return callerClass; 144 | } 145 | 146 | public void setCallerClass(String callerClass) { 147 | this.callerClass = callerClass; 148 | } 149 | 150 | public String getCallerMethod() { 151 | return callerMethod; 152 | } 153 | 154 | public void setCallerMethod(String callerMethod) { 155 | this.callerMethod = callerMethod; 156 | } 157 | 158 | public String getCallerLine() { 159 | return callerLine; 160 | } 161 | 162 | public void setCallerLine(String callerLine) { 163 | this.callerLine = callerLine; 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/LoggingEventException.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | import java.io.Serializable; 5 | 6 | @Entity 7 | @Table(name = "logging_event_exception") 8 | public class LoggingEventException implements Serializable { 9 | private static final long serialVersionUID = 1L; 10 | 11 | @Id 12 | @OneToOne 13 | @JoinColumn(name="event_id") 14 | private LoggingEvent loggingEvent; 15 | @Id 16 | @GeneratedValue 17 | @Column(columnDefinition="SMALLINT NOT NULL") 18 | private int i; 19 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 20 | private String traceLine; 21 | 22 | public LoggingEventException() { 23 | super(); 24 | } 25 | 26 | public LoggingEvent getLoggingEvent() { 27 | return loggingEvent; 28 | } 29 | 30 | public void setLoggingEvent(LoggingEvent loggingEvent) { 31 | this.loggingEvent = loggingEvent; 32 | } 33 | 34 | public int getI() { 35 | return i; 36 | } 37 | 38 | public void setI(int i) { 39 | this.i = i; 40 | } 41 | 42 | public String getTraceLine() { 43 | return traceLine; 44 | } 45 | 46 | public void setTraceLine(String traceLine) { 47 | this.traceLine = traceLine; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/LoggingEventProperty.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | import java.io.Serializable; 5 | 6 | @Entity 7 | @Table(name = "logging_event_property") 8 | public class LoggingEventProperty implements Serializable{ 9 | private static final long serialVersionUID = 1L; 10 | 11 | @Id 12 | @OneToOne 13 | @JoinColumn(name="event_id") 14 | private LoggingEvent loggingEvent; 15 | @Id 16 | @Column(columnDefinition="VARCHAR(254) NOT NULL") 17 | private String mappedKey; 18 | @Column(columnDefinition="TEXT") 19 | private String mappedValue; 20 | 21 | public LoggingEventProperty() { 22 | super(); 23 | } 24 | 25 | public LoggingEvent getLoggingEvent() { 26 | return loggingEvent; 27 | } 28 | 29 | public void setLoggingEvent(LoggingEvent loggingEvent) { 30 | this.loggingEvent = loggingEvent; 31 | } 32 | 33 | public String getMappedKey() { 34 | return mappedKey; 35 | } 36 | 37 | public void setMappedKey(String mappedKey) { 38 | this.mappedKey = mappedKey; 39 | } 40 | 41 | public String getMappedValue() { 42 | return mappedValue; 43 | } 44 | 45 | public void setMappedValue(String mappedValue) { 46 | this.mappedValue = mappedValue; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Model.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | /** 6 | * 实体模型 7 | * @author liwenbing 8 | * @create 2018/1/12/012 11:52 9 | **/ 10 | @MappedSuperclass 11 | public abstract class Model { 12 | @Id 13 | @GeneratedValue 14 | @Column(length = 20) 15 | private Long id;//分组唯一id 16 | @Column(length = 225,nullable = false) 17 | private String name;//名 18 | private String description;//描述 19 | private boolean isEnabled;//是否可用 20 | private int sequence;//排列序号 21 | private String icon;//图类型 22 | private boolean isDir;//是否为目录 23 | 24 | public Model() { 25 | super(); 26 | } 27 | 28 | public Long getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Long id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public String getDescription() { 45 | return description; 46 | } 47 | 48 | public void setDescription(String description) { 49 | this.description = description; 50 | } 51 | 52 | public boolean isEnabled() { 53 | return isEnabled; 54 | } 55 | 56 | public void setEnabled(boolean enabled) { 57 | isEnabled = enabled; 58 | } 59 | 60 | public int getSequence() { 61 | return sequence; 62 | } 63 | 64 | public void setSequence(int sequence) { 65 | this.sequence = sequence; 66 | } 67 | 68 | public String getIcon() { 69 | return icon; 70 | } 71 | 72 | public void setIcon(String icon) { 73 | this.icon = icon; 74 | } 75 | 76 | public boolean isDir() { 77 | return isDir; 78 | } 79 | 80 | public void setDir(boolean dir) { 81 | isDir = dir; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Node.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | @Entity 8 | @Table(name = "t_node") 9 | public class Node { 10 | @Id 11 | @GeneratedValue 12 | @Column(length = 20) 13 | private Long id; 14 | private String name; 15 | private String defName;//默认名 16 | private String cateGory;//类型 17 | private Integer positionX; 18 | private Integer positionY; 19 | private boolean isComposite; 20 | private Date startTime; 21 | private Date lastTime; 22 | private String icon; 23 | private Long experimentId; 24 | private Integer inNumber; 25 | private Integer outNumber; 26 | //指定一对多的关系 指明学生对象为关系的被维护端 使用grade对象中的student属性进行维护 27 | //并且级联所有的更新操作 28 | @OneToMany(cascade = CascadeType.ALL) 29 | @JoinColumn(name = "node_id") 30 | private List inPorts; 31 | @OneToMany(cascade = CascadeType.ALL) 32 | @JoinColumn(name = "node_id") 33 | private List outPorts; 34 | 35 | public Node() { 36 | super(); 37 | } 38 | 39 | public String getCateGory() { 40 | return cateGory; 41 | } 42 | 43 | public void setCateGory(String cateGory) { 44 | this.cateGory = cateGory; 45 | } 46 | 47 | public String getIcon() { 48 | return icon; 49 | } 50 | 51 | public void setIcon(String icon) { 52 | this.icon = icon; 53 | } 54 | 55 | public Long getId() { 56 | return id; 57 | } 58 | 59 | public void setId(Long id) { 60 | this.id = id; 61 | } 62 | 63 | public String getName() { 64 | return name; 65 | } 66 | 67 | public void setName(String name) { 68 | this.name = name; 69 | } 70 | 71 | public String getDefName() { 72 | return defName; 73 | } 74 | 75 | public void setDefName(String defName) { 76 | this.defName = defName; 77 | } 78 | 79 | public Integer getPositionX() { 80 | return positionX; 81 | } 82 | 83 | public void setPositionX(Integer positionX) { 84 | this.positionX = positionX; 85 | } 86 | 87 | public Integer getPositionY() { 88 | return positionY; 89 | } 90 | 91 | public void setPositionY(Integer positionY) { 92 | this.positionY = positionY; 93 | } 94 | 95 | public boolean isComposite() { 96 | return isComposite; 97 | } 98 | 99 | public void setComposite(boolean composite) { 100 | isComposite = composite; 101 | } 102 | 103 | public Date getStartTime() { 104 | return startTime; 105 | } 106 | 107 | public void setStartTime(Date startTime) { 108 | this.startTime = startTime; 109 | } 110 | 111 | public Date getLastTime() { 112 | return lastTime; 113 | } 114 | 115 | public void setLastTime(Date lastTime) { 116 | this.lastTime = lastTime; 117 | } 118 | 119 | public Long getExperimentId() { 120 | return experimentId; 121 | } 122 | 123 | public void setExperimentId(Long experimentId) { 124 | this.experimentId = experimentId; 125 | } 126 | 127 | public List getInPorts() { 128 | return inPorts; 129 | } 130 | 131 | public void setInPorts(List inPorts) { 132 | this.inPorts = inPorts; 133 | } 134 | 135 | public List getOutPorts() { 136 | return outPorts; 137 | } 138 | 139 | public void setOutPorts(List outPorts) { 140 | this.outPorts = outPorts; 141 | } 142 | 143 | public Integer getInNumber() { 144 | return inNumber; 145 | } 146 | 147 | public void setInNumber(Integer inNumber) { 148 | this.inNumber = inNumber; 149 | } 150 | 151 | public Integer getOutNumber() { 152 | return outNumber; 153 | } 154 | 155 | public void setOutNumber(Integer outNumber) { 156 | this.outNumber = outNumber; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/NodeData.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import com.mml.utils.ObjectListType; 4 | import org.hibernate.annotations.Type; 5 | import org.hibernate.annotations.TypeDef; 6 | 7 | import javax.persistence.*; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | @Entity 12 | @Table(name = "t_node_data") 13 | @TypeDef(name = "ObjectListType", typeClass = ObjectListType.class) 14 | public class NodeData { 15 | @Id 16 | @GeneratedValue 17 | @Column(length = 20) 18 | private Long id; 19 | 20 | @Column(length = 20) 21 | @Type(type = "ObjectListType") 22 | private List tableHeader; 23 | 24 | @Type(type = "ObjectListType") 25 | private List tableData; 26 | 27 | @Type(type = "ObjectListType") 28 | private List columnLimit; 29 | private Date updateTime; 30 | @OneToOne 31 | @JoinColumn(name="node_id") 32 | private Node node; 33 | 34 | public NodeData() { 35 | super(); 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public List getTableHeader() { 47 | return tableHeader; 48 | } 49 | 50 | public void setTableHeader(List tableHeader) { 51 | this.tableHeader = tableHeader; 52 | } 53 | 54 | public List getTableData() { 55 | return tableData; 56 | } 57 | 58 | public void setTableData(List tableData) { 59 | this.tableData = tableData; 60 | } 61 | 62 | public Date getUpdateTime() { 63 | return updateTime; 64 | } 65 | 66 | public void setUpdateTime(Date updateTime) { 67 | this.updateTime = updateTime; 68 | } 69 | 70 | public Node getNode() { 71 | return node; 72 | } 73 | 74 | public void setNode(Node node) { 75 | this.node = node; 76 | } 77 | 78 | public List getColumnLimit() { 79 | return columnLimit; 80 | } 81 | 82 | public void setColumnLimit(List columnLimit) { 83 | this.columnLimit = columnLimit; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/NodeInPort.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_node_in_port") 7 | public class NodeInPort { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | @OneToOne 13 | @JoinColumn(name="port_id") 14 | private Port port; 15 | private Integer sequence;//排列序号 16 | 17 | public NodeInPort() { 18 | super(); 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Long id) { 26 | this.id = id; 27 | } 28 | 29 | public Port getPort() { 30 | return port; 31 | } 32 | 33 | public void setPort(Port port) { 34 | this.port = port; 35 | } 36 | 37 | public Integer getSequence() { 38 | return sequence; 39 | } 40 | 41 | public void setSequence(Integer sequence) { 42 | this.sequence = sequence; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/NodeLink.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | /** 6 | * 节点之间的关联关系 7 | * @author liwenbing 8 | * @create 2018/1/6/006 23:14 9 | **/ 10 | @Entity 11 | @Table(name = "t_node_link") 12 | public class NodeLink { 13 | @Id 14 | @GeneratedValue 15 | @Column(length = 20) 16 | private Long id; 17 | private Long source;//算法节点id 18 | private Long outputPortId;//输出节点id 19 | private Long target;//被算法节点id 20 | private Long inputPortId;//输入节点id 21 | private String type; 22 | private Long experimentId;//实验id 23 | 24 | public NodeLink(Long source, Long outputPortId, Long target, Long inputPortId, String type, Long experimentId) { 25 | super(); 26 | this.source = source; 27 | this.outputPortId = outputPortId; 28 | this.target = target; 29 | this.inputPortId = inputPortId; 30 | this.type = type; 31 | this.experimentId = experimentId; 32 | } 33 | 34 | public NodeLink() { 35 | super(); 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public Long getSource() { 47 | return source; 48 | } 49 | 50 | public void setSource(Long source) { 51 | this.source = source; 52 | } 53 | 54 | public Long getOutputPortId() { 55 | return outputPortId; 56 | } 57 | 58 | public void setOutputPortId(Long outputPortId) { 59 | this.outputPortId = outputPortId; 60 | } 61 | 62 | public Long getTarget() { 63 | return target; 64 | } 65 | 66 | public void setTarget(Long target) { 67 | this.target = target; 68 | } 69 | 70 | public Long getInputPortId() { 71 | return inputPortId; 72 | } 73 | 74 | public void setInputPortId(Long inputPortId) { 75 | this.inputPortId = inputPortId; 76 | } 77 | 78 | public String getType() { 79 | return type; 80 | } 81 | 82 | public void setType(String type) { 83 | this.type = type; 84 | } 85 | 86 | public Long getExperimentId() { 87 | return experimentId; 88 | } 89 | 90 | public void setExperimentId(Long experimentId) { 91 | this.experimentId = experimentId; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/NodeOutPort.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_node_out_port") 7 | public class NodeOutPort { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | @OneToOne 13 | @JoinColumn(name="port_id") 14 | private Port port; 15 | private Integer sequence;//排列序号 16 | 17 | public NodeOutPort() { 18 | super(); 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Long id) { 26 | this.id = id; 27 | } 28 | 29 | public Port getPort() { 30 | return port; 31 | } 32 | 33 | public void setPort(Port port) { 34 | this.port = port; 35 | } 36 | 37 | public Integer getSequence() { 38 | return sequence; 39 | } 40 | 41 | public void setSequence(Integer sequence) { 42 | this.sequence = sequence; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/NodeState.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | @Entity 5 | @Table(name = "t_node_state") 6 | public class NodeState { 7 | @Id 8 | @GeneratedValue 9 | @Column(length = 20) 10 | private Long id; 11 | private Integer sequence;//排列序号 12 | private String instStatus; 13 | @OneToOne 14 | @JoinColumn(name="node_id") 15 | private Node node; 16 | @OneToOne 17 | @JoinColumn(name="experiment_id") 18 | private Experiment experiment; 19 | public NodeState() { 20 | super(); 21 | } 22 | 23 | public NodeState(Integer sequence, String instStatus, Node node, Experiment experiment) { 24 | super(); 25 | this.sequence = sequence; 26 | this.instStatus = instStatus; 27 | this.node = node; 28 | this.experiment = experiment; 29 | } 30 | 31 | public Long getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Long id) { 36 | this.id = id; 37 | } 38 | 39 | public Integer getSequence() { 40 | return sequence; 41 | } 42 | 43 | public void setSequence(Integer sequence) { 44 | this.sequence = sequence; 45 | } 46 | 47 | public String getInstStatus() { 48 | return instStatus; 49 | } 50 | 51 | public void setInstStatus(String instStatus) { 52 | this.instStatus = instStatus; 53 | } 54 | 55 | public Node getNode() { 56 | return node; 57 | } 58 | 59 | public void setNode(Node node) { 60 | this.node = node; 61 | } 62 | 63 | public Experiment getExperiment() { 64 | return experiment; 65 | } 66 | 67 | public void setExperiment(Experiment experiment) { 68 | this.experiment = experiment; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Port.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_port") 7 | public class Port { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | private String description; 13 | private String type; 14 | public Port() { 15 | super(); 16 | } 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getDescription() { 27 | return description; 28 | } 29 | 30 | public void setDescription(String description) { 31 | this.description = description; 32 | } 33 | 34 | public String getType() { 35 | return type; 36 | } 37 | 38 | public void setType(String type) { 39 | this.type = type; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/StudentData.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | 6 | @Entity 7 | @Table(name = "t_student_data") 8 | public class StudentData { 9 | @Id 10 | @GeneratedValue 11 | @Column(length = 20) 12 | private Long id; 13 | private String className; 14 | private Integer sex; 15 | private double yuwen; 16 | private double yingyu; 17 | private double shuxue; 18 | private double wuli; 19 | private double huaxue; 20 | private double shengwu; 21 | 22 | public StudentData() { 23 | super(); 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getClassName() { 35 | return className; 36 | } 37 | 38 | public void setClassName(String className) { 39 | this.className = className; 40 | } 41 | 42 | public Integer getSex() { 43 | return sex; 44 | } 45 | 46 | public void setSex(Integer sex) { 47 | this.sex = sex; 48 | } 49 | 50 | public double getYuwen() { 51 | return yuwen; 52 | } 53 | 54 | public void setYuwen(double yuwen) { 55 | this.yuwen = yuwen; 56 | } 57 | 58 | public double getYingyu() { 59 | return yingyu; 60 | } 61 | 62 | public void setYingyu(double yingyu) { 63 | this.yingyu = yingyu; 64 | } 65 | 66 | public double getShuxue() { 67 | return shuxue; 68 | } 69 | 70 | public void setShuxue(double shuxue) { 71 | this.shuxue = shuxue; 72 | } 73 | 74 | public double getWuli() { 75 | return wuli; 76 | } 77 | 78 | public void setWuli(double wuli) { 79 | this.wuli = wuli; 80 | } 81 | 82 | public double getHuaxue() { 83 | return huaxue; 84 | } 85 | 86 | public void setHuaxue(double huaxue) { 87 | this.huaxue = huaxue; 88 | } 89 | 90 | public double getShengwu() { 91 | return shengwu; 92 | } 93 | 94 | public void setShengwu(double shengwu) { 95 | this.shengwu = shengwu; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/SystemRole.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_system_role") 7 | public class SystemRole { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | private String name;//角色名称 13 | private boolean checkTeam;//查看团队 14 | private boolean createTeam;//创建团队 15 | private boolean checkExperiment;//查看所有实验 16 | private boolean createExperimentTemplate;//新建(模板)实验 17 | private boolean adminRegister;//管理员注册 18 | private boolean checkSystemUser;//查看系统用户 19 | private boolean updateUserSystemRoles;//修改用户系统角色 20 | private boolean updateInformation;//修改个人信息 21 | private boolean checkAgent;//查看Agent列表 (代理) 22 | private boolean updateAgent;//修改Agent信息 23 | 24 | public SystemRole() { 25 | super(); 26 | } 27 | 28 | public Long getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Long id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public boolean isCheckTeam() { 45 | return checkTeam; 46 | } 47 | 48 | public void setCheckTeam(boolean checkTeam) { 49 | this.checkTeam = checkTeam; 50 | } 51 | 52 | public boolean isCreateTeam() { 53 | return createTeam; 54 | } 55 | 56 | public void setCreateTeam(boolean createTeam) { 57 | this.createTeam = createTeam; 58 | } 59 | 60 | public boolean isCheckExperiment() { 61 | return checkExperiment; 62 | } 63 | 64 | public void setCheckExperiment(boolean checkExperiment) { 65 | this.checkExperiment = checkExperiment; 66 | } 67 | 68 | public boolean isCreateExperimentTemplate() { 69 | return createExperimentTemplate; 70 | } 71 | 72 | public void setCreateExperimentTemplate(boolean createExperimentTemplate) { 73 | this.createExperimentTemplate = createExperimentTemplate; 74 | } 75 | 76 | public boolean isAdminRegister() { 77 | return adminRegister; 78 | } 79 | 80 | public void setAdminRegister(boolean adminRegister) { 81 | this.adminRegister = adminRegister; 82 | } 83 | 84 | public boolean isCheckSystemUser() { 85 | return checkSystemUser; 86 | } 87 | 88 | public void setCheckSystemUser(boolean checkSystemUser) { 89 | this.checkSystemUser = checkSystemUser; 90 | } 91 | 92 | public boolean isUpdateUserSystemRoles() { 93 | return updateUserSystemRoles; 94 | } 95 | 96 | public void setUpdateUserSystemRoles(boolean updateUserSystemRoles) { 97 | this.updateUserSystemRoles = updateUserSystemRoles; 98 | } 99 | 100 | public boolean isUpdateInformation() { 101 | return updateInformation; 102 | } 103 | 104 | public void setUpdateInformation(boolean updateInformation) { 105 | this.updateInformation = updateInformation; 106 | } 107 | 108 | public boolean isCheckAgent() { 109 | return checkAgent; 110 | } 111 | 112 | public void setCheckAgent(boolean checkAgent) { 113 | this.checkAgent = checkAgent; 114 | } 115 | 116 | public boolean isUpdateAgent() { 117 | return updateAgent; 118 | } 119 | 120 | public void setUpdateAgent(boolean updateAgent) { 121 | this.updateAgent = updateAgent; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/Team.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | import java.util.Date; 5 | /** 6 | * 团队实体 7 | * @author liwenbing 8 | * @create 2018/1/6/006 23:13 9 | **/ 10 | @Entity 11 | @Table(name = "t_team") 12 | public class Team { 13 | @Id 14 | @GeneratedValue 15 | @Column(length = 20) 16 | private Long id; 17 | private String name; 18 | private Date createTime; 19 | private Date lastUpdateTime; 20 | 21 | public Team() { 22 | super(); 23 | } 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public Date getCreateTime() { 42 | return createTime; 43 | } 44 | 45 | public void setCreateTime(Date createTime) { 46 | this.createTime = createTime; 47 | } 48 | 49 | public Date getLastUpdateTime() { 50 | return lastUpdateTime; 51 | } 52 | 53 | public void setLastUpdateTime(Date lastUpdateTime) { 54 | this.lastUpdateTime = lastUpdateTime; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/TeamMember.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | /** 6 | * 团队与成员的关系实体 7 | * @author liwenbing 8 | * @create 2018/1/6/006 23:13 9 | **/ 10 | @Entity 11 | @Table(name = "t_team_member") 12 | public class TeamMember { 13 | @Id 14 | @GeneratedValue 15 | @Column(length = 20) 16 | private Long id; 17 | @OneToOne 18 | @JoinColumn(name="team_id") 19 | private Team team; 20 | @OneToOne 21 | @JoinColumn(name="user_id") 22 | private User user; 23 | @OneToOne 24 | @JoinColumn(name="team_role_id") 25 | private TeamRole teamRole; 26 | 27 | public TeamMember() { 28 | super(); 29 | } 30 | 31 | public Long getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Long id) { 36 | this.id = id; 37 | } 38 | 39 | public Team getTeam() { 40 | return team; 41 | } 42 | 43 | public void setTeam(Team team) { 44 | this.team = team; 45 | } 46 | 47 | public User getUser() { 48 | return user; 49 | } 50 | 51 | public void setUser(User user) { 52 | this.user = user; 53 | } 54 | 55 | public TeamRole getTeamRole() { 56 | return teamRole; 57 | } 58 | 59 | public void setTeamRole(TeamRole teamRole) { 60 | this.teamRole = teamRole; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/TeamRole.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | @Entity 5 | @Table(name = "t_team_role") 6 | public class TeamRole { 7 | @Id 8 | @GeneratedValue 9 | @Column(length = 20) 10 | private Long id; 11 | private String name; 12 | private boolean checkTeamInformation;//查看团队统计信息 13 | private boolean updateTeamInformation; //修改团信息 14 | private boolean addMembers;//添加成员 15 | private boolean updateMemberRole;//修改成员角色 16 | private boolean removeMember;//删除成员 17 | private boolean removeTeam;//删除团队 18 | private boolean onlineExperiment;//上线实验 19 | private boolean offlineExperiment;//下线实验 20 | private boolean removeExperiment;//删除实验 21 | private boolean memberRegister;//成员注册 22 | 23 | public TeamRole() { 24 | super(); 25 | } 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Long id) { 32 | this.id = id; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public boolean isCheckTeamInformation() { 44 | return checkTeamInformation; 45 | } 46 | 47 | public void setCheckTeamInformation(boolean checkTeamInformation) { 48 | this.checkTeamInformation = checkTeamInformation; 49 | } 50 | 51 | public boolean isUpdateTeamInformation() { 52 | return updateTeamInformation; 53 | } 54 | 55 | public void setUpdateTeamInformation(boolean updateTeamInformation) { 56 | this.updateTeamInformation = updateTeamInformation; 57 | } 58 | 59 | public boolean isAddMembers() { 60 | return addMembers; 61 | } 62 | 63 | public void setAddMembers(boolean addMembers) { 64 | this.addMembers = addMembers; 65 | } 66 | 67 | public boolean isUpdateMemberRole() { 68 | return updateMemberRole; 69 | } 70 | 71 | public void setUpdateMemberRole(boolean updateMemberRole) { 72 | this.updateMemberRole = updateMemberRole; 73 | } 74 | 75 | public boolean isRemoveMember() { 76 | return removeMember; 77 | } 78 | 79 | public void setRemoveMember(boolean removeMember) { 80 | this.removeMember = removeMember; 81 | } 82 | 83 | public boolean isRemoveTeam() { 84 | return removeTeam; 85 | } 86 | 87 | public void setRemoveTeam(boolean removeTeam) { 88 | this.removeTeam = removeTeam; 89 | } 90 | 91 | public boolean isOnlineExperiment() { 92 | return onlineExperiment; 93 | } 94 | 95 | public void setOnlineExperiment(boolean onlineExperiment) { 96 | this.onlineExperiment = onlineExperiment; 97 | } 98 | 99 | public boolean isOfflineExperiment() { 100 | return offlineExperiment; 101 | } 102 | 103 | public void setOfflineExperiment(boolean offlineExperiment) { 104 | this.offlineExperiment = offlineExperiment; 105 | } 106 | 107 | public boolean isRemoveExperiment() { 108 | return removeExperiment; 109 | } 110 | 111 | public void setRemoveExperiment(boolean removeExperiment) { 112 | this.removeExperiment = removeExperiment; 113 | } 114 | 115 | public boolean isMemberRegister() { 116 | return memberRegister; 117 | } 118 | 119 | public void setMemberRegister(boolean memberRegister) { 120 | this.memberRegister = memberRegister; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/domain/jpa/User.java: -------------------------------------------------------------------------------- 1 | package com.mml.domain.jpa; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "t_user") 7 | public class User { 8 | @Id 9 | @GeneratedValue 10 | @Column(length = 20) 11 | private Long id; 12 | private String userName; 13 | private String userPhone; 14 | private String userEmail; 15 | @OneToOne 16 | @JoinColumn(name="experiment_dir_id") 17 | private ExperimentDir experimentDir; 18 | @OneToOne 19 | @JoinColumn(name="last_operation_id") 20 | private LastOperation lastOperation; 21 | @OneToOne 22 | @JoinColumn(name="system_role_id") 23 | private SystemRole systemRole; 24 | 25 | public User() { 26 | super(); 27 | } 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public void setId(Long id) { 34 | this.id = id; 35 | } 36 | 37 | public String getUserName() { 38 | return userName; 39 | } 40 | 41 | public void setUserName(String userName) { 42 | this.userName = userName; 43 | } 44 | 45 | public String getUserPhone() { 46 | return userPhone; 47 | } 48 | 49 | public void setUserPhone(String userPhone) { 50 | this.userPhone = userPhone; 51 | } 52 | 53 | public String getUserEmail() { 54 | return userEmail; 55 | } 56 | 57 | public void setUserEmail(String userEmail) { 58 | this.userEmail = userEmail; 59 | } 60 | 61 | public ExperimentDir getExperimentDir() { 62 | return experimentDir; 63 | } 64 | 65 | public void setExperimentDir(ExperimentDir experimentDir) { 66 | this.experimentDir = experimentDir; 67 | } 68 | 69 | public LastOperation getLastOperation() { 70 | return lastOperation; 71 | } 72 | 73 | public void setLastOperation(LastOperation lastOperation) { 74 | this.lastOperation = lastOperation; 75 | } 76 | 77 | public SystemRole getSystemRole() { 78 | return systemRole; 79 | } 80 | 81 | public void setSystemRole(SystemRole systemRole) { 82 | this.systemRole = systemRole; 83 | } 84 | } -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/exceptions/DataException.java: -------------------------------------------------------------------------------- 1 | package com.mml.exceptions; 2 | 3 | public class DataException extends MlException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public DataException() { 7 | super(); 8 | } 9 | 10 | public DataException(String message) { 11 | super(message); 12 | } 13 | 14 | public DataException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public DataException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | public DataException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 23 | super(message, cause, enableSuppression, writableStackTrace); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/exceptions/MlException.java: -------------------------------------------------------------------------------- 1 | package com.mml.exceptions; 2 | 3 | public class MlException extends RuntimeException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public MlException() { 7 | super(); 8 | } 9 | 10 | public MlException(String message) { 11 | super(message); 12 | } 13 | 14 | public MlException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public MlException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | public MlException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 23 | super(message, cause, enableSuppression, writableStackTrace); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/AppService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | 3 | import com.mml.domain.TResponse; 4 | 5 | public interface AppService { 6 | public TResponse findAppMenu(); 7 | } 8 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/ComponentService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | 3 | import com.mml.domain.TResponse; 4 | 5 | public interface ComponentService { 6 | /** 7 | * 查询具体组件 8 | * @param id 9 | * @return 10 | */ 11 | TResponse findById(Long id); 12 | 13 | /** 14 | * 返回一个目录下的文件和目录 15 | * @param parentId 16 | * @return 17 | */ 18 | TResponse findComponent(Long parentId); 19 | } 20 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/DataService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | 3 | import com.mml.domain.TResponse; 4 | import org.springframework.data.domain.Pageable; 5 | 6 | public interface DataService { 7 | TResponse findStudentData(String class_name, Pageable pageable); 8 | } 9 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/ExperimentService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | import com.mml.domain.TResponse; 3 | 4 | public interface ExperimentService { 5 | /** 6 | * 查询具体实验 7 | * @param id 8 | * @return 9 | */ 10 | TResponse findById(Long id); 11 | 12 | /** 13 | * 返回一个目录下的文件和目录 14 | * @param parentId 15 | * @return 16 | */ 17 | TResponse findExperiment(Long parentId); 18 | 19 | /** 20 | * 返回一个目录下的目录 21 | * @param parentId 22 | * @return 23 | */ 24 | TResponse findExperimentDir(Long parentId); 25 | 26 | /** 27 | * 新建实验 28 | * @param name 29 | * @param projectName 30 | * @param description 31 | * @param parentId 32 | * @return 33 | */ 34 | TResponse registerExperiment(String name,String projectName,String description,Long parentId); 35 | } 36 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/NodeService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | 3 | import com.mml.domain.TResponse; 4 | import org.springframework.data.domain.Pageable; 5 | 6 | public interface NodeService { 7 | /** 8 | * 注册节点 9 | * @param id 10 | * @param x 11 | * @param y 12 | * @param experimentId 13 | * @return 14 | */ 15 | public TResponse registerNode(Long id,Integer x,Integer y,Long experimentId); 16 | 17 | /** 18 | * 查询一个节点的具体信息 19 | * @param id 20 | * @return 21 | */ 22 | public TResponse findNode(Long id); 23 | 24 | /** 25 | * 查询出这个实验的所有节点信息 26 | * @param experimentId 27 | * @return 28 | */ 29 | public TResponse findNodeAll(Long experimentId); 30 | 31 | /** 32 | * 删除节点关系 33 | * @param id 34 | * @return 35 | */ 36 | public TResponse deleteNode(Long id); 37 | 38 | /** 39 | * 查询节点关系 40 | * @param id 41 | * @return 42 | */ 43 | public TResponse findNodeLink(Long id); 44 | 45 | /** 46 | * 查询节点关系all 47 | * @param experimentId 48 | * @return 49 | */ 50 | public TResponse findNodeLinkAll(Long experimentId); 51 | 52 | /** 53 | * 删除节点关系 54 | * @param id 55 | * @return 56 | */ 57 | public TResponse deleteNodeLink(Long id); 58 | 59 | /** 60 | * 注册节点关系 61 | * @param source 62 | * @param outputPortId 63 | * @param target 64 | * @param inputPortId 65 | * @param type 66 | * @param experimentId 67 | * @return 68 | */ 69 | public TResponse registerNodeLink(Long source, Long outputPortId, Long target, Long inputPortId, String type, Long experimentId); 70 | 71 | public TResponse getNodeState(Long experimentId); 72 | 73 | /** 74 | * 表格数据 75 | * @param nodeId 76 | * @param pageable 77 | * @return 78 | */ 79 | public TResponse getNodeTableData(Long nodeId,Pageable pageable); 80 | 81 | /** 82 | * 雷达图数据 83 | * @param nodeId 84 | * @param pageable 85 | * @return 86 | */ 87 | public TResponse getNodeRadarData(Long nodeId,Pageable pageable); 88 | 89 | /** 90 | * 折线图,条形图数据 91 | * @param nodeId 92 | * @param pageable 93 | * @return 94 | */ 95 | public TResponse getNodeLineBarData(Long nodeId,Pageable pageable); 96 | } 97 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.mml.service; 2 | 3 | import com.mml.domain.TResponse; 4 | import org.springframework.data.domain.Pageable; 5 | 6 | public interface UserService { 7 | 8 | /** 9 | * 验证token 10 | * @param obj 11 | */ 12 | public void verification(Object obj); 13 | 14 | public TResponse findById(Long id); 15 | 16 | public TResponse getLogging(String caller_method,Pageable pageable); 17 | } 18 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/impl/AppServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import com.mml.dao.AppMenuDao; 4 | import com.mml.domain.TResponse; 5 | import com.mml.service.AppService; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | @Service 12 | public class AppServiceImpl implements AppService { 13 | private static TResponse tResponse = new TResponse(); 14 | Logger logger = LoggerFactory.getLogger(this.getClass()); 15 | 16 | @Autowired 17 | private AppMenuDao appMenuDao; 18 | 19 | @Override 20 | public TResponse findAppMenu() { 21 | logger.info("init ->findAppMenu"); 22 | return tResponse.getTResponse("oxs-pai-appMenu","zh_CN",appMenuDao.findAll(),true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/impl/ComponentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import com.mml.dao.ComponentDao; 4 | import com.mml.dao.ComponentDirDao; 5 | import com.mml.domain.TResponse; 6 | import com.mml.exceptions.DataException; 7 | import com.mml.service.ComponentService; 8 | import com.mml.utils.ToolUtil; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | 15 | @Service 16 | public class ComponentServiceImpl implements ComponentService { 17 | 18 | 19 | Logger logger = LoggerFactory.getLogger(this.getClass()); 20 | 21 | @Autowired 22 | private ComponentDao componentDao; 23 | @Autowired 24 | private ComponentDirDao componentDirDao; 25 | 26 | @Autowired 27 | private ToolUtil dirModuleUtil; 28 | private static TResponse tResponse = new TResponse(); 29 | 30 | @Override 31 | public TResponse findById(Long id) { 32 | try{ 33 | tResponse.getTResponse("oxs-pai-Component","zh_CN",componentDao.findById(id),true); 34 | }catch (DataException e){ 35 | tResponse.getTResponse("oxs-pai-Component","zh_CN",e.getMessage(),false); 36 | logger.error(e.getMessage()); 37 | } 38 | return tResponse; 39 | } 40 | 41 | @Override 42 | public TResponse findComponent(Long parentId) { 43 | try{ 44 | tResponse.getTResponse("oxs-pai-ComponentAll","zh_CN",dirModuleUtil.getDirModule(componentDirDao.findByParentId(parentId),componentDao.findByParentId(parentId)),true); 45 | }catch (DataException e){ 46 | tResponse.getTResponse("oxs-pai-ComponentAll","zh_CN",e.getMessage(),false); 47 | logger.error(e.getMessage()); 48 | } 49 | return tResponse; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/impl/DataServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import com.mml.dao.DataDao; 4 | import com.mml.domain.TResponse; 5 | import com.mml.exceptions.DataException; 6 | import com.mml.service.DataService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.stereotype.Service; 10 | 11 | @Service 12 | public class DataServiceImpl implements DataService { 13 | @Autowired 14 | private DataDao dataDao; 15 | 16 | private static TResponse tResponse = new TResponse(); 17 | @Override 18 | public TResponse findStudentData(String class_name, Pageable pageable) throws DataException{ 19 | return tResponse.getTResponse("oxs-pai-data","zh_CN",dataDao.findByClassNameIn(class_name,pageable),true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/impl/ExperimentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import com.mml.dao.ExperimentDao; 4 | import com.mml.dao.ExperimentDirDao; 5 | import com.mml.domain.Dir; 6 | import com.mml.domain.jpa.Experiment; 7 | import com.mml.domain.jpa.ExperimentDir; 8 | import com.mml.domain.TResponse; 9 | import com.mml.exceptions.DataException; 10 | import com.mml.service.ExperimentService; 11 | import com.mml.utils.ToolUtil; 12 | import com.mml.utils.SystemUtil; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | @Service 20 | public class ExperimentServiceImpl implements ExperimentService { 21 | 22 | @Autowired 23 | private ExperimentDao experimentDao; 24 | 25 | @Autowired 26 | private ExperimentDirDao experimentDirDao; 27 | 28 | @Autowired 29 | private ToolUtil dirModuleUtil; 30 | 31 | private static TResponse tResponse = new TResponse(); 32 | 33 | @Override 34 | public TResponse findById(Long id) { 35 | return tResponse.getTResponse("oxs-pai-Experiment","zh_CN",experimentDao.findById(id),true); 36 | } 37 | 38 | @Override 39 | public TResponse findExperiment(Long parentId) { 40 | 41 | 42 | //DataModel dataModel = new DataModel(experimentDirDao.findByParentId(parentId),experimentDao.findByParentId(parentId)); 43 | return tResponse.getTResponse("oxs-pai-ExperimentAll","zh_CN",dirModuleUtil.getDirModule(experimentDirDao.findByParentId(parentId),experimentDao.findByParentId(parentId)),true); 44 | } 45 | 46 | @Override 47 | public TResponse findExperimentDir(Long parentId) { 48 | try { 49 | tResponse.getTResponse("oxs-pai-Experiment","zh_CN",returnExperimentDir(parentId),true); 50 | }catch (DataException e){ 51 | tResponse.getTResponse("oxs-pai-Experiment","zh_CN",e.getStackTrace(),false); 52 | } 53 | return tResponse; 54 | } 55 | 56 | @Override 57 | public TResponse registerExperiment(String name, String projectName, String description, Long parentId) { 58 | try { 59 | Experiment experiment = new Experiment(); 60 | experiment.setCreatedTime(SystemUtil.getNowTime()); 61 | experiment.setLastUpdateTime(SystemUtil.getNowTime()); 62 | 63 | experiment.setName(name); 64 | experiment.setProjectName(projectName); 65 | experiment.setDescription(description); 66 | experiment.setParentId(parentId); 67 | 68 | experiment.setDir(false); 69 | experiment.setIcon("ml-icon-shiyan"); 70 | tResponse.getTResponse("oxs-pai-Experiment","zh_CN",experimentDao.save(experiment),true); 71 | }catch (DataException e){ 72 | tResponse.getTResponse("oxs-pai-Experiment","zh_CN",e.getStackTrace(),false); 73 | } 74 | return tResponse; 75 | } 76 | 77 | /** 78 | * 创建Dir的List 79 | * @param parentId 80 | * @return 81 | */ 82 | private List returnExperimentDir(Long parentId){ 83 | List experimentDirs = experimentDirDao.findByParentId(parentId); 84 | List dirs = new ArrayList(); 85 | if (experimentDirs.size()>0) { 86 | for (ExperimentDir item : experimentDirs) { 87 | Dir dir = new Dir(item.getId(), item.getName(), returnExperimentDir(item.getId())); 88 | dirs.add(dir); 89 | } 90 | } 91 | return dirs; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/service/impl/NodeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import com.mml.dao.*; 4 | import com.mml.dao.impl.CustomDaoImpl; 5 | import com.mml.domain.TResponse; 6 | import com.mml.domain.TableData; 7 | import com.mml.domain.jpa.*; 8 | import com.mml.exceptions.DataException; 9 | import com.mml.service.NodeService; 10 | import com.mml.utils.SystemUtil; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.data.domain.Pageable; 15 | import org.springframework.stereotype.Service; 16 | 17 | import java.util.ArrayList; 18 | import java.util.HashMap; 19 | import java.util.List; 20 | import java.util.Map; 21 | 22 | @Service 23 | public class NodeServiceImpl implements NodeService { 24 | 25 | Logger logger = LoggerFactory.getLogger(this.getClass()); 26 | 27 | @Autowired 28 | private NodeDao nodeDao; 29 | @Autowired 30 | private NodeLinkDao nodeLinkDao; 31 | @Autowired 32 | private ComponentDao componentDao; 33 | @Autowired 34 | private CustomDaoImpl customDao; 35 | @Autowired 36 | private ComponentPortDao componentPortDao; 37 | @Autowired 38 | private ExperimentDao experimentDao; 39 | @Autowired 40 | private NodeStateDao nodeStateDao; 41 | @Autowired 42 | private NodeDataDao nodeDataDao; 43 | private static TResponse tResponse = new TResponse(); 44 | 45 | @Override 46 | public TResponse registerNode(Long id,Integer x,Integer y,Long experimentId) { 47 | List inlist = new ArrayList(); 48 | List outlist = new ArrayList(); 49 | try { 50 | Component component = componentDao.findById(id); 51 | Node node = new Node(); 52 | node.setName(component.getName()); 53 | node.setDefName(component.getName()); 54 | for (ComponentPort comport : component.getPorts()){ 55 | if ( "in".equals(comport.getType())){ 56 | NodeInPort nodeinPort = new NodeInPort(); 57 | nodeinPort.setPort(comport.getPort()); 58 | nodeinPort.setSequence(comport.getSequence()); 59 | inlist.add(nodeinPort); 60 | }else { 61 | NodeOutPort nodeoutPort = new NodeOutPort(); 62 | nodeoutPort.setPort(comport.getPort()); 63 | nodeoutPort.setSequence(comport.getSequence()); 64 | outlist.add(nodeoutPort); 65 | } 66 | } 67 | node.setStartTime(SystemUtil.getNowTime()); 68 | node.setLastTime(SystemUtil.getNowTime()); 69 | node.setExperimentId(experimentId); 70 | node.setPositionX(x); 71 | node.setPositionY(y); 72 | node.setCateGory(component.getCategory()); 73 | node.setIcon(component.getIcon()); 74 | node.setInNumber(component.getInNumber()); 75 | node.setOutNumber(component.getOutNumber()); 76 | node.setInPorts(inlist); 77 | node.setOutPorts(outlist); 78 | node = nodeDao.save(node); 79 | tResponse.getTResponse("oxs-pai-Node","zh_CN",node,true); 80 | NodeState nodeState = new NodeState(Integer.valueOf(1), "ready", node, experimentDao.findById(experimentId)); 81 | nodeStateDao.save(nodeState); 82 | }catch (Exception e){ 83 | e.getStackTrace(); 84 | tResponse.getTResponse("oxs-pai-Node","zh_CN",e.getStackTrace(),false); 85 | } 86 | return tResponse; 87 | } 88 | 89 | @Override 90 | public TResponse findNode(Long id) { 91 | logger.info("node -> findNode id="+id); 92 | return tResponse.getTResponse("oxs-pai-Node","zh_CN",nodeDao.findById(id),true); 93 | } 94 | 95 | @Override 96 | public TResponse findNodeAll(Long experimentId) { 97 | return tResponse.getTResponse("oxs-pai-Node","zh_CN",nodeDao.findByExperimentId(experimentId),true); 98 | } 99 | 100 | @Override 101 | public TResponse deleteNode(Long id) { 102 | try { 103 | nodeDao.deleteById(nodeDao.findById(id)); 104 | nodeLinkDao.deleteAllBySource(id); 105 | nodeLinkDao.deleteAllByTarget(id); 106 | tResponse.getTResponse("oxs-pai-Node","zh_CN",null,true); 107 | }catch (Exception e){ 108 | tResponse.getTResponse("oxs-pai-Node","zh_CN",e.getMessage(),false); 109 | } 110 | return tResponse; 111 | } 112 | 113 | @Override 114 | public TResponse findNodeLink(Long id) { 115 | return tResponse.getTResponse("oxs-pai-NodeLink","zh_CN",nodeLinkDao.findById(id),true); 116 | } 117 | 118 | @Override 119 | public TResponse findNodeLinkAll(Long experimentId) { 120 | return tResponse.getTResponse("oxs-pai-NodeLink","zh_CN",nodeLinkDao.findByExperimentId(experimentId),true); 121 | } 122 | 123 | @Override 124 | public TResponse deleteNodeLink(Long id) { 125 | return tResponse.getTResponse("oxs-pai-NodeLink","zh_CN",nodeLinkDao.deleteById(id),true); 126 | } 127 | 128 | @Override 129 | public TResponse registerNodeLink(Long source, Long outputPortId, Long target, Long inputPortId, String type, Long experimentId) { 130 | NodeLink nodeLink = new NodeLink( source, outputPortId, target, inputPortId, type, experimentId); 131 | 132 | return tResponse.getTResponse("oxs-pai-NodeLink","zh_CN",nodeLinkDao.save(nodeLink),true); 133 | } 134 | 135 | @Override 136 | public TResponse getNodeState(Long experimentId) { 137 | return tResponse.getTResponse("oxs-pai-NodeState","zh_CN",customDao.getNodeState(experimentId),true); 138 | } 139 | 140 | @Override 141 | public TResponse getNodeRadarData(Long nodeId,Pageable pageable) { 142 | Node node = nodeDao.findById(nodeId); 143 | return tResponse.getTResponse("oxs-pai-NodeRadarData","zh_CN",nodeDataDao.findByNode(node,pageable),true); 144 | } 145 | 146 | @Override 147 | public TResponse getNodeLineBarData(Long nodeId, Pageable pageable) { 148 | Node node = nodeDao.findById(nodeId); 149 | return tResponse.getTResponse("oxs-pai-NodeRadarData","zh_CN",nodeDataDao.findByNode(node,pageable),true); 150 | } 151 | 152 | @Override 153 | public TResponse getNodeTableData(Long nodeId,Pageable pageable) { 154 | try{ 155 | List nodes = new ArrayList(); 156 | Node node = nodeDao.findById(nodeId); 157 | List nodeDatas = nodeDataDao.findByNode(node,pageable); 158 | TableData tableData = new TableData(); 159 | for (NodeData nodeData:nodeDatas){ 160 | Map map = new HashMap(); 161 | map.put("id",nodeData.getId()); 162 | map.put("updateTime",nodeData.getUpdateTime()); 163 | tableData.setTableHeader(nodeData.getTableHeader()); 164 | for (int i=0;i findById"); 33 | return tResponse.getTResponse("oxs-pai-user","zh_CN",userDao.findById(id),true); 34 | } 35 | 36 | @Override 37 | public TResponse getLogging(String caller_method,Pageable pageable) throws DataException { 38 | return tResponse.getTResponse("oxs-pai-getLogging","zh_CN",loggingEventDao.findByCallerMethod(caller_method, pageable),true); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /mml-server/src/main/java/com/mml/utils/ObjectListType.java: -------------------------------------------------------------------------------- 1 | package com.mml.utils; 2 | 3 | import org.hibernate.HibernateException; 4 | import org.hibernate.engine.spi.SessionImplementor; 5 | import org.hibernate.usertype.UserType; 6 | 7 | import java.io.Serializable; 8 | import java.sql.PreparedStatement; 9 | import java.sql.ResultSet; 10 | import java.sql.SQLException; 11 | import java.sql.Types; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * 自定义List - hibernate 17 | * @author liwenbing 18 | * @create 2018/1/2/002 16:10 19 | **/ 20 | public class ObjectListType implements UserType,Serializable { 21 | 22 | private static final char SPLITER=';'; 23 | private static int[] TYPES = new int[]{Types.VARCHAR};//对应数据库中的类型 24 | private static Class RETURN_CLASS = List.class; 25 | @Override 26 | public int[] sqlTypes() { 27 | return TYPES; 28 | } 29 | 30 | /** 31 | * 修改类型对应的java类型 32 | * 我们这边使用LIST类型 33 | * @return 34 | */ 35 | @Override 36 | public Class returnedClass() { 37 | return RETURN_CLASS; 38 | } 39 | 40 | /** 41 | * 自定义数据类型比对方法 42 | * @param x 43 | * @param y 44 | * @return 45 | * @throws HibernateException 46 | */ 47 | @Override 48 | public boolean equals(Object x, Object y) throws HibernateException { 49 | if (x==y) { 50 | return true; 51 | } 52 | if(x!=null&&y!=null){ 53 | List xList=(List)x; 54 | List ylList=(List)y; 55 | if (xList.size()!=ylList.size()) { 56 | return false; 57 | } 58 | for(int i=0;i(); 81 | if(resultSet.wasNull()) 82 | { 83 | return null; 84 | } 85 | else 86 | { 87 | String[] strs=s.split(";"); 88 | for(int i=0;i getObjectList(String mail_str,String split){ 17 | List temp=new ArrayList(); 18 | if(mail_str==null) 19 | { 20 | return null; 21 | } 22 | else 23 | { 24 | String[] strs=mail_str.split(split); 25 | for(int i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 10 | 11 | 12 | 13 | 14 | 15 | 16 | ${LOG_HOME}/mml-server-%d{yyyy-MM-dd}.log 17 | 18 | 30 19 | 20 | 21 | 22 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 23 | 24 | 25 | 26 | 10MB 27 | 28 | 29 | 30 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | com.mysql.jdbc.Driver 47 | jdbc:mysql://localhost:3306/dbml?characterEncoding=utf8&useSSL=false 48 | collname 49 | collpassword 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /mml-server/src/main/resources/logging.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | DROP TABLE IF EXISTS logging_event_property; 3 | DROP TABLE IF EXISTS logging_event_exception; 4 | DROP TABLE IF EXISTS logging_event; 5 | COMMIT; 6 | 7 | BEGIN; 8 | CREATE TABLE logging_event 9 | ( 10 | timestmp BIGINT NOT NULL, 11 | formatted_message TEXT NOT NULL, 12 | logger_name VARCHAR(254) NOT NULL, 13 | level_string VARCHAR(254) NOT NULL, 14 | thread_name VARCHAR(254), 15 | reference_flag SMALLINT, 16 | arg0 VARCHAR(254), 17 | arg1 VARCHAR(254), 18 | arg2 VARCHAR(254), 19 | arg3 VARCHAR(254), 20 | caller_filename VARCHAR(254) NOT NULL, 21 | caller_class VARCHAR(254) NOT NULL, 22 | caller_method VARCHAR(254) NOT NULL, 23 | caller_line CHAR(4) NOT NULL, 24 | event_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY 25 | ); 26 | COMMIT; 27 | BEGIN; 28 | CREATE TABLE logging_event_property 29 | ( 30 | event_id BIGINT NOT NULL, 31 | mapped_key VARCHAR(254) NOT NULL, 32 | mapped_value TEXT, 33 | PRIMARY KEY(event_id, mapped_key), 34 | FOREIGN KEY (event_id) REFERENCES logging_event(event_id) 35 | ); 36 | COMMIT; 37 | BEGIN; 38 | CREATE TABLE logging_event_exception 39 | ( 40 | event_id BIGINT NOT NULL, 41 | i SMALLINT NOT NULL, 42 | trace_line VARCHAR(254) NOT NULL, 43 | PRIMARY KEY(event_id, i), 44 | FOREIGN KEY (event_id) REFERENCES logging_event(event_id) 45 | ); 46 | COMMIT; -------------------------------------------------------------------------------- /mml-server/src/test/java/com/mml/MmlServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.mml; 2 | 3 | import com.mml.domain.jpa.ExperimentDir; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class MmlServerApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | ExperimentDir n = new ExperimentDir(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mml-server/src/test/java/com/mml/service/impl/ComponentServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.mml.service.impl; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class ComponentServiceImplTest { 12 | @Autowired 13 | private ComponentServiceImpl componentService; 14 | @Test 15 | public void findById() throws Exception { 16 | componentService.findById(Long.valueOf(1)); 17 | } 18 | 19 | @Test 20 | public void findComponent() throws Exception { 21 | componentService.findComponent(Long.valueOf("10000")); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /mml-ui/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", { "modules": false }] 4 | ], 5 | "plugins": [["component", [ 6 | { 7 | "libraryName": "element-ui", 8 | "styleLibraryName": "theme-chalk" 9 | } 10 | ]]] 11 | } 12 | -------------------------------------------------------------------------------- /mml-ui/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /mml-ui/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /mml-ui/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {}, 7 | "autoprefixer": {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /mml-ui/README.md: -------------------------------------------------------------------------------- 1 | # mml-ui 2 | 3 | > A Vue.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | 20 | # run unit tests 21 | npm run unit 22 | 23 | # run e2e tests 24 | npm run e2e 25 | 26 | # run all tests 27 | npm test 28 | ``` 29 | 30 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /mml-ui/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // if you are using ts-loader, setting this to true will make tyescript errors show up during build 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /mml-ui/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /mml-ui/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/build/logo.png -------------------------------------------------------------------------------- /mml-ui/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /mml-ui/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /mml-ui/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | module.exports = { 12 | context: path.resolve(__dirname, '../'), 13 | entry: { 14 | app: './src/main.js' 15 | }, 16 | output: { 17 | path: config.build.assetsRoot, 18 | filename: '[name].js', 19 | publicPath: process.env.NODE_ENV === 'production' 20 | ? config.build.assetsPublicPath 21 | : config.dev.assetsPublicPath 22 | }, 23 | resolve: { 24 | extensions: ['.js', '.vue', '.json'], 25 | alias: { 26 | 'vue$': 'vue/dist/vue.esm.js', 27 | '@': resolve('src'), 28 | } 29 | }, 30 | module: { 31 | loaders: [ 32 | { 33 | test: /\.js$/, 34 | exclude: /(node_modules|bower_components)/, 35 | loader: 'babel', 36 | query: { 37 | presets: ['es2015','stage-3'] 38 | } 39 | }, 40 | { 41 | test: /\.css$/, 42 | loader: 'style-loader!css-loader' 43 | } 44 | ], 45 | rules: [ 46 | { 47 | test: /\.vue$/, 48 | loader: 'vue-loader', 49 | options: vueLoaderConfig 50 | }, 51 | { 52 | test: /\.js$/, 53 | loader: 'babel-loader', 54 | include: [resolve('src'), resolve('test')] 55 | }, 56 | { 57 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 58 | loader: 'url-loader', 59 | options: { 60 | limit: 10000, 61 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 62 | } 63 | }, 64 | { 65 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 66 | loader: 'url-loader', 67 | options: { 68 | limit: 10000, 69 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 70 | } 71 | }, 72 | { 73 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 74 | loader: 'url-loader', 75 | options: { 76 | limit: 10000, 77 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 78 | } 79 | } 80 | ] 81 | }, 82 | node: { 83 | // prevent webpack from injecting useless setImmediate polyfill because Vue 84 | // source contains it (although only uses it if it's native). 85 | setImmediate: false, 86 | // prevent webpack from injecting mocks to Node native modules 87 | // that does not make sense for the client 88 | dgram: 'empty', 89 | fs: 'empty', 90 | net: 'empty', 91 | tls: 'empty', 92 | child_process: 'empty' 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /mml-ui/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const baseWebpackConfig = require('./webpack.base.conf') 7 | const HtmlWebpackPlugin = require('html-webpack-plugin') 8 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 9 | const portfinder = require('portfinder') 10 | 11 | const HOST = process.env.HOST 12 | const PORT = process.env.PORT && Number(process.env.PORT) 13 | 14 | const devWebpackConfig = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: config.dev.devtool, 20 | 21 | // these devServer options should be customized in /config/index.js 22 | devServer: { 23 | clientLogLevel: 'warning', 24 | historyApiFallback: true, 25 | hot: true, 26 | compress: true, 27 | host: HOST || config.dev.host, 28 | port: PORT || config.dev.port, 29 | open: config.dev.autoOpenBrowser, 30 | overlay: config.dev.errorOverlay 31 | ? { warnings: false, errors: true } 32 | : false, 33 | publicPath: config.dev.assetsPublicPath, 34 | proxy: config.dev.proxyTable, 35 | quiet: true, // necessary for FriendlyErrorsPlugin 36 | watchOptions: { 37 | poll: config.dev.poll, 38 | } 39 | }, 40 | plugins: [ 41 | new webpack.DefinePlugin({ 42 | 'process.env': require('../config/dev.env') 43 | }), 44 | new webpack.HotModuleReplacementPlugin(), 45 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 46 | new webpack.NoEmitOnErrorsPlugin(), 47 | // https://github.com/ampedandwired/html-webpack-plugin 48 | new HtmlWebpackPlugin({ 49 | filename: 'index.html', 50 | template: 'index.html', 51 | inject: true 52 | }), 53 | ] 54 | }) 55 | 56 | module.exports = new Promise((resolve, reject) => { 57 | portfinder.basePort = process.env.PORT || config.dev.port 58 | portfinder.getPort((err, port) => { 59 | if (err) { 60 | reject(err) 61 | } else { 62 | // publish the new Port, necessary for e2e tests 63 | process.env.PORT = port 64 | // add port to devServer config 65 | devWebpackConfig.devServer.port = port 66 | 67 | // Add FriendlyErrorsPlugin 68 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 69 | compilationSuccessInfo: { 70 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 71 | }, 72 | onErrors: config.dev.notifyOnErrors 73 | ? utils.createNotifierCallback() 74 | : undefined 75 | })) 76 | 77 | resolve(devWebpackConfig) 78 | } 79 | }) 80 | }) 81 | -------------------------------------------------------------------------------- /mml-ui/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = process.env.NODE_ENV === 'testing' 15 | ? require('../config/test.env') 16 | : require('../config/prod.env') 17 | 18 | const webpackConfig = merge(baseWebpackConfig, { 19 | module: { 20 | rules: utils.styleLoaders({ 21 | sourceMap: config.build.productionSourceMap, 22 | extract: true, 23 | usePostCSS: true 24 | }) 25 | }, 26 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 30 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 31 | }, 32 | plugins: [ 33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 34 | new webpack.DefinePlugin({ 35 | 'process.env': env 36 | }), 37 | new UglifyJsPlugin({ 38 | uglifyOptions: { 39 | compress: { 40 | warnings: false 41 | } 42 | }, 43 | sourceMap: config.build.productionSourceMap, 44 | parallel: true 45 | }), 46 | // extract css into its own file 47 | new ExtractTextPlugin({ 48 | filename: utils.assetsPath('css/[name].[contenthash].css'), 49 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 50 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 51 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 52 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 53 | allChunks: true, 54 | }), 55 | // Compress extracted CSS. We are using this plugin so that possible 56 | // duplicated CSS from different components can be deduped. 57 | new OptimizeCSSPlugin({ 58 | cssProcessorOptions: config.build.productionSourceMap 59 | ? { safe: true, map: { inline: false } } 60 | : { safe: true } 61 | }), 62 | // generate dist index.html with correct asset hash for caching. 63 | // you can customize output by editing /index.html 64 | // see https://github.com/ampedandwired/html-webpack-plugin 65 | new HtmlWebpackPlugin({ 66 | filename: process.env.NODE_ENV === 'testing' 67 | ? 'index.html' 68 | : config.build.index, 69 | template: 'index.html', 70 | inject: true, 71 | minify: { 72 | removeComments: true, 73 | collapseWhitespace: true, 74 | removeAttributeQuotes: true 75 | // more options: 76 | // https://github.com/kangax/html-minifier#options-quick-reference 77 | }, 78 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 79 | chunksSortMode: 'dependency' 80 | }), 81 | // keep module.id stable when vender modules does not change 82 | new webpack.HashedModuleIdsPlugin(), 83 | // enable scope hoisting 84 | new webpack.optimize.ModuleConcatenationPlugin(), 85 | // split vendor js into its own file 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'vendor', 88 | minChunks (module) { 89 | // any required modules inside node_modules are extracted to vendor 90 | return ( 91 | module.resource && 92 | /\.js$/.test(module.resource) && 93 | module.resource.indexOf( 94 | path.join(__dirname, '../node_modules') 95 | ) === 0 96 | ) 97 | } 98 | }), 99 | // extract webpack runtime and module manifest to its own file in order to 100 | // prevent vendor hash from being updated whenever app bundle is updated 101 | new webpack.optimize.CommonsChunkPlugin({ 102 | name: 'manifest', 103 | minChunks: Infinity 104 | }), 105 | // This instance extracts shared chunks from code splitted chunks and bundles them 106 | // in a separate chunk, similar to the vendor chunk 107 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 108 | new webpack.optimize.CommonsChunkPlugin({ 109 | name: 'app', 110 | async: 'vendor-async', 111 | children: true, 112 | minChunks: 3 113 | }), 114 | 115 | // copy custom static assets 116 | new CopyWebpackPlugin([ 117 | { 118 | from: path.resolve(__dirname, '../static'), 119 | to: config.build.assetsSubDirectory, 120 | ignore: ['.*'] 121 | } 122 | ]) 123 | ] 124 | }) 125 | 126 | if (config.build.productionGzip) { 127 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 128 | 129 | webpackConfig.plugins.push( 130 | new CompressionWebpackPlugin({ 131 | asset: '[path].gz[query]', 132 | algorithm: 'gzip', 133 | test: new RegExp( 134 | '\\.(' + 135 | config.build.productionGzipExtensions.join('|') + 136 | ')$' 137 | ), 138 | threshold: 10240, 139 | minRatio: 0.8 140 | }) 141 | ) 142 | } 143 | 144 | if (config.build.bundleAnalyzerReport) { 145 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 146 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 147 | } 148 | 149 | module.exports = webpackConfig 150 | -------------------------------------------------------------------------------- /mml-ui/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /mml-ui/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.7 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | // Various Dev Server settings 13 | host: 'localhost', // can be overwritten by process.env.HOST 14 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 15 | autoOpenBrowser: false, 16 | errorOverlay: true, 17 | notifyOnErrors: true, 18 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 19 | 20 | 21 | /** 22 | * Source Maps 23 | */ 24 | 25 | // https://webpack.js.org/configuration/devtool/#development 26 | devtool: 'eval-source-map', 27 | 28 | // If you have problems debugging vue-files in devtools, 29 | // set this to false - it *may* help 30 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 31 | cacheBusting: true, 32 | 33 | // CSS Sourcemaps off by default because relative paths are "buggy" 34 | // with this option, according to the CSS-Loader README 35 | // (https://github.com/webpack/css-loader#sourcemaps) 36 | // In our experience, they generally work as expected, 37 | // just be aware of this issue when enabling this option. 38 | cssSourceMap: false, 39 | }, 40 | 41 | build: { 42 | // Template for index.html 43 | index: path.resolve(__dirname, '../dist/index.html'), 44 | 45 | // Paths 46 | assetsRoot: path.resolve(__dirname, '../dist'), 47 | assetsSubDirectory: 'static', 48 | assetsPublicPath: '/', 49 | 50 | /** 51 | * Source Maps 52 | */ 53 | 54 | productionSourceMap: true, 55 | // https://webpack.js.org/configuration/devtool/#production 56 | devtool: '#source-map', 57 | 58 | // Gzip off by default as many popular static hosts such as 59 | // Surge or Netlify already gzip all static assets for you. 60 | // Before setting to `true`, make sure to: 61 | // npm install --save-dev compression-webpack-plugin 62 | productionGzip: false, 63 | productionGzipExtensions: ['js', 'css'], 64 | 65 | // Run the build command with an extra argument to 66 | // View the bundle analyzer report after build finishes: 67 | // `npm run build --report` 68 | // Set to `true` or `false` to always turn it on or off 69 | bundleAnalyzerReport: process.env.npm_config_report 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /mml-ui/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /mml-ui/config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /mml-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | mml-ui 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /mml-ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mml-ui", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "unit": "jest --config test/unit/jest.conf.js --coverage", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "build": "node build/build.js" 14 | }, 15 | "dependencies": { 16 | "babel-preset-stage-3": "^6.24.1", 17 | "echarts": "^4.0.2", 18 | "element-ui": "^2.0.8", 19 | "jquery": "^3.3.1", 20 | "vue": "^2.5.2", 21 | "vue-router": "^3.0.1", 22 | "whatwg-fetch": "^2.0.3" 23 | }, 24 | "devDependencies": { 25 | "autoprefixer": "^7.1.2", 26 | "babel-core": "^6.22.1", 27 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 28 | "babel-jest": "^21.0.2", 29 | "babel-loader": "^7.1.1", 30 | "babel-plugin-component": "^1.0.0", 31 | "babel-plugin-dynamic-import-node": "^1.2.0", 32 | "babel-plugin-syntax-jsx": "^6.18.0", 33 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 34 | "babel-plugin-transform-runtime": "^6.22.0", 35 | "babel-plugin-transform-vue-jsx": "^3.5.0", 36 | "babel-preset-env": "^1.3.2", 37 | "babel-preset-es2015": "^6.24.1", 38 | "babel-preset-stage-2": "^6.22.0", 39 | "babel-register": "^6.22.0", 40 | "chalk": "^2.0.1", 41 | "chromedriver": "^2.27.2", 42 | "copy-webpack-plugin": "^4.0.1", 43 | "cross-spawn": "^5.0.1", 44 | "css-loader": "^0.28.9", 45 | "extract-text-webpack-plugin": "^3.0.2", 46 | "file-loader": "^1.1.4", 47 | "friendly-errors-webpack-plugin": "^1.6.1", 48 | "html-webpack-plugin": "^2.30.1", 49 | "jest": "^21.2.0", 50 | "jest-serializer-vue": "^0.3.0", 51 | "nightwatch": "^0.9.12", 52 | "node-notifier": "^5.1.2", 53 | "optimize-css-assets-webpack-plugin": "^3.2.0", 54 | "ora": "^1.2.0", 55 | "portfinder": "^1.0.13", 56 | "postcss-import": "^11.0.0", 57 | "postcss-loader": "^2.0.8", 58 | "rimraf": "^2.6.0", 59 | "selenium-server": "^3.0.1", 60 | "semver": "^5.3.0", 61 | "shelljs": "^0.7.6", 62 | "uglifyjs-webpack-plugin": "^1.1.1", 63 | "url-loader": "^0.5.8", 64 | "vue-jest": "^1.0.2", 65 | "vue-loader": "^13.3.0", 66 | "vue-style-loader": "^3.0.1", 67 | "vue-template-compiler": "^2.5.2", 68 | "webpack": "^3.6.0", 69 | "webpack-bundle-analyzer": "^2.9.0", 70 | "webpack-dev-server": "^2.9.1", 71 | "webpack-merge": "^4.1.0" 72 | }, 73 | "engines": { 74 | "node": ">= 4.0.0", 75 | "npm": ">= 3.0.0" 76 | }, 77 | "browserslist": [ 78 | "> 1%", 79 | "last 2 versions", 80 | "not ie <= 8" 81 | ] 82 | } 83 | -------------------------------------------------------------------------------- /mml-ui/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 63 | 64 | -------------------------------------------------------------------------------- /mml-ui/src/api/api.js: -------------------------------------------------------------------------------- 1 | import http from '../utils/HTTP' 2 | var api={}; 3 | api.getMenu=(data)=>http('GET','/app.json/menu',data); 4 | api.getExperiment=(data)=>http('GET','/init.json/experiment/getExperiment',data); 5 | api.getExperimentDir=(data)=>http('GET','/init.json/experiment/getExperimentDir',data); 6 | api.getDir=(data)=>http('GET','/init.json/experiment/getDir',data); 7 | 8 | api.getData=(data)=>http('POST','/user.json/data/getData',data); 9 | api.addExperiment=(data)=>http('POST','/user.json/experiment/addExperiment',data); 10 | api.getUserInformation=(data)=>http('POST','/user.json/user/getUserInformation',data); 11 | api.addNode=(data)=>http('POST','/task.json/norun/addNode',data); 12 | api.addNodeLink=(data)=>http('POST','/task.json/norun/addNodeLink',data); 13 | api.getNode=(data)=>http('POST','/task.json/norun/loadNode',data); 14 | api.getNodeState=(data)=>http('GET','/task.json/norun/getNodeState',data); 15 | api.getNodeTableData=(data)=>http('POST','/user.json/data/getNodeTableData',data); 16 | api.getNodeLineBarData=(data)=>http('POST','/user.json/data/getNodeLineBarData',data); 17 | api.getNodeRadarData=(data)=>http('POST','/user.json/data/getNodeRadarData',data); 18 | 19 | api.getNodeAll=(data)=>http('GET','/task.json/norun/loadNodeAll',data); 20 | api.getNodeLinkAll=(data)=>http('GET','/task.json/norun/loadNodeLinkAll',data); 21 | api.deleteNode=(data)=>http('POST','/task.json/norun/deleteNode',data); 22 | api.deleteNodeLink=(data)=>http('POST','/task.json/norun/deleteNodeLink',data); 23 | api.getComponent=(data)=>http('GET','/init.json/component/getComponent',data); 24 | api.getComponentDir=(data)=>http('GET','/init.json/component/getComponentDir',data); 25 | api.getDataSource=(data)=>http('GET','/init.json/dataSource/getDataSource',data); 26 | api.getDataSourceDir=(data)=>http('GET','/init.json/dataSource/getDataSourceDir',data); 27 | 28 | api.getLogging=(data)=>http('POST','/user.json/log/getLogging',data); 29 | 30 | export default api; 31 | -------------------------------------------------------------------------------- /mml-ui/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/favicon.ico -------------------------------------------------------------------------------- /mml-ui/src/assets/icon/demo.css: -------------------------------------------------------------------------------- 1 | *{margin: 0;padding: 0;list-style: none;} 2 | /* 3 | KISSY CSS Reset 4 | 理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。 5 | 2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。 6 | 3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。 7 | 特色:1. 适应中文;2. 基于最新主流浏览器。 8 | 维护:玉伯, 正淳 9 | */ 10 | 11 | /** 清除内外边距 **/ 12 | body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ 13 | dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ 14 | pre, /* text formatting elements 文本格式元素 */ 15 | form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */ 16 | th, td /* table elements 表格元素 */ { 17 | margin: 0; 18 | padding: 0; 19 | } 20 | 21 | /** 设置默认字体 **/ 22 | body, 23 | button, input, select, textarea /* for ie */ { 24 | font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif; 25 | } 26 | h1, h2, h3, h4, h5, h6 { font-size: 100%; } 27 | address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */ 28 | code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */ 29 | small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */ 30 | 31 | /** 重置列表元素 **/ 32 | ul, ol { list-style: none; } 33 | 34 | /** 重置文本格式元素 **/ 35 | a { text-decoration: none; } 36 | a:hover { text-decoration: underline; } 37 | 38 | 39 | /** 重置表单元素 **/ 40 | legend { color: #000; } /* for ie6 */ 41 | fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */ 42 | button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */ 43 | /* 注:optgroup 无法扶正 */ 44 | 45 | /** 重置表格元素 **/ 46 | table { border-collapse: collapse; border-spacing: 0; } 47 | 48 | /* 清除浮动 */ 49 | .ks-clear:after, .clear:after { 50 | content: '\20'; 51 | display: block; 52 | height: 0; 53 | clear: both; 54 | } 55 | .ks-clear, .clear { 56 | *zoom: 1; 57 | } 58 | 59 | .main { 60 | padding: 30px 100px; 61 | width: 960px; 62 | margin: 0 auto; 63 | } 64 | .main h1{font-size:36px; color:#333; text-align:left;margin-bottom:30px; border-bottom: 1px solid #eee;} 65 | 66 | .helps{margin-top:40px;} 67 | .helps pre{ 68 | padding:20px; 69 | margin:10px 0; 70 | border:solid 1px #e7e1cd; 71 | background-color: #fffdef; 72 | overflow: auto; 73 | } 74 | 75 | .icon_lists{ 76 | width: 100% !important; 77 | 78 | } 79 | 80 | .icon_lists li{ 81 | float:left; 82 | width: 100px; 83 | height:180px; 84 | text-align: center; 85 | list-style: none !important; 86 | } 87 | .icon_lists .icon{ 88 | font-size: 42px; 89 | line-height: 100px; 90 | margin: 10px 0; 91 | color:#333; 92 | -webkit-transition: font-size 0.25s ease-out 0s; 93 | -moz-transition: font-size 0.25s ease-out 0s; 94 | transition: font-size 0.25s ease-out 0s; 95 | 96 | } 97 | .icon_lists .icon:hover{ 98 | font-size: 100px; 99 | } 100 | 101 | 102 | 103 | .markdown { 104 | color: #666; 105 | font-size: 14px; 106 | line-height: 1.8; 107 | } 108 | 109 | .highlight { 110 | line-height: 1.5; 111 | } 112 | 113 | .markdown img { 114 | vertical-align: middle; 115 | max-width: 100%; 116 | } 117 | 118 | .markdown h1 { 119 | color: #404040; 120 | font-weight: 500; 121 | line-height: 40px; 122 | margin-bottom: 24px; 123 | } 124 | 125 | .markdown h2, 126 | .markdown h3, 127 | .markdown h4, 128 | .markdown h5, 129 | .markdown h6 { 130 | color: #404040; 131 | margin: 1.6em 0 0.6em 0; 132 | font-weight: 500; 133 | clear: both; 134 | } 135 | 136 | .markdown h1 { 137 | font-size: 28px; 138 | } 139 | 140 | .markdown h2 { 141 | font-size: 22px; 142 | } 143 | 144 | .markdown h3 { 145 | font-size: 16px; 146 | } 147 | 148 | .markdown h4 { 149 | font-size: 14px; 150 | } 151 | 152 | .markdown h5 { 153 | font-size: 12px; 154 | } 155 | 156 | .markdown h6 { 157 | font-size: 12px; 158 | } 159 | 160 | .markdown hr { 161 | height: 1px; 162 | border: 0; 163 | background: #e9e9e9; 164 | margin: 16px 0; 165 | clear: both; 166 | } 167 | 168 | .markdown p, 169 | .markdown pre { 170 | margin: 1em 0; 171 | } 172 | 173 | .markdown > p, 174 | .markdown > blockquote, 175 | .markdown > .highlight, 176 | .markdown > ol, 177 | .markdown > ul { 178 | width: 80%; 179 | } 180 | 181 | .markdown ul > li { 182 | list-style: circle; 183 | } 184 | 185 | .markdown > ul li, 186 | .markdown blockquote ul > li { 187 | margin-left: 20px; 188 | padding-left: 4px; 189 | } 190 | 191 | .markdown > ul li p, 192 | .markdown > ol li p { 193 | margin: 0.6em 0; 194 | } 195 | 196 | .markdown ol > li { 197 | list-style: decimal; 198 | } 199 | 200 | .markdown > ol li, 201 | .markdown blockquote ol > li { 202 | margin-left: 20px; 203 | padding-left: 4px; 204 | } 205 | 206 | .markdown code { 207 | margin: 0 3px; 208 | padding: 0 5px; 209 | background: #eee; 210 | border-radius: 3px; 211 | } 212 | 213 | .markdown pre { 214 | border-radius: 6px; 215 | background: #f7f7f7; 216 | padding: 20px; 217 | } 218 | 219 | .markdown pre code { 220 | border: none; 221 | background: #f7f7f7; 222 | margin: 0; 223 | } 224 | 225 | .markdown strong, 226 | .markdown b { 227 | font-weight: 600; 228 | } 229 | 230 | .markdown > table { 231 | border-collapse: collapse; 232 | border-spacing: 0px; 233 | empty-cells: show; 234 | border: 1px solid #e9e9e9; 235 | width: 95%; 236 | margin-bottom: 24px; 237 | } 238 | 239 | .markdown > table th { 240 | white-space: nowrap; 241 | color: #333; 242 | font-weight: 600; 243 | 244 | } 245 | 246 | .markdown > table th, 247 | .markdown > table td { 248 | border: 1px solid #e9e9e9; 249 | padding: 8px 16px; 250 | text-align: left; 251 | } 252 | 253 | .markdown > table th { 254 | background: #F7F7F7; 255 | } 256 | 257 | .markdown blockquote { 258 | font-size: 90%; 259 | color: #999; 260 | border-left: 4px solid #e9e9e9; 261 | padding-left: 0.8em; 262 | margin: 1em 0; 263 | font-style: italic; 264 | } 265 | 266 | .markdown blockquote p { 267 | margin: 0; 268 | } 269 | 270 | .markdown .anchor { 271 | opacity: 0; 272 | transition: opacity 0.3s ease; 273 | margin-left: 8px; 274 | } 275 | 276 | .markdown .waiting { 277 | color: #ccc; 278 | } 279 | 280 | .markdown h1:hover .anchor, 281 | .markdown h2:hover .anchor, 282 | .markdown h3:hover .anchor, 283 | .markdown h4:hover .anchor, 284 | .markdown h5:hover .anchor, 285 | .markdown h6:hover .anchor { 286 | opacity: 1; 287 | display: inline-block; 288 | } 289 | 290 | .markdown > br, 291 | .markdown > p > br { 292 | clear: both; 293 | } 294 | 295 | 296 | .hljs { 297 | display: block; 298 | background: white; 299 | padding: 0.5em; 300 | color: #333333; 301 | overflow-x: auto; 302 | } 303 | 304 | .hljs-comment, 305 | .hljs-meta { 306 | color: #969896; 307 | } 308 | 309 | .hljs-string, 310 | .hljs-variable, 311 | .hljs-template-variable, 312 | .hljs-strong, 313 | .hljs-emphasis, 314 | .hljs-quote { 315 | color: #df5000; 316 | } 317 | 318 | .hljs-keyword, 319 | .hljs-selector-tag, 320 | .hljs-type { 321 | color: #a71d5d; 322 | } 323 | 324 | .hljs-literal, 325 | .hljs-symbol, 326 | .hljs-bullet, 327 | .hljs-attribute { 328 | color: #0086b3; 329 | } 330 | 331 | .hljs-section, 332 | .hljs-name { 333 | color: #63a35c; 334 | } 335 | 336 | .hljs-tag { 337 | color: #333333; 338 | } 339 | 340 | .hljs-title, 341 | .hljs-attr, 342 | .hljs-selector-id, 343 | .hljs-selector-class, 344 | .hljs-selector-attr, 345 | .hljs-selector-pseudo { 346 | color: #795da3; 347 | } 348 | 349 | .hljs-addition { 350 | color: #55a532; 351 | background-color: #eaffea; 352 | } 353 | 354 | .hljs-deletion { 355 | color: #bd2c00; 356 | background-color: #ffecec; 357 | } 358 | 359 | .hljs-link { 360 | text-decoration: underline; 361 | } 362 | 363 | pre{ 364 | background: #fff; 365 | } 366 | 367 | 368 | 369 | 370 | 371 | -------------------------------------------------------------------------------- /mml-ui/src/assets/icon/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/icon/iconfont.eot -------------------------------------------------------------------------------- /mml-ui/src/assets/icon/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/icon/iconfont.ttf -------------------------------------------------------------------------------- /mml-ui/src/assets/icon/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/icon/iconfont.woff -------------------------------------------------------------------------------- /mml-ui/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/logo.png -------------------------------------------------------------------------------- /mml-ui/src/assets/outicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/assets/outicon.png -------------------------------------------------------------------------------- /mml-ui/src/components/dataview/DataView.vue: -------------------------------------------------------------------------------- 1 | 39 | 169 | 175 | -------------------------------------------------------------------------------- /mml-ui/src/components/dragtree/MlTree.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 60 | 61 | 110 | -------------------------------------------------------------------------------- /mml-ui/src/components/dragtree/defs.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 30 | 31 | 67 | 68 | -------------------------------------------------------------------------------- /mml-ui/src/components/fieldsdialog/FieldsDialog.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 138 | 139 | 140 | 236 | -------------------------------------------------------------------------------- /mml-ui/src/components/mlitem/MlItem.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 26 | 27 | 47 | -------------------------------------------------------------------------------- /mml-ui/src/components/mllabel/MlLabel.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 28 | 29 | 57 | -------------------------------------------------------------------------------- /mml-ui/src/components/selectdir/SelectDir.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 29 | 30 | 67 | -------------------------------------------------------------------------------- /mml-ui/src/css.css: -------------------------------------------------------------------------------- 1 | ul{ 2 | padding: 0px; 3 | } 4 | .ml-padding{ 5 | padding: 5px; 6 | } 7 | 8 | .el-checkbox+.el-checkbox{ 9 | margin-left: 0px; 10 | } 11 | -------------------------------------------------------------------------------- /mml-ui/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import $ from 'jquery'; 7 | import { 8 | Pagination, 9 | Dialog, 10 | Autocomplete, 11 | Dropdown, 12 | DropdownMenu, 13 | DropdownItem, 14 | Menu, 15 | Submenu, 16 | MenuItem, 17 | MenuItemGroup, 18 | Input, 19 | InputNumber, 20 | Radio, 21 | RadioGroup, 22 | RadioButton, 23 | Checkbox, 24 | CheckboxButton, 25 | CheckboxGroup, 26 | Switch, 27 | Select, 28 | Option, 29 | OptionGroup, 30 | Button, 31 | ButtonGroup, 32 | Table, 33 | TableColumn, 34 | DatePicker, 35 | TimeSelect, 36 | TimePicker, 37 | Popover, 38 | Tooltip, 39 | Breadcrumb, 40 | BreadcrumbItem, 41 | Form, 42 | FormItem, 43 | Tabs, 44 | TabPane, 45 | Tag, 46 | Tree, 47 | Alert, 48 | Slider, 49 | Icon, 50 | Row, 51 | Col, 52 | Upload, 53 | Progress, 54 | Badge, 55 | Card, 56 | Rate, 57 | Steps, 58 | Step, 59 | Carousel, 60 | CarouselItem, 61 | Collapse, 62 | CollapseItem, 63 | Cascader, 64 | ColorPicker, 65 | Transfer, 66 | Container, 67 | Header, 68 | Aside, 69 | Main, 70 | Footer, 71 | Loading, 72 | MessageBox, 73 | Message, 74 | Notification 75 | } from 'element-ui' 76 | 77 | Vue.use(Pagination) 78 | Vue.use(Dialog) 79 | Vue.use(Autocomplete) 80 | Vue.use(Dropdown) 81 | Vue.use(DropdownMenu) 82 | Vue.use(DropdownItem) 83 | Vue.use(Menu) 84 | Vue.use(Submenu) 85 | Vue.use(MenuItem) 86 | Vue.use(MenuItemGroup) 87 | Vue.use(Input) 88 | Vue.use(InputNumber) 89 | Vue.use(Radio) 90 | Vue.use(RadioGroup) 91 | Vue.use(RadioButton) 92 | Vue.use(Checkbox) 93 | Vue.use(CheckboxButton) 94 | Vue.use(CheckboxGroup) 95 | Vue.use(Switch) 96 | Vue.use(Select) 97 | Vue.use(Option) 98 | Vue.use(OptionGroup) 99 | Vue.use(Button) 100 | Vue.use(ButtonGroup) 101 | Vue.use(Table) 102 | Vue.use(TableColumn) 103 | Vue.use(DatePicker) 104 | Vue.use(TimeSelect) 105 | Vue.use(TimePicker) 106 | Vue.use(Popover) 107 | Vue.use(Tooltip) 108 | Vue.use(Breadcrumb) 109 | Vue.use(BreadcrumbItem) 110 | Vue.use(Form) 111 | Vue.use(FormItem) 112 | Vue.use(Tabs) 113 | Vue.use(TabPane) 114 | Vue.use(Tag) 115 | Vue.use(Tree) 116 | Vue.use(Alert) 117 | Vue.use(Slider) 118 | Vue.use(Icon) 119 | Vue.use(Row) 120 | Vue.use(Col) 121 | Vue.use(Upload) 122 | Vue.use(Progress) 123 | Vue.use(Badge) 124 | Vue.use(Card) 125 | Vue.use(Rate) 126 | Vue.use(Steps) 127 | Vue.use(Step) 128 | Vue.use(Carousel) 129 | Vue.use(CarouselItem) 130 | Vue.use(Collapse) 131 | Vue.use(CollapseItem) 132 | Vue.use(Cascader) 133 | Vue.use(ColorPicker) 134 | Vue.use(Container) 135 | Vue.use(Header) 136 | Vue.use(Aside) 137 | Vue.use(Main) 138 | Vue.use(Footer) 139 | Vue.use(Transfer) 140 | Vue.config.productionTip = false 141 | // 引入echarts 142 | import echarts from 'echarts' 143 | Vue.prototype.$echarts = echarts 144 | 145 | import './assets/icon/iconfont.css' 146 | 147 | /* eslint-disable no-new */ 148 | new Vue({ 149 | el: '#app', 150 | router, 151 | template: '', 152 | components: { App } 153 | }) 154 | 155 | $(document).ready(function(){ 156 | $("#node_37").bind("contextmenu",function(e){ 157 | return false; 158 | }); 159 | }); 160 | 161 | $("#node_37").bind("contextmenu",function () { 162 | console.log('Info contextmenu false!'); 163 | return false; 164 | }); 165 | 166 | document.contextmenu=function () { 167 | console.log('Info contextmenu false!'); 168 | return false; 169 | } 170 | $("#node_37").click(function(){ 171 | // 动作触发后执行的代码!! 172 | console.log("click"); 173 | }); 174 | $('#node_37').mousedown(function(e) { 175 | console.log("sdfghjkljhgfds"); 176 | //右键为3 177 | if (3 == e.which) { 178 | $(".ml-right").css('display','block'); 179 | $(".ml-right > ul").css('top',e.clientX); 180 | $(".ml-right > ul").css('left',e.clientY); 181 | console.log('Info 右击事件!!'); 182 | } else if (1 == e.which) { 183 | //左键为1 184 | console.log('Info 左键事件!!'); 185 | } 186 | }) 187 | 188 | /*node节点鼠标右击事件*/ 189 | 190 | -------------------------------------------------------------------------------- /mml-ui/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Home from '@/views/home/Home' 4 | //import Index from '@/views/index/Index' 5 | //import Datasource from '@/views/datasource/Datasource' 6 | 7 | 8 | Vue.use(Router) 9 | 10 | export default new Router({ 11 | routes: [ 12 | { 13 | path: '/', 14 | name: '/Home', 15 | component: Home 16 | } 17 | ] 18 | }) 19 | -------------------------------------------------------------------------------- /mml-ui/src/tools/webApp.js: -------------------------------------------------------------------------------- 1 | const webApp = { 2 | daytime:{//白天 3 | ASIDE_BACKGROUND_COLOR:'#454c59', 4 | ASIDE_ICO_TEXT_COLOR:'#FFF', 5 | ACTIVE_TEXT_COLOR:"#ffd04b", 6 | BOX_HOM_BACKGROUND_COLOR:'#e7ecf5',//首页背景颜色 7 | TEMPLATE_BACKGROUND_COLOR:'#FFF',//首页模板背景颜色 8 | TEMPLATE_BACKGROUND_COLOR_HOVER:'rgba(0,170,238,.6)',//鼠标上移动背景颜色 9 | TEMPLATE_COLOR:'#666', 10 | 11 | SUBASSEMBLY_ICON_BACKGROUND_COLOR:'#74aece',//组件图标颜色 12 | SUBASSEMBLY_TEXT_COLOR:'#666' 13 | }, 14 | night:{//夜间 15 | ASIDE_BACKGROUND_COLOR:'#454c59', 16 | ASIDE_ICO_TEXT_COLOR:'#FFF', 17 | BOX_HOM_BACKGROUND_COLOR:'#e7ecf5',//首页背景颜色 18 | TEMPLATE_BACKGROUND_COLOR:'#FFF',//首页模板背景颜色 19 | TEMPLATE_BACKGROUND_COLOR_HOVER:'rgba(0,170,238,.6)',//鼠标上移动背景颜色 20 | TEMPLATE_COLOR:'#666', 21 | 22 | SUBASSEMBLY_ICON_BACKGROUND_COLOR:'#74aece',//组件图标颜色 23 | SUBASSEMBLY_TEXT_COLOR:'#666' 24 | }, 25 | jianjie:{ 26 | title:'简介', 27 | value:['ml 是一款全新的机器学习平台', 28 | '本版本定位于:易用、强大、高效。通过提供丰富易用的界面拖拽组件以及背后强大的数据处理功能,让用户轻松上手,完成各种机器学习建模分析任务。主要包\n' + 29 | '含了: 数据源创建、特征工程、机器学习算法、模型评估、一键部署以及训练数据可视化等。', 30 | '数据源创建: 支持本地文件上传、实时流数据接入(Kafka、Redis)、Hdfs数据(Hive)、Mysql等。', 31 | '机器学习模型:'+ 32 | '从底层支持而言,主要分为Spark、Tensorflow与MXNet三种,封装了常用的机器学习算法。包括但不局限于: 逻辑回归LR、梯度提升' + 33 | '决策树GBDT、因子分解模型FM、深度神经网络DNN、分类SVM、聚类Kmeans、主题模型LDA、协同过滤CF以及Spark原生自带算法等' + 34 | '。' , 35 | '模型评估: 对模型训练结果进行可视化分析,比如ROC曲线绘制等。', 36 | '一键部署: 基于ml平台实现项目的一键部署上线,通过开发通用的Score框架,实现各种模型的嵌入。'] 37 | }, 38 | banben:{title:'版本沿进', 39 | value:['主要参照阿里数加机器学习平台 + 谷歌云机器学习平台进行改造。','提供更友好的使用姿势,更快捷的实验处理过程。']} 40 | 41 | }; 42 | export default webApp; 43 | -------------------------------------------------------------------------------- /mml-ui/src/utils/HTTP.js: -------------------------------------------------------------------------------- 1 | export default(type = 'GET', url = '', data = {}, method = 'fetch') => { 2 | type = type.toUpperCase(); 3 | url = "http://vidanao.com:8080/mlService"+url; 4 | let mlHeaders = new Headers(); 5 | mlHeaders.append('Accept','application/json'); 6 | mlHeaders.append('Access-Control-Allow-Origin','*'); 7 | mlHeaders.append('Access-Control-Allow-Credentials','true'); 8 | mlHeaders.append('Accept-Charset' ,'utf-8'); 9 | mlHeaders.append('Content-Type', 'application/x-www-form-urlencoded'); 10 | console.log('sadsdasd'); 11 | if (type == 'GET') { 12 | let dataStr = ''; //数据拼接字符串 13 | for (var key of data.keys()) { 14 | dataStr += key + '=' + data.get(key) + '&'; 15 | } 16 | if (dataStr !== '') { 17 | dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); 18 | url = url + '?' + dataStr; 19 | } 20 | } 21 | 22 | if(window.fetch && method == 'fetch'){ 23 | let requestConfig = { 24 | method:type, 25 | Headers:{ 26 | 'Accept': 'application/json', 27 | 'Access-Control-Allow-Origin':'*', 28 | 'Access-Control-Allow-Credentials': 'true', 29 | 'Accept-Charset' : 'utf-8', 30 | 'Content-Type': 'application/x-www-form-urlencoded' 31 | }, 32 | mode:'cors', 33 | cache:'default', 34 | credentials:'include', 35 | } 36 | if(type =='POST'){ 37 | Object.defineProperty(requestConfig, 'body', { 38 | value: data 39 | }) 40 | } 41 | return fetch(url, requestConfig); 42 | }else{ 43 | return new Promise((resolve, reject) => { 44 | let requestObj; 45 | if (window.XMLHttpRequest) { 46 | requestObj = new XMLHttpRequest(); 47 | } else { 48 | requestObj = new ActiveXObject; 49 | } 50 | 51 | let sendData = ''; 52 | if (type == 'POST') { 53 | sendData = data; 54 | } 55 | 56 | requestObj.open(type, url, true); 57 | requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 58 | requestObj.send(sendData); 59 | 60 | requestObj.onreadystatechange = () => { 61 | if (requestObj.readyState == 4) { 62 | if (requestObj.status == 200) { 63 | let obj = requestObj.response 64 | if (typeof obj !== 'object') { 65 | obj = JSON.parse(obj); 66 | } 67 | resolve(obj) 68 | } else { 69 | reject(requestObj) 70 | } 71 | } 72 | } 73 | }) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /mml-ui/src/utils/util.http.js: -------------------------------------------------------------------------------- 1 | export default(type = 'GET', url = 'http://localhost:8080', data = new FormData(), method = 'fetch') => {//export default async 2 | type = type.toUpperCase(); 3 | url = "http://localhost:8080" + url; 4 | var headers = new Headers({ 5 | 'Accept': 'application/json', 6 | 'Content-Type': 'application/json' 7 | }); 8 | 9 | if (type == 'GET') { 10 | let dataStr = ''; //数据拼接字符串 11 | for (var key of data.keys()) { 12 | dataStr += key + '=' + data.get(key) + '&'; 13 | } 14 | 15 | if (dataStr !== '') { 16 | dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); 17 | url = url + '?' + dataStr; 18 | } 19 | } 20 | 21 | if (window.fetch && method == 'fetch') { 22 | let requestConfig = { 23 | credentials: 'include', 24 | method: type, 25 | headers:headers, 26 | mode: "no-cors", 27 | cache: "default" 28 | } 29 | if (type == 'POST') { 30 | Object.defineProperty(requestConfig, 'body', { 31 | value: data 32 | }) 33 | } 34 | return fetch(url, requestConfig); 35 | } else { 36 | return new Promise((resolve, reject) => { 37 | let requestObj; 38 | if (window.XMLHttpRequest) { 39 | requestObj = new XMLHttpRequest(); 40 | } else { 41 | requestObj = new ActiveXObject; 42 | } 43 | 44 | let sendData = ''; 45 | if (type == 'POST') { 46 | sendData = data; 47 | } 48 | 49 | requestObj.open(type, url, true); 50 | requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 51 | requestObj.send(sendData); 52 | 53 | requestObj.onreadystatechange = () => { 54 | if (requestObj.readyState == 4) { 55 | if (requestObj.status == 200) { 56 | let obj = requestObj.response 57 | if (typeof obj !== 'object') { 58 | obj = JSON.parse(obj); 59 | } 60 | resolve(obj) 61 | } else { 62 | reject(requestObj) 63 | } 64 | } 65 | } 66 | }) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /mml-ui/src/views/index/Index.vue: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/src/views/index/Index.vue -------------------------------------------------------------------------------- /mml-ui/src/views/login/Login.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /mml-ui/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Liwengbin/mml/f68206fc1961340d146ea0fff9705dea2dca3b9e/mml-ui/static/.gitkeep -------------------------------------------------------------------------------- /mml-ui/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // The assertion name is the filename. 3 | // Example usage: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // For more information on custom assertions see: 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | 10 | exports.assertion = function (selector, count) { 11 | this.message = 'Testing if element <' + selector + '> has count: ' + count 12 | this.expected = count 13 | this.pass = function (val) { 14 | return val === this.expected 15 | } 16 | this.value = function (res) { 17 | return res.value 18 | } 19 | this.command = function (cb) { 20 | var self = this 21 | return this.api.execute(function (selector) { 22 | return document.querySelectorAll(selector).length 23 | }, [selector], function (res) { 24 | cb.call(self, res) 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mml-ui/test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /mml-ui/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | 4 | const webpack = require('webpack') 5 | const DevServer = require('webpack-dev-server') 6 | 7 | const webpackConfig = require('../../build/webpack.prod.conf') 8 | const devConfigPromise = require('../../build/webpack.dev.conf') 9 | 10 | let server 11 | 12 | devConfigPromise.then(devConfig => { 13 | const devServerOptions = devConfig.devServer 14 | const compiler = webpack(webpackConfig) 15 | server = new DevServer(compiler, devServerOptions) 16 | const port = devServerOptions.port 17 | const host = devServerOptions.host 18 | return server.listen(port, host) 19 | }) 20 | .then(() => { 21 | // 2. run the nightwatch test suite against it 22 | // to run in additional browsers: 23 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 24 | // 2. add it to the --env flag below 25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 26 | // For more information on Nightwatch's config file, see 27 | // http://nightwatchjs.org/guide#settings-file 28 | let opts = process.argv.slice(2) 29 | if (opts.indexOf('--config') === -1) { 30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 31 | } 32 | if (opts.indexOf('--env') === -1) { 33 | opts = opts.concat(['--env', 'chrome']) 34 | } 35 | 36 | const spawn = require('cross-spawn') 37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 38 | 39 | runner.on('exit', function (code) { 40 | server.close() 41 | process.exit(code) 42 | }) 43 | 44 | runner.on('error', function (err) { 45 | server.close() 46 | throw err 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /mml-ui/test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mml-ui/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /mml-ui/test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | mapCoverage: true, 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/main.js', 27 | '!src/router/index.js', 28 | '!**/node_modules/**' 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /mml-ui/test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /mml-ui/test/unit/specs/HelloWorld.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import HelloWorld from '@/components/HelloWorld' 3 | 4 | describe('HelloWorld.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(HelloWorld) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .toEqual('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | --------------------------------------------------------------------------------