# HG changeset patch # User Thomas Junk # Date 1543506109 -3600 # Node ID f4b3fb43b3111155e9452e68d01214e787ab5243 # Parent ec0a0542c221b27c6cf2bfbd666c185bf16ebe86 automatic imports WIP added diff -r ec0a0542c221 -r f4b3fb43b311 client/src/components/Sidebar.vue --- a/client/src/components/Sidebar.vue Thu Nov 29 16:17:54 2018 +0100 +++ b/client/src/components/Sidebar.vue Thu Nov 29 16:41:49 2018 +0100 @@ -58,6 +58,10 @@ Importqueue + + + Importschedule +
@@ -108,6 +112,7 @@ ]; } }, + IMPORTSCHEDULE: process.env.VUE_APP_FEATURE_IMPORTSCHEDULE, methods: { logoff() { this.$store.commit("reset"); diff -r ec0a0542c221 -r f4b3fb43b311 client/src/main.js --- a/client/src/main.js Thu Nov 29 16:17:54 2018 +0100 +++ b/client/src/main.js Thu Nov 29 16:41:49 2018 +0100 @@ -29,91 +29,95 @@ import VTooltip from "v-tooltip"; import { library } from "@fortawesome/fontawesome-svg-core"; import { + faAngleDown, + faAngleLeft, + faAngleRight, + faAngleUp, + faBars, + faBook, + faChartArea, + faCheck, + faCity, + faClipboardCheck, + faClock, + faCopy, + faDrawPolygon, + faExclamationTriangle, faEye, faEyeSlash, - faCopy, - faCheck, - faTimes, + faFilePdf, + faFolderPlus, faInfo, faLayerGroup, - faChartArea, + faMapMarkedAlt, + faMinus, + faPaperPlane, + faPencilAlt, + faPlus, + faPowerOff, faRuler, - faDrawPolygon, - faAngleDown, - faAngleUp, - faAngleLeft, - faAngleRight, - faFolderPlus, - faFilePdf, - faBars, faSearch, faShip, - faUpload, - faTasks, - faUsersCog, - faMapMarkedAlt, - faClipboardCheck, - faWrench, - faBook, - faPowerOff, - faTrash, + faSortAmountDown, + faSortAmountUp, + faSpinner, faStar, + faTasks, + faTimes, + faTrash, + faUpload, faUser, - faExclamationTriangle, - faPaperPlane, - faPlus, - faMinus, - faSortAmountUp, - faSortAmountDown, - faSpinner, - faCity, - faWater + faUsersCog, + faWater, + faWrench } from "@fortawesome/free-solid-svg-icons"; import { faAdn } from "@fortawesome/free-brands-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import VueClipboard from "vue-clipboard2"; library.add( + faAdn, + faAngleDown, + faAngleLeft, + faAngleRight, + faAngleUp, + faBars, + faBook, + faChartArea, + faCheck, + faCity, + faClipboardCheck, + faClock, + faCopy, + faDrawPolygon, + faExclamationTriangle, faEye, faEyeSlash, - faCopy, - faCheck, - faTimes, + faFilePdf, + faFolderPlus, faInfo, faLayerGroup, - faChartArea, + faMapMarkedAlt, + faMinus, + faPaperPlane, + faPencilAlt, + faPlus, + faPowerOff, faRuler, - faDrawPolygon, - faAngleDown, - faAngleUp, - faAngleLeft, - faAngleRight, - faFolderPlus, - faFilePdf, - faBars, faSearch, faShip, - faUpload, - faTasks, - faUsersCog, - faMapMarkedAlt, - faClipboardCheck, - faWrench, - faBook, - faPowerOff, - faTrash, + faSortAmountDown, + faSortAmountUp, + faSpinner, faStar, - faAdn, + faTasks, + faTimes, + faTrash, + faUpload, faUser, - faExclamationTriangle, - faPaperPlane, - faPlus, - faMinus, - faSortAmountUp, - faSortAmountDown, - faSpinner, - faCity, - faWater + faUsersCog, + faWater, + faWrench ); Vue.component("font-awesome-icon", FontAwesomeIcon); diff -r ec0a0542c221 -r f4b3fb43b311 client/src/router.js --- a/client/src/router.js Thu Nov 29 16:17:54 2018 +0100 +++ b/client/src/router.js Thu Nov 29 16:41:49 2018 +0100 @@ -25,6 +25,8 @@ import("./components/admin/usermanagement/Usermanagement.vue"); const Logs = () => import("./components/admin/Logs.vue"); const Importqueue = () => import("./components/admin/Importqueue.vue"); +const Importschedule = () => + import("./components/admin/importschedule/Importschedule.vue"); const Systemconfiguration = () => import("./components/admin/Systemconfiguration.vue"); @@ -93,7 +95,23 @@ requiresAuth: true }, beforeEnter: (to, from, next) => { - const isWaterwayAdmin = store.getters["user/isSysAdmin"]; + const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; + if (!isWaterwayAdmin) { + next("/"); + } else { + next(); + } + } + }, + { + path: "/importschedule", + name: "importschedule", + component: Importschedule, + meta: { + requiresAuth: true + }, + beforeEnter: (to, from, next) => { + const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; if (!isWaterwayAdmin) { next("/"); } else { diff -r ec0a0542c221 -r f4b3fb43b311 client/src/store/imports.js --- a/client/src/store/imports.js Thu Nov 29 16:17:54 2018 +0100 +++ b/client/src/store/imports.js Thu Nov 29 16:41:49 2018 +0100 @@ -22,11 +22,29 @@ REJECTED: "REJECTED" }; +const SCHEDULES = { + DAILY: "daily", + MONTHLY: "monthly" +}; + // initial state const init = () => { return { imports: [], - staging: [] + staging: [], + schedules: [], + importScheduleDetail: null, + importScheduleDetailVisible: false + }; +}; + +const newImportScheduleDetail = () => { + return { + import: "", + type: "", + author: "", + schedule: "", + emailNotification: null }; }; @@ -35,6 +53,21 @@ namespaced: true, state: init(), mutations: { + clearImportScheduleDetail: state => { + state.importScheduleDetail = newImportScheduleDetail(); + }, + deleteSchedule: (state, index) => { + state.schedules.splice(index, 1); + }, + setImportScheduleDetailInvisible: state => { + state.importScheduleDetailVisible = false; + }, + setImportScheduleDetailVisible: state => { + state.importScheduleDetailVisible = true; + }, + setSchedules: (state, schedules) => { + state.schedules = schedules; + }, setImports: (state, imports) => { state.imports = imports; }, @@ -58,6 +91,21 @@ } }, actions: { + getSchedules({ commit }) { + throw new Error("Not Implemented!"); + return new Promise((resolve, reject) => { + HTTP.get("/imports", { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } + }) + .then(response => { + commit("setImports", response.data.imports); + resolve(response); + }) + .catch(error => { + reject(error); + }); + }); + }, getImports({ commit }) { return new Promise((resolve, reject) => { HTTP.get("/imports", { @@ -85,23 +133,8 @@ reject(error); }); }); - }, - setStaging({ commit }, results) { - return new Promise((resolve, reject) => { - throw "Not implemented!"; - HTTP.get("/imports?states=pending", { - headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }) - .then(response => { - commit("setStaging", response.data.imports); - resolve(response); - }) - .catch(error => { - reject(error); - }); - }); } } }; -export { imports, STATES }; +export { imports, STATES, SCHEDULES };