Merge pull request #143 from dinukadesilva/02-16-2022-remove-unnecessary-logs

Remove unnecessary logs
diff --git a/package-lock.json b/package-lock.json
index c53fbc5..a53cb50 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "airavata-custos-portal",
-  "version": "0.1.6",
+  "version": "0.1.7",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 62c315d..f3c94e7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "airavata-custos-portal",
-  "version": "0.1.6",
+  "version": "0.1.7",
   "private": true,
   "main": "src/lib/index.js",
   "scripts": {
diff --git a/src/lib/components/input-fields/input-select-users-or-groups.vue b/src/lib/components/input-fields/input-select-users-or-groups.vue
index 4cdc443..48ccb34 100644
--- a/src/lib/components/input-fields/input-select-users-or-groups.vue
+++ b/src/lib/components/input-fields/input-select-users-or-groups.vue
@@ -48,17 +48,6 @@
 
       return _typeheadData;
     },
-    // typeheadDataSerializer() {
-    //   return (obj) => {
-    //     console.log("typeheadDataSerializer", obj)
-    //     if (obj.username) {
-    //       return obj.username;
-    //     } else {
-    //       // return obj.name;
-    //       return `<small>GROUP </small> ${obj.name}`;
-    //     }
-    //   };
-    // },
     users() {
       if (this.allowUsers) {
         return this.$store.getters["user/getUsers"]({
diff --git a/src/lib/components/pages/TenantEntities.vue b/src/lib/components/pages/TenantEntities.vue
index b09694f..687c2f9 100644
--- a/src/lib/components/pages/TenantEntities.vue
+++ b/src/lib/components/pages/TenantEntities.vue
@@ -159,7 +159,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     allEntities() {
@@ -197,8 +196,6 @@
         }
       }
 
-      console.log("this.entityIds : ", entityIds);
-
       this.entityIds = entityIds;
       this.entityMap = entityMap;
       this.entityIndent = entityIndent;
diff --git a/src/lib/components/pages/TenantEntityTypes.vue b/src/lib/components/pages/TenantEntityTypes.vue
index f1eb6d5..fb2ae27 100644
--- a/src/lib/components/pages/TenantEntityTypes.vue
+++ b/src/lib/components/pages/TenantEntityTypes.vue
@@ -62,7 +62,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     entityTypes() {
diff --git a/src/lib/components/pages/TenantGroups.vue b/src/lib/components/pages/TenantGroups.vue
index 1d689cd..19f2494 100644
--- a/src/lib/components/pages/TenantGroups.vue
+++ b/src/lib/components/pages/TenantGroups.vue
@@ -74,7 +74,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     groups() {
diff --git a/src/lib/components/pages/TenantNewGroup.vue b/src/lib/components/pages/TenantNewGroup.vue
index ed1a200..b2320e7 100644
--- a/src/lib/components/pages/TenantNewGroup.vue
+++ b/src/lib/components/pages/TenantNewGroup.vue
@@ -56,7 +56,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     inputState() {
diff --git a/src/lib/components/pages/TenantNewRole.vue b/src/lib/components/pages/TenantNewRole.vue
index 0aab7ad..b22c80b 100644
--- a/src/lib/components/pages/TenantNewRole.vue
+++ b/src/lib/components/pages/TenantNewRole.vue
@@ -91,7 +91,6 @@
       }
     },
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     breadcrumbLinks() {
diff --git a/src/lib/components/pages/TenantRoles.vue b/src/lib/components/pages/TenantRoles.vue
index f417438..c1d444c 100644
--- a/src/lib/components/pages/TenantRoles.vue
+++ b/src/lib/components/pages/TenantRoles.vue
@@ -74,7 +74,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     roles() {
diff --git a/src/lib/components/pages/TenantUser.vue b/src/lib/components/pages/TenantUser.vue
index 3451ab3..a00e176 100644
--- a/src/lib/components/pages/TenantUser.vue
+++ b/src/lib/components/pages/TenantUser.vue
@@ -347,7 +347,6 @@
   watch: {
     user() {
       if (this.user) {
-        console.log("########## user watch")
         this.firstName = this.user.firstName;
         this.lastName = this.user.lastName;
         this.email = this.user.email;
@@ -366,7 +365,6 @@
     this.$store.dispatch("tenant/fetchTenantRoles", {clientId: this.clientId, clientLevel: false});
 
     if (this.user) {
-      console.log("########## user watch")
       this.firstName = this.user.firstName;
       this.lastName = this.user.lastName;
       this.email = this.user.email;
diff --git a/src/lib/components/pages/TenantUsers.vue b/src/lib/components/pages/TenantUsers.vue
index ac5fca1..40273d4 100644
--- a/src/lib/components/pages/TenantUsers.vue
+++ b/src/lib/components/pages/TenantUsers.vue
@@ -89,7 +89,6 @@
   },
   computed: {
     clientId() {
-      console.log("this.$route.params : ", this.$route.params);
       return this.$route.params.clientId;
     },
     tenant() {
diff --git a/src/lib/service/custos-service/custos-service-entities/index.js b/src/lib/service/custos-service/custos-service-entities/index.js
index a0df7c7..f90dc75 100644
--- a/src/lib/service/custos-service/custos-service-entities/index.js
+++ b/src/lib/service/custos-service/custos-service-entities/index.js
@@ -99,9 +99,7 @@
                 "client_id": clientId,
                 "owner_id": ownerId
             }
-            // ).then(({data: entity_array}) => entity_array);
         ).then((res) => {
-            console.log(" $$$$$$$ getEntities ", res);
             return res.data.entity_array;
         });
     }
diff --git a/src/lib/service/custos-service/custos-service-groups.js b/src/lib/service/custos-service/custos-service-groups.js
index 37e9bc9..6940c51 100644
--- a/src/lib/service/custos-service/custos-service-groups.js
+++ b/src/lib/service/custos-service/custos-service-groups.js
@@ -97,8 +97,6 @@
      * @return {Promise<AxiosResponse<any>>}
      */
     getAllGroups({offset = 0, limit = 50, groupId = null, tenantId = null, clientId = null, username} = {}) {
-        console.log("sfsdfsdf", {offset, limit, groupId, tenantId, clientId})
-
         if (username) {
             return this.custosService.axiosInstanceWithTokenAuthorization.get(
                 `${CustosService.ENDPOINTS.GROUPS}/user/group/memberships`,
diff --git a/src/lib/service/custos-service/custos-service-identity.js b/src/lib/service/custos-service/custos-service-identity.js
index 44a56a1..f8234b8 100644
--- a/src/lib/service/custos-service/custos-service-identity.js
+++ b/src/lib/service/custos-service/custos-service-identity.js
@@ -122,7 +122,6 @@
     }
 
     getClientSecret({clientId}) {
-        console.log("##### getClientSecret :  ", clientId);
         return this.custosService.axiosInstanceWithTokenAuthorization.get(
             `${CustosService.ENDPOINTS.IDENTITY}/credentials`,
             {
diff --git a/src/lib/service/custos-service/custos-service-sharing.js b/src/lib/service/custos-service/custos-service-sharing.js
index a173a88..5a8f39b 100644
--- a/src/lib/service/custos-service/custos-service-sharing.js
+++ b/src/lib/service/custos-service/custos-service-sharing.js
@@ -95,8 +95,6 @@
             }
         ).then(({data: {shared_data}}) => shared_data);
 
-        console.log(" res : ", res);
-
         return res;
     }
 
diff --git a/src/lib/service/custos-service/custos-service-tenants.js b/src/lib/service/custos-service/custos-service-tenants.js
index 9a87087..b12afa8 100644
--- a/src/lib/service/custos-service/custos-service-tenants.js
+++ b/src/lib/service/custos-service/custos-service-tenants.js
@@ -16,8 +16,6 @@
     }
 
     fetchTenants({limit, offset, status, parentTenantId, parentClientId, parentClientSecret, requesterEmail}) {
-        console.log("fetchTenants ", {limit, offset, status, parentTenantId, parentClientSecret, requesterEmail})
-
         let url = `${CustosService.ENDPOINTS.TENANTS}/tenants`
         const params = {
             limit: limit,
diff --git a/src/lib/service/custos-service/custos-service-users.js b/src/lib/service/custos-service/custos-service-users.js
index 27b7580..7d7155c 100644
--- a/src/lib/service/custos-service/custos-service-users.js
+++ b/src/lib/service/custos-service/custos-service-users.js
@@ -95,7 +95,6 @@
      * @return {Promise<AxiosResponse<any>>}
      */
     addUserAttribute({clientId, attributes, usernames}) {
-        console.log("addUserAttribute : ", {clientId, attributes, usernames});
         return this.custosService.axiosInstanceWithTokenAuthorization.post(
             `${CustosService.ENDPOINTS.USERS}/attributes`,
             {
@@ -134,8 +133,6 @@
      * @return {Promise<AxiosResponse<any>>}
      */
     async addRolesToUser({clientId, roles, usernames, clientLevel = false}) {
-        // const axiosInstance = await this.custosService.getAxiosInstanceWithClientAuthorization({clientId});
-        console.log(" addRolesToUser ", {clientId, roles, usernames, clientLevel});
         const axiosInstance = await this.custosService.axiosInstanceWithTokenAuthorization;
         return axiosInstance.post(
             `${CustosService.ENDPOINTS.USERS}/users/roles`,
diff --git a/src/lib/store/modules/auth.store.js b/src/lib/store/modules/auth.store.js
index 8ccd86e..f088f8d 100644
--- a/src/lib/store/modules/auth.store.js
+++ b/src/lib/store/modules/auth.store.js
@@ -31,7 +31,6 @@
             url += `&kc_idp_hint=oidc`;
         }
 
-        console.log("CI LOGON : ", url);
         window.location.href = url;
     },
     async authenticateUsingCode({commit}, {code}) {
diff --git a/src/lib/store/modules/group.store.js b/src/lib/store/modules/group.store.js
index 18363fe..be78648 100644
--- a/src/lib/store/modules/group.store.js
+++ b/src/lib/store/modules/group.store.js
@@ -158,7 +158,6 @@
     getGroups(state, getters) {
         return ({offset = 0, limit = 50, groupId = null, tenantId = null, clientId = null, username} = {}) => {
             const queryString = JSON.stringify({offset, limit, groupId, tenantId, clientId, username});
-            console.log("getGroups : ", queryString);
             if (state.groupListMap[queryString]) {
                 return state.groupListMap[queryString].map(groupId => getters.getGroup({groupId}));
             } else {
diff --git a/src/lib/store/modules/sharing.store.js b/src/lib/store/modules/sharing.store.js
index fdb44a0..bd5ab2e 100644
--- a/src/lib/store/modules/sharing.store.js
+++ b/src/lib/store/modules/sharing.store.js
@@ -46,7 +46,6 @@
     },
     async fetchEntityTypes({commit}, {clientId}) {
         const entityTypes = await custosService.sharing.getEntityTypes({clientId});
-        console.log("##### fetchEntityTypes : ", entityTypes);
         const entityTypeIds = entityTypes.map(({id, name, description}) => {
             commit('SET_ENTITY_TYPE', {clientId, id, name, description});
 
diff --git a/src/lib/store/modules/tenant.store.js b/src/lib/store/modules/tenant.store.js
index e4f8e80..5f21694 100644
--- a/src/lib/store/modules/tenant.store.js
+++ b/src/lib/store/modules/tenant.store.js
@@ -17,20 +17,13 @@
 const actions = {
     async fetchTenantSecret({commit}, {clientId}) {
         const clientSecret = await custosService.identity.getClientSecret({clientId});
-        console.log("STORE : fetchTenantSecret ", clientSecret);
 
         commit('SET_TENANT_SECRET', {clientId, clientSecret});
     },
     async fetchTenants({commit, rootGetters}, {limit, offset, status, requesterEmail, parentTenantId, parentClientId}) {
         const params = {limit, offset, status, requesterEmail, parentTenantId, parentClientId};
-
-        console.log("STORE : fetchTenants ", params);
         const queryString = JSON.stringify(params);
 
-        // const username = rootGetters["auth/currentUsername"];
-        // await dispatch("user/fetchUsers", {username}, {root: true});
-        // const requesterEmail = rootGetters["user/getUser"]({username}).email;
-
         let {tenant, total_num_of_tenants} = await custosService.tenants.fetchTenants(params);
         const tenantIds = tenant.map(({tenant_id, tenant_status, client_name, domain, client_id, parent_tenant_id, admin_username, requester_email}) => {
             let type = "CHILD_TENANT";
@@ -71,12 +64,7 @@
 
     async fetchTenant({commit, rootGetters}, {clientId}) {
         let tenant = await custosService.tenants.fetchTenant({clientId});
-        console.log("----- fetchTenant : ", tenant);
-//         admin_email: "hasithanjo2work@gmail.com"
-// admin_first_name: "Hasitha"
-// admin_last_name: "Jayasundara"
-// admin_password: ""
-// admin_username: "hasithanjo2work@gmail.com"
+
         const {
             admin_username, admin_first_name, admin_last_name, admin_email,
             tenant_id, tenant_status, client_name, domain,
@@ -278,10 +266,9 @@
     getTenants(state, getters) {
         return ({limit, offset, status, requesterEmail, parentTenantId, parentClientId}) => {
             const queryString = JSON.stringify({limit, offset, status, requesterEmail, parentTenantId, parentClientId});
-            console.log("###### getTenants : ", queryString)
             if (state.tenantsListMap[queryString]) {
                 const r = state.tenantsListMap[queryString].map(tenantId => getters.getTenant({tenantId}));
-                console.log("getTenants ==== ", r)
+
                 return r
             } else {
                 return null;
diff --git a/src/lib/store/modules/user.store.js b/src/lib/store/modules/user.store.js
index 4c9e784..7b1b05a 100644
--- a/src/lib/store/modules/user.store.js
+++ b/src/lib/store/modules/user.store.js
@@ -177,7 +177,6 @@
 const getters = {
     getUser: (state) => ({clientId, username}) => {
         if (state.userMap[clientId] && state.userMap[clientId][username]) {
-            console.log("####### state.userMap[username] : ", state.userMap[clientId][username])
             return state.userMap[clientId][username];
         } else {
             return null;
@@ -187,7 +186,6 @@
         return ({username = null, offset = 0, limit = 10, groupId = null, tenantId = null, clientId = null}) => {
             const params = {username, offset, limit, groupId, tenantId, clientId};
             const queryString = JSON.stringify(params);
-            console.log("######## getUsers ", queryString)
             if (state.userListMap[clientId] && state.userListMap[clientId][queryString]) {
                 const usernames = state.userListMap[clientId][queryString];
                 return usernames.map(username => getters.getUser({clientId, username}));
diff --git a/src/router.js b/src/router.js
index ac57666..0ff6e49 100644
--- a/src/router.js
+++ b/src/router.js
@@ -215,25 +215,11 @@
     ]
 })
 
-// async function validate(next) {
-//     if (await store.getters["auth/authenticated"] === true) {
-//         // You can use store variable here to access globalError or commit mutation
-//         console.log("Authenticationed")
-//         next(true)
-//     } else {
-//         console.log("NOT Authenticationed")
-//         next('/')
-//     }
-// }
-
 async function _validateAuthenticationBeforeEnter(to, from, next) {
     await store.dispatch('auth/refreshAuthentication');
     const authenticated = store.getters['auth/authenticated'];
 
-
-    console.log("store ", store)
     if (!authenticated) {
-        console.log("NOT authenticated");
         // next(true);
         next('/');
     } else {
@@ -247,19 +233,6 @@
             await store.dispatch("tenant/fetchTenant", {clientId: custosService.clientId});
         }
 
-        console.log("YES authenticated " + store.getters["user/getUser"]({username}));
         next(true);
     }
 }
-
-// async function _validateSuperAdminAuthenticationBeforeEnter(to, from, next) {
-//     await _validateAuthenticationBeforeEnter(to, from, async (nextArg) => {
-//         await store.dispatch("tenant/fetchTenant", {clientId: custosService.clientId});
-//         const appTenant = store.getters["tenant/getTenant"]({clientId: custosService.clientId});
-//
-//         // const username = store.getters["auth/currentUsername"];
-//
-//         console.log("@@@@@@@@ appTenant : ", appTenant);
-//         next(nextArg);
-//     });
-// }