├── .editorconfig ├── .gitattributes ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .prettierignore ├── .prettierrc ├── .yo-rc.json ├── README.md ├── angular.json ├── mvnw ├── mvnw.cmd ├── package-lock.json ├── package.json ├── pom.xml ├── proxy.conf.json ├── src ├── main │ ├── docker │ │ ├── .dockerignore │ │ ├── Dockerfile │ │ ├── app.yml │ │ ├── central-server-config │ │ │ ├── README.md │ │ │ ├── docker-config │ │ │ │ └── application.yml │ │ │ └── localhost-config │ │ │ │ └── application.yml │ │ ├── entrypoint.sh │ │ ├── jhipster-registry.yml │ │ ├── mysql.yml │ │ └── sonar.yml │ ├── java │ │ └── com │ │ │ └── mycompany │ │ │ └── myapp │ │ │ ├── ApplicationWebXml.java │ │ │ ├── JiuzhangquanzhankeApp.java │ │ │ ├── aop │ │ │ └── logging │ │ │ │ └── LoggingAspect.java │ │ │ ├── config │ │ │ ├── ApplicationProperties.java │ │ │ ├── AsyncConfiguration.java │ │ │ ├── CloudDatabaseConfiguration.java │ │ │ ├── Constants.java │ │ │ ├── DatabaseConfiguration.java │ │ │ ├── DateTimeFormatConfiguration.java │ │ │ ├── DefaultProfileUtil.java │ │ │ ├── JacksonConfiguration.java │ │ │ ├── LiquibaseConfiguration.java │ │ │ ├── LocaleConfiguration.java │ │ │ ├── LoggingAspectConfiguration.java │ │ │ ├── LoggingConfiguration.java │ │ │ ├── MetricsConfiguration.java │ │ │ ├── SecurityConfiguration.java │ │ │ ├── WebConfigurer.java │ │ │ ├── audit │ │ │ │ ├── AuditEventConverter.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ ├── domain │ │ │ ├── AbstractAuditingEntity.java │ │ │ ├── Authority.java │ │ │ ├── Course.java │ │ │ ├── PersistentAuditEvent.java │ │ │ ├── User.java │ │ │ ├── UserCourse.java │ │ │ └── package-info.java │ │ │ ├── repository │ │ │ ├── AuthorityRepository.java │ │ │ ├── CourseRepository.java │ │ │ ├── CustomAuditEventRepository.java │ │ │ ├── PersistenceAuditEventRepository.java │ │ │ ├── UserCourseRepository.java │ │ │ ├── UserRepository.java │ │ │ └── package-info.java │ │ │ ├── security │ │ │ ├── AuthoritiesConstants.java │ │ │ ├── DomainUserDetailsService.java │ │ │ ├── SecurityUtils.java │ │ │ ├── SpringSecurityAuditorAware.java │ │ │ ├── UserNotActivatedException.java │ │ │ ├── jwt │ │ │ │ ├── JWTConfigurer.java │ │ │ │ ├── JWTFilter.java │ │ │ │ └── TokenProvider.java │ │ │ └── package-info.java │ │ │ ├── service │ │ │ ├── AuditEventService.java │ │ │ ├── MailService.java │ │ │ ├── UserService.java │ │ │ ├── dto │ │ │ │ ├── PasswordChangeDTO.java │ │ │ │ ├── UserDTO.java │ │ │ │ └── package-info.java │ │ │ ├── mapper │ │ │ │ ├── UserMapper.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── util │ │ │ │ └── RandomUtil.java │ │ │ └── web │ │ │ └── rest │ │ │ ├── AccountResource.java │ │ │ ├── AuditResource.java │ │ │ ├── LogsResource.java │ │ │ ├── UserJWTController.java │ │ │ ├── UserResource.java │ │ │ ├── errors │ │ │ ├── BadRequestAlertException.java │ │ │ ├── CustomParameterizedException.java │ │ │ ├── EmailAlreadyUsedException.java │ │ │ ├── EmailNotFoundException.java │ │ │ ├── ErrorConstants.java │ │ │ ├── ExceptionTranslator.java │ │ │ ├── FieldErrorVM.java │ │ │ ├── InternalServerErrorException.java │ │ │ ├── InvalidPasswordException.java │ │ │ ├── LoginAlreadyUsedException.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── util │ │ │ ├── HeaderUtil.java │ │ │ └── PaginationUtil.java │ │ │ └── vm │ │ │ ├── KeyAndPasswordVM.java │ │ │ ├── LoggerVM.java │ │ │ ├── LoginVM.java │ │ │ ├── ManagedUserVM.java │ │ │ └── package-info.java │ ├── resources │ │ ├── banner.txt │ │ ├── config │ │ │ ├── application-dev.yml │ │ │ ├── application-prod.yml │ │ │ ├── application.yml │ │ │ ├── bootstrap-prod.yml │ │ │ ├── bootstrap.yml │ │ │ └── liquibase │ │ │ │ ├── authorities.csv │ │ │ │ ├── changelog │ │ │ │ ├── 00000000000000_initial_schema.xml │ │ │ │ ├── 20180803182708_changelog.xml │ │ │ │ ├── 20180803183131_changelog.xml │ │ │ │ ├── 20180803184842_changelog.xml │ │ │ │ ├── 20180803185046_changelog.xml │ │ │ │ ├── 20180803190054_changelog.xml │ │ │ │ ├── 20180803191305_changelog.xml │ │ │ │ └── 20180803191436_changelog.xml │ │ │ │ ├── master.xml │ │ │ │ ├── users.csv │ │ │ │ └── users_authorities.csv │ │ ├── i18n │ │ │ └── messages.properties │ │ ├── logback-spring.xml │ │ └── templates │ │ │ ├── error.html │ │ │ └── mail │ │ │ ├── activationEmail.html │ │ │ ├── creationEmail.html │ │ │ └── passwordResetEmail.html │ └── webapp │ │ ├── 404.html │ │ ├── app │ │ ├── account │ │ │ ├── account.module.ts │ │ │ ├── account.route.ts │ │ │ ├── activate │ │ │ │ ├── activate.component.html │ │ │ │ ├── activate.component.ts │ │ │ │ ├── activate.route.ts │ │ │ │ └── activate.service.ts │ │ │ ├── index.ts │ │ │ ├── password-reset │ │ │ │ ├── finish │ │ │ │ │ ├── password-reset-finish.component.html │ │ │ │ │ ├── password-reset-finish.component.ts │ │ │ │ │ ├── password-reset-finish.route.ts │ │ │ │ │ └── password-reset-finish.service.ts │ │ │ │ └── init │ │ │ │ │ ├── password-reset-init.component.html │ │ │ │ │ ├── password-reset-init.component.ts │ │ │ │ │ ├── password-reset-init.route.ts │ │ │ │ │ └── password-reset-init.service.ts │ │ │ ├── password │ │ │ │ ├── password-strength-bar.component.ts │ │ │ │ ├── password-strength-bar.css │ │ │ │ ├── password.component.html │ │ │ │ ├── password.component.ts │ │ │ │ ├── password.route.ts │ │ │ │ └── password.service.ts │ │ │ ├── register │ │ │ │ ├── register.component.html │ │ │ │ ├── register.component.ts │ │ │ │ ├── register.route.ts │ │ │ │ └── register.service.ts │ │ │ └── settings │ │ │ │ ├── settings.component.html │ │ │ │ ├── settings.component.ts │ │ │ │ └── settings.route.ts │ │ ├── admin │ │ │ ├── admin.module.ts │ │ │ ├── admin.route.ts │ │ │ ├── audits │ │ │ │ ├── audit-data.model.ts │ │ │ │ ├── audit.model.ts │ │ │ │ ├── audits.component.html │ │ │ │ ├── audits.component.ts │ │ │ │ ├── audits.route.ts │ │ │ │ └── audits.service.ts │ │ │ ├── configuration │ │ │ │ ├── configuration.component.html │ │ │ │ ├── configuration.component.ts │ │ │ │ ├── configuration.route.ts │ │ │ │ └── configuration.service.ts │ │ │ ├── docs │ │ │ │ ├── docs.component.html │ │ │ │ ├── docs.component.ts │ │ │ │ └── docs.route.ts │ │ │ ├── health │ │ │ │ ├── health-modal.component.html │ │ │ │ ├── health-modal.component.ts │ │ │ │ ├── health.component.html │ │ │ │ ├── health.component.ts │ │ │ │ ├── health.route.ts │ │ │ │ └── health.service.ts │ │ │ ├── index.ts │ │ │ ├── logs │ │ │ │ ├── log.model.ts │ │ │ │ ├── logs.component.html │ │ │ │ ├── logs.component.ts │ │ │ │ ├── logs.route.ts │ │ │ │ └── logs.service.ts │ │ │ ├── metrics │ │ │ │ ├── metrics-modal.component.html │ │ │ │ ├── metrics-modal.component.ts │ │ │ │ ├── metrics.component.html │ │ │ │ ├── metrics.component.ts │ │ │ │ ├── metrics.route.ts │ │ │ │ └── metrics.service.ts │ │ │ └── user-management │ │ │ │ ├── user-management-delete-dialog.component.html │ │ │ │ ├── user-management-delete-dialog.component.ts │ │ │ │ ├── user-management-detail.component.html │ │ │ │ ├── user-management-detail.component.ts │ │ │ │ ├── user-management-update.component.html │ │ │ │ ├── user-management-update.component.ts │ │ │ │ ├── user-management.component.html │ │ │ │ ├── user-management.component.ts │ │ │ │ └── user-management.route.ts │ │ ├── app-routing.module.ts │ │ ├── app.constants.ts │ │ ├── app.main.ts │ │ ├── app.module.ts │ │ ├── blocks │ │ │ ├── config │ │ │ │ ├── prod.config.ts │ │ │ │ └── uib-pagination.config.ts │ │ │ └── interceptor │ │ │ │ ├── auth-expired.interceptor.ts │ │ │ │ ├── auth.interceptor.ts │ │ │ │ ├── errorhandler.interceptor.ts │ │ │ │ └── notification.interceptor.ts │ │ ├── core │ │ │ ├── auth │ │ │ │ ├── account.service.ts │ │ │ │ ├── auth-jwt.service.ts │ │ │ │ ├── csrf.service.ts │ │ │ │ ├── principal.service.ts │ │ │ │ ├── state-storage.service.ts │ │ │ │ └── user-route-access-service.ts │ │ │ ├── core.module.ts │ │ │ ├── index.ts │ │ │ ├── login │ │ │ │ ├── login-modal.service.ts │ │ │ │ └── login.service.ts │ │ │ └── user │ │ │ │ ├── account.model.ts │ │ │ │ ├── user.model.ts │ │ │ │ └── user.service.ts │ │ ├── entities │ │ │ └── entity.module.ts │ │ ├── home │ │ │ ├── course.model.ts │ │ │ ├── home.component.html │ │ │ ├── home.component.ts │ │ │ ├── home.css │ │ │ ├── home.module.ts │ │ │ ├── home.route.ts │ │ │ └── index.ts │ │ ├── layouts │ │ │ ├── error │ │ │ │ ├── error.component.html │ │ │ │ ├── error.component.ts │ │ │ │ └── error.route.ts │ │ │ ├── footer │ │ │ │ ├── footer.component.html │ │ │ │ └── footer.component.ts │ │ │ ├── index.ts │ │ │ ├── main │ │ │ │ ├── main.component.html │ │ │ │ └── main.component.ts │ │ │ ├── navbar │ │ │ │ ├── navbar.component.html │ │ │ │ ├── navbar.component.ts │ │ │ │ ├── navbar.css │ │ │ │ └── navbar.route.ts │ │ │ └── profiles │ │ │ │ ├── page-ribbon.component.ts │ │ │ │ ├── page-ribbon.css │ │ │ │ ├── profile-info.model.ts │ │ │ │ └── profile.service.ts │ │ ├── polyfills.ts │ │ ├── shared │ │ │ ├── alert │ │ │ │ ├── alert-error.component.ts │ │ │ │ └── alert.component.ts │ │ │ ├── auth │ │ │ │ └── has-any-authority.directive.ts │ │ │ ├── constants │ │ │ │ ├── error.constants.ts │ │ │ │ ├── input.constants.ts │ │ │ │ └── pagination.constants.ts │ │ │ ├── index.ts │ │ │ ├── login │ │ │ │ ├── login.component.html │ │ │ │ └── login.component.ts │ │ │ ├── shared-common.module.ts │ │ │ ├── shared-libs.module.ts │ │ │ ├── shared.module.ts │ │ │ └── util │ │ │ │ ├── datepicker-adapter.ts │ │ │ │ └── request-util.ts │ │ └── vendor.ts │ │ ├── content │ │ ├── css │ │ │ ├── documentation.css │ │ │ ├── global.css │ │ │ └── vendor.css │ │ └── images │ │ │ ├── hipster.png │ │ │ ├── hipster192.png │ │ │ ├── hipster256.png │ │ │ ├── hipster2x.png │ │ │ ├── hipster384.png │ │ │ ├── hipster512.png │ │ │ └── logo-jhipster.png │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── manifest.webapp │ │ ├── robots.txt │ │ └── swagger-ui │ │ ├── dist │ │ └── images │ │ │ └── throbber.gif │ │ └── index.html └── test │ ├── java │ └── com │ │ └── mycompany │ │ └── myapp │ │ ├── config │ │ ├── WebConfigurerTest.java │ │ └── WebConfigurerTestController.java │ │ ├── repository │ │ └── CustomAuditEventRepositoryIntTest.java │ │ ├── security │ │ ├── DomainUserDetailsServiceIntTest.java │ │ ├── SecurityUtilsUnitTest.java │ │ └── jwt │ │ │ ├── JWTFilterTest.java │ │ │ └── TokenProviderTest.java │ │ ├── service │ │ ├── MailServiceIntTest.java │ │ └── UserServiceIntTest.java │ │ └── web │ │ └── rest │ │ ├── AccountResourceIntTest.java │ │ ├── AuditResourceIntTest.java │ │ ├── LogsResourceIntTest.java │ │ ├── TestUtil.java │ │ ├── UserJWTControllerIntTest.java │ │ ├── UserResourceIntTest.java │ │ ├── errors │ │ ├── ExceptionTranslatorIntTest.java │ │ └── ExceptionTranslatorTestController.java │ │ └── util │ │ └── PaginationUtilUnitTest.java │ ├── javascript │ ├── jest-global-mocks.ts │ ├── jest.conf.js │ ├── jest.ts │ └── spec │ │ ├── app │ │ ├── account │ │ │ ├── activate │ │ │ │ └── activate.component.spec.ts │ │ │ ├── password-reset │ │ │ │ ├── finish │ │ │ │ │ └── password-reset-finish.component.spec.ts │ │ │ │ └── init │ │ │ │ │ └── password-reset-init.component.spec.ts │ │ │ ├── password │ │ │ │ ├── password-strength-bar.component.spec.ts │ │ │ │ └── password.component.spec.ts │ │ │ ├── register │ │ │ │ └── register.component.spec.ts │ │ │ └── settings │ │ │ │ └── settings.component.spec.ts │ │ ├── admin │ │ │ ├── audits │ │ │ │ ├── audits.component.spec.ts │ │ │ │ └── audits.service.spec.ts │ │ │ ├── health │ │ │ │ └── health.component.spec.ts │ │ │ └── user-management │ │ │ │ ├── user-management-delete-dialog.component.spec.ts │ │ │ │ ├── user-management-detail.component.spec.ts │ │ │ │ ├── user-management-update.component.spec.ts │ │ │ │ └── user-management.component.spec.ts │ │ ├── core │ │ │ └── user │ │ │ │ └── user.service.spec.ts │ │ └── shared │ │ │ └── login │ │ │ └── login.component.spec.ts │ │ ├── helpers │ │ ├── mock-account.service.ts │ │ ├── mock-active-modal.service.ts │ │ ├── mock-event-manager.service.ts │ │ ├── mock-login.service.ts │ │ ├── mock-principal.service.ts │ │ ├── mock-route.service.ts │ │ ├── mock-state-storage.service.ts │ │ └── spyobject.ts │ │ └── test.module.ts │ └── resources │ ├── config │ ├── application.yml │ └── bootstrap.yml │ ├── i18n │ └── messages_en.properties │ ├── logback.xml │ └── templates │ └── mail │ └── testEmail.html ├── tsconfig-aot.json ├── tsconfig.json ├── tslint.json ├── webpack ├── logo-jhipster.png ├── utils.js ├── webpack.common.js ├── webpack.dev.js └── webpack.prod.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 4 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | 22 | [{package,bower}.json] 23 | indent_style = space 24 | indent_size = 2 25 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | target 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | # Prettier configuration 2 | 3 | printWidth: 140 4 | singleQuote: true 5 | tabWidth: 4 6 | useTabs: false 7 | 8 | # js and ts rules: 9 | arrowParens: avoid 10 | 11 | # jsx and tsx rules: 12 | jsxBracketSameLine: false 13 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-jhipster": { 3 | "promptValues": { 4 | "packageName": "com.mycompany.myapp" 5 | }, 6 | "jhipsterVersion": "5.1.0", 7 | "applicationType": "monolith", 8 | "baseName": "jiuzhangquanzhanke", 9 | "packageName": "com.mycompany.myapp", 10 | "packageFolder": "com/mycompany/myapp", 11 | "serverPort": "8080", 12 | "authenticationType": "jwt", 13 | "cacheProvider": "no", 14 | "websocket": false, 15 | "databaseType": "sql", 16 | "devDatabaseType": "mysql", 17 | "prodDatabaseType": "mysql", 18 | "searchEngine": false, 19 | "messageBroker": false, 20 | "serviceDiscoveryType": "eureka", 21 | "buildTool": "maven", 22 | "enableSwaggerCodegen": false, 23 | "jwtSecretKey": "f2f974d0f761222827717448ed5c821ec505d005", 24 | "clientFramework": "angularX", 25 | "useSass": false, 26 | "clientPackageManager": "yarn", 27 | "testFrameworks": [], 28 | "jhiPrefix": "jhi", 29 | "enableTranslation": false 30 | } 31 | } -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "jiuzhangquanzhanke": { 7 | "root": "", 8 | "sourceRoot": "src/main/webapp", 9 | "projectType": "application", 10 | "architect": {} 11 | } 12 | }, 13 | "defaultProject": "jiuzhangquanzhanke", 14 | "cli": { 15 | "packageManager": "yarn" 16 | }, 17 | "schematics": { 18 | "@schematics/angular:component": { 19 | "inlineStyle": true, 20 | "inlineTemplate": false, 21 | "spec": false, 22 | "prefix": "jhi", 23 | "styleExt": "css" 24 | }, 25 | "@schematics/angular:directive": { 26 | "spec": false, 27 | "prefix": "jhi" 28 | }, 29 | "@schematics/angular:guard": { 30 | "spec": false 31 | }, 32 | "@schematics/angular:pipe": { 33 | "spec": false 34 | }, 35 | "@schematics/angular:service": { 36 | "spec": false 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /proxy.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "target": "http://localhost:8080", 4 | "secure": false, 5 | "loglevel": "debug" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/docker/.dockerignore: -------------------------------------------------------------------------------- 1 | # https://docs.docker.com/engine/reference/builder/#dockerignore-file 2 | classes/ 3 | generated-sources/ 4 | generated-test-sources/ 5 | h2db/ 6 | maven-archiver/ 7 | maven-status/ 8 | reports/ 9 | surefire-reports/ 10 | test-classes/ 11 | test-results/ 12 | www/ 13 | !*.jar 14 | !*.war 15 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-alpine 2 | 3 | ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ 4 | JHIPSTER_SLEEP=0 \ 5 | JAVA_OPTS="" 6 | 7 | # Add a jhipster user to run our application so that it doesn't need to run as root 8 | RUN adduser -D -s /bin/sh jhipster 9 | WORKDIR /home/jhipster 10 | 11 | ADD entrypoint.sh entrypoint.sh 12 | RUN chmod 755 entrypoint.sh && chown jhipster:jhipster entrypoint.sh 13 | USER jhipster 14 | 15 | ADD *.war app.war 16 | 17 | ENTRYPOINT ["./entrypoint.sh"] 18 | 19 | EXPOSE 8080 20 | 21 | -------------------------------------------------------------------------------- /src/main/docker/app.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jiuzhangquanzhanke-app: 4 | image: jiuzhangquanzhanke 5 | environment: 6 | # - _JAVA_OPTIONS=-Xmx512m -Xms256m 7 | - SPRING_PROFILES_ACTIVE=prod,swagger 8 | - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka 9 | - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config 10 | - SPRING_DATASOURCE_URL=jdbc:mysql://jiuzhangquanzhanke-mysql:3306/jiuzhangquanzhanke?useUnicode=true&characterEncoding=utf8&useSSL=false 11 | - JHIPSTER_SLEEP=30 # gives time for the JHipster Registry to boot before the application 12 | ports: 13 | - 8080:8080 14 | jiuzhangquanzhanke-mysql: 15 | extends: 16 | file: mysql.yml 17 | service: jiuzhangquanzhanke-mysql 18 | jhipster-registry: 19 | extends: 20 | file: jhipster-registry.yml 21 | service: jhipster-registry 22 | environment: 23 | - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native 24 | - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/docker-config/ 25 | -------------------------------------------------------------------------------- /src/main/docker/central-server-config/README.md: -------------------------------------------------------------------------------- 1 | # Central configuration sources details 2 | 3 | The JHipster-Registry will use the following directories as its configuration source : 4 | - localhost-config : when running the registry in docker with the jhipster-registry.yml docker-compose file 5 | - docker-config : when running the registry and the app both in docker with the app.yml docker-compose file 6 | 7 | For more info, refer to https://www.jhipster.tech/microservices-architecture/#registry_app_configuration 8 | -------------------------------------------------------------------------------- /src/main/docker/central-server-config/docker-config/application.yml: -------------------------------------------------------------------------------- 1 | # Common configuration shared between all applications 2 | configserver: 3 | name: Docker JHipster Registry 4 | status: Connected to the JHipster Registry running in Docker 5 | 6 | jhipster: 7 | security: 8 | authentication: 9 | jwt: 10 | secret: my-secret-token-to-change-in-production 11 | 12 | eureka: 13 | client: 14 | service-url: 15 | defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/ 16 | -------------------------------------------------------------------------------- /src/main/docker/central-server-config/localhost-config/application.yml: -------------------------------------------------------------------------------- 1 | # Common configuration shared between all applications 2 | configserver: 3 | name: Docker JHipster Registry 4 | status: Connected to the JHipster Registry running in Docker 5 | 6 | jhipster: 7 | security: 8 | authentication: 9 | jwt: 10 | secret: my-secret-token-to-change-in-production 11 | 12 | eureka: 13 | client: 14 | service-url: 15 | defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ 16 | -------------------------------------------------------------------------------- /src/main/docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} 4 | exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "${HOME}/app.war" "$@" 5 | -------------------------------------------------------------------------------- /src/main/docker/jhipster-registry.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jhipster-registry: 4 | image: jhipster/jhipster-registry:v4.0.0 5 | volumes: 6 | - ./central-server-config:/central-config 7 | # When run with the "dev" Spring profile, the JHipster Registry will 8 | # read the config from the local filesystem (central-server-config directory) 9 | # When run with the "prod" Spring profile, it will read the configuration from a Git repository 10 | # See https://www.jhipster.tech/microservices-architecture/#registry_app_configuration 11 | environment: 12 | # - _JAVA_OPTIONS=-Xmx512m -Xms256m 13 | - SPRING_PROFILES_ACTIVE=dev,swagger 14 | - SPRING_SECURITY_USER_PASSWORD=admin 15 | - JHIPSTER_REGISTRY_PASSWORD=admin 16 | - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native 17 | - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/localhost-config/ 18 | # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git 19 | # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/ 20 | # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config 21 | ports: 22 | - 8761:8761 23 | -------------------------------------------------------------------------------- /src/main/docker/mysql.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jiuzhangquanzhanke-mysql: 4 | image: mysql:5.7.20 5 | # volumes: 6 | # - ~/volumes/jhipster/jiuzhangquanzhanke/mysql/:/var/lib/mysql/ 7 | environment: 8 | - MYSQL_USER=root 9 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 10 | - MYSQL_DATABASE=jiuzhangquanzhanke 11 | ports: 12 | - 3306:3306 13 | command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp 14 | -------------------------------------------------------------------------------- /src/main/docker/sonar.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jiuzhangquanzhanke-sonar: 4 | image: sonarqube:7.1-alpine 5 | ports: 6 | - 9000:9000 7 | - 9092:9092 8 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/ApplicationWebXml.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp; 2 | 3 | import com.mycompany.myapp.config.DefaultProfileUtil; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 6 | 7 | /** 8 | * This is a helper Java class that provides an alternative to creating a web.xml. 9 | * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. 10 | */ 11 | public class ApplicationWebXml extends SpringBootServletInitializer { 12 | 13 | @Override 14 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 15 | /** 16 | * set a default to use when no profile is configured. 17 | */ 18 | DefaultProfileUtil.addDefaultProfile(application.application()); 19 | return application.sources(JiuzhangquanzhankeApp.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/ApplicationProperties.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * Properties specific to Jiuzhangquanzhanke. 7 | *

8 | * Properties are configured in the application.yml file. 9 | * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. 10 | */ 11 | @ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) 12 | public class ApplicationProperties { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/AsyncConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; 4 | import io.github.jhipster.config.JHipsterProperties; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; 9 | import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.scheduling.annotation.*; 13 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 14 | 15 | import java.util.concurrent.Executor; 16 | 17 | @Configuration 18 | @EnableAsync 19 | @EnableScheduling 20 | public class AsyncConfiguration implements AsyncConfigurer { 21 | 22 | private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); 23 | 24 | private final JHipsterProperties jHipsterProperties; 25 | 26 | public AsyncConfiguration(JHipsterProperties jHipsterProperties) { 27 | this.jHipsterProperties = jHipsterProperties; 28 | } 29 | 30 | @Override 31 | @Bean(name = "taskExecutor") 32 | public Executor getAsyncExecutor() { 33 | log.debug("Creating Async Task Executor"); 34 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 35 | executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize()); 36 | executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize()); 37 | executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity()); 38 | executor.setThreadNamePrefix("jiuzhangquanzhanke-Executor-"); 39 | return new ExceptionHandlingAsyncTaskExecutor(executor); 40 | } 41 | 42 | @Override 43 | public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { 44 | return new SimpleAsyncUncaughtExceptionHandler(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/CloudDatabaseConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import io.github.jhipster.config.JHipsterConstants; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.cloud.config.java.AbstractCloudConfig; 8 | import org.springframework.context.annotation.*; 9 | 10 | import javax.sql.DataSource; 11 | 12 | @Configuration 13 | @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) 14 | public class CloudDatabaseConfiguration extends AbstractCloudConfig { 15 | 16 | private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); 17 | 18 | @Bean 19 | public DataSource dataSource() { 20 | log.info("Configuring JDBC datasource from a cloud provider"); 21 | return connectionFactory().dataSource(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/Constants.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | /** 4 | * Application constants. 5 | */ 6 | public final class Constants { 7 | 8 | // Regex for acceptable logins 9 | public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$"; 10 | 11 | public static final String SYSTEM_ACCOUNT = "system"; 12 | public static final String ANONYMOUS_USER = "anonymoususer"; 13 | public static final String DEFAULT_LANGUAGE = "en"; 14 | 15 | private Constants() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/DatabaseConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import io.github.jhipster.config.JHipsterConstants; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | 10 | import org.springframework.data.jpa.repository.config.EnableJpaAuditing; 11 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 12 | import org.springframework.transaction.annotation.EnableTransactionManagement; 13 | 14 | 15 | @Configuration 16 | @EnableJpaRepositories("com.mycompany.myapp.repository") 17 | @EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") 18 | @EnableTransactionManagement 19 | public class DatabaseConfiguration { 20 | 21 | private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/DateTimeFormatConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.format.FormatterRegistry; 5 | import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 7 | 8 | @Configuration 9 | public class DateTimeFormatConfiguration implements WebMvcConfigurer { 10 | 11 | @Override 12 | public void addFormatters(FormatterRegistry registry) { 13 | DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); 14 | registrar.setUseIsoFormat(true); 15 | registrar.registerFormatters(registry); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/DefaultProfileUtil.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import io.github.jhipster.config.JHipsterConstants; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.core.env.Environment; 7 | 8 | import java.util.*; 9 | 10 | /** 11 | * Utility class to load a Spring profile to be used as default 12 | * when there is no spring.profiles.active set in the environment or as command line argument. 13 | * If the value is not available in application.yml then dev profile will be used as default. 14 | */ 15 | public final class DefaultProfileUtil { 16 | 17 | private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; 18 | 19 | private DefaultProfileUtil() { 20 | } 21 | 22 | /** 23 | * Set a default to use when no profile is configured. 24 | * 25 | * @param app the Spring application 26 | */ 27 | public static void addDefaultProfile(SpringApplication app) { 28 | Map defProperties = new HashMap<>(); 29 | /* 30 | * The default profile to use when no other profiles are defined 31 | * This cannot be set in the application.yml file. 32 | * See https://github.com/spring-projects/spring-boot/issues/1219 33 | */ 34 | defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); 35 | app.setDefaultProperties(defProperties); 36 | } 37 | 38 | /** 39 | * Get the profiles that are applied else get default profiles. 40 | * 41 | * @param env spring environment 42 | * @return profiles 43 | */ 44 | public static String[] getActiveProfiles(Environment env) { 45 | String[] profiles = env.getActiveProfiles(); 46 | if (profiles.length == 0) { 47 | return env.getDefaultProfiles(); 48 | } 49 | return profiles; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/JacksonConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; 4 | import com.fasterxml.jackson.module.afterburner.AfterburnerModule; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.zalando.problem.ProblemModule; 9 | import org.zalando.problem.validation.ConstraintViolationProblemModule; 10 | 11 | @Configuration 12 | public class JacksonConfiguration { 13 | 14 | /* 15 | * Support for Hibernate types in Jackson. 16 | */ 17 | @Bean 18 | public Hibernate5Module hibernate5Module() { 19 | return new Hibernate5Module(); 20 | } 21 | 22 | /* 23 | * Jackson Afterburner module to speed up serialization/deserialization. 24 | */ 25 | @Bean 26 | public AfterburnerModule afterburnerModule() { 27 | return new AfterburnerModule(); 28 | } 29 | 30 | /* 31 | * Module for serialization/deserialization of RFC7807 Problem. 32 | */ 33 | @Bean 34 | ProblemModule problemModule() { 35 | return new ProblemModule(); 36 | } 37 | 38 | /* 39 | * Module for serialization/deserialization of ConstraintViolationProblem. 40 | */ 41 | @Bean 42 | ConstraintViolationProblemModule constraintViolationProblemModule() { 43 | return new ConstraintViolationProblemModule(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/LiquibaseConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import javax.sql.DataSource; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.core.env.Environment; 12 | import org.springframework.core.task.TaskExecutor; 13 | 14 | import io.github.jhipster.config.JHipsterConstants; 15 | import io.github.jhipster.config.liquibase.AsyncSpringLiquibase; 16 | import liquibase.integration.spring.SpringLiquibase; 17 | 18 | @Configuration 19 | public class LiquibaseConfiguration { 20 | 21 | private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); 22 | 23 | private final Environment env; 24 | 25 | 26 | public LiquibaseConfiguration(Environment env) { 27 | this.env = env; 28 | } 29 | 30 | @Bean 31 | public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor, 32 | DataSource dataSource, LiquibaseProperties liquibaseProperties) { 33 | 34 | // Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously 35 | SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env); 36 | liquibase.setDataSource(dataSource); 37 | liquibase.setChangeLog("classpath:config/liquibase/master.xml"); 38 | liquibase.setContexts(liquibaseProperties.getContexts()); 39 | liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); 40 | liquibase.setDropFirst(liquibaseProperties.isDropFirst()); 41 | if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) { 42 | liquibase.setShouldRun(false); 43 | } else { 44 | liquibase.setShouldRun(liquibaseProperties.isEnabled()); 45 | log.debug("Configuring Liquibase"); 46 | } 47 | return liquibase; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/LocaleConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import io.github.jhipster.config.locale.AngularCookieLocaleResolver; 4 | 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.LocaleResolver; 8 | import org.springframework.web.servlet.config.annotation.*; 9 | import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; 10 | 11 | @Configuration 12 | public class LocaleConfiguration implements WebMvcConfigurer { 13 | 14 | @Bean(name = "localeResolver") 15 | public LocaleResolver localeResolver() { 16 | AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); 17 | cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); 18 | return cookieLocaleResolver; 19 | } 20 | 21 | @Override 22 | public void addInterceptors(InterceptorRegistry registry) { 23 | LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); 24 | localeChangeInterceptor.setParamName("language"); 25 | registry.addInterceptor(localeChangeInterceptor); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/LoggingAspectConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import com.mycompany.myapp.aop.logging.LoggingAspect; 4 | 5 | import io.github.jhipster.config.JHipsterConstants; 6 | 7 | import org.springframework.context.annotation.*; 8 | import org.springframework.core.env.Environment; 9 | 10 | @Configuration 11 | @EnableAspectJAutoProxy 12 | public class LoggingAspectConfiguration { 13 | 14 | @Bean 15 | @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) 16 | public LoggingAspect loggingAspect(Environment env) { 17 | return new LoggingAspect(env); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/audit/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Audit specific code. 3 | */ 4 | package com.mycompany.myapp.config.audit; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/config/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Framework configuration files. 3 | */ 4 | package com.mycompany.myapp.config; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/domain/Authority.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.domain; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Id; 5 | import javax.persistence.Table; 6 | import javax.persistence.Column; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.io.Serializable; 10 | 11 | /** 12 | * An authority (a security role) used by Spring Security. 13 | */ 14 | @Entity 15 | @Table(name = "jhi_authority") 16 | public class Authority implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | @NotNull 21 | @Size(max = 50) 22 | @Id 23 | @Column(length = 50) 24 | private String name; 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | @Override 35 | public boolean equals(Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | 43 | Authority authority = (Authority) o; 44 | 45 | return !(name != null ? !name.equals(authority.name) : authority.name != null); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return name != null ? name.hashCode() : 0; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "Authority{" + 56 | "name='" + name + '\'' + 57 | "}"; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/domain/Course.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.Table; 11 | 12 | @Entity 13 | @Table(name = "course") 14 | @Data 15 | public class Course { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | @Column(unique = true, nullable = false, columnDefinition = "bigint") 19 | private long id; 20 | 21 | @Column(name = "course_name", nullable = false, length = 100, columnDefinition = "nvarchar(100)") 22 | private String courseName; 23 | 24 | @Column(name = "course_location", nullable = false, length = 30, columnDefinition = "nvarchar(30)") 25 | private String courseLocation; 26 | 27 | @Column(name = "course_content", nullable = false, length = 200, columnDefinition = "nvarchar(200)") 28 | private String courseContent; 29 | 30 | @Column(name = "teacher_id", nullable = false, columnDefinition = "bigint") 31 | private long teacherId; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/domain/PersistentAuditEvent.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.domain; 2 | 3 | import javax.persistence.*; 4 | import javax.validation.constraints.NotNull; 5 | import java.io.Serializable; 6 | import java.time.Instant; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Persist AuditEvent managed by the Spring Boot actuator. 12 | * 13 | * @see org.springframework.boot.actuate.audit.AuditEvent 14 | */ 15 | @Entity 16 | @Table(name = "jhi_persistent_audit_event") 17 | public class PersistentAuditEvent implements Serializable { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | @Column(name = "event_id") 24 | private Long id; 25 | 26 | @NotNull 27 | @Column(nullable = false) 28 | private String principal; 29 | 30 | @Column(name = "event_date") 31 | private Instant auditEventDate; 32 | 33 | @Column(name = "event_type") 34 | private String auditEventType; 35 | 36 | @ElementCollection 37 | @MapKeyColumn(name = "name") 38 | @Column(name = "value") 39 | @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) 40 | private Map data = new HashMap<>(); 41 | 42 | public Long getId() { 43 | return id; 44 | } 45 | 46 | public void setId(Long id) { 47 | this.id = id; 48 | } 49 | 50 | public String getPrincipal() { 51 | return principal; 52 | } 53 | 54 | public void setPrincipal(String principal) { 55 | this.principal = principal; 56 | } 57 | 58 | public Instant getAuditEventDate() { 59 | return auditEventDate; 60 | } 61 | 62 | public void setAuditEventDate(Instant auditEventDate) { 63 | this.auditEventDate = auditEventDate; 64 | } 65 | 66 | public String getAuditEventType() { 67 | return auditEventType; 68 | } 69 | 70 | public void setAuditEventType(String auditEventType) { 71 | this.auditEventType = auditEventType; 72 | } 73 | 74 | public Map getData() { 75 | return data; 76 | } 77 | 78 | public void setData(Map data) { 79 | this.data = data; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/domain/UserCourse.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.domain; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import javax.persistence.*; 9 | 10 | @Entity 11 | @Table(name = "user_course") 12 | @Data 13 | @Builder 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public class UserCourse { 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.IDENTITY) 19 | @Column(unique = true, nullable = false, columnDefinition = "bigint") 20 | private long id; 21 | 22 | @ManyToOne(fetch = FetchType.LAZY) 23 | @JoinColumn(name = "course_id", nullable = false) 24 | private Course course; 25 | 26 | @ManyToOne(fetch = FetchType.LAZY) 27 | @JoinColumn(name = "user_id", nullable = false) 28 | private User user; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/domain/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * JPA domain objects. 3 | */ 4 | package com.mycompany.myapp.domain; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/AuthorityRepository.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.repository; 2 | 3 | import com.mycompany.myapp.domain.Authority; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | /** 8 | * Spring Data JPA repository for the Authority entity. 9 | */ 10 | public interface AuthorityRepository extends JpaRepository { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/CourseRepository.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.repository; 2 | 3 | import com.mycompany.myapp.domain.Course; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.data.repository.query.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface CourseRepository extends JpaRepository { 11 | 12 | @Query("SELECT Course FROM course c WHERE c.name = :courseName") 13 | Long findCourseByName(@Param("courseName") String courseName); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/PersistenceAuditEventRepository.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.repository; 2 | 3 | import com.mycompany.myapp.domain.PersistentAuditEvent; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | 8 | import java.time.Instant; 9 | import java.util.List; 10 | 11 | /** 12 | * Spring Data JPA repository for the PersistentAuditEvent entity. 13 | */ 14 | public interface PersistenceAuditEventRepository extends JpaRepository { 15 | 16 | List findByPrincipal(String principal); 17 | 18 | List findByAuditEventDateAfter(Instant after); 19 | 20 | List findByPrincipalAndAuditEventDateAfter(String principal, Instant after); 21 | 22 | List findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principle, Instant after, String type); 23 | 24 | Page findAllByAuditEventDateBetween(Instant fromDate, Instant toDate, Pageable pageable); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/UserCourseRepository.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.repository; 2 | 3 | import com.mycompany.myapp.domain.UserCourse; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface UserCourseRepository extends JpaRepository{ 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.repository; 2 | 3 | import com.mycompany.myapp.domain.User; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.data.jpa.repository.EntityGraph; 8 | import org.springframework.data.jpa.repository.JpaRepository; 9 | import org.springframework.stereotype.Repository; 10 | import java.util.List; 11 | import java.util.Optional; 12 | import java.time.Instant; 13 | 14 | /** 15 | * Spring Data JPA repository for the User entity. 16 | */ 17 | @Repository 18 | public interface UserRepository extends JpaRepository { 19 | 20 | Optional findOneByActivationKey(String activationKey); 21 | 22 | List findAllByActivatedIsFalseAndCreatedDateBefore(Instant dateTime); 23 | 24 | Optional findOneByResetKey(String resetKey); 25 | 26 | Optional findOneByEmailIgnoreCase(String email); 27 | 28 | Optional findOneByLogin(String login); 29 | 30 | @EntityGraph(attributePaths = "authorities") 31 | Optional findOneWithAuthoritiesById(Long id); 32 | 33 | @EntityGraph(attributePaths = "authorities") 34 | Optional findOneWithAuthoritiesByLogin(String login); 35 | 36 | @EntityGraph(attributePaths = "authorities") 37 | Optional findOneWithAuthoritiesByEmail(String email); 38 | 39 | Page findAllByLoginNot(Pageable pageable, String login); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/repository/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Data JPA repositories. 3 | */ 4 | package com.mycompany.myapp.repository; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/AuthoritiesConstants.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.security; 2 | 3 | /** 4 | * Constants for Spring Security authorities. 5 | */ 6 | public final class AuthoritiesConstants { 7 | 8 | public static final String ADMIN = "ROLE_ADMIN"; 9 | 10 | public static final String USER = "ROLE_USER"; 11 | 12 | public static final String ANONYMOUS = "ROLE_ANONYMOUS"; 13 | 14 | private AuthoritiesConstants() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/SpringSecurityAuditorAware.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.security; 2 | 3 | import com.mycompany.myapp.config.Constants; 4 | 5 | import java.util.Optional; 6 | 7 | import org.springframework.data.domain.AuditorAware; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * Implementation of AuditorAware based on Spring Security. 12 | */ 13 | @Component 14 | public class SpringSecurityAuditorAware implements AuditorAware { 15 | 16 | @Override 17 | public Optional getCurrentAuditor() { 18 | return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/UserNotActivatedException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.security; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * This exception is thrown in case of a not activated user trying to authenticate. 7 | */ 8 | public class UserNotActivatedException extends AuthenticationException { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserNotActivatedException(String message) { 13 | super(message); 14 | } 15 | 16 | public UserNotActivatedException(String message, Throwable t) { 17 | super(message, t); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/jwt/JWTConfigurer.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.security.jwt; 2 | 3 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.web.DefaultSecurityFilterChain; 6 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 7 | 8 | public class JWTConfigurer extends SecurityConfigurerAdapter { 9 | 10 | public static final String AUTHORIZATION_HEADER = "Authorization"; 11 | 12 | private TokenProvider tokenProvider; 13 | 14 | public JWTConfigurer(TokenProvider tokenProvider) { 15 | this.tokenProvider = tokenProvider; 16 | } 17 | 18 | @Override 19 | public void configure(HttpSecurity http) throws Exception { 20 | JWTFilter customFilter = new JWTFilter(tokenProvider); 21 | http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/jwt/JWTFilter.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.security.jwt; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.util.StringUtils; 6 | import org.springframework.web.filter.GenericFilterBean; 7 | 8 | import javax.servlet.FilterChain; 9 | import javax.servlet.ServletException; 10 | import javax.servlet.ServletRequest; 11 | import javax.servlet.ServletResponse; 12 | import javax.servlet.http.HttpServletRequest; 13 | import java.io.IOException; 14 | 15 | /** 16 | * Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is 17 | * found. 18 | */ 19 | public class JWTFilter extends GenericFilterBean { 20 | 21 | private TokenProvider tokenProvider; 22 | 23 | public JWTFilter(TokenProvider tokenProvider) { 24 | this.tokenProvider = tokenProvider; 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) 29 | throws IOException, ServletException { 30 | HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; 31 | String jwt = resolveToken(httpServletRequest); 32 | if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) { 33 | Authentication authentication = this.tokenProvider.getAuthentication(jwt); 34 | SecurityContextHolder.getContext().setAuthentication(authentication); 35 | } 36 | filterChain.doFilter(servletRequest, servletResponse); 37 | } 38 | 39 | private String resolveToken(HttpServletRequest request){ 40 | String bearerToken = request.getHeader(JWTConfigurer.AUTHORIZATION_HEADER); 41 | if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { 42 | return bearerToken.substring(7, bearerToken.length()); 43 | } 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/security/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Security configuration. 3 | */ 4 | package com.mycompany.myapp.security; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/AuditEventService.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.service; 2 | 3 | import com.mycompany.myapp.config.audit.AuditEventConverter; 4 | import com.mycompany.myapp.repository.PersistenceAuditEventRepository; 5 | import org.springframework.boot.actuate.audit.AuditEvent; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import java.time.Instant; 12 | import java.util.Optional; 13 | 14 | /** 15 | * Service for managing audit events. 16 | *

17 | * This is the default implementation to support SpringBoot Actuator AuditEventRepository 18 | */ 19 | @Service 20 | @Transactional 21 | public class AuditEventService { 22 | 23 | private final PersistenceAuditEventRepository persistenceAuditEventRepository; 24 | 25 | private final AuditEventConverter auditEventConverter; 26 | 27 | public AuditEventService( 28 | PersistenceAuditEventRepository persistenceAuditEventRepository, 29 | AuditEventConverter auditEventConverter) { 30 | 31 | this.persistenceAuditEventRepository = persistenceAuditEventRepository; 32 | this.auditEventConverter = auditEventConverter; 33 | } 34 | 35 | public Page findAll(Pageable pageable) { 36 | return persistenceAuditEventRepository.findAll(pageable) 37 | .map(auditEventConverter::convertToAuditEvent); 38 | } 39 | 40 | public Page findByDates(Instant fromDate, Instant toDate, Pageable pageable) { 41 | return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable) 42 | .map(auditEventConverter::convertToAuditEvent); 43 | } 44 | 45 | public Optional find(Long id) { 46 | return Optional.ofNullable(persistenceAuditEventRepository.findById(id)) 47 | .filter(Optional::isPresent) 48 | .map(Optional::get) 49 | .map(auditEventConverter::convertToAuditEvent); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/dto/PasswordChangeDTO.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.service.dto; 2 | 3 | /** 4 | * A DTO representing a password change required data - current and new password. 5 | */ 6 | public class PasswordChangeDTO { 7 | private String currentPassword; 8 | private String newPassword; 9 | 10 | public PasswordChangeDTO() { 11 | // Empty constructor needed for Jackson. 12 | } 13 | 14 | public PasswordChangeDTO(String currentPassword, String newPassword) { 15 | this.currentPassword = currentPassword; 16 | this.newPassword = newPassword; 17 | } 18 | 19 | public String getCurrentPassword() { 20 | 21 | return currentPassword; 22 | } 23 | 24 | public void setCurrentPassword(String currentPassword) { 25 | this.currentPassword = currentPassword; 26 | } 27 | 28 | public String getNewPassword() { 29 | return newPassword; 30 | } 31 | 32 | public void setNewPassword(String newPassword) { 33 | this.newPassword = newPassword; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/dto/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Data Transfer Objects. 3 | */ 4 | package com.mycompany.myapp.service.dto; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/mapper/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MapStruct mappers for mapping domain objects and Data Transfer Objects. 3 | */ 4 | package com.mycompany.myapp.service.mapper; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Service layer beans. 3 | */ 4 | package com.mycompany.myapp.service; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/service/util/RandomUtil.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.service.util; 2 | 3 | import org.apache.commons.lang3.RandomStringUtils; 4 | 5 | /** 6 | * Utility class for generating random Strings. 7 | */ 8 | public final class RandomUtil { 9 | 10 | private static final int DEF_COUNT = 20; 11 | 12 | private RandomUtil() { 13 | } 14 | 15 | /** 16 | * Generate a password. 17 | * 18 | * @return the generated password 19 | */ 20 | public static String generatePassword() { 21 | return RandomStringUtils.randomAlphanumeric(DEF_COUNT); 22 | } 23 | 24 | /** 25 | * Generate an activation key. 26 | * 27 | * @return the generated activation key 28 | */ 29 | public static String generateActivationKey() { 30 | return RandomStringUtils.randomNumeric(DEF_COUNT); 31 | } 32 | 33 | /** 34 | * Generate a reset key. 35 | * 36 | * @return the generated reset key 37 | */ 38 | public static String generateResetKey() { 39 | return RandomStringUtils.randomNumeric(DEF_COUNT); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/LogsResource.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest; 2 | 3 | import com.mycompany.myapp.web.rest.vm.LoggerVM; 4 | 5 | import ch.qos.logback.classic.Level; 6 | import ch.qos.logback.classic.LoggerContext; 7 | import com.codahale.metrics.annotation.Timed; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | /** 16 | * Controller for view and managing Log Level at runtime. 17 | */ 18 | @RestController 19 | @RequestMapping("/management") 20 | public class LogsResource { 21 | 22 | @GetMapping("/logs") 23 | @Timed 24 | public List getList() { 25 | LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); 26 | return context.getLoggerList() 27 | .stream() 28 | .map(LoggerVM::new) 29 | .collect(Collectors.toList()); 30 | } 31 | 32 | @PutMapping("/logs") 33 | @ResponseStatus(HttpStatus.NO_CONTENT) 34 | @Timed 35 | public void changeLevel(@RequestBody LoggerVM jsonLogger) { 36 | LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); 37 | context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/BadRequestAlertException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | import java.net.URI; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | public class BadRequestAlertException extends AbstractThrowableProblem { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | private final String entityName; 15 | 16 | private final String errorKey; 17 | 18 | public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { 19 | this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); 20 | } 21 | 22 | public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { 23 | super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); 24 | this.entityName = entityName; 25 | this.errorKey = errorKey; 26 | } 27 | 28 | public String getEntityName() { 29 | return entityName; 30 | } 31 | 32 | public String getErrorKey() { 33 | return errorKey; 34 | } 35 | 36 | private static Map getAlertParameters(String entityName, String errorKey) { 37 | Map parameters = new HashMap<>(); 38 | parameters.put("message", "error." + errorKey); 39 | parameters.put("params", entityName); 40 | return parameters; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/CustomParameterizedException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | import static org.zalando.problem.Status.BAD_REQUEST; 9 | 10 | /** 11 | * Custom, parameterized exception, which can be translated on the client side. 12 | * For example: 13 | * 14 | *

15 |  * throw new CustomParameterizedException("myCustomError", "hello", "world");
16 |  * 
17 | * 18 | * Can be translated with: 19 | * 20 | *
21 |  * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
22 |  * 
23 | */ 24 | public class CustomParameterizedException extends AbstractThrowableProblem { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | private static final String PARAM = "param"; 29 | 30 | public CustomParameterizedException(String message, String... params) { 31 | this(message, toParamMap(params)); 32 | } 33 | 34 | public CustomParameterizedException(String message, Map paramMap) { 35 | super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); 36 | } 37 | 38 | public static Map toParamMap(String... params) { 39 | Map paramMap = new HashMap<>(); 40 | if (params != null && params.length > 0) { 41 | for (int i = 0; i < params.length; i++) { 42 | paramMap.put(PARAM + i, params[i]); 43 | } 44 | } 45 | return paramMap; 46 | } 47 | 48 | public static Map toProblemParameters(String message, Map paramMap) { 49 | Map parameters = new HashMap<>(); 50 | parameters.put("message", message); 51 | parameters.put("params", paramMap); 52 | return parameters; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/EmailAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | public class EmailAlreadyUsedException extends BadRequestAlertException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public EmailAlreadyUsedException() { 8 | super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/EmailNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | public class EmailNotFoundException extends AbstractThrowableProblem { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | public EmailNotFoundException() { 11 | super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/ErrorConstants.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import java.net.URI; 4 | 5 | public final class ErrorConstants { 6 | 7 | public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; 8 | public static final String ERR_VALIDATION = "error.validation"; 9 | public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; 10 | public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); 11 | public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); 12 | public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); 13 | public static final URI ENTITY_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/entity-not-found"); 14 | public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); 15 | public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); 16 | public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); 17 | public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); 18 | 19 | private ErrorConstants() { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/FieldErrorVM.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import java.io.Serializable; 4 | 5 | public class FieldErrorVM implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private final String objectName; 10 | 11 | private final String field; 12 | 13 | private final String message; 14 | 15 | public FieldErrorVM(String dto, String field, String message) { 16 | this.objectName = dto; 17 | this.field = field; 18 | this.message = message; 19 | } 20 | 21 | public String getObjectName() { 22 | return objectName; 23 | } 24 | 25 | public String getField() { 26 | return field; 27 | } 28 | 29 | public String getMessage() { 30 | return message; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/InternalServerErrorException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | /** 7 | * Simple exception with a message, that returns an Internal Server Error code. 8 | */ 9 | public class InternalServerErrorException extends AbstractThrowableProblem { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public InternalServerErrorException(String message) { 14 | super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/InvalidPasswordException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | public class InvalidPasswordException extends AbstractThrowableProblem { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | public InvalidPasswordException() { 11 | super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/LoginAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.errors; 2 | 3 | public class LoginAlreadyUsedException extends BadRequestAlertException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public LoginAlreadyUsedException() { 8 | super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/errors/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Specific errors used with Zalando's "problem-spring-web" library. 3 | * 4 | * More information on https://github.com/zalando/problem-spring-web 5 | */ 6 | package com.mycompany.myapp.web.rest.errors; 7 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring MVC REST controllers. 3 | */ 4 | package com.mycompany.myapp.web.rest; 5 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/util/HeaderUtil.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.http.HttpHeaders; 6 | 7 | /** 8 | * Utility class for HTTP headers creation. 9 | */ 10 | public final class HeaderUtil { 11 | 12 | private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); 13 | 14 | private static final String APPLICATION_NAME = "jiuzhangquanzhankeApp"; 15 | 16 | private HeaderUtil() { 17 | } 18 | 19 | public static HttpHeaders createAlert(String message, String param) { 20 | HttpHeaders headers = new HttpHeaders(); 21 | headers.add("X-" + APPLICATION_NAME + "-alert", message); 22 | headers.add("X-" + APPLICATION_NAME + "-params", param); 23 | return headers; 24 | } 25 | 26 | public static HttpHeaders createEntityCreationAlert(String entityName, String param) { 27 | return createAlert("A new " + entityName + " is created with identifier " + param, param); 28 | } 29 | 30 | public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { 31 | return createAlert("A " + entityName + " is updated with identifier " + param, param); 32 | } 33 | 34 | public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { 35 | return createAlert("A " + entityName + " is deleted with identifier " + param, param); 36 | } 37 | 38 | public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { 39 | log.error("Entity processing failed, {}", defaultMessage); 40 | HttpHeaders headers = new HttpHeaders(); 41 | headers.add("X-" + APPLICATION_NAME + "-error", defaultMessage); 42 | headers.add("X-" + APPLICATION_NAME + "-params", entityName); 43 | return headers; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/util/PaginationUtil.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.util; 2 | 3 | import org.springframework.data.domain.Page; 4 | import org.springframework.http.HttpHeaders; 5 | import org.springframework.web.util.UriComponentsBuilder; 6 | 7 | /** 8 | * Utility class for handling pagination. 9 | * 10 | *

11 | * Pagination uses the same principles as the GitHub API, 12 | * and follow RFC 5988 (Link header). 13 | */ 14 | public final class PaginationUtil { 15 | 16 | private PaginationUtil() { 17 | } 18 | 19 | public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) { 20 | 21 | HttpHeaders headers = new HttpHeaders(); 22 | headers.add("X-Total-Count", Long.toString(page.getTotalElements())); 23 | String link = ""; 24 | if ((page.getNumber() + 1) < page.getTotalPages()) { 25 | link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\","; 26 | } 27 | // prev link 28 | if ((page.getNumber()) > 0) { 29 | link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\","; 30 | } 31 | // last and first link 32 | int lastPage = 0; 33 | if (page.getTotalPages() > 0) { 34 | lastPage = page.getTotalPages() - 1; 35 | } 36 | link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\","; 37 | link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\""; 38 | headers.add(HttpHeaders.LINK, link); 39 | return headers; 40 | } 41 | 42 | private static String generateUri(String baseUrl, int page, int size) { 43 | return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/vm/KeyAndPasswordVM.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.vm; 2 | 3 | /** 4 | * View Model object for storing the user's key and password. 5 | */ 6 | public class KeyAndPasswordVM { 7 | 8 | private String key; 9 | 10 | private String newPassword; 11 | 12 | public String getKey() { 13 | return key; 14 | } 15 | 16 | public void setKey(String key) { 17 | this.key = key; 18 | } 19 | 20 | public String getNewPassword() { 21 | return newPassword; 22 | } 23 | 24 | public void setNewPassword(String newPassword) { 25 | this.newPassword = newPassword; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/vm/LoggerVM.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.vm; 2 | 3 | import ch.qos.logback.classic.Logger; 4 | 5 | /** 6 | * View Model object for storing a Logback logger. 7 | */ 8 | public class LoggerVM { 9 | 10 | private String name; 11 | 12 | private String level; 13 | 14 | public LoggerVM(Logger logger) { 15 | this.name = logger.getName(); 16 | this.level = logger.getEffectiveLevel().toString(); 17 | } 18 | 19 | public LoggerVM() { 20 | // Empty public constructor used by Jackson. 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getLevel() { 32 | return level; 33 | } 34 | 35 | public void setLevel(String level) { 36 | this.level = level; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "LoggerVM{" + 42 | "name='" + name + '\'' + 43 | ", level='" + level + '\'' + 44 | '}'; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/vm/LoginVM.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.vm; 2 | 3 | import javax.validation.constraints.NotNull; 4 | import javax.validation.constraints.Size; 5 | 6 | /** 7 | * View Model object for storing a user's credentials. 8 | */ 9 | public class LoginVM { 10 | 11 | @NotNull 12 | @Size(min = 1, max = 50) 13 | private String username; 14 | 15 | @NotNull 16 | @Size(min = ManagedUserVM.PASSWORD_MIN_LENGTH, max = ManagedUserVM.PASSWORD_MAX_LENGTH) 17 | private String password; 18 | 19 | private Boolean rememberMe; 20 | 21 | public String getUsername() { 22 | return username; 23 | } 24 | 25 | public void setUsername(String username) { 26 | this.username = username; 27 | } 28 | 29 | public String getPassword() { 30 | return password; 31 | } 32 | 33 | public void setPassword(String password) { 34 | this.password = password; 35 | } 36 | 37 | public Boolean isRememberMe() { 38 | return rememberMe; 39 | } 40 | 41 | public void setRememberMe(Boolean rememberMe) { 42 | this.rememberMe = rememberMe; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "LoginVM{" + 48 | "username='" + username + '\'' + 49 | ", rememberMe=" + rememberMe + 50 | '}'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/vm/ManagedUserVM.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.vm; 2 | 3 | import com.mycompany.myapp.service.dto.UserDTO; 4 | import javax.validation.constraints.Size; 5 | 6 | /** 7 | * View Model extending the UserDTO, which is meant to be used in the user management UI. 8 | */ 9 | public class ManagedUserVM extends UserDTO { 10 | 11 | public static final int PASSWORD_MIN_LENGTH = 4; 12 | 13 | public static final int PASSWORD_MAX_LENGTH = 100; 14 | 15 | @Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH) 16 | private String password; 17 | 18 | public ManagedUserVM() { 19 | // Empty constructor needed for Jackson. 20 | } 21 | 22 | public String getPassword() { 23 | return password; 24 | } 25 | 26 | public void setPassword(String password) { 27 | this.password = password; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "ManagedUserVM{" + 33 | "} " + super.toString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mycompany/myapp/web/rest/vm/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * View Models used by Spring MVC REST controllers. 3 | */ 4 | package com.mycompany.myapp.web.rest.vm; 5 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ 3 | ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ 4 | ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ 5 | ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ 6 | ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ 7 | ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ 8 | 9 | ${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: 10 | :: https://www.jhipster.tech ::${AnsiColor.DEFAULT} 11 | -------------------------------------------------------------------------------- /src/main/resources/config/bootstrap-prod.yml: -------------------------------------------------------------------------------- 1 | # =================================================================== 2 | # Spring Cloud Config bootstrap configuration for the "prod" profile 3 | # =================================================================== 4 | 5 | spring: 6 | cloud: 7 | config: 8 | fail-fast: true 9 | retry: 10 | initial-interval: 1000 11 | max-interval: 2000 12 | max-attempts: 100 13 | uri: http://admin:${jhipster.registry.password}@localhost:8761/config 14 | # name of the config server's property source (file.yml) that we want to use 15 | name: jiuzhangquanzhanke 16 | profile: prod # profile(s) of the property source 17 | label: master # toggle to switch to a different version of the configuration as stored in git 18 | # it can be set to any label, branch or commit of the configuration source Git repository 19 | 20 | jhipster: 21 | registry: 22 | password: admin 23 | -------------------------------------------------------------------------------- /src/main/resources/config/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # =================================================================== 2 | # Spring Cloud Config bootstrap configuration for the "dev" profile 3 | # In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml 4 | # =================================================================== 5 | 6 | jhipster: 7 | registry: 8 | password: admin 9 | 10 | spring: 11 | application: 12 | name: jiuzhangquanzhanke 13 | profiles: 14 | # The commented value for `active` can be replaced with valid Spring profiles to load. 15 | # Otherwise, it will be filled in by maven when building the WAR file 16 | # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` 17 | active: #spring.profiles.active# 18 | cloud: 19 | config: 20 | fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config 21 | uri: http://admin:${jhipster.registry.password}@localhost:8761/config 22 | # name of the config server's property source (file.yml) that we want to use 23 | name: jiuzhangquanzhanke 24 | profile: dev # profile(s) of the property source 25 | label: master # toggle to switch to a different version of the configuration as stored in git 26 | # it can be set to any label, branch or commit of the configuration source Git repository 27 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/authorities.csv: -------------------------------------------------------------------------------- 1 | name 2 | ROLE_ADMIN 3 | ROLE_USER 4 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803183131_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803184842_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803185046_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803190054_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803191305_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/changelog/20180803191436_changelog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/master.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/users.csv: -------------------------------------------------------------------------------- 1 | id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by 2 | 1;system;$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG;System;System;system@localhost;;true;en;system;system 3 | 2;anonymoususer;$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO;Anonymous;User;anonymous@localhost;;true;en;system;system 4 | 3;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;en;system;system 5 | 4;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;en;system;system 6 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/users_authorities.csv: -------------------------------------------------------------------------------- 1 | user_id;authority_name 2 | 1;ROLE_ADMIN 3 | 1;ROLE_USER 4 | 3;ROLE_ADMIN 5 | 3;ROLE_USER 6 | 4;ROLE_USER 7 | -------------------------------------------------------------------------------- /src/main/resources/i18n/messages.properties: -------------------------------------------------------------------------------- 1 | # Error page 2 | error.title=Your request cannot be processed 3 | error.subtitle=Sorry, an error has occurred. 4 | error.status=Status: 5 | error.message=Message: 6 | 7 | # Activation email 8 | email.activation.title=jiuzhangquanzhanke account activation 9 | email.activation.greeting=Dear {0} 10 | email.activation.text1=Your jiuzhangquanzhanke account has been created, please click on the URL below to activate it: 11 | email.activation.text2=Regards, 12 | email.signature=jiuzhangquanzhanke Team. 13 | 14 | # Creation email 15 | email.creation.text1=Your jiuzhangquanzhanke account has been created, please click on the URL below to access it: 16 | 17 | # Reset email 18 | email.reset.title=jiuzhangquanzhanke password reset 19 | email.reset.greeting=Dear {0} 20 | email.reset.text1=For your jiuzhangquanzhanke account a password reset was requested, please click on the URL below to reset it: 21 | email.reset.text2=Regards, 22 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/activationEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster activation 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | Your JHipster account has been created, please click on the URL below to activate it: 14 |

15 |

16 | 17 | Activation Link 19 | 20 |

21 |

22 | Regards, 23 |
24 | JHipster. 25 |

26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/creationEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster creation 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | Your JHipster account has been created, please click on the URL below to access it: 14 |

15 |

16 | 17 | Login link 19 | 20 |

21 |

22 | Regards, 23 |
24 | JHipster. 25 |

26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/passwordResetEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster password reset 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | For your JHipster account a password reset was requested, please click on the URL below to reset it: 14 |

15 |

16 | 17 | Login link 19 | 20 |

21 |

22 | Regards, 23 |
24 | JHipster. 25 |

26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/webapp/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page Not Found 6 | 7 | 8 | 55 | 56 | 57 |

Page Not Found

58 |

Sorry, but the page you were trying to view does not exist.

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/account.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { JiuzhangquanzhankeSharedModule } from 'app/shared'; 5 | 6 | import { 7 | PasswordStrengthBarComponent, 8 | RegisterComponent, 9 | ActivateComponent, 10 | PasswordComponent, 11 | PasswordResetInitComponent, 12 | PasswordResetFinishComponent, 13 | SettingsComponent, 14 | accountState 15 | } from './'; 16 | 17 | @NgModule({ 18 | imports: [JiuzhangquanzhankeSharedModule, RouterModule.forChild(accountState)], 19 | declarations: [ 20 | ActivateComponent, 21 | RegisterComponent, 22 | PasswordComponent, 23 | PasswordStrengthBarComponent, 24 | PasswordResetInitComponent, 25 | PasswordResetFinishComponent, 26 | SettingsComponent 27 | ], 28 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 29 | }) 30 | export class JiuzhangquanzhankeAccountModule {} 31 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/account.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute } from './'; 4 | 5 | const ACCOUNT_ROUTES = [activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute]; 6 | 7 | export const accountState: Routes = [ 8 | { 9 | path: '', 10 | children: ACCOUNT_ROUTES 11 | } 12 | ]; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Activation

5 | 6 |
7 | Your user account has been activated. Please 8 | sign in. 9 |
10 | 11 |
12 | Your user could not be activated. Please use the registration form to sign up. 13 |
14 | 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | 5 | import { LoginModalService } from 'app/core'; 6 | import { ActivateService } from './activate.service'; 7 | 8 | @Component({ 9 | selector: 'jhi-activate', 10 | templateUrl: './activate.component.html' 11 | }) 12 | export class ActivateComponent implements OnInit { 13 | error: string; 14 | success: string; 15 | modalRef: NgbModalRef; 16 | 17 | constructor(private activateService: ActivateService, private loginModalService: LoginModalService, private route: ActivatedRoute) {} 18 | 19 | ngOnInit() { 20 | this.route.queryParams.subscribe(params => { 21 | this.activateService.get(params['key']).subscribe( 22 | () => { 23 | this.error = null; 24 | this.success = 'OK'; 25 | }, 26 | () => { 27 | this.success = null; 28 | this.error = 'ERROR'; 29 | } 30 | ); 31 | }); 32 | } 33 | 34 | login() { 35 | this.modalRef = this.loginModalService.open(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from 'app/core'; 4 | import { ActivateComponent } from './activate.component'; 5 | 6 | export const activateRoute: Route = { 7 | path: 'activate', 8 | component: ActivateComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'Activation' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpParams } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class ActivateService { 9 | constructor(private http: HttpClient) {} 10 | 11 | get(key: string): Observable { 12 | return this.http.get(SERVER_API_URL + 'api/activate', { 13 | params: new HttpParams().set('key', key) 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/index.ts: -------------------------------------------------------------------------------- 1 | export * from './activate/activate.component'; 2 | export * from './activate/activate.service'; 3 | export * from './activate/activate.route'; 4 | export * from './password/password.component'; 5 | export * from './password/password-strength-bar.component'; 6 | export * from './password/password.service'; 7 | export * from './password/password.route'; 8 | export * from './password-reset/finish/password-reset-finish.component'; 9 | export * from './password-reset/finish/password-reset-finish.service'; 10 | export * from './password-reset/finish/password-reset-finish.route'; 11 | export * from './password-reset/init/password-reset-init.component'; 12 | export * from './password-reset/init/password-reset-init.service'; 13 | export * from './password-reset/init/password-reset-init.route'; 14 | export * from './register/register.component'; 15 | export * from './register/register.service'; 16 | export * from './register/register.route'; 17 | export * from './settings/settings.component'; 18 | export * from './settings/settings.route'; 19 | export * from './account.route'; 20 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { PasswordResetFinishComponent } from './password-reset-finish.component'; 4 | 5 | export const passwordResetFinishRoute: Route = { 6 | path: 'reset/finish', 7 | component: PasswordResetFinishComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'Password' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class PasswordResetFinishService { 9 | constructor(private http: HttpClient) {} 10 | 11 | save(keyAndPassword: any): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/reset-password/finish', keyAndPassword); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, AfterViewInit, Renderer, ElementRef } from '@angular/core'; 2 | import { EMAIL_NOT_FOUND_TYPE } from 'app/shared'; 3 | import { PasswordResetInitService } from './password-reset-init.service'; 4 | 5 | @Component({ 6 | selector: 'jhi-password-reset-init', 7 | templateUrl: './password-reset-init.component.html' 8 | }) 9 | export class PasswordResetInitComponent implements OnInit, AfterViewInit { 10 | error: string; 11 | errorEmailNotExists: string; 12 | resetAccount: any; 13 | success: string; 14 | 15 | constructor(private passwordResetInitService: PasswordResetInitService, private elementRef: ElementRef, private renderer: Renderer) {} 16 | 17 | ngOnInit() { 18 | this.resetAccount = {}; 19 | } 20 | 21 | ngAfterViewInit() { 22 | this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#email'), 'focus', []); 23 | } 24 | 25 | requestReset() { 26 | this.error = null; 27 | this.errorEmailNotExists = null; 28 | 29 | this.passwordResetInitService.save(this.resetAccount.email).subscribe( 30 | () => { 31 | this.success = 'OK'; 32 | }, 33 | response => { 34 | this.success = null; 35 | if (response.status === 400 && response.error.type === EMAIL_NOT_FOUND_TYPE) { 36 | this.errorEmailNotExists = 'ERROR'; 37 | } else { 38 | this.error = 'ERROR'; 39 | } 40 | } 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { PasswordResetInitComponent } from './password-reset-init.component'; 4 | 5 | export const passwordResetInitRoute: Route = { 6 | path: 'reset/request', 7 | component: PasswordResetInitComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'Password' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class PasswordResetInitService { 9 | constructor(private http: HttpClient) {} 10 | 11 | save(mail: string): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/reset-password/init', mail); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password-strength-bar.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | start Password strength bar style 3 | ========================================================================== */ 4 | ul#strengthBar { 5 | display: inline; 6 | list-style: none; 7 | margin: 0; 8 | margin-left: 15px; 9 | padding: 0; 10 | vertical-align: 2px; 11 | } 12 | 13 | .point:last { 14 | margin: 0 !important; 15 | } 16 | .point { 17 | background: #ddd; 18 | border-radius: 2px; 19 | display: inline-block; 20 | height: 5px; 21 | margin-right: 1px; 22 | width: 20px; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Principal } from 'app/core'; 4 | import { PasswordService } from './password.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-password', 8 | templateUrl: './password.component.html' 9 | }) 10 | export class PasswordComponent implements OnInit { 11 | doNotMatch: string; 12 | error: string; 13 | success: string; 14 | account: any; 15 | currentPassword: string; 16 | newPassword: string; 17 | confirmPassword: string; 18 | 19 | constructor(private passwordService: PasswordService, private principal: Principal) {} 20 | 21 | ngOnInit() { 22 | this.principal.identity().then(account => { 23 | this.account = account; 24 | }); 25 | } 26 | 27 | changePassword() { 28 | if (this.newPassword !== this.confirmPassword) { 29 | this.error = null; 30 | this.success = null; 31 | this.doNotMatch = 'ERROR'; 32 | } else { 33 | this.doNotMatch = null; 34 | this.passwordService.save(this.newPassword, this.currentPassword).subscribe( 35 | () => { 36 | this.error = null; 37 | this.success = 'OK'; 38 | }, 39 | () => { 40 | this.success = null; 41 | this.error = 'ERROR'; 42 | } 43 | ); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from 'app/core'; 4 | import { PasswordComponent } from './password.component'; 5 | 6 | export const passwordRoute: Route = { 7 | path: 'password', 8 | component: PasswordComponent, 9 | data: { 10 | authorities: ['ROLE_USER'], 11 | pageTitle: 'Password' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class PasswordService { 9 | constructor(private http: HttpClient) {} 10 | 11 | save(newPassword: string, currentPassword: string): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/change-password', { currentPassword, newPassword }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/register/register.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | export const registerRoute: Route = { 6 | path: 'register', 7 | component: RegisterComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'Registration' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/register/register.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class Register { 9 | constructor(private http: HttpClient) {} 10 | 11 | save(account: any): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/register', account); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/settings/settings.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Principal, AccountService } from 'app/core'; 4 | 5 | @Component({ 6 | selector: 'jhi-settings', 7 | templateUrl: './settings.component.html' 8 | }) 9 | export class SettingsComponent implements OnInit { 10 | error: string; 11 | success: string; 12 | settingsAccount: any; 13 | languages: any[]; 14 | 15 | constructor(private account: AccountService, private principal: Principal) {} 16 | 17 | ngOnInit() { 18 | this.principal.identity().then(account => { 19 | this.settingsAccount = this.copyAccount(account); 20 | }); 21 | } 22 | 23 | save() { 24 | this.account.save(this.settingsAccount).subscribe( 25 | () => { 26 | this.error = null; 27 | this.success = 'OK'; 28 | this.principal.identity(true).then(account => { 29 | this.settingsAccount = this.copyAccount(account); 30 | }); 31 | }, 32 | () => { 33 | this.success = null; 34 | this.error = 'ERROR'; 35 | } 36 | ); 37 | } 38 | 39 | copyAccount(account) { 40 | return { 41 | activated: account.activated, 42 | email: account.email, 43 | firstName: account.firstName, 44 | langKey: account.langKey, 45 | lastName: account.lastName, 46 | login: account.login, 47 | imageUrl: account.imageUrl 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/settings/settings.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from 'app/core'; 4 | import { SettingsComponent } from './settings.component'; 5 | 6 | export const settingsRoute: Route = { 7 | path: 'settings', 8 | component: SettingsComponent, 9 | data: { 10 | authorities: ['ROLE_USER'], 11 | pageTitle: 'Settings' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { JiuzhangquanzhankeSharedModule } from 'app/shared'; 4 | /* jhipster-needle-add-admin-module-import - JHipster will add admin modules imports here */ 5 | 6 | import { 7 | adminState, 8 | AuditsComponent, 9 | UserMgmtComponent, 10 | UserMgmtDetailComponent, 11 | UserMgmtUpdateComponent, 12 | UserMgmtDeleteDialogComponent, 13 | LogsComponent, 14 | JhiMetricsMonitoringModalComponent, 15 | JhiMetricsMonitoringComponent, 16 | JhiHealthModalComponent, 17 | JhiHealthCheckComponent, 18 | JhiConfigurationComponent, 19 | JhiDocsComponent 20 | } from './'; 21 | 22 | @NgModule({ 23 | imports: [ 24 | JiuzhangquanzhankeSharedModule, 25 | RouterModule.forChild(adminState) 26 | /* jhipster-needle-add-admin-module - JHipster will add admin modules here */ 27 | ], 28 | declarations: [ 29 | AuditsComponent, 30 | UserMgmtComponent, 31 | UserMgmtDetailComponent, 32 | UserMgmtUpdateComponent, 33 | UserMgmtDeleteDialogComponent, 34 | LogsComponent, 35 | JhiConfigurationComponent, 36 | JhiHealthCheckComponent, 37 | JhiHealthModalComponent, 38 | JhiDocsComponent, 39 | JhiMetricsMonitoringComponent, 40 | JhiMetricsMonitoringModalComponent 41 | ], 42 | entryComponents: [UserMgmtDeleteDialogComponent, JhiHealthModalComponent, JhiMetricsMonitoringModalComponent], 43 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 44 | }) 45 | export class JiuzhangquanzhankeAdminModule {} 46 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/admin.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { auditsRoute, configurationRoute, docsRoute, healthRoute, logsRoute, metricsRoute, userMgmtRoute } from './'; 4 | 5 | import { UserRouteAccessService } from 'app/core'; 6 | 7 | const ADMIN_ROUTES = [auditsRoute, configurationRoute, docsRoute, healthRoute, logsRoute, ...userMgmtRoute, metricsRoute]; 8 | 9 | export const adminState: Routes = [ 10 | { 11 | path: '', 12 | data: { 13 | authorities: ['ROLE_ADMIN'] 14 | }, 15 | canActivate: [UserRouteAccessService], 16 | children: ADMIN_ROUTES 17 | } 18 | ]; 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audit-data.model.ts: -------------------------------------------------------------------------------- 1 | export class AuditData { 2 | constructor(public remoteAddress: string, public sessionId: string) {} 3 | } 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audit.model.ts: -------------------------------------------------------------------------------- 1 | import { AuditData } from './audit-data.model'; 2 | 3 | export class Audit { 4 | constructor(public data: AuditData, public principal: string, public timestamp: string, public type: string) {} 5 | } 6 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audits.route.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Route } from '@angular/router'; 3 | import { JhiPaginationUtil, JhiResolvePagingParams } from 'ng-jhipster'; 4 | 5 | import { AuditsComponent } from './audits.component'; 6 | 7 | export const auditsRoute: Route = { 8 | path: 'audits', 9 | component: AuditsComponent, 10 | resolve: { 11 | pagingParams: JhiResolvePagingParams 12 | }, 13 | data: { 14 | pageTitle: 'Audits', 15 | defaulSort: 'auditEventDate,desc' 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audits.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { createRequestOption } from 'app/shared'; 6 | import { SERVER_API_URL } from 'app/app.constants'; 7 | import { Audit } from './audit.model'; 8 | 9 | @Injectable({ providedIn: 'root' }) 10 | export class AuditsService { 11 | constructor(private http: HttpClient) {} 12 | 13 | query(req: any): Observable> { 14 | const params: HttpParams = createRequestOption(req); 15 | params.set('fromDate', req.fromDate); 16 | params.set('toDate', req.toDate); 17 | 18 | const requestURL = SERVER_API_URL + 'management/audits'; 19 | 20 | return this.http.get(requestURL, { 21 | params, 22 | observe: 'response' 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Configuration

3 | 4 | Filter (by prefix) 5 |

Spring configuration

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 |
PrefixProperties
{{entry.prefix}} 17 |
18 |
{{key}}
19 |
20 | {{entry.properties[key] | json}} 21 |
22 |
23 |
27 |
28 |

{{key}}

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 |
PropertyValue
{{item.key}} 40 | {{item.val}} 41 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { JhiConfigurationService } from './configuration.service'; 4 | 5 | @Component({ 6 | selector: 'jhi-configuration', 7 | templateUrl: './configuration.component.html' 8 | }) 9 | export class JhiConfigurationComponent implements OnInit { 10 | allConfiguration: any = null; 11 | configuration: any = null; 12 | configKeys: any[]; 13 | filter: string; 14 | orderProp: string; 15 | reverse: boolean; 16 | 17 | constructor(private configurationService: JhiConfigurationService) { 18 | this.configKeys = []; 19 | this.filter = ''; 20 | this.orderProp = 'prefix'; 21 | this.reverse = false; 22 | } 23 | 24 | keys(dict): Array { 25 | return dict === undefined ? [] : Object.keys(dict); 26 | } 27 | 28 | ngOnInit() { 29 | this.configurationService.get().subscribe(configuration => { 30 | this.configuration = configuration; 31 | 32 | for (const config of configuration) { 33 | if (config.properties !== undefined) { 34 | this.configKeys.push(Object.keys(config.properties)); 35 | } 36 | } 37 | }); 38 | 39 | this.configurationService.getEnv().subscribe(configuration => { 40 | this.allConfiguration = configuration; 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiConfigurationComponent } from './configuration.component'; 4 | 5 | export const configurationRoute: Route = { 6 | path: 'jhi-configuration', 7 | component: JhiConfigurationComponent, 8 | data: { 9 | pageTitle: 'Configuration' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.component.html: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'jhi-docs', 5 | templateUrl: './docs.component.html' 6 | }) 7 | export class JhiDocsComponent { 8 | constructor() {} 9 | } 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiDocsComponent } from './docs.component'; 4 | 5 | export const docsRoute: Route = { 6 | path: 'docs', 7 | component: JhiDocsComponent, 8 | data: { 9 | pageTitle: 'API' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health-modal.component.html: -------------------------------------------------------------------------------- 1 | 8 | 33 | 36 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiHealthService } from './health.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-health-modal', 8 | templateUrl: './health-modal.component.html' 9 | }) 10 | export class JhiHealthModalComponent { 11 | currentHealth: any; 12 | 13 | constructor(private healthService: JhiHealthService, public activeModal: NgbActiveModal) {} 14 | 15 | baseName(name) { 16 | return this.healthService.getBaseName(name); 17 | } 18 | 19 | subSystemName(name) { 20 | return this.healthService.getSubSystemName(name); 21 | } 22 | 23 | readableValue(value: number) { 24 | if (this.currentHealth.name === 'diskSpace') { 25 | // Should display storage space in an human readable unit 26 | const val = value / 1073741824; 27 | if (val > 1) { 28 | // Value 29 | return val.toFixed(2) + ' GB'; 30 | } else { 31 | return (value / 1048576).toFixed(2) + ' MB'; 32 | } 33 | } 34 | 35 | if (typeof value === 'object') { 36 | return JSON.stringify(value); 37 | } else { 38 | return value.toString(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Health Checks 4 | 7 |

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 30 | 31 | 32 |
Service NameStatusDetails
{{ baseName(health.name) }} {{subSystemName(health.name)}} 21 | 22 | {{health.status}} 23 | 24 | 26 | 27 | 28 | 29 |
33 |
34 |
35 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiHealthService } from './health.service'; 5 | import { JhiHealthModalComponent } from './health-modal.component'; 6 | 7 | @Component({ 8 | selector: 'jhi-health', 9 | templateUrl: './health.component.html' 10 | }) 11 | export class JhiHealthCheckComponent implements OnInit { 12 | healthData: any; 13 | updatingHealth: boolean; 14 | 15 | constructor(private modalService: NgbModal, private healthService: JhiHealthService) {} 16 | 17 | ngOnInit() { 18 | this.refresh(); 19 | } 20 | 21 | baseName(name: string) { 22 | return this.healthService.getBaseName(name); 23 | } 24 | 25 | getBadgeClass(statusState) { 26 | if (statusState === 'UP') { 27 | return 'badge-success'; 28 | } else { 29 | return 'badge-danger'; 30 | } 31 | } 32 | 33 | refresh() { 34 | this.updatingHealth = true; 35 | 36 | this.healthService.checkHealth().subscribe( 37 | health => { 38 | this.healthData = this.healthService.transformHealthData(health); 39 | this.updatingHealth = false; 40 | }, 41 | error => { 42 | if (error.status === 503) { 43 | this.healthData = this.healthService.transformHealthData(error.error); 44 | this.updatingHealth = false; 45 | } 46 | } 47 | ); 48 | } 49 | 50 | showHealth(health: any) { 51 | const modalRef = this.modalService.open(JhiHealthModalComponent); 52 | modalRef.componentInstance.currentHealth = health; 53 | modalRef.result.then( 54 | result => { 55 | // Left blank intentionally, nothing to do here 56 | }, 57 | reason => { 58 | // Left blank intentionally, nothing to do here 59 | } 60 | ); 61 | } 62 | 63 | subSystemName(name: string) { 64 | return this.healthService.getSubSystemName(name); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiHealthCheckComponent } from './health.component'; 4 | 5 | export const healthRoute: Route = { 6 | path: 'jhi-health', 7 | component: JhiHealthCheckComponent, 8 | data: { 9 | pageTitle: 'Health Checks' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/index.ts: -------------------------------------------------------------------------------- 1 | export * from './audits/audits.component'; 2 | export * from './audits/audits.service'; 3 | export * from './audits/audits.route'; 4 | export * from './audits/audit.model'; 5 | export * from './audits/audit-data.model'; 6 | export * from './configuration/configuration.component'; 7 | export * from './configuration/configuration.service'; 8 | export * from './configuration/configuration.route'; 9 | export * from './docs/docs.component'; 10 | export * from './docs/docs.route'; 11 | export * from './health/health.component'; 12 | export * from './health/health-modal.component'; 13 | export * from './health/health.service'; 14 | export * from './health/health.route'; 15 | export * from './logs/logs.component'; 16 | export * from './logs/logs.service'; 17 | export * from './logs/logs.route'; 18 | export * from './logs/log.model'; 19 | export * from './metrics/metrics.component'; 20 | export * from './metrics/metrics-modal.component'; 21 | export * from './metrics/metrics.service'; 22 | export * from './metrics/metrics.route'; 23 | export * from './user-management/user-management-update.component'; 24 | export * from './user-management/user-management-delete-dialog.component'; 25 | export * from './user-management/user-management-detail.component'; 26 | export * from './user-management/user-management.component'; 27 | export * from './user-management/user-management.route'; 28 | export * from './admin.route'; 29 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/log.model.ts: -------------------------------------------------------------------------------- 1 | export class Log { 2 | constructor(public name: string, public level: string) {} 3 | } 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Logs

3 | 4 |

There are {{ loggers.length }} loggers.

5 | 6 | Filter 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 26 | 27 |
NameLevel
{{logger.name | slice:0:140}} 19 | 20 | 21 | 22 | 23 | 24 | 25 |
28 |
29 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Log } from './log.model'; 4 | import { LogsService } from './logs.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-logs', 8 | templateUrl: './logs.component.html' 9 | }) 10 | export class LogsComponent implements OnInit { 11 | loggers: Log[]; 12 | filter: string; 13 | orderProp: string; 14 | reverse: boolean; 15 | 16 | constructor(private logsService: LogsService) { 17 | this.filter = ''; 18 | this.orderProp = 'name'; 19 | this.reverse = false; 20 | } 21 | 22 | ngOnInit() { 23 | this.logsService.findAll().subscribe(response => (this.loggers = response.body)); 24 | } 25 | 26 | changeLevel(name: string, level: string) { 27 | const log = new Log(name, level); 28 | this.logsService.changeLevel(log).subscribe(() => { 29 | this.logsService.findAll().subscribe(response => (this.loggers = response.body)); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { LogsComponent } from './logs.component'; 4 | 5 | export const logsRoute: Route = { 6 | path: 'logs', 7 | component: LogsComponent, 8 | data: { 9 | pageTitle: 'Logs' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpResponse } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | import { Log } from './log.model'; 7 | 8 | @Injectable({ providedIn: 'root' }) 9 | export class LogsService { 10 | constructor(private http: HttpClient) {} 11 | 12 | changeLevel(log: Log): Observable> { 13 | return this.http.put(SERVER_API_URL + 'management/logs', log, { observe: 'response' }); 14 | } 15 | 16 | findAll(): Observable> { 17 | return this.http.get(SERVER_API_URL + 'management/logs', { observe: 'response' }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | @Component({ 5 | selector: 'jhi-metrics-modal', 6 | templateUrl: './metrics-modal.component.html' 7 | }) 8 | export class JhiMetricsMonitoringModalComponent implements OnInit { 9 | threadDumpFilter: any; 10 | threadDump: any; 11 | threadDumpAll = 0; 12 | threadDumpBlocked = 0; 13 | threadDumpRunnable = 0; 14 | threadDumpTimedWaiting = 0; 15 | threadDumpWaiting = 0; 16 | 17 | constructor(public activeModal: NgbActiveModal) {} 18 | 19 | ngOnInit() { 20 | this.threadDump.forEach(value => { 21 | if (value.threadState === 'RUNNABLE') { 22 | this.threadDumpRunnable += 1; 23 | } else if (value.threadState === 'WAITING') { 24 | this.threadDumpWaiting += 1; 25 | } else if (value.threadState === 'TIMED_WAITING') { 26 | this.threadDumpTimedWaiting += 1; 27 | } else if (value.threadState === 'BLOCKED') { 28 | this.threadDumpBlocked += 1; 29 | } 30 | }); 31 | 32 | this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked; 33 | } 34 | 35 | getBadgeClass(threadState) { 36 | if (threadState === 'RUNNABLE') { 37 | return 'badge-success'; 38 | } else if (threadState === 'WAITING') { 39 | return 'badge-info'; 40 | } else if (threadState === 'TIMED_WAITING') { 41 | return 'badge-warning'; 42 | } else if (threadState === 'BLOCKED') { 43 | return 'badge-danger'; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiMetricsMonitoringComponent } from './metrics.component'; 4 | 5 | export const metricsRoute: Route = { 6 | path: 'jhi-metrics', 7 | component: JhiMetricsMonitoringComponent, 8 | data: { 9 | pageTitle: 'Application Metrics' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class JhiMetricsService { 9 | constructor(private http: HttpClient) {} 10 | 11 | getMetrics(): Observable { 12 | return this.http.get(SERVER_API_URL + 'management/metrics'); 13 | } 14 | 15 | threadDump(): Observable { 16 | return this.http.get(SERVER_API_URL + 'management/threaddump'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 11 | 19 |
20 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | import { JhiEventManager } from 'ng-jhipster'; 4 | 5 | import { User, UserService } from 'app/core'; 6 | 7 | @Component({ 8 | selector: 'jhi-user-mgmt-delete-dialog', 9 | templateUrl: './user-management-delete-dialog.component.html' 10 | }) 11 | export class UserMgmtDeleteDialogComponent { 12 | user: User; 13 | 14 | constructor(private userService: UserService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {} 15 | 16 | clear() { 17 | this.activeModal.dismiss('cancel'); 18 | } 19 | 20 | confirmDelete(login) { 21 | this.userService.delete(login).subscribe(response => { 22 | this.eventManager.broadcast({ 23 | name: 'userListModification', 24 | content: 'Deleted a user' 25 | }); 26 | this.activeModal.dismiss(true); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 | User [{{user.login}}] 6 |

7 |
8 |
Login
9 |
10 | {{user.login}} 11 | 15 | 16 |
17 |
First Name
18 |
{{user.firstName}}
19 |
Last Name
20 |
{{user.lastName}}
21 |
Email
22 |
{{user.email}}
23 |
Created By
24 |
{{user.createdBy}}
25 |
Created Date
26 |
{{user.createdDate | date:'dd/MM/yy HH:mm' }}
27 |
Last Modified By
28 |
{{user.lastModifiedBy}}
29 |
Last Modified Date
30 |
{{user.lastModifiedDate | date:'dd/MM/yy HH:mm'}}
31 |
Profiles
32 |
33 |
    34 |
  • 35 | {{authority}} 36 |
  • 37 |
38 |
39 |
40 | 45 |
46 |
47 |
48 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | import { User } from 'app/core'; 5 | 6 | @Component({ 7 | selector: 'jhi-user-mgmt-detail', 8 | templateUrl: './user-management-detail.component.html' 9 | }) 10 | export class UserMgmtDetailComponent implements OnInit { 11 | user: User; 12 | 13 | constructor(private route: ActivatedRoute) {} 14 | 15 | ngOnInit() { 16 | this.route.data.subscribe(({ user }) => { 17 | this.user = user.body ? user.body : user; 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | 4 | import { User, UserService } from 'app/core'; 5 | 6 | @Component({ 7 | selector: 'jhi-user-mgmt-update', 8 | templateUrl: './user-management-update.component.html' 9 | }) 10 | export class UserMgmtUpdateComponent implements OnInit { 11 | user: User; 12 | languages: any[]; 13 | authorities: any[]; 14 | isSaving: boolean; 15 | 16 | constructor(private userService: UserService, private route: ActivatedRoute, private router: Router) {} 17 | 18 | ngOnInit() { 19 | this.isSaving = false; 20 | this.route.data.subscribe(({ user }) => { 21 | this.user = user.body ? user.body : user; 22 | }); 23 | this.authorities = []; 24 | this.userService.authorities().subscribe(authorities => { 25 | this.authorities = authorities; 26 | }); 27 | } 28 | 29 | previousState() { 30 | this.router.navigate(['/admin/user-management']); 31 | } 32 | 33 | save() { 34 | this.isSaving = true; 35 | if (this.user.id !== null) { 36 | this.userService.update(this.user).subscribe(response => this.onSaveSuccess(response), () => this.onSaveError()); 37 | } else { 38 | this.user.langKey = 'en'; 39 | this.userService.create(this.user).subscribe(response => this.onSaveSuccess(response), () => this.onSaveError()); 40 | } 41 | } 42 | 43 | private onSaveSuccess(result) { 44 | this.isSaving = false; 45 | this.previousState(); 46 | } 47 | 48 | private onSaveError() { 49 | this.isSaving = false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management.route.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes, CanActivate } from '@angular/router'; 3 | import { JhiPaginationUtil, JhiResolvePagingParams } from 'ng-jhipster'; 4 | 5 | import { Principal, User, UserService } from 'app/core'; 6 | import { UserMgmtComponent } from './user-management.component'; 7 | import { UserMgmtDetailComponent } from './user-management-detail.component'; 8 | import { UserMgmtUpdateComponent } from './user-management-update.component'; 9 | 10 | @Injectable({ providedIn: 'root' }) 11 | export class UserResolve implements CanActivate { 12 | constructor(private principal: Principal) {} 13 | 14 | canActivate() { 15 | return this.principal.identity().then(account => this.principal.hasAnyAuthority(['ROLE_ADMIN'])); 16 | } 17 | } 18 | 19 | @Injectable({ providedIn: 'root' }) 20 | export class UserMgmtResolve implements Resolve { 21 | constructor(private service: UserService) {} 22 | 23 | resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { 24 | const id = route.params['login'] ? route.params['login'] : null; 25 | if (id) { 26 | return this.service.find(id); 27 | } 28 | return new User(); 29 | } 30 | } 31 | 32 | export const userMgmtRoute: Routes = [ 33 | { 34 | path: 'user-management', 35 | component: UserMgmtComponent, 36 | resolve: { 37 | pagingParams: JhiResolvePagingParams 38 | }, 39 | data: { 40 | pageTitle: 'Users', 41 | defaultSort: 'id,asc' 42 | } 43 | }, 44 | { 45 | path: 'user-management/:login/view', 46 | component: UserMgmtDetailComponent, 47 | resolve: { 48 | user: UserMgmtResolve 49 | }, 50 | data: { 51 | pageTitle: 'Users' 52 | } 53 | }, 54 | { 55 | path: 'user-management/new', 56 | component: UserMgmtUpdateComponent, 57 | resolve: { 58 | user: UserMgmtResolve 59 | } 60 | }, 61 | { 62 | path: 'user-management/:login/edit', 63 | component: UserMgmtUpdateComponent, 64 | resolve: { 65 | user: UserMgmtResolve 66 | } 67 | } 68 | ]; 69 | -------------------------------------------------------------------------------- /src/main/webapp/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { errorRoute, navbarRoute } from './layouts'; 4 | import { DEBUG_INFO_ENABLED } from 'app/app.constants'; 5 | 6 | const LAYOUT_ROUTES = [navbarRoute, ...errorRoute]; 7 | 8 | @NgModule({ 9 | imports: [ 10 | RouterModule.forRoot( 11 | [ 12 | ...LAYOUT_ROUTES, 13 | { 14 | path: 'admin', 15 | loadChildren: './admin/admin.module#JiuzhangquanzhankeAdminModule' 16 | } 17 | ], 18 | { useHash: true, enableTracing: DEBUG_INFO_ENABLED } 19 | ) 20 | ], 21 | exports: [RouterModule] 22 | }) 23 | export class JiuzhangquanzhankeAppRoutingModule {} 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.constants.ts: -------------------------------------------------------------------------------- 1 | // These constants are injected via webpack environment variables. 2 | // You can add more variables in webpack.common.js or in profile specific webpack..js files. 3 | // If you change the values in the webpack config files, you need to re run webpack to update the application 4 | 5 | export const VERSION = process.env.VERSION; 6 | export const DEBUG_INFO_ENABLED: boolean = !!process.env.DEBUG_INFO_ENABLED; 7 | export const SERVER_API_URL = process.env.SERVER_API_URL; 8 | export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP; 9 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | import { ProdConfig } from './blocks/config/prod.config'; 3 | import { JiuzhangquanzhankeAppModule } from './app.module'; 4 | 5 | ProdConfig(); 6 | 7 | if (module['hot']) { 8 | module['hot'].accept(); 9 | } 10 | 11 | platformBrowserDynamic() 12 | .bootstrapModule(JiuzhangquanzhankeAppModule, { preserveWhitespaces: true }) 13 | .then(success => console.log(`Application started`)) 14 | .catch(err => console.error(err)); 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/config/prod.config.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { DEBUG_INFO_ENABLED } from 'app/app.constants'; 3 | 4 | export function ProdConfig() { 5 | // disable debug data on prod profile to improve performance 6 | if (!DEBUG_INFO_ENABLED) { 7 | enableProdMode(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/config/uib-pagination.config.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { NgbPaginationConfig } from '@ng-bootstrap/ng-bootstrap'; 3 | import { ITEMS_PER_PAGE } from 'app/shared'; 4 | 5 | @Injectable({ providedIn: 'root' }) 6 | export class PaginationConfig { 7 | // tslint:disable-next-line: no-unused-variable 8 | constructor(private config: NgbPaginationConfig) { 9 | config.boundaryLinks = true; 10 | config.maxSize = 5; 11 | config.pageSize = ITEMS_PER_PAGE; 12 | config.size = 'sm'; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injector } from '@angular/core'; 2 | import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { tap } from 'rxjs/operators'; 5 | import { LoginService } from 'app/core/login/login.service'; 6 | 7 | export class AuthExpiredInterceptor implements HttpInterceptor { 8 | constructor(private injector: Injector) {} 9 | 10 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 11 | return next.handle(request).pipe( 12 | tap( 13 | (event: HttpEvent) => {}, 14 | (err: any) => { 15 | if (err instanceof HttpErrorResponse) { 16 | if (err.status === 401) { 17 | const loginService: LoginService = this.injector.get(LoginService); 18 | loginService.logout(); 19 | } 20 | } 21 | } 22 | ) 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from 'rxjs'; 2 | import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; 3 | import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | export class AuthInterceptor implements HttpInterceptor { 8 | constructor(private localStorage: LocalStorageService, private sessionStorage: SessionStorageService) {} 9 | 10 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 11 | if (!request || !request.url || (/^http/.test(request.url) && !(SERVER_API_URL && request.url.startsWith(SERVER_API_URL)))) { 12 | return next.handle(request); 13 | } 14 | 15 | const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken'); 16 | if (!!token) { 17 | request = request.clone({ 18 | setHeaders: { 19 | Authorization: 'Bearer ' + token 20 | } 21 | }); 22 | } 23 | return next.handle(request); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { JhiEventManager } from 'ng-jhipster'; 2 | import { HttpInterceptor, HttpRequest, HttpErrorResponse, HttpHandler, HttpEvent } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { tap } from 'rxjs/operators'; 5 | 6 | export class ErrorHandlerInterceptor implements HttpInterceptor { 7 | constructor(private eventManager: JhiEventManager) {} 8 | 9 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 10 | return next.handle(request).pipe( 11 | tap( 12 | (event: HttpEvent) => {}, 13 | (err: any) => { 14 | if (err instanceof HttpErrorResponse) { 15 | if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('/api/account'))))) { 16 | if (this.eventManager !== undefined) { 17 | this.eventManager.broadcast({ name: 'jiuzhangquanzhankeApp.httpError', content: err }); 18 | } 19 | } 20 | } 21 | } 22 | ) 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/notification.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { JhiAlertService } from 'ng-jhipster'; 2 | import { HttpInterceptor, HttpRequest, HttpResponse, HttpHandler, HttpEvent } from '@angular/common/http'; 3 | import { Injector } from '@angular/core'; 4 | import { Observable } from 'rxjs'; 5 | import { tap } from 'rxjs/operators'; 6 | 7 | export class NotificationInterceptor implements HttpInterceptor { 8 | private alertService: JhiAlertService; 9 | 10 | // tslint:disable-next-line: no-unused-variable 11 | constructor(private injector: Injector) { 12 | setTimeout(() => (this.alertService = injector.get(JhiAlertService))); 13 | } 14 | 15 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 16 | return next.handle(request).pipe( 17 | tap( 18 | (event: HttpEvent) => { 19 | if (event instanceof HttpResponse) { 20 | const arr = event.headers.keys(); 21 | let alert = null; 22 | arr.forEach(entry => { 23 | if (entry.toLowerCase().endsWith('app-alert')) { 24 | alert = event.headers.get(entry); 25 | } 26 | }); 27 | if (alert) { 28 | if (typeof alert === 'string') { 29 | if (this.alertService) { 30 | this.alertService.success(alert, null, null); 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | (err: any) => {} 37 | ) 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/auth/account.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpResponse } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | 7 | @Injectable({ providedIn: 'root' }) 8 | export class AccountService { 9 | constructor(private http: HttpClient) {} 10 | 11 | get(): Observable> { 12 | return this.http.get(SERVER_API_URL + 'api/account', { observe: 'response' }); 13 | } 14 | 15 | save(account: any): Observable> { 16 | return this.http.post(SERVER_API_URL + 'api/account', account, { observe: 'response' }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/auth/csrf.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CookieService } from 'ngx-cookie'; 3 | 4 | @Injectable({ providedIn: 'root' }) 5 | export class CSRFService { 6 | constructor(private cookieService: CookieService) {} 7 | 8 | getCSRF(name?: string) { 9 | name = `${name ? name : 'XSRF-TOKEN'}`; 10 | return this.cookieService.get(name); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/auth/state-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { SessionStorageService } from 'ngx-webstorage'; 3 | 4 | @Injectable({ providedIn: 'root' }) 5 | export class StateStorageService { 6 | constructor(private $sessionStorage: SessionStorageService) {} 7 | 8 | getPreviousState() { 9 | return this.$sessionStorage.retrieve('previousState'); 10 | } 11 | 12 | resetPreviousState() { 13 | this.$sessionStorage.clear('previousState'); 14 | } 15 | 16 | storePreviousState(previousStateName, previousStateParams) { 17 | const previousState = { name: previousStateName, params: previousStateParams }; 18 | this.$sessionStorage.store('previousState', previousState); 19 | } 20 | 21 | getDestinationState() { 22 | return this.$sessionStorage.retrieve('destinationState'); 23 | } 24 | 25 | storeUrl(url: string) { 26 | this.$sessionStorage.store('previousUrl', url); 27 | } 28 | 29 | getUrl() { 30 | return this.$sessionStorage.retrieve('previousUrl'); 31 | } 32 | 33 | storeDestinationState(destinationState, destinationStateParams, fromState) { 34 | const destinationInfo = { 35 | destination: { 36 | name: destinationState.name, 37 | data: destinationState.data 38 | }, 39 | params: destinationStateParams, 40 | from: { 41 | name: fromState.name 42 | } 43 | }; 44 | this.$sessionStorage.store('destinationState', destinationInfo); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, LOCALE_ID } from '@angular/core'; 2 | import { DatePipe, registerLocaleData } from '@angular/common'; 3 | import { HttpClientModule } from '@angular/common/http'; 4 | import { Title } from '@angular/platform-browser'; 5 | import locale from '@angular/common/locales/en'; 6 | 7 | @NgModule({ 8 | imports: [HttpClientModule], 9 | exports: [], 10 | declarations: [], 11 | providers: [ 12 | Title, 13 | { 14 | provide: LOCALE_ID, 15 | useValue: 'en' 16 | }, 17 | DatePipe 18 | ] 19 | }) 20 | export class JiuzhangquanzhankeCoreModule { 21 | constructor() { 22 | registerLocaleData(locale); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './auth/csrf.service'; 2 | export * from './auth/state-storage.service'; 3 | export * from './auth/account.service'; 4 | export * from './auth/auth-jwt.service'; 5 | export * from './user/account.model'; 6 | export * from './user/user.model'; 7 | export * from './auth/principal.service'; 8 | export * from './auth/user-route-access-service'; 9 | export * from './login/login-modal.service'; 10 | export * from './login/login.service'; 11 | export * from './user/user.service'; 12 | export * from './core.module'; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/login/login-modal.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiLoginModalComponent } from 'app/shared/login/login.component'; 5 | 6 | @Injectable({ providedIn: 'root' }) 7 | export class LoginModalService { 8 | private isOpen = false; 9 | constructor(private modalService: NgbModal) {} 10 | 11 | open(): NgbModalRef { 12 | if (this.isOpen) { 13 | return; 14 | } 15 | this.isOpen = true; 16 | const modalRef = this.modalService.open(JhiLoginModalComponent); 17 | modalRef.result.then( 18 | result => { 19 | this.isOpen = false; 20 | }, 21 | reason => { 22 | this.isOpen = false; 23 | } 24 | ); 25 | return modalRef; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/login/login.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | import { Principal } from '../auth/principal.service'; 4 | import { AuthServerProvider } from '../auth/auth-jwt.service'; 5 | 6 | @Injectable({ providedIn: 'root' }) 7 | export class LoginService { 8 | constructor(private principal: Principal, private authServerProvider: AuthServerProvider) {} 9 | 10 | login(credentials, callback?) { 11 | const cb = callback || function() {}; 12 | 13 | return new Promise((resolve, reject) => { 14 | this.authServerProvider.login(credentials).subscribe( 15 | data => { 16 | this.principal.identity(true).then(account => { 17 | resolve(data); 18 | }); 19 | return cb(); 20 | }, 21 | err => { 22 | this.logout(); 23 | reject(err); 24 | return cb(err); 25 | } 26 | ); 27 | }); 28 | } 29 | 30 | loginWithToken(jwt, rememberMe) { 31 | return this.authServerProvider.loginWithToken(jwt, rememberMe); 32 | } 33 | 34 | logout() { 35 | this.authServerProvider.logout().subscribe(); 36 | this.principal.authenticate(null); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/user/account.model.ts: -------------------------------------------------------------------------------- 1 | export class Account { 2 | constructor( 3 | public activated: boolean, 4 | public authorities: string[], 5 | public email: string, 6 | public firstName: string, 7 | public langKey: string, 8 | public lastName: string, 9 | public login: string, 10 | public imageUrl: string 11 | ) {} 12 | } 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/user/user.model.ts: -------------------------------------------------------------------------------- 1 | export interface IUser { 2 | id?: any; 3 | login?: string; 4 | firstName?: string; 5 | lastName?: string; 6 | email?: string; 7 | activated?: boolean; 8 | langKey?: string; 9 | authorities?: any[]; 10 | createdBy?: string; 11 | createdDate?: Date; 12 | lastModifiedBy?: string; 13 | lastModifiedDate?: Date; 14 | password?: string; 15 | } 16 | 17 | export class User implements IUser { 18 | constructor( 19 | public id?: any, 20 | public login?: string, 21 | public firstName?: string, 22 | public lastName?: string, 23 | public email?: string, 24 | public activated?: boolean, 25 | public langKey?: string, 26 | public authorities?: any[], 27 | public createdBy?: string, 28 | public createdDate?: Date, 29 | public lastModifiedBy?: string, 30 | public lastModifiedDate?: Date, 31 | public password?: string 32 | ) { 33 | this.id = id ? id : null; 34 | this.login = login ? login : null; 35 | this.firstName = firstName ? firstName : null; 36 | this.lastName = lastName ? lastName : null; 37 | this.email = email ? email : null; 38 | this.activated = activated ? activated : false; 39 | this.langKey = langKey ? langKey : null; 40 | this.authorities = authorities ? authorities : null; 41 | this.createdBy = createdBy ? createdBy : null; 42 | this.createdDate = createdDate ? createdDate : null; 43 | this.lastModifiedBy = lastModifiedBy ? lastModifiedBy : null; 44 | this.lastModifiedDate = lastModifiedDate ? lastModifiedDate : null; 45 | this.password = password ? password : null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/webapp/app/core/user/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpResponse } from '@angular/common/http'; 3 | import { Observable, of } from 'rxjs'; 4 | 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | import { createRequestOption } from 'app/shared/util/request-util'; 7 | import { IUser } from './user.model'; 8 | 9 | @Injectable({ providedIn: 'root' }) 10 | export class UserService { 11 | private resourceUrl = SERVER_API_URL + 'api/users'; 12 | 13 | constructor(private http: HttpClient) {} 14 | 15 | create(user: IUser): Observable> { 16 | return this.http.post(this.resourceUrl, user, { observe: 'response' }); 17 | } 18 | 19 | update(user: IUser): Observable> { 20 | return this.http.put(this.resourceUrl, user, { observe: 'response' }); 21 | } 22 | 23 | find(login: string): Observable> { 24 | return this.http.get(`${this.resourceUrl}/${login}`, { observe: 'response' }); 25 | } 26 | 27 | query(req?: any): Observable> { 28 | const options = createRequestOption(req); 29 | return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); 30 | } 31 | 32 | delete(login: string): Observable> { 33 | return this.http.delete(`${this.resourceUrl}/${login}`, { observe: 'response' }); 34 | } 35 | 36 | authorities(): Observable { 37 | return this.http.get(SERVER_API_URL + 'api/users/authorities'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/webapp/app/entities/entity.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | 3 | /* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */ 4 | 5 | @NgModule({ 6 | // prettier-ignore 7 | imports: [ 8 | /* jhipster-needle-add-entity-module - JHipster will add entity modules here */ 9 | ], 10 | declarations: [], 11 | entryComponents: [], 12 | providers: [], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 14 | }) 15 | export class JiuzhangquanzhankeEntityModule {} 16 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/course.model.ts: -------------------------------------------------------------------------------- 1 | export class Course { 2 | public courseName: string; 3 | public courseLocation: string; 4 | public courseContent: string; 5 | public teacherId: string; 6 | 7 | constructor(courseName: string, courseLocation: string, courseContent: string, teacherId: string) { 8 | this.courseName = courseName; 9 | this.courseLocation = courseLocation; 10 | this.courseContent = courseContent; 11 | this.teacherId = teacherId; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | import { JhiEventManager } from 'ng-jhipster'; 4 | 5 | import { LoginModalService, Principal, Account } from 'app/core'; 6 | import { Course } from './course.model'; 7 | 8 | @Component({ 9 | selector: 'jhi-home', 10 | templateUrl: './home.component.html', 11 | styleUrls: ['home.css'] 12 | }) 13 | export class HomeComponent implements OnInit { 14 | account: Account; 15 | modalRef: NgbModalRef; 16 | 17 | constructor(private principal: Principal, private loginModalService: LoginModalService, private eventManager: JhiEventManager) {} 18 | 19 | courses: Course[] = [ 20 | new Course('testCourse1', 'USA', 'testContent1', '100'), 21 | new Course('testCourse2', 'USA', 'testContent2', '200'), 22 | new Course('testCourse3', 'CHN', 'testContent3', '300') 23 | ]; 24 | 25 | ngOnInit() { 26 | this.principal.identity().then(account => { 27 | this.account = account; 28 | }); 29 | this.registerAuthenticationSuccess(); 30 | } 31 | 32 | registerAuthenticationSuccess() { 33 | this.eventManager.subscribe('authenticationSuccess', message => { 34 | this.principal.identity().then(account => { 35 | this.account = account; 36 | }); 37 | }); 38 | } 39 | 40 | isAuthenticated() { 41 | return this.principal.isAuthenticated(); 42 | } 43 | 44 | login() { 45 | this.modalRef = this.loginModalService.open(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Main page styles 3 | ========================================================================== */ 4 | 5 | .hipster { 6 | display: inline-block; 7 | width: 347px; 8 | height: 497px; 9 | background: url('../../content/images/hipster.png') no-repeat center top; 10 | background-size: contain; 11 | } 12 | 13 | /* wait autoprefixer update to allow simple generation of high pixel density media query */ 14 | @media only screen and (-webkit-min-device-pixel-ratio: 2), 15 | only screen and (min--moz-device-pixel-ratio: 2), 16 | only screen and (-o-min-device-pixel-ratio: 2/1), 17 | only screen and (min-device-pixel-ratio: 2), 18 | only screen and (min-resolution: 192dpi), 19 | only screen and (min-resolution: 2dppx) { 20 | .hipster { 21 | background: url('../../content/images/hipster2x.png') no-repeat center top; 22 | background-size: contain; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { JiuzhangquanzhankeSharedModule } from 'app/shared'; 5 | import { HOME_ROUTE, HomeComponent } from './'; 6 | 7 | @NgModule({ 8 | imports: [JiuzhangquanzhankeSharedModule, RouterModule.forChild([HOME_ROUTE])], 9 | declarations: [HomeComponent], 10 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 11 | }) 12 | export class JiuzhangquanzhankeHomeModule {} 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { HomeComponent } from './'; 4 | 5 | export const HOME_ROUTE: Route = { 6 | path: '', 7 | component: HomeComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'Welcome, Java Hipster!' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/index.ts: -------------------------------------------------------------------------------- 1 | export * from './home.component'; 2 | export * from './home.route'; 3 | export * from './home.module'; 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
7 |

Error Page!

8 | 9 |
10 |
{{errorMessage}} 11 |
12 |
13 |
You are not authorized to access this page. 14 |
15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'jhi-error', 6 | templateUrl: './error.component.html' 7 | }) 8 | export class ErrorComponent implements OnInit { 9 | errorMessage: string; 10 | error403: boolean; 11 | 12 | constructor(private route: ActivatedRoute) {} 13 | 14 | ngOnInit() { 15 | this.route.data.subscribe(routeData => { 16 | if (routeData.error403) { 17 | this.error403 = routeData.error403; 18 | } 19 | if (routeData.errorMessage) { 20 | this.errorMessage = routeData.errorMessage; 21 | } 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { ErrorComponent } from './error.component'; 4 | 5 | export const errorRoute: Routes = [ 6 | { 7 | path: 'error', 8 | component: ErrorComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'jiuzhangquanzhanke' 12 | } 13 | }, 14 | { 15 | path: 'accessdenied', 16 | component: ErrorComponent, 17 | data: { 18 | authorities: [], 19 | pageTitle: 'jiuzhangquanzhanke', 20 | error403: true 21 | } 22 | } 23 | ]; 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/footer/footer.component.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'jhi-footer', 5 | templateUrl: './footer.component.html' 6 | }) 7 | export class FooterComponent {} 8 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './error/error.component'; 2 | export * from './error/error.route'; 3 | export * from './main/main.component'; 4 | export * from './footer/footer.component'; 5 | export * from './navbar/navbar.component'; 6 | export * from './navbar/navbar.route'; 7 | export * from './profiles/page-ribbon.component'; 8 | export * from './profiles/profile.service'; 9 | export * from './profiles/profile-info.model'; 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/main/main.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 | 8 | 9 |
10 | 11 |
12 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/main/main.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router, ActivatedRouteSnapshot, NavigationEnd } from '@angular/router'; 3 | 4 | import { Title } from '@angular/platform-browser'; 5 | 6 | @Component({ 7 | selector: 'jhi-main', 8 | templateUrl: './main.component.html' 9 | }) 10 | export class JhiMainComponent implements OnInit { 11 | constructor(private titleService: Title, private router: Router) {} 12 | 13 | private getPageTitle(routeSnapshot: ActivatedRouteSnapshot) { 14 | let title: string = 15 | routeSnapshot.data && routeSnapshot.data['pageTitle'] ? routeSnapshot.data['pageTitle'] : 'jiuzhangquanzhankeApp'; 16 | if (routeSnapshot.firstChild) { 17 | title = this.getPageTitle(routeSnapshot.firstChild) || title; 18 | } 19 | return title; 20 | } 21 | 22 | ngOnInit() { 23 | this.router.events.subscribe(event => { 24 | if (event instanceof NavigationEnd) { 25 | this.titleService.setTitle(this.getPageTitle(this.router.routerState.snapshot.root)); 26 | } 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/navbar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 4 | 5 | import { VERSION } from 'app/app.constants'; 6 | import { Principal, LoginModalService, LoginService } from 'app/core'; 7 | import { ProfileService } from '../profiles/profile.service'; 8 | 9 | @Component({ 10 | selector: 'jhi-navbar', 11 | templateUrl: './navbar.component.html', 12 | styleUrls: ['navbar.css'] 13 | }) 14 | export class NavbarComponent implements OnInit { 15 | inProduction: boolean; 16 | isNavbarCollapsed: boolean; 17 | languages: any[]; 18 | swaggerEnabled: boolean; 19 | modalRef: NgbModalRef; 20 | version: string; 21 | 22 | constructor( 23 | private loginService: LoginService, 24 | private principal: Principal, 25 | private loginModalService: LoginModalService, 26 | private profileService: ProfileService, 27 | private router: Router 28 | ) { 29 | this.version = VERSION ? 'v' + VERSION : ''; 30 | this.isNavbarCollapsed = true; 31 | } 32 | 33 | ngOnInit() { 34 | this.profileService.getProfileInfo().then(profileInfo => { 35 | this.inProduction = profileInfo.inProduction; 36 | this.swaggerEnabled = profileInfo.swaggerEnabled; 37 | }); 38 | } 39 | 40 | collapseNavbar() { 41 | this.isNavbarCollapsed = true; 42 | } 43 | 44 | isAuthenticated() { 45 | return this.principal.isAuthenticated(); 46 | } 47 | 48 | login() { 49 | this.modalRef = this.loginModalService.open(); 50 | } 51 | 52 | logout() { 53 | this.collapseNavbar(); 54 | this.loginService.logout(); 55 | this.router.navigate(['']); 56 | } 57 | 58 | toggleNavbar() { 59 | this.isNavbarCollapsed = !this.isNavbarCollapsed; 60 | } 61 | 62 | getImageUrl() { 63 | return this.isAuthenticated() ? this.principal.getImageUrl() : null; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/navbar.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Navbar 3 | ========================================================================== */ 4 | .navbar-version { 5 | font-size: 10px; 6 | color: #ccc; 7 | } 8 | 9 | .jh-navbar { 10 | background-color: #353d47; 11 | padding: 0.2em 1em; 12 | } 13 | 14 | .jh-navbar .profile-image { 15 | margin: -10px 0px; 16 | height: 40px; 17 | width: 40px; 18 | border-radius: 50%; 19 | } 20 | 21 | .jh-navbar .dropdown-item.active, 22 | .jh-navbar .dropdown-item.active:focus, 23 | .jh-navbar .dropdown-item.active:hover { 24 | background-color: #353d47; 25 | } 26 | 27 | .jh-navbar .dropdown-toggle::after { 28 | margin-left: 0.15em; 29 | } 30 | 31 | .jh-navbar ul.navbar-nav { 32 | padding: 0.5em; 33 | } 34 | 35 | .jh-navbar .navbar-nav .nav-item { 36 | margin-left: 1.5rem; 37 | } 38 | 39 | .jh-navbar a.nav-link { 40 | font-weight: 400; 41 | } 42 | 43 | .jh-navbar .jh-navbar-toggler { 44 | color: #ccc; 45 | font-size: 1.5em; 46 | padding: 10px; 47 | } 48 | 49 | .jh-navbar .jh-navbar-toggler:hover { 50 | color: #fff; 51 | } 52 | 53 | @media screen and (min-width: 768px) { 54 | .jh-navbar-toggler { 55 | display: none; 56 | } 57 | } 58 | 59 | @media screen and (max-width: 992px) { 60 | .jh-logo-container { 61 | width: 100%; 62 | } 63 | } 64 | 65 | .navbar-title { 66 | display: inline-block; 67 | vertical-align: middle; 68 | } 69 | 70 | /* ========================================================================== 71 | Logo styles 72 | ========================================================================== */ 73 | .navbar-brand.logo { 74 | padding: 5px 15px; 75 | } 76 | 77 | .logo .logo-img { 78 | height: 45px; 79 | display: inline-block; 80 | vertical-align: middle; 81 | width: 70px; 82 | } 83 | 84 | .logo-img { 85 | height: 100%; 86 | background: url('../../../content/images/logo-jhipster.png') no-repeat center center; 87 | background-size: contain; 88 | width: 100%; 89 | } 90 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/navbar.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { NavbarComponent } from './navbar.component'; 4 | 5 | export const navbarRoute: Route = { 6 | path: '', 7 | component: NavbarComponent, 8 | outlet: 'navbar' 9 | }; 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/page-ribbon.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ProfileService } from './profile.service'; 3 | import { ProfileInfo } from './profile-info.model'; 4 | 5 | @Component({ 6 | selector: 'jhi-page-ribbon', 7 | template: ``, 8 | styleUrls: ['page-ribbon.css'] 9 | }) 10 | export class PageRibbonComponent implements OnInit { 11 | profileInfo: ProfileInfo; 12 | ribbonEnv: string; 13 | 14 | constructor(private profileService: ProfileService) {} 15 | 16 | ngOnInit() { 17 | this.profileService.getProfileInfo().then(profileInfo => { 18 | this.profileInfo = profileInfo; 19 | this.ribbonEnv = profileInfo.ribbonEnv; 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/page-ribbon.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Developement Ribbon 3 | ========================================================================== */ 4 | .ribbon { 5 | background-color: rgba(170, 0, 0, 0.5); 6 | left: -3.5em; 7 | moz-transform: rotate(-45deg); 8 | ms-transform: rotate(-45deg); 9 | o-transform: rotate(-45deg); 10 | webkit-transform: rotate(-45deg); 11 | transform: rotate(-45deg); 12 | overflow: hidden; 13 | position: absolute; 14 | top: 40px; 15 | white-space: nowrap; 16 | width: 15em; 17 | z-index: 9999; 18 | pointer-events: none; 19 | opacity: 0.75; 20 | } 21 | 22 | .ribbon a { 23 | color: #fff; 24 | display: block; 25 | font-weight: 400; 26 | margin: 1px 0; 27 | padding: 10px 50px; 28 | text-align: center; 29 | text-decoration: none; 30 | text-shadow: 0 0 5px #444; 31 | pointer-events: none; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/profile-info.model.ts: -------------------------------------------------------------------------------- 1 | export class ProfileInfo { 2 | activeProfiles: string[]; 3 | ribbonEnv: string; 4 | inProduction: boolean; 5 | swaggerEnabled: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/profile.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpResponse } from '@angular/common/http'; 3 | 4 | import { SERVER_API_URL } from 'app/app.constants'; 5 | import { ProfileInfo } from './profile-info.model'; 6 | import { map } from 'rxjs/operators'; 7 | 8 | @Injectable({ providedIn: 'root' }) 9 | export class ProfileService { 10 | private infoUrl = SERVER_API_URL + 'management/info'; 11 | private profileInfo: Promise; 12 | 13 | constructor(private http: HttpClient) {} 14 | 15 | getProfileInfo(): Promise { 16 | if (!this.profileInfo) { 17 | this.profileInfo = this.http 18 | .get(this.infoUrl, { observe: 'response' }) 19 | .pipe( 20 | map((res: HttpResponse) => { 21 | const data = res.body; 22 | const pi = new ProfileInfo(); 23 | pi.activeProfiles = data['activeProfiles']; 24 | const displayRibbonOnProfiles = data['display-ribbon-on-profiles'].split(','); 25 | if (pi.activeProfiles) { 26 | const ribbonProfiles = displayRibbonOnProfiles.filter(profile => pi.activeProfiles.includes(profile)); 27 | if (ribbonProfiles.length !== 0) { 28 | pi.ribbonEnv = ribbonProfiles[0]; 29 | } 30 | pi.inProduction = pi.activeProfiles.includes('prod'); 31 | pi.swaggerEnabled = pi.activeProfiles.includes('swagger'); 32 | } 33 | return pi; 34 | }) 35 | ) 36 | .toPromise(); 37 | } 38 | return this.profileInfo; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/alert/alert.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { JhiAlertService } from 'ng-jhipster'; 3 | 4 | @Component({ 5 | selector: 'jhi-alert', 6 | template: ` 7 | ` 14 | }) 15 | export class JhiAlertComponent implements OnInit, OnDestroy { 16 | alerts: any[]; 17 | 18 | constructor(private alertService: JhiAlertService) {} 19 | 20 | ngOnInit() { 21 | this.alerts = this.alertService.get(); 22 | } 23 | 24 | ngOnDestroy() { 25 | this.alerts = []; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/auth/has-any-authority.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; 2 | import { Principal } from 'app/core/auth/principal.service'; 3 | 4 | /** 5 | * @whatItDoes Conditionally includes an HTML element if current user has any 6 | * of the authorities passed as the `expression`. 7 | * 8 | * @howToUse 9 | * ``` 10 | * ... 11 | * 12 | * ... 13 | * ``` 14 | */ 15 | @Directive({ 16 | selector: '[jhiHasAnyAuthority]' 17 | }) 18 | export class HasAnyAuthorityDirective { 19 | private authorities: string[]; 20 | 21 | constructor(private principal: Principal, private templateRef: TemplateRef, private viewContainerRef: ViewContainerRef) {} 22 | 23 | @Input() 24 | set jhiHasAnyAuthority(value: string | string[]) { 25 | this.authorities = typeof value === 'string' ? [value] : value; 26 | this.updateView(); 27 | // Get notified each time authentication state changes. 28 | this.principal.getAuthenticationState().subscribe(identity => this.updateView()); 29 | } 30 | 31 | private updateView(): void { 32 | this.principal.hasAnyAuthority(this.authorities).then(result => { 33 | this.viewContainerRef.clear(); 34 | if (result) { 35 | this.viewContainerRef.createEmbeddedView(this.templateRef); 36 | } 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/constants/error.constants.ts: -------------------------------------------------------------------------------- 1 | export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem'; 2 | export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used'; 3 | export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used'; 4 | export const EMAIL_NOT_FOUND_TYPE = PROBLEM_BASE_URL + '/email-not-found'; 5 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/constants/input.constants.ts: -------------------------------------------------------------------------------- 1 | export const DATE_FORMAT = 'YYYY-MM-DD'; 2 | export const DATE_TIME_FORMAT = 'YYYY-MM-DDThh:mm'; 3 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/constants/pagination.constants.ts: -------------------------------------------------------------------------------- 1 | export const ITEMS_PER_PAGE = 20; 2 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from './constants/error.constants'; 2 | export * from './constants/pagination.constants'; 3 | export * from './constants/input.constants'; 4 | export * from './alert/alert.component'; 5 | export * from './alert/alert-error.component'; 6 | export * from './auth/has-any-authority.directive'; 7 | export * from './login/login.component'; 8 | export * from './util/request-util'; 9 | export * from './shared-libs.module'; 10 | export * from './shared-common.module'; 11 | export * from './shared.module'; 12 | export * from './util/datepicker-adapter'; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/login/login.component.html: -------------------------------------------------------------------------------- 1 | 6 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared-common.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { JiuzhangquanzhankeSharedLibsModule, JhiAlertComponent, JhiAlertErrorComponent } from './'; 4 | 5 | @NgModule({ 6 | imports: [JiuzhangquanzhankeSharedLibsModule], 7 | declarations: [JhiAlertComponent, JhiAlertErrorComponent], 8 | exports: [JiuzhangquanzhankeSharedLibsModule, JhiAlertComponent, JhiAlertErrorComponent] 9 | }) 10 | export class JiuzhangquanzhankeSharedCommonModule {} 11 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared-libs.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { CommonModule } from '@angular/common'; 4 | import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; 5 | import { NgJhipsterModule } from 'ng-jhipster'; 6 | import { InfiniteScrollModule } from 'ngx-infinite-scroll'; 7 | import { CookieModule } from 'ngx-cookie'; 8 | import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; 9 | 10 | @NgModule({ 11 | imports: [ 12 | NgbModule.forRoot(), 13 | NgJhipsterModule.forRoot({ 14 | // set below to true to make alerts look like toast 15 | alertAsToast: false 16 | }), 17 | InfiniteScrollModule, 18 | CookieModule.forRoot(), 19 | FontAwesomeModule 20 | ], 21 | exports: [FormsModule, CommonModule, NgbModule, NgJhipsterModule, InfiniteScrollModule, FontAwesomeModule] 22 | }) 23 | export class JiuzhangquanzhankeSharedLibsModule {} 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { NgbDateMomentAdapter } from './util/datepicker-adapter'; 5 | import { 6 | JiuzhangquanzhankeSharedLibsModule, 7 | JiuzhangquanzhankeSharedCommonModule, 8 | JhiLoginModalComponent, 9 | HasAnyAuthorityDirective 10 | } from './'; 11 | 12 | @NgModule({ 13 | imports: [JiuzhangquanzhankeSharedLibsModule, JiuzhangquanzhankeSharedCommonModule], 14 | declarations: [JhiLoginModalComponent, HasAnyAuthorityDirective], 15 | providers: [{ provide: NgbDateAdapter, useClass: NgbDateMomentAdapter }], 16 | entryComponents: [JhiLoginModalComponent], 17 | exports: [JiuzhangquanzhankeSharedCommonModule, JhiLoginModalComponent, HasAnyAuthorityDirective], 18 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 19 | }) 20 | export class JiuzhangquanzhankeSharedModule {} 21 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/util/datepicker-adapter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Angular bootstrap Date adapter 3 | */ 4 | import { Injectable } from '@angular/core'; 5 | import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; 6 | import { Moment } from 'moment'; 7 | import * as moment from 'moment'; 8 | 9 | @Injectable() 10 | export class NgbDateMomentAdapter extends NgbDateAdapter { 11 | fromModel(date: Moment): NgbDateStruct { 12 | if (date != null && date.isValid()) { 13 | return { year: date.year(), month: date.month() + 1, day: date.date() }; 14 | } 15 | return null; 16 | } 17 | 18 | toModel(date: NgbDateStruct): Moment { 19 | return date ? moment(date.year + '-' + date.month + '-' + date.day, 'YYYY-MM-DD') : null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/util/request-util.ts: -------------------------------------------------------------------------------- 1 | import { HttpParams } from '@angular/common/http'; 2 | 3 | export const createRequestOption = (req?: any): HttpParams => { 4 | let options: HttpParams = new HttpParams(); 5 | if (req) { 6 | Object.keys(req).forEach(key => { 7 | if (key !== 'sort') { 8 | options = options.set(key, req[key]); 9 | } 10 | }); 11 | if (req.sort) { 12 | req.sort.forEach(val => { 13 | options = options.append('sort', val); 14 | }); 15 | } 16 | } 17 | return options; 18 | }; 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/vendor.ts: -------------------------------------------------------------------------------- 1 | /* after changing this file run 'yarn run webpack:build' */ 2 | /* tslint:disable */ 3 | import '../content/css/vendor.css'; 4 | 5 | // Imports all fontawesome core and solid icons 6 | 7 | import { library } from '@fortawesome/fontawesome-svg-core'; 8 | import { 9 | faUser, 10 | faSort, 11 | faSync, 12 | faEye, 13 | faBan, 14 | faTimes, 15 | faArrowLeft, 16 | faSave, 17 | faPlus, 18 | faPencilAlt, 19 | faBars, 20 | faThList, 21 | faUserPlus, 22 | faRoad, 23 | faTachometerAlt, 24 | faHeart, 25 | faList, 26 | faBell, 27 | faBook, 28 | faHdd, 29 | faFlag, 30 | faWrench, 31 | faClock, 32 | faCloud, 33 | faSignOutAlt, 34 | faSignInAlt, 35 | faCalendarAlt, 36 | faSearch, 37 | faTrashAlt, 38 | faAsterisk, 39 | faTasks, 40 | faHome 41 | } from '@fortawesome/free-solid-svg-icons'; 42 | 43 | // Adds the SVG icon to the library so you can use it in your page 44 | library.add(faUser); 45 | library.add(faSort); 46 | library.add(faSync); 47 | library.add(faEye); 48 | library.add(faBan); 49 | library.add(faTimes); 50 | library.add(faArrowLeft); 51 | library.add(faSave); 52 | library.add(faPlus); 53 | library.add(faPencilAlt); 54 | library.add(faBars); 55 | library.add(faHome); 56 | library.add(faThList); 57 | library.add(faUserPlus); 58 | library.add(faRoad); 59 | library.add(faTachometerAlt); 60 | library.add(faHeart); 61 | library.add(faList); 62 | library.add(faBell); 63 | library.add(faTasks); 64 | library.add(faBook); 65 | library.add(faHdd); 66 | library.add(faFlag); 67 | library.add(faWrench); 68 | library.add(faClock); 69 | library.add(faCloud); 70 | library.add(faSignOutAlt); 71 | library.add(faSignInAlt); 72 | library.add(faCalendarAlt); 73 | library.add(faSearch); 74 | library.add(faTrashAlt); 75 | library.add(faAsterisk); 76 | 77 | // jhipster-needle-add-element-to-vendor - JHipster will add new menu items here 78 | -------------------------------------------------------------------------------- /src/main/webapp/content/css/documentation.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Your CSS files will be generated in this directory by Webpack 3 | */ 4 | -------------------------------------------------------------------------------- /src/main/webapp/content/css/vendor.css: -------------------------------------------------------------------------------- 1 | /* after changing this file run 'yarn run webpack:build' */ 2 | @import '~bootstrap/dist/css/bootstrap.min.css'; 3 | -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster192.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster256.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster2x.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster384.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/hipster512.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/logo-jhipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/content/images/logo-jhipster.png -------------------------------------------------------------------------------- /src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | jiuzhangquanzhanke 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 23 | 32 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/webapp/manifest.webapp: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Jiuzhangquanzhanke", 3 | "short_name": "Jiuzhangquanzhanke", 4 | "icons": [ 5 | { 6 | "src": "./content/images/hipster192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "./content/images/hipster256.png", 12 | "sizes": "256x256", 13 | "type": "image/png" 14 | }, 15 | { 16 | "src": "./content/images/hipster384.png", 17 | "sizes": "384x384", 18 | "type": "image/png" 19 | }, 20 | { 21 | "src": "./content/images/hipster512.png", 22 | "sizes": "512x512", 23 | "type": "image/png" 24 | } 25 | ], 26 | "theme_color": "#000000", 27 | "background_color": "#e0e0e0", 28 | "start_url": "/index.html", 29 | "display": "standalone", 30 | "orientation": "portrait" 31 | } 32 | -------------------------------------------------------------------------------- /src/main/webapp/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org/ 2 | 3 | User-agent: * 4 | Disallow: /api/account 5 | Disallow: /api/account/change-password 6 | Disallow: /api/account/sessions 7 | Disallow: /api/audits/ 8 | Disallow: /api/logs/ 9 | Disallow: /api/users/ 10 | Disallow: /management/ 11 | Disallow: /v2/api-docs/ 12 | -------------------------------------------------------------------------------- /src/main/webapp/swagger-ui/dist/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/src/main/webapp/swagger-ui/dist/images/throbber.gif -------------------------------------------------------------------------------- /src/test/java/com/mycompany/myapp/config/WebConfigurerTestController.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.config; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class WebConfigurerTestController { 8 | 9 | @GetMapping("/api/test-cors") 10 | public void testCorsOnApiPath() { 11 | } 12 | 13 | @GetMapping("/test/test-cors") 14 | public void testCorsOnOtherPath() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/com/mycompany/myapp/web/rest/util/PaginationUtilUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.mycompany.myapp.web.rest.util; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNotNull; 5 | import static org.junit.Assert.assertTrue; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import org.junit.Test; 11 | import org.springframework.data.domain.Page; 12 | import org.springframework.data.domain.PageImpl; 13 | import org.springframework.data.domain.PageRequest; 14 | import org.springframework.http.HttpHeaders; 15 | 16 | /** 17 | * Tests based on parsing algorithm in app/components/util/pagination-util.service.js 18 | * 19 | * @see PaginationUtil 20 | */ 21 | public class PaginationUtilUnitTest { 22 | 23 | @Test 24 | public void generatePaginationHttpHeadersTest() { 25 | String baseUrl = "/api/_search/example"; 26 | List content = new ArrayList<>(); 27 | Page page = new PageImpl<>(content, PageRequest.of(6, 50), 400L); 28 | HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); 29 | List strHeaders = headers.get(HttpHeaders.LINK); 30 | assertNotNull(strHeaders); 31 | assertTrue(strHeaders.size() == 1); 32 | String headerData = strHeaders.get(0); 33 | assertTrue(headerData.split(",").length == 4); 34 | String expectedData = "; rel=\"next\"," 35 | + "; rel=\"prev\"," 36 | + "; rel=\"last\"," 37 | + "; rel=\"first\""; 38 | assertEquals(expectedData, headerData); 39 | List xTotalCountHeaders = headers.get("X-Total-Count"); 40 | assertTrue(xTotalCountHeaders.size() == 1); 41 | assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/test/javascript/jest-global-mocks.ts: -------------------------------------------------------------------------------- 1 | const mock = () => { 2 | let storage = {}; 3 | return { 4 | getItem: key => (key in storage ? storage[key] : null), 5 | setItem: (key, value) => (storage[key] = value || ''), 6 | removeItem: key => delete storage[key], 7 | clear: () => (storage = {}) 8 | }; 9 | }; 10 | 11 | Object.defineProperty(window, 'localStorage', { value: mock() }); 12 | Object.defineProperty(window, 'sessionStorage', { value: mock() }); 13 | Object.defineProperty(window, 'getComputedStyle', { 14 | value: () => ['-webkit-appearance'] 15 | }); 16 | -------------------------------------------------------------------------------- /src/test/javascript/jest.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'jest-preset-angular', 3 | setupTestFrameworkScriptFile: '/src/test/javascript/jest.ts', 4 | coverageDirectory: '/target/test-results/', 5 | globals: { 6 | 'ts-jest': { 7 | tsConfigFile: 'tsconfig.json' 8 | }, 9 | __TRANSFORM_HTML__: true 10 | }, 11 | moduleNameMapper: { 12 | 'app/(.*)': '/src/main/webapp/app/$1' 13 | }, 14 | reporters: [ 15 | 'default', 16 | [ 'jest-junit', { output: './target/test-results/jest/TESTS-results.xml' } ] 17 | ], 18 | testResultsProcessor: 'jest-sonar-reporter', 19 | transformIgnorePatterns: ['node_modules/(?!@angular/common/locales)'], 20 | testMatch: ['/src/test/javascript/spec/**/+(*.)+(spec.ts)'], 21 | rootDir: '../../../' 22 | }; 23 | -------------------------------------------------------------------------------- /src/test/javascript/jest.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | import './jest-global-mocks'; 3 | -------------------------------------------------------------------------------- /src/test/javascript/spec/app/admin/audits/audits.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuditsService } from 'app/admin/audits/audits.service'; 4 | import { Audit } from 'app/admin/audits/audit.model'; 5 | import { SERVER_API_URL } from 'app/app.constants'; 6 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 7 | 8 | describe('Service Tests', () => { 9 | describe('Audits Service', () => { 10 | let service: AuditsService; 11 | let httpMock; 12 | 13 | beforeEach(() => { 14 | TestBed.configureTestingModule({ 15 | imports: [HttpClientTestingModule] 16 | }); 17 | 18 | service = TestBed.get(AuditsService); 19 | httpMock = TestBed.get(HttpTestingController); 20 | }); 21 | 22 | afterEach(() => { 23 | httpMock.verify(); 24 | }); 25 | 26 | describe('Service methods', () => { 27 | it('should call correct URL', () => { 28 | service.query({}).subscribe(() => {}); 29 | 30 | const req = httpMock.expectOne({ method: 'GET' }); 31 | const resourceUrl = SERVER_API_URL + 'management/audits'; 32 | expect(req.request.url).toEqual(resourceUrl); 33 | }); 34 | 35 | it('should return Audits', () => { 36 | const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS'); 37 | 38 | service.query({}).subscribe(received => { 39 | expect(received.body[0]).toEqual(audit); 40 | }); 41 | 42 | const req = httpMock.expectOne({ method: 'GET' }); 43 | req.flush([audit]); 44 | }); 45 | 46 | it('should propagate not found response', () => { 47 | service.query({}).subscribe(null, (_error: any) => { 48 | expect(_error.status).toEqual(404); 49 | }); 50 | 51 | const req = httpMock.expectOne({ method: 'GET' }); 52 | req.flush('Invalid request parameters', { 53 | status: 404, 54 | statusText: 'Bad Request' 55 | }); 56 | }); 57 | }); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-account.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { AccountService } from 'app/core/auth/account.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockAccountService extends SpyObject { 6 | getSpy: Spy; 7 | saveSpy: Spy; 8 | fakeResponse: any; 9 | 10 | constructor() { 11 | super(AccountService); 12 | 13 | this.fakeResponse = null; 14 | this.getSpy = this.spy('get').andReturn(this); 15 | this.saveSpy = this.spy('save').andReturn(this); 16 | } 17 | 18 | subscribe(callback: any) { 19 | callback(this.fakeResponse); 20 | } 21 | 22 | setResponse(json: any): void { 23 | this.fakeResponse = json; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-active-modal.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockActiveModal extends SpyObject { 6 | dismissSpy: Spy; 7 | 8 | constructor() { 9 | super(NgbActiveModal); 10 | this.dismissSpy = this.spy('dismiss').andReturn(this); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-event-manager.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { JhiEventManager } from 'ng-jhipster'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockEventManager extends SpyObject { 6 | broadcastSpy: Spy; 7 | 8 | constructor() { 9 | super(JhiEventManager); 10 | this.broadcastSpy = this.spy('broadcast').andReturn(this); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-login.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { LoginService } from 'app/core/login/login.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockLoginService extends SpyObject { 6 | loginSpy: Spy; 7 | logoutSpy: Spy; 8 | registerSpy: Spy; 9 | requestResetPasswordSpy: Spy; 10 | cancelSpy: Spy; 11 | 12 | constructor() { 13 | super(LoginService); 14 | 15 | this.setLoginSpy({}); 16 | this.logoutSpy = this.spy('logout').andReturn(this); 17 | this.registerSpy = this.spy('register').andReturn(this); 18 | this.requestResetPasswordSpy = this.spy('requestResetPassword').andReturn(this); 19 | this.cancelSpy = this.spy('cancel').andReturn(this); 20 | } 21 | 22 | setLoginSpy(json: any) { 23 | this.loginSpy = this.spy('login').andReturn(Promise.resolve(json)); 24 | } 25 | 26 | setResponse(json: any): void { 27 | this.setLoginSpy(json); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-principal.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { Principal } from 'app/core/auth/principal.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockPrincipal extends SpyObject { 6 | identitySpy: Spy; 7 | 8 | constructor() { 9 | super(Principal); 10 | 11 | this.setIdentitySpy({}); 12 | } 13 | setIdentitySpy(json: any): any { 14 | this.identitySpy = this.spy('identity').andReturn(Promise.resolve(json)); 15 | } 16 | 17 | setResponse(json: any): void { 18 | this.setIdentitySpy(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-route.service.ts: -------------------------------------------------------------------------------- 1 | import { ActivatedRoute, Router } from '@angular/router'; 2 | import { SpyObject } from './spyobject'; 3 | import { Observable, of } from 'rxjs'; 4 | import Spy = jasmine.Spy; 5 | 6 | export class MockActivatedRoute extends ActivatedRoute { 7 | constructor(parameters?: any) { 8 | super(); 9 | this.queryParams = of(parameters); 10 | this.params = of(parameters); 11 | this.data = of({ 12 | ...parameters, 13 | pagingParams: { 14 | page: 10, 15 | ascending: false, 16 | predicate: 'id' 17 | } 18 | }); 19 | } 20 | } 21 | 22 | export class MockRouter extends SpyObject { 23 | navigateSpy: Spy; 24 | 25 | constructor() { 26 | super(Router); 27 | this.navigateSpy = this.spy('navigate'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-state-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { StateStorageService } from 'app/core/auth/state-storage.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockStateStorageService extends SpyObject { 6 | getUrlSpy: Spy; 7 | storeUrlSpy: Spy; 8 | 9 | constructor() { 10 | super(StateStorageService); 11 | this.setUrlSpy({}); 12 | this.storeUrlSpy = this.spy('storeUrl').andReturn(this); 13 | } 14 | 15 | setUrlSpy(json) { 16 | this.getUrlSpy = this.spy('getUrl').andReturn(json); 17 | } 18 | 19 | setResponse(json: any): void { 20 | this.setUrlSpy(json); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/config/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | enabled: false 5 | -------------------------------------------------------------------------------- /src/test/resources/i18n/messages_en.properties: -------------------------------------------------------------------------------- 1 | email.test.title=test title 2 | -------------------------------------------------------------------------------- /src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/resources/templates/mail/testEmail.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tsconfig-aot.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": false, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "suppressImplicitAnyIndexErrors": true, 12 | "skipLibCheck": true, 13 | "outDir": "target/www/app", 14 | "lib": ["es7", "dom"], 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "baseUrl": "./", 19 | "paths": { 20 | "app/*": ["src/main/webapp/app/*"] 21 | }, 22 | "importHelpers": true 23 | }, 24 | "angularCompilerOptions": { 25 | "genDir": "target/aot", 26 | "skipMetadataEmit" : true, 27 | "fullTemplateTypeCheck": true, 28 | "preserveWhitespaces": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "skipLibCheck": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "outDir": "target/www/app", 14 | "lib": ["es7", "dom"], 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "baseUrl": "./", 19 | "paths": { 20 | "app/*": ["src/main/webapp/app/*"] 21 | }, 22 | "importHelpers": true, 23 | "allowJs": true 24 | }, 25 | "include": [ 26 | "src/main/webapp/app", 27 | "src/test/javascript/" 28 | ], 29 | "exclude": [ 30 | "node_modules" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /webpack/logo-jhipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang2510/AngularStudentManagement/fac6061bd3a7fe31f86c6eeb97ca2a318e023ae0/webpack/logo-jhipster.png -------------------------------------------------------------------------------- /webpack/utils.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | module.exports = { 5 | parseVersion, 6 | root, 7 | isExternalLib 8 | }; 9 | 10 | const parseString = require('xml2js').parseString; 11 | // return the version number from `pom.xml` file 12 | function parseVersion() { 13 | let version = null; 14 | const pomXml = fs.readFileSync('pom.xml', 'utf8'); 15 | parseString(pomXml, (err, result) => { 16 | if (err) { 17 | throw new Error('Failed to parse pom.xml: ' + err); 18 | } 19 | if (result.project.version && result.project.version[0]) { 20 | version = result.project.version[0]; 21 | } else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) { 22 | version = result.project.parent[0].version[0]; 23 | } 24 | }); 25 | if (version === null) { 26 | throw new Error('pom.xml is malformed. No version is defined'); 27 | } 28 | return version; 29 | } 30 | 31 | const _root = path.resolve(__dirname, '..'); 32 | 33 | function root(args) { 34 | args = Array.prototype.slice.call(arguments, 0); 35 | return path.join.apply(path, [_root].concat(args)); 36 | } 37 | 38 | function isExternalLib(module, check = /node_modules/) { 39 | const req = module.userRequest; 40 | if (typeof req !== 'string') { 41 | return false; 42 | } 43 | return req.search(check) >= 0; 44 | } 45 | --------------------------------------------------------------------------------