From 657edcd43779df8b5d7cd6c71c1913c65a8324c0 Mon Sep 17 00:00:00 2001 From: gkumar Date: Fri, 23 Feb 2018 18:22:41 +0530 Subject: [PATCH] solved #387, #377(moved), #335, #307 and added #300,#337,#302 as low priority --- src/views/PageSettings.vue | 8 +- src/views/ProjectSettings.vue | 5 +- src/views/index.vue | 352 +++++++++++++++++++--------------- 3 files changed, 203 insertions(+), 162 deletions(-) diff --git a/src/views/PageSettings.vue b/src/views/PageSettings.vue index 7a69f52..47241ef 100644 --- a/src/views/PageSettings.vue +++ b/src/views/PageSettings.vue @@ -255,7 +255,9 @@
- + + +
@@ -306,7 +308,9 @@
- + + +
diff --git a/src/views/ProjectSettings.vue b/src/views/ProjectSettings.vue index 0c3a792..15c26ff 100644 --- a/src/views/ProjectSettings.vue +++ b/src/views/ProjectSettings.vue @@ -122,7 +122,7 @@ - CRM Setting + CRM Setting @@ -1382,6 +1382,9 @@ export default { }, methods: { + linktocrm(){ + window.open('https://crm.'+config.domainkey); + }, setPrimaryRole(index){ for(var i = 0; i < this.websiteRoles.length ; i++){ diff --git a/src/views/index.vue b/src/views/index.vue index 94ff14f..82c5272 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -52,30 +52,30 @@ - + - + - Cancel Create + Cancel - + - + - Cancel Create + Cancel @@ -122,29 +122,29 @@
- + - + - Cancel Create + Cancel - + - + - Cancel Create + Cancel @@ -300,9 +300,9 @@ // New File creation validator let checkFileName = (rule, value, callback) => { if (!value) { - return callback(new Error('Please enter filename.')); + return callback(new Error('Please Enter File Name.')); }else if(!(/^[a-z0-9A-Z]+$/i.test(value))){ - return callback(new Error('Please enter valid filename. (file name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); + return callback(new Error('Please Enter valid File Name. (File name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); }else{ return callback(); } @@ -311,9 +311,9 @@ // New Folder creation validator let checkFolderName = (rule, value, callback) => { if (!value) { - return callback(new Error('Please enter Folder Name.')); + return callback(new Error('Please Enter Folder Name.')); }else if(!(/^[a-z0-9A-Z]+$/i.test(value))){ - return callback(new Error('Please enter valid Foldername. (Folder name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); + return callback(new Error('Please Enter valid Folder Name. (Folder name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); }else{ return callback(); } @@ -322,9 +322,9 @@ // New Project creation validator let checkProjectName = (rule, value, callback) => { if (!value) { - return callback(new Error('Please enter Project Name.')); + return callback(new Error('Please Enter Project Name.')); }else if(!(/^[a-z0-9A-Z]+$/i.test(value))){ - return callback(new Error('Please enter valid Project Name. (Project name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); + return callback(new Error('Please Enter valid Project Name. (Project name must only contain a-z or A-Z and 0-9. Special characters and spaces are not allowed)')); }else{ // this.checknameexist() return callback(); @@ -670,6 +670,15 @@ //axios.defaults.headers.common['subscriptionId'] = this.value; await this.getData(); this.fullscreenLoading=false + }).catch((e)=>{ + this.$message({ + showClose: true, + duration:0, + message: 'Servers are down please try again later.', + type: 'error' + }); + // console.log(e) + this.fullscreenLoading=false; }) }, canceldialog(){ @@ -823,7 +832,7 @@ message: 'Services unreachable. Please try again later.', type: 'error' }); - //console.log(e); + console.log(e); }); }else{ this.treeLoading = false; @@ -1985,166 +1994,191 @@ // Create new Website async addProjectFolder(projectName) { - if(Cookies.get('auth_token') != null && Cookies.get('auth_token') != undefined){ - this.$refs[projectName].validate((valid) => { - if (valid) { - - let token = Cookies.get('auth_token'); - this.folderUrl = this.$store.state.fileUrl.replace(/\\/g, "\/"); - var userid = this.folderUrl.split('/')[this.folderUrl.split('/').length - 1] - - // this.formAddProjectFolder.projectName = this.formAddProjectFolder.projectName.toLowerCase(); - - // console.log("'subscriptionId': this.value,'authorization': token", this.value, token) - axios.post(config.baseURL + '/project-configuration', { - userEmail: Cookies.get('email'), - websiteName: this.formAddProjectFolder.projectName, - userId: userid, - subscriptionId:this.value - },{ headers: { 'subscriptionId': this.value,'authorization': token }}) - .then((res) => { - // console.log('##############') - let newFolderName = this.currentFile.path.replace(/\\/g, "\/") + '/' + res.data.id - // let newFolderName=res.data.id - return axios.post(config.baseURL + '/flows-dir-listing', { - foldername: newFolderName, - type: 'folder' - }, { - headers: { - 'authorization': token - } - }) - .then(async (resp) => { - // console.log(resp) - this.newProjectFolderDialog = false - this.addNewProjectFolderLoading = false; + // console.log('this.value:',this.value) + if (this.value == '') { + this.newProjectFolderDialog = false; + this.fullscreenLoading = false; + this.$message({ + showClose: true, + duration:0, + message: 'Subscription not selected.', + type: 'error' + }); - // var response = resp - let gitResponse = await axios.get(config.baseURL + '/gitlab-add-repo?nameOfRepo=' + res.data.id + '&userDetailId=' + Cookies.get('userDetailId'), {}); + } else { + if (Cookies.get('auth_token') != null && Cookies.get('auth_token') != undefined) { + this.$refs[projectName].validate((valid) => { + if (valid) { + + let token = Cookies.get('auth_token'); + this.folderUrl = this.$store.state.fileUrl.replace(/\\/g, "\/"); + var userid = this.folderUrl.split('/')[this.folderUrl.split('/').length - 1] + + // this.formAddProjectFolder.projectName = this.formAddProjectFolder.projectName.toLowerCase(); + + // console.log("'subscriptionId': this.value,'authorization': token", this.value, token) + axios.post(config.baseURL + '/project-configuration', { + userEmail: Cookies.get('email'), + websiteName: this.formAddProjectFolder.projectName, + userId: userid, + subscriptionId: this.value + }, { + headers: { + 'subscriptionId': this.value, + 'authorization': token + } + }) + .then((res) => { + // console.log('##############') + let newFolderName = this.currentFile.path.replace(/\\/g, "\/") + '/' + res.data.id + // let newFolderName=res.data.id + return axios.post(config.baseURL + '/flows-dir-listing', { + foldername: newFolderName, + type: 'folder' + }, { + headers: { + 'authorization': token + } + }) + .then(async(resp) => { + // console.log(resp) + this.newProjectFolderDialog = false + this.addNewProjectFolderLoading = false; - if (!(gitResponse.data.statusCode)) { + // var response = resp + let gitResponse = await axios.get(config.baseURL + '/gitlab-add-repo?nameOfRepo=' + res.data.id + '&userDetailId=' + Cookies.get('userDetailId'), {}); - localStorage.setItem("folderUrl", newFolderName); - var folder = localStorage.getItem("folderUrl"); + if (!(gitResponse.data.statusCode)) { - this.newRepoId = gitResponse.data.id; - this.repoName = gitResponse.data.name; + localStorage.setItem("folderUrl", newFolderName); + var folder = localStorage.getItem("folderUrl"); - // Create essential folders - this.addOtherFolder(newFolderName); + this.newRepoId = gitResponse.data.id; + this.repoName = gitResponse.data.name; - // Init ldap for website subscription in ACL - axios.post(config.initLdap, { - "app":"aaa" - }) - .then((res) => { - // console.log(res.data); - }) - .catch((e) => { - console.log(e) - }); + // Create essential folders + this.addOtherFolder(newFolderName); - await axios.post(config.baseURL + '/register-website-subscriptions', { - websiteId: this.repoName - }) - .then((res) => { - // console.log(res.data); - }) - .catch((e) => { - console.log(e) - }); + // Init ldap for website subscription in ACL + axios.post(config.initLdap, { + "app": "aaa" + }) + .then((res) => { + // console.log(res.data); + }) + .catch((e) => { + console.log(e) + }); - this.currentProjectName = this.formAddProjectFolder.projectName; + await axios.post(config.baseURL + '/register-website-subscriptions', { + websiteId: this.repoName + }) + .then((res) => { + // console.log(res.data); + }) + .catch((e) => { + console.log(e) + }); - this.formAddProjectFolder.projectName = null; - } else { + this.currentProjectName = this.formAddProjectFolder.projectName; - localStorage.setItem("folderUrl", newFolderName); - var folder = localStorage.getItem("folderUrl"); + this.formAddProjectFolder.projectName = null; + } else { - this.newRepoId = undefined; - this.repoName = res.data.id; + localStorage.setItem("folderUrl", newFolderName); + var folder = localStorage.getItem("folderUrl"); - // Create essential folders - this.addOtherFolder(newFolderName); + this.newRepoId = undefined; + this.repoName = res.data.id; - // Init ldap for website subscription in ACL - axios.post(config.initLdap, { - "app":"aaa" - }) - .then((res) => { - // console.log(res.data); - }) - .catch((e) => { - console.log(e) - }); + // Create essential folders + this.addOtherFolder(newFolderName); - await axios.post(config.baseURL + '/register-website-subscription', { - websiteId: this.repoName - }) - .then((res) => { - // console.log(res.data); - }) - .catch((e) => { - console.log(e) - }) + // Init ldap for website subscription in ACL + axios.post(config.initLdap, { + "app": "aaa" + }) + .then((res) => { + // console.log(res.data); + }) + .catch((e) => { + console.log(e) + }); - this.formAddProjectFolder.projectName = null; + await axios.post(config.baseURL + '/register-website-subscription', { + websiteId: this.repoName + }) + .then((res) => { + // console.log(res.data); + }) + .catch((e) => { + console.log(e) + }) - // Delete folder from storage - // axios.delete(config.baseURL + '/flows-dir-listing/0?filename=' + newFolderName) - // .then((res) => { - // }) - // .catch((e) => { - // }) + this.formAddProjectFolder.projectName = null; - // return; - } - - }) - .catch((e) => { - //console.log(e); - // this.componentId = 'buyPage'; - this.newProjectFolderDialog = false; - this.fullscreenLoading = false; - // this.buyNowDialog = true; - console.log(e) - }); - // }) + // Delete folder from storage + // axios.delete(config.baseURL + '/flows-dir-listing/0?filename=' + newFolderName) + // .then((res) => { + // }) + // .catch((e) => { + // }) - }) - .catch((e) => { - console.log(e) - if(e.response.status = 403){ - this.$message({ - showClose: true, - message: e.response.data.message, - type: 'error' + // return; + } + + }) + .catch((e) => { + //console.log(e); + // this.componentId = 'buyPage'; + this.newProjectFolderDialog = false; + this.fullscreenLoading = false; + // this.buyNowDialog = true; + console.log(e) + }); + // }) + + }) + .catch((e) => { + console.log(e) + if (e.response.status = 403) { + this.$message({ + showClose: true, + message: e.response.data.message, + type: 'error' + }); + } + this.newProjectFolderDialog = false; + this.fullscreenLoading = false; + }); + } }); - } - this.newProjectFolderDialog = false; - this.fullscreenLoading = false; - }); + } else { + this.newProjectFolderDialog = false; + this.fullscreenLoading = false; + this.$session.remove('username'); + localStorage.removeItem('current_sub_id'); + let location = psl.parse(window.location.hostname) + location = location.domain === null ? location.input : location.domain + + Cookies.remove('auth_token', { + domain: location + }); + Cookies.remove('email', { + domain: location + }); + Cookies.remove('userDetailId', { + domain: location + }); + Cookies.remove('subscriptionId', { + domain: location + }); + this.$swal("You're Logged Out From System. Please login again!") + .then((value) => { + window.location = '/login' + }); + } } - }); - } else{ - this.newProjectFolderDialog = false; - this.fullscreenLoading = false; - this.$session.remove('username'); - localStorage.removeItem('current_sub_id'); - let location = psl.parse(window.location.hostname) - location = location.domain === null ? location.input : location.domain - - Cookies.remove('auth_token' ,{domain: location}); - Cookies.remove('email' ,{domain: location}); - Cookies.remove('userDetailId' ,{domain: location}); - Cookies.remove('subscriptionId' ,{domain: location}); - this.$swal("You're Logged Out From System. Please login again!") - .then((value) => { - window.location = '/login' - }); - } - }, // Create neccessary folders for project