From 15af0849146f395bdc3af103c866fa1ae5317f13 Mon Sep 17 00:00:00 2001 From: Peter Joles Date: Sun, 23 Feb 2020 12:09:54 -0800 Subject: [PATCH] :sparkles: Add kutt.it as a url shortner option. Used for sharing configurations. --- .env | 43 +- .travis.yml | 5 +- secrets.tar.enc | Bin 10256 -> 10300 bytes src/utils/leopardConfig.js | 97 +- src/views/Config.vue | 2898 ++++++++++++++++++------------------ 5 files changed, 1537 insertions(+), 1506 deletions(-) diff --git a/.env b/.env index 7c9ba914..97543991 100644 --- a/.env +++ b/.env @@ -1,21 +1,22 @@ -VUE_APP_BUILD_COMPRESS_JAVASCRIPT_ASSETS=true -VUE_APP_BUILD_COMPRESS_CSS_ASSETS=true -VUE_APP_EMBED_KILL_SESSION_ON_CLOSE=false -VUE_APP_FIREBASE_API_KEY= -VUE_APP_FIREBASE_AUTH_DOMAIN= -VUE_APP_FIREBASE_DATABASE_URL= -VUE_APP_FIREBASE_MESSAGING_SENDER_ID= -VUE_APP_FIREBASE_PROJECT_ID= -VUE_APP_FIREBASE_STORAGE_BUCKET= -VUE_APP_GET_STATIC_DEFAULT_CONFIG=false -VUE_APP_HIDE_CONFIG_MENU=false -VUE_APP_LIVE_CHAT_AGENT_ASSIST_SERVER= -VUE_APP_LIVE_CHAT_INC_KEY= -VUE_APP_LOAD_FRESH_CONFIG_FOR_NEW_SESSIONS=false -VUE_APP_LOCATION_IQ_KEY= -VUE_APP_LOG_ROCKET= -VUE_APP_PUSHER_KEY= -VUE_APP_SENTRY_DSN= -VUE_APP_SOLUTION_CONFIG_FILE=.env.solution.json -VUE_APP_SOURCE_MAP=false -VUE_APP_HIDE_AS_BRANDING=false \ No newline at end of file +VUE_APP_BUILD_COMPRESS_JAVASCRIPT_ASSETS=true +VUE_APP_BUILD_COMPRESS_CSS_ASSETS=true +VUE_APP_EMBED_KILL_SESSION_ON_CLOSE=false +VUE_APP_FIREBASE_API_KEY= +VUE_APP_FIREBASE_AUTH_DOMAIN= +VUE_APP_FIREBASE_DATABASE_URL= +VUE_APP_FIREBASE_MESSAGING_SENDER_ID= +VUE_APP_FIREBASE_PROJECT_ID= +VUE_APP_FIREBASE_STORAGE_BUCKET= +VUE_APP_GET_STATIC_DEFAULT_CONFIG=false +VUE_APP_HIDE_CONFIG_MENU=false +VUE_APP_LIVE_CHAT_AGENT_ASSIST_SERVER= +VUE_APP_LIVE_CHAT_INC_KEY= +VUE_APP_LOAD_FRESH_CONFIG_FOR_NEW_SESSIONS=false +VUE_APP_LOCATION_IQ_KEY= +VUE_APP_LOG_ROCKET= +VUE_APP_PUSHER_KEY= +VUE_APP_SENTRY_DSN= +VUE_APP_SOLUTION_CONFIG_FILE=.env.solution.json +VUE_APP_SOURCE_MAP=false +VUE_APP_HIDE_AS_BRANDING=false +VUE_APP_KUTT_IT_API_KEY= \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2fa9db50..356e6159 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ env: - secure: Fb0DilEJ862wobrfbO/9tqCfap7gmmUQyUZLx6g9QDsCv/pq7yEeBmOWZT1ld8Praw0rdPSs7r+sgoLqvfYyaBA58bvCkk7HtP6ANuDVH+LKG9z6ThL3ehuS0FBbXTCrgaT77ZA5SJu1ReDlEWRl6SU/lnCyDeV+ZJxOG2lRduDAuYGT9aKH6YVbsjT7mAuQMZPyfp3mjMxeNDtu6Vs07hXbqyv70Usdert3X/NXIMeN2L+jWSBXXYAsLvhQNJ/uGG3mEgqcJInaCI68DIlNGkbgmymBrkbDj7Ii4K3nKu4mV4naTRScF5++eu7nHrzZ+aP3heBCLKY967aNZZiXh9nazvMXpMsSjFb2h4DCeMfMfMmsxIYM/FDtIZa5NxeggRe/8DgahHSaNyw9k60ur40dte8K+ef438jDAsXrIGWTUZlqf5KVOXiOHWOQ0uC0bB3t0heSpvbwvqsaXeU50Hmxn4mqGK4aGuPpGeU7EAFLXZdPvxRa0Zjaw1EAXBpmK430foTxmrcEIaTvjg+jM/b59wLFYcbACnHoouWos4CWKp5kMw2b1HX1Q0bBod3oJAZJL59lwC9nFpQj3p56M5wK9Ptd6VRSGuv8Lw2xiYtnN3fCYP/gsxpqeZFTFsH3MiSGwU7+9RF+4cS5RlXdiCwb7vjLV9qVeAIImL7m1Cw= - secure: DUK7mtuIPxnjWlFkZJs1kMpqIgQwQtdee3HPBKRSvLLx99eHv5gFxJDfBjllJ5zJ6UqkTPuRFq23Z69m6ButxDgL4vJ0LKGXr1p/EOpB6LizKH7NKdH/A1ha6HLmkJI39w13uZGZUZ0BjF1KKlKEa79Jile+DiYJGgoayjhyJxVHubJ/0eJx0XdCr3mmFoHet85GncIqf77ohRyVi2dzzY1cFRS6hHb6nxkX6/8wLQmShuB2tuZNOFNA/EnB1D9NhQ1LOEiZLViCweHzt98la02tKH8e08wKA4RurxMkvNaYeVlQlBBDtQ1H/LXJbrQmMjLcNkncyAXWdvig51X5IF4xWHoKtLzK864t87X0PPBuIbZoWfxh3EX1FAdC9+XYIrHGZdbbwewB5QqJz4CYs1CdWrEiIlLO0LVKfxr0kJMR25Gu91Z1y78xlQc06Hc9skmmALNMpPDUQ1vHlzkvlLkgd4Alm6rinzYfJW2PWdAQOB6iNKd+pIH1qN7QWUBU0FKtKN3Z6iwzV6P0Z0FnH3RYC42g6pY+XmPKY1lgfkSlBw9IS3lvpcL2ddv3rXb2nN0o4hFvOl5o1SeDYWNqdeUOmqLDc2kOvrKYHTBoFaVF4T/0YmvUK+CdwKhn1nwqsUjQzoY41leD7Hqa73UWyQZ3i/Jf8lpTaCBjvf9zWu0= before_install: - - openssl aes-256-cbc -K $encrypted_e0272ac8690c_key -iv $encrypted_e0272ac8690c_iv + - openssl aes-256-cbc -K $encrypted_54a1e4422a70_key -iv $encrypted_54a1e4422a70_iv -in secrets.tar.enc -out secrets.tar -d - tar xvf secrets.tar install: @@ -29,6 +29,7 @@ before_deploy: - ssh-add deploy_rsa deploy: provider: script - script: rsync -r -e "ssh -o StrictHostKeyChecking=no" --delete-after --quiet ./dist/ + script: + rsync -r -e "ssh -o StrictHostKeyChecking=no" --delete-after --quiet ./dist/ ${SSH_USER}@${SSH_HOST}:/var/www/leopard-chat edge: true diff --git a/secrets.tar.enc b/secrets.tar.enc index ae36f4b09062b68eaceaf5402cd70e79220aa83d..02313ccc960f6ab1e3d9b7148a7868376cd7cc31 100644 GIT binary patch literal 10300 zcmV-CD8tvvR@JeWRN(H#nLG#{BW(r(qIh@6#>$Wjb`N#TiX^a>{))l?;^<>fw$U~$ z`YYAwTz_PC75w@Z<+~hK>;uoeumSPTeu?x}L?bRiGL@kZ@8F2f+q}Xzlu|JvU=3cM zNs5)zlUqt)PwisJyH{|(sU`(krg`n9oAMPu0xDD}k$OjHJM%}(joRWX7Zl-KS2WTs z1%~S5HS4#ez7Nvky*`dsrH}sr)_^xr^&yQ~OImC@g&DODtg{@&y=Ng1Apuz=a)5_o zQu4KW)dS0e8SiUYjAaIez+pWZLwgyC7Q&#SP8&7e7Pwfp~)88aEpnh|p4;|l8C??DuxX5pW$yWqss(-06 z1vRK<{`;zDm0ie%()c>7`2nYSRISE$N)=1Fz5GWKlt1Ko32Meb85gC@(kD<@>!Vp0zWu;{us?&VKwv9 z0HN;#N9ORt=DGV2Z)?kNu)V|m1o8=3nYaxK(2yg56lJ_X;pVdkCkq(N`sUf9T0&!~ zF#CMgOb7yBtnpm~K{@ic0D%Cf3~;|65E{v_+C#AVq;Ya)k*X#YnTRbx`=E8>6sF@F zdnd}+?wp8*i4KHWg$+hX{iULkI20Vqo;sdNaKXbWX_o^=$*XrgB^KYv8^qthAzGr@uAHzl zH_uhvE1cXTZ4Edef7#MF?k{705ERsuLNwsZl{J9TJA6xx5~Oz|(hub%^z1^)cf3ULdjp zgcua5TRGp^VOUWC0e-Su)vrer;x0m^`u*m&ifTb&7B@#F)|GfgheqZWYApZKjf%BW z^z1hHXYnU6y+uW&bB|1b_r4y(L*j=oH3jd^2mqEu-J0t`yOm*!6`EP+;Q=oFY_u2kG!py&-z6;}+vB($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mh?k~8H zJH@9ZoAcDmpo??$jagQA8w6nCsrU?jV)(Q&pQLSuc#yVq4vm7#@|w2SeTGBi3Vq&0 z_aV*f;FIzT>xO_Ml~XDGog~!MQf&~`B{u#Wsh>YV7&`I;c~OF+$tex--+`@)V1<<8 zKhV`i4WA9r+mmKu=ZfHLBI?O_J(Wrr9U=W!BXMh6xteh6{lpk&rW;IdHii@*)eS~H WaKP-QRmNfM>Dqff=BwJEpjruyZszL% diff --git a/src/utils/leopardConfig.js b/src/utils/leopardConfig.js index a29321d9..f1cede04 100644 --- a/src/utils/leopardConfig.js +++ b/src/utils/leopardConfig.js @@ -1,48 +1,49 @@ -const environmentVariables = process.env; - -const getEnvValue = (name, fallback = "") => { - let result = fallback; - if (name in environmentVariables && environmentVariables[name] !== "") { - result = environmentVariables[name]; - if (result === "true") { - result = true; - } else if (result === "false") { - result = false; - } - } - return result; -}; - -export default { - isProduction: getEnvValue("NODE_ENV", "production") === "production", - killSessionOnCloseEmbed: getEnvValue("VUE_APP_EMBED_KILL_SESSION_ON_CLOSE", false), - solutionConfig: { - buildConfig: getEnvValue("VUE_APP_SOLUTION_CONFIG", {}) - }, - hideConfigMenu: getEnvValue("VUE_APP_HIDE_CONFIG_MENU", true), - hideArtificalSolutionsBranding: getEnvValue("VUE_APP_HIDE_AS_BRANDING", false), - loadFreshConfigForNewSessions: getEnvValue("VUE_APP_LOAD_FRESH_CONFIG_FOR_NEW_SESSIONS", false), - mustGetStaticDefaultConfig: getEnvValue("VUE_APP_GET_STATIC_DEFAULT_CONFIG", false), - liveChat: { - licenseKey: getEnvValue("VUE_APP_LIVE_CHAT_INC_KEY"), - agentAssistServerUrl: getEnvValue("VUE_APP_LIVE_CHAT_AGENT_ASSIST_SERVER") - }, - pusherKey: getEnvValue("VUE_APP_PUSHER_KEY"), - locationIqKey: getEnvValue("VUE_APP_LOCATION_IQ_KEY"), - firebase: { - apiKey: getEnvValue("VUE_APP_FIREBASE_API_KEY"), - authDomain: getEnvValue("VUE_APP_FIREBASE_AUTH_DOMAIN"), - databaseUrl: getEnvValue("VUE_APP_FIREBASE_DATABASE_URL"), - projectId: getEnvValue("VUE_APP_FIREBASE_PROJECT_ID"), - storageBucket: getEnvValue("VUE_APP_FIREBASE_STORAGE_BUCKET"), - messagingSenderId: getEnvValue("VUE_APP_FIREBASE_MESSAGING_SENDER_ID") - }, - logging: { - sentryDsn: getEnvValue("VUE_APP_SENTRY_DSN"), - logRocket: getEnvValue("VUE_APP_LOG_ROCKET") - }, - build: { - compressJavascript: getEnvValue("VUE_APP_BUILD_COMPRESS_JAVASCRIPT_ASSETS", false), - compressCss: getEnvValue("VUE_APP_BUILD_COMPRESS_CSS_ASSETS", true) - } -}; +const environmentVariables = process.env; + +const getEnvValue = (name, fallback = "") => { + let result = fallback; + if (name in environmentVariables && environmentVariables[name] !== "") { + result = environmentVariables[name]; + if (result === "true") { + result = true; + } else if (result === "false") { + result = false; + } + } + return result; +}; + +export default { + isProduction: getEnvValue("NODE_ENV", "production") === "production", + killSessionOnCloseEmbed: getEnvValue("VUE_APP_EMBED_KILL_SESSION_ON_CLOSE", false), + solutionConfig: { + buildConfig: getEnvValue("VUE_APP_SOLUTION_CONFIG", {}) + }, + hideConfigMenu: getEnvValue("VUE_APP_HIDE_CONFIG_MENU", true), + hideArtificalSolutionsBranding: getEnvValue("VUE_APP_HIDE_AS_BRANDING", false), + loadFreshConfigForNewSessions: getEnvValue("VUE_APP_LOAD_FRESH_CONFIG_FOR_NEW_SESSIONS", false), + mustGetStaticDefaultConfig: getEnvValue("VUE_APP_GET_STATIC_DEFAULT_CONFIG", false), + liveChat: { + licenseKey: getEnvValue("VUE_APP_LIVE_CHAT_INC_KEY"), + agentAssistServerUrl: getEnvValue("VUE_APP_LIVE_CHAT_AGENT_ASSIST_SERVER") + }, + kuttItKey: getEnvValue("VUE_APP_KUTT_IT_API_KEY"), + pusherKey: getEnvValue("VUE_APP_PUSHER_KEY"), + locationIqKey: getEnvValue("VUE_APP_LOCATION_IQ_KEY"), + firebase: { + apiKey: getEnvValue("VUE_APP_FIREBASE_API_KEY"), + authDomain: getEnvValue("VUE_APP_FIREBASE_AUTH_DOMAIN"), + databaseUrl: getEnvValue("VUE_APP_FIREBASE_DATABASE_URL"), + projectId: getEnvValue("VUE_APP_FIREBASE_PROJECT_ID"), + storageBucket: getEnvValue("VUE_APP_FIREBASE_STORAGE_BUCKET"), + messagingSenderId: getEnvValue("VUE_APP_FIREBASE_MESSAGING_SENDER_ID") + }, + logging: { + sentryDsn: getEnvValue("VUE_APP_SENTRY_DSN"), + logRocket: getEnvValue("VUE_APP_LOG_ROCKET") + }, + build: { + compressJavascript: getEnvValue("VUE_APP_BUILD_COMPRESS_JAVASCRIPT_ASSETS", false), + compressCss: getEnvValue("VUE_APP_BUILD_COMPRESS_CSS_ASSETS", true) + } +}; diff --git a/src/views/Config.vue b/src/views/Config.vue index 639d5358..06faefc1 100644 --- a/src/views/Config.vue +++ b/src/views/Config.vue @@ -1,1438 +1,1466 @@ - - - - - - - + if (this.$store.getters.activeSolution) { + const activeSolutionPast = this.$store.getters.activeSolution; + const activeSolutionCurrent = this.config.solutions.find( + solution => solution.id === activeSolutionPast.id + ); + if (!skipRefreshDialog && activeSolutionCurrent.id !== this.selectedSolution.id) { + // another solution is selected than what was originally used to enter the config area + this.showPossibleRefreshDialog = true; + return; + } + + if (JSON.stringify(activeSolutionPast) !== JSON.stringify(activeSolutionCurrent)) { + this.refreshBrowserToSolution(activeSolutionCurrent); + return; + } else { + this.showModal = false; + setTimeout(() => { + this.$router.push("/"); + }, 300); + } + } else { + this.showModal = false; + setTimeout(() => { + this.$router.push("/"); + }, 300); + } + }, + refreshBrowserToSolution(solution) { + this.showPossibleRefreshDialog = false; + this.refresh = true; + sessionStorage.removeItem("teneo-chat-history"); // new config delete chat history + let addtionalParams = ""; + if (doesParameterExist("plugin_id")) { + const params = new URLSearchParams(window.location.search); + const pluginId = params.get("plugin_id"); + addtionalParams += `&plugin_id=${pluginId}`; + } + if (doesParameterExist("embed")) { + addtionalParams += "&embed"; + } + if (doesParameterExist("button")) { + addtionalParams += "&button"; + } + window.location = `${location.protocol}//${location.host}${location.pathname}?dl=${solution.deepLink}${addtionalParams}`; + }, + toggleFullscreen() { + let modalElements = document.getElementsByClassName("leopard-config-modal"); + modalElements[0].setAttribute("style", ""); + this.fullscreen = !this.fullscreen; + }, + createShareLinkForSolution() { + const sharableLink = createSharableLink(this.selectedSolution); + if (window.leopardConfig.kuttItKey) { + superagent + .post("https://cors-anywhere.herokuapp.com/https://kutt.it/api/v2/links") + .send({ + target: sharableLink, + reuse: true + }) + .set("X-API-KEY", window.leopardConfig.kuttItKey) + .set("Accept", "application/json") + .then(res => { + copy( + `${res.body.link}#${slugify(this.selectedSolution.name)}-${dayjs().format( + "YYYY-MM-DD" + )}` + ); + this.displaySnackBar("📋 Copied Solution Sharable Import Link to Clipboard 🔗"); + this.snackbarClipboard = true; + }) + .catch(() => { + copy(sharableLink); + this.displaySnackBar("📋 Copied Solution Sharable Import Link to Clipboard 🔗"); + this.snackbarClipboard = true; + }); + } else { + copy(sharableLink); + this.displaySnackBar("📋 Copied Solution Sharable Import Link to Clipboard 🔗"); + this.snackbarClipboard = true; + } + }, + closeAddNewSolutionDialog(result) { + logger.info("Supposed to close Add Edit Dialog"); + this.displayAddEditDialog = false; + + if (result) { + this.config = result.config; + this.selectedSolution = this.config.solutions.find( + solution => solution.id === result.selectedSolutionId + ); + } + this.currentModeEdit = ""; + this.saveToLocalStorage(); + const self = this; + setTimeout(function() { + self.solution = cloneObject(SOLUTION_DEFAULT); + self.solution.id = uuid(); + }, 1000); + }, + toggleDisplayOfSolutionConfig() { + this.displayFullSolutionConfig = !this.displayFullSolutionConfig; + }, + importSolution(newSolution) { + let existingSolutionsWithId = this.config.solutions.findIndex( + solution => solution.id === newSolution.id + ); + + let existingSolutionsWithName = this.config.solutions.findIndex( + solution => solution.name === newSolution.name + ); + let existingSolutionsWithDeepLink = this.config.solutions.findIndex( + solution => solution.deepLink === newSolution.deepLink + ); + + if ( + existingSolutionsWithId < 0 && + existingSolutionsWithName < 0 && + existingSolutionsWithDeepLink < 0 + ) { + // no clashes in id, name, deep link + this.config.solutions.push(newSolution); // no conflicts + } else if ( + existingSolutionsWithId >= 0 && + existingSolutionsWithName >= 0 && + existingSolutionsWithDeepLink >= 0 + ) { + // id, name and deep link clash + newSolution.name = newSolution.name + " [imported]"; + newSolution.deepLink = newSolution.deepLink + "-" + generateRandomId(); + newSolution.id = uuid(); + this.config.solutions.push(newSolution); + } else if ( + existingSolutionsWithId < 0 && + existingSolutionsWithName >= 0 && + existingSolutionsWithDeepLink >= 0 + ) { + // name and deep link clash + newSolution.name = newSolution.name + " [imported]"; + newSolution.deepLink = newSolution.deepLink + "-" + generateRandomId(); + this.config.solutions.push(newSolution); + } else if ( + existingSolutionsWithId < 0 && + existingSolutionsWithName >= 0 && + existingSolutionsWithDeepLink < 0 + ) { + // name clash only + newSolution.name = newSolution.name + " [imported]"; + this.config.solutions.push(newSolution); + } else if ( + existingSolutionsWithId >= 0 && + existingSolutionsWithDeepLink < 0 && + existingSolutionsWithName < 0 + ) { + // id clash only + newSolution.id = uuid(); + this.config.solutions.push(newSolution); + } else if ( + existingSolutionsWithId < 0 && + existingSolutionsWithDeepLink >= 0 && + existingSolutionsWithName < 0 + ) { + // deeplink clash only + newSolution.deepLink = newSolution.deepLink + "-" + generateRandomId(); + this.config.solutions.push(newSolution); + } + }, + toggleLoading() { + this.showProgressUpload = true; + }, + readConfigFile(event) { + this.showProgressUpload = true; + var file = event.target.files[0]; + this.uploadConfig = ""; + + let reader = new FileReader(); + let self = this; + reader.onload = function() { + self.uploadConfig = reader.result; + self.showProgressUpload = false; + }; + reader.readAsText(file); + }, + compareSolutions(a, b) { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }, + downloadSolutionConfig() { + download( + this.getFullSolutionConfig, + `leopard-all-config-${dayjs().format("YYYYMMDD[-]H[-]mm")}.txt` + ); + + let now = dayjs(); + localStorage.setItem(STORAGE_KEY + "lastBackupDate", now.format()); + }, + downloadSelectedSolutionConfig() { + download( + JSON.stringify(this.selectedSolution, null, 2), + `leopard-${this.selectedSolution.name + .replace(/[|&;$%@"<>()+,]/g, "") + .replace(/\s+/g, "-") + .toLowerCase()}-config-${dayjs().format("YYYYMMDD[-]H[-]mm")}.txt` + ); + }, + copyWholeConfigClipboard() { + copy(JSON.stringify(this.config, null, 2)); + this.displaySnackBar("📋 Copied All Solution Configs to Clipboard"); + this.snackbarClipboard = true; + }, + copySolutionToClipboard() { + copy(JSON.stringify(this.selectedSolution, null, 2)); + this.displaySnackBar("📋 Copied Solution Config to Clipboard"); + }, + setActiveSolutionAsSelected() { + // pre select the solution active in the browser + if (this.$store.getters.activeSolution) { + this.selectedSolution = this.$store.getters.activeSolution; + } else { + // fallback to the default active solutions + this.selectedSolution = this.config.solutions.find( + solution => solution.id === this.config.activeSolution + ); + } + }, + setSolutionAsSelected(solutionId) { + this.selectedSolution = this.config.solutions.find(solution => solution.id === solutionId); + }, + refreshBrowser() { + if (this.selectedSolution) { + this.refresh = true; + sessionStorage.removeItem("teneo-chat-history"); // new config delete chat history + let addtionalParams = ""; + if (doesParameterExist("plugin_id")) { + const params = new URLSearchParams(window.location.search); + const pluginId = params.get("plugin_id"); + addtionalParams += `&plugin_id=${pluginId}`; + } + if (doesParameterExist("embed")) { + addtionalParams += "&embed"; + } + if (doesParameterExist("button")) { + addtionalParams += "&button"; + } + window.location = `${location.protocol}//${location.host}${location.pathname}?dl=${this.selectedSolution.deepLink}${addtionalParams}`; + } else { + window.location = `${location.protocol}//${location.host}${location.pathname}`; + } + }, + saveToLocalStorage() { + this.$store.commit("SET_CHAT_CONFIG", this.config); + localStorage.setItem(STORAGE_KEY + "config", JSON.stringify(this.config)); + logger.debug(`Saved all solutions to localStorage`); + }, + editSolution() { + if (this.selectedSolution !== null) { + this.dialogTitle = "Editing Solution"; + this.currentModeEdit = "edit"; + this.solution = cloneObject(this.selectedSolution); // make a copy - we have a save button + logger.info("Trying to open Add Edit Dialod"); + this.showAddEditDialog(); + } + }, + setActiveSolution() { + this.config.activeSolution = this.selectedSolution.id; + this.saveToLocalStorage(); + }, + cloneSolution() { + const newName = this.selectedSolution.name + " - Copy"; + let clonedSolution = cloneObject(this.selectedSolution); + clonedSolution.id = uuid(); + clonedSolution.name = newName; + const duplicateSolutions = this.config.solutions.filter( + solution => solution.name === newName + ); + if (duplicateSolutions.length > 0) { + clonedSolution.name = clonedSolution.name + " [" + generateRandomId() + "]"; + } + clonedSolution.deepLink = clonedSolution.deepLink + "-" + generateRandomId(); + this.config.solutions.push(clonedSolution); + this.selectedSolution = cloneObject(clonedSolution); + this.displaySnackBar("Solution was cloned. New name is " + clonedSolution.name, 3000); + this.saveToLocalStorage(); + }, + displayUploadSnackBar(message, timeout = 2000, color = "#2F2869") { + this.uploadSnackbar = false; + this.globalSnackbarMessage = message; + this.uploadSnackbar = true; + this.globalSnackbarTimeout = timeout; + this.globalSnackbarColor = color; + }, + displaySnackBar(message, timeout = 2000, color = "#2F2869") { + this.globalSnackbar = false; + this.globalSnackbarMessage = message; + this.globalSnackbar = true; + this.globalSnackbarTimeout = timeout; + this.globalSnackbarColor = color; + }, + deleteSolution(solutionId) { + this.config.solutions = this.config.solutions.filter(solution => { + return solution.id !== solutionId; + }); + + this.audit.results = this.audit.results.filter(result => { + return result.solution.id !== solutionId; + }); + + this.saveToLocalStorage(); + }, + editSolutionAudit(solutionId) { + let foundSolution = this.config.solutions.find(solution => solution.id === solutionId); + this.selectedSolution = foundSolution; + this.solution = cloneObject(this.selectedSolution); // make a copy - we have a save button + this.dialogTitle = `Editing Solution | ${this.selectedSolution.name}`; + this.currentModeEdit = "edit"; + + this.showAddEditDialog(); + }, + deleteSolutionConfig() { + if (this.selectedSolution) { + const theId = this.selectedSolution.id; + if (this.config.activeSolution === theId) { + this.config.activeSolution = ""; + } + this.config.solutions = this.config.solutions.filter( + obj => JSON.stringify(obj) !== JSON.stringify(this.selectedSolution) + ); + if (this.config.solutions.length === 1) { + this.config.activeSolution = this.config.solutions[0].id; + this.selectedSolution = cloneObject(this.config.solutions[0]); + } else if (this.config.solutions.length > 1) { + let self = this; + this.selectedSolution = cloneObject( + this.config.solutions.find(function(solution) { + return solution.id === self.config.activeSolution; + }) + ); + } else { + this.selectedSolution = null; + } + this.displaySnackBar("Solution was deleted", 3000); + this.ensureDefaultSolutionIsSet(); + this.saveToLocalStorage(); + this.setActiveSolutionAsSelected(); + } + }, + ensureDefaultSolutionIsSet() { + // this.config.activeSolution + let foundActiveSolution = this.config.solutions.find( + solution => solution.id === this.config.activeSolution + ); + if (!foundActiveSolution && this.config.solutions.length > 0) { + this.config.activeSolution = this.config.solutions[0].id; + } + }, + closeUploadDialog() { + this.newConfig = ""; + this.uploadConfig = ""; + this.uploadDialog = false; + }, + saveUploadForm() { + // let inputValue = this.$refs.newConfig.inputValue; + if (this.uploadConfig && this.uploadConfig.trim()) { + let newConfig = ""; + try { + newConfig = JSON.parse(this.uploadConfig); + } catch (error) { + this.displaySnackBar("Please provide a valid configuration", 3000); + return; + } + if (newConfig && "activeSolution" in newConfig) { + // ok uploading a full config + if ("activeSolution" in this.config) { + // let's merge + newConfig.solutions.forEach(newSolution => { + this.importSolution(newSolution); + }); + this.displaySnackBar("Merged existing full config with newly uploded", 3000); + } else { + // current config is empty + this.config = fixSolutions(newConfig); + this.displaySnackBar("Imported a new full configuration", 3000); + } + this.setActiveSolutionAsSelected(); + } else if (newConfig && "name" in newConfig) { + // uploading a single config - add it to the current solution config + newConfig = fixSolution(newConfig); + this.importSolution(newConfig); // import individual solution + this.setSolutionAsSelected(newConfig.id); + this.displaySnackBar("Imported as " + newConfig.name, 3000); + } + + this.config = fixSolutions(this.config); + + this.closeUploadDialog(); + this.saveToLocalStorage(); + } else { + this.displayUploadSnackBar("Please provide a valid configuration", 3000, "red"); + } + }, + addSolution() { + this.dialogTitle = "Creating a new solution configuration"; + this.currentModeEdit = ""; // meaning add + this.solution = cloneObject(SOLUTION_DEFAULT); + this.solution.id = uuid(); + this.showAddEditDialog(); + }, + showAddEditDialog() { + this.displayAddEditDialog = true; + logger.info(`Ok add edit dialog should be showing...`); + }, + showUploadDialog() { + this.uploadDialog = true; + } + } +}; + + + + +