diff --git a/src/main/java/ru/ulstu/core/controller/AdviceController.java b/src/main/java/ru/ulstu/core/controller/AdviceController.java index 27ba6c9..4a6bee0 100644 --- a/src/main/java/ru/ulstu/core/controller/AdviceController.java +++ b/src/main/java/ru/ulstu/core/controller/AdviceController.java @@ -6,7 +6,6 @@ import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ModelAttribute; import ru.ulstu.core.error.EntityIdIsNullException; import ru.ulstu.core.model.ErrorConstants; import ru.ulstu.core.model.response.Response; @@ -20,7 +19,6 @@ import ru.ulstu.user.error.UserNotActivatedException; import ru.ulstu.user.error.UserNotFoundException; import ru.ulstu.user.error.UserPasswordsNotValidOrNotMatchException; import ru.ulstu.user.error.UserResetKeyError; -import ru.ulstu.user.service.UserService; import java.util.Set; import java.util.stream.Collectors; @@ -28,21 +26,6 @@ import java.util.stream.Collectors; @ControllerAdvice public class AdviceController { private final Logger log = LoggerFactory.getLogger(AdviceController.class); - private final UserService userService; - - public AdviceController(UserService userService) { - this.userService = userService; - } - - @ModelAttribute("currentUser") - public String getCurrentUser() { - return userService.getCurrentUser().getUserAbbreviate(); - } - - @ModelAttribute("flashMessage") - public String getFlashMessage() { - return null; - } private Response handleException(ErrorConstants error) { log.warn(error.toString()); diff --git a/src/main/java/ru/ulstu/index/controller/IndexController.java b/src/main/java/ru/ulstu/index/controller/IndexController.java deleted file mode 100644 index f6ab100..0000000 --- a/src/main/java/ru/ulstu/index/controller/IndexController.java +++ /dev/null @@ -1,23 +0,0 @@ -package ru.ulstu.index.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import ru.ulstu.core.controller.AdviceController; -import ru.ulstu.user.service.UserService; -import springfox.documentation.annotations.ApiIgnore; - -@Controller() -@RequestMapping(value = "/index") -@ApiIgnore -public class IndexController extends AdviceController { - public IndexController(UserService userService) { - super(userService); - } - - @GetMapping - public void currentUser(ModelMap modelMap) { - //нужен здесь для добавления параметров на стартовой странице - } -} diff --git a/src/main/resources/static/core-components/app-messages-item.vue b/src/main/resources/static/core-components/app-messages-item.vue new file mode 100644 index 0000000..8d7f49c --- /dev/null +++ b/src/main/resources/static/core-components/app-messages-item.vue @@ -0,0 +1,42 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/core-components/app-messages.vue b/src/main/resources/static/core-components/app-messages.vue new file mode 100644 index 0000000..261b464 --- /dev/null +++ b/src/main/resources/static/core-components/app-messages.vue @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/core-components/app.vue b/src/main/resources/static/core-components/app.vue new file mode 100644 index 0000000..aa81216 --- /dev/null +++ b/src/main/resources/static/core-components/app.vue @@ -0,0 +1,226 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/core-components/page-not-found.vue b/src/main/resources/static/core-components/page-not-found.vue new file mode 100644 index 0000000..88d7672 --- /dev/null +++ b/src/main/resources/static/core-components/page-not-found.vue @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/main/resources/static/js/app-axios.js b/src/main/resources/static/js/app-axios.js new file mode 100644 index 0000000..081945a --- /dev/null +++ b/src/main/resources/static/js/app-axios.js @@ -0,0 +1,57 @@ +/* global axios */ + +(function umd(root, factory) { + if (typeof module === 'object' && typeof exports === 'object') + module.exports = factory(); + else if (typeof define === 'function' && define.amd) + define([], factory); + else + root.axiosEx = factory(); +})(this, function factory() { + 'use strict'; + + var axiosConfig = { + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + "Access-Control-Allow-Origin": "*" + } + }; + + function errorHandler(result, callback) { + var data = result.data; + if (callback) { + callback(data); + } + } + + function axiosGet(url, resolv, reject) { + axios.get(url) + .then(function (result) { + errorHandler(result, resolv, reject); + }) + .catch(function (error) { + setTimeout(function () { + throw Error(error); + } + ); + }); + } + + function axiosPost(url, data, resolv, reject) { + axios.post(url, JSON.stringify(data), axiosConfig) + .then(function (result) { + errorHandler(result, resolv, reject); + }) + .catch(function (error) { + setTimeout(function () { + throw Error(error); + } + ); + }); + } + + return { + get: axiosGet, + post: axiosPost + }; +}); \ No newline at end of file diff --git a/src/main/resources/static/js/app-config.js b/src/main/resources/static/js/app-config.js new file mode 100644 index 0000000..3e6fdf2 --- /dev/null +++ b/src/main/resources/static/js/app-config.js @@ -0,0 +1,29 @@ +(function umd(root, factory) { + if (typeof module === 'object' && typeof exports === 'object') + module.exports = factory(); + else if (typeof define === 'function' && define.amd) + define([], factory); + else + root.appConfig = factory(); +})(this, function factory() { + 'use strict'; + + var contextPath = ""; + var apiVersion = ""; + var basePath = contextPath + apiVersion; + + var appVersion = "@@version"; + var resourcesTimestamp = "?v=@@timestamp"; + + var getOwl = basePath + "/get-owl"; + var getTables = basePath + "/get-tables"; + var makeIntegration = basePath + "/make-integration"; + + return { + version: appVersion, + timestamp: resourcesTimestamp, + owl: getOwl, + tables: getTables, + integration: makeIntegration + }; +}); \ No newline at end of file diff --git a/src/main/resources/static/js/app-vue-loader.js b/src/main/resources/static/js/app-vue-loader.js new file mode 100644 index 0000000..fc855e2 --- /dev/null +++ b/src/main/resources/static/js/app-vue-loader.js @@ -0,0 +1,18 @@ +/* global httpVueLoader, appConfig */ + +(function umd(root, factory) { + if (typeof module === 'object' && typeof exports === 'object') + module.exports = factory(); + else if (typeof define === 'function' && define.amd) + define([], factory); + else + root.httpVueLoaderEx = factory(); +})(this, function factory() { + 'use strict'; + + function httpVueLoaderEx(url, name) { + return httpVueLoader(url + appConfig.timestamp, name); + } + + return httpVueLoaderEx; +}); \ No newline at end of file diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js new file mode 100644 index 0000000..ea0c20d --- /dev/null +++ b/src/main/resources/static/js/app.js @@ -0,0 +1,62 @@ +/* global Vue, VueRouter, Vuex, httpVueLoaderEx */ + +var router = new VueRouter({ + linkActiveClass: "active", + linkExactActiveClass: "", + mode: "history", + routes: [ + { + path: "/", component: httpVueLoaderEx("/core-components/integration-main.vue", "Integration") + }, + { + path: "/*", component: httpVueLoaderEx("/core-components/page-not-found.vue", "PageNotFound") + } + ] +}); + +var store = new Vuex.Store({ + state: { + messages: [] + }, + mutations: { + addMessage: function (state, message) { + state.messages.push({ + id: state.messages.length === 0 ? 0 : state.messages[state.messages.length - 1], + text: message.text, + type: message.type || "info" + }); + }, + removeMessage: function (state, messageId) { + if (messageId < 0 || messageId >= state.messages.length) { + return; + } + state.messages.splice(messageId, 1); + } + }, + actions: { + addInfoMessage: function (context, message) { + context.commit("addMessage", message); + }, + addSuccessMessage: function (context, message) { + context.commit("addMessage", {text: message, type: "success"}); + }, + addWarningMessage: function (context, message) { + context.commit("addMessage", {text: message, type: "warning"}); + }, + addDangerMessage: function (context, message) { + context.commit("addMessage", {text: message, type: "danger"}); + }, + removeMessage: function (context, messageId) { + context.commit("removeMessage", messageId); + } + } +}); + +new Vue({ + el: "#integration-app", + router: router, + store: store, + components: { + "app": httpVueLoaderEx("/core-components/app.vue") + } +}); \ No newline at end of file diff --git a/src/main/resources/templates/vue.html b/src/main/resources/templates/vue.html index a201d9c..c8fd30b 100644 --- a/src/main/resources/templates/vue.html +++ b/src/main/resources/templates/vue.html @@ -14,215 +14,18 @@ - -
-
- -
-
-
-
-
- -
-
- -
-
- -
-
-

Статьи

-

-
-
-
- -
-
- -
-
- -
-
-

Гранты

-

-
-
-
- -
-
- -
-
- -
-
-

Проекты

-

-
-
-
- -
-
- -
-
- -
-
-

Конференции

-

-
-
-
- -
-
- -
-
- -
-
-

Команда

-

-
-
-
- -
-
- -
-
- -
-
-

Работа со студентами

-

-
-
-
- -
-
- -
-
- -
-
-

Задачи

-

-
-
-
- -
-
- -
-
- -
-
-

Карьера

-

-
-
-
- -
-
- -
-
- -
-
-

Прочее

-

-
-
-
-
-
-
-
-
-
- {{ message }} -
-
-
-
+
+
- + - - + + + + \ No newline at end of file