You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/05/22 22:13:03 UTC

[cloudstack-primate] branch master updated (c9de1ff -> ab44b60)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git.


    from c9de1ff  compute: VM deployment wizard fixes (#307)
     new fc9f618  auth: translation menu in login form
     new ab44b60  store: implement API caching for logged in user

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 package-lock.json                         |  2 +-
 src/components/header/TranslationMenu.vue |  2 --
 src/config/section/event.js               |  4 ++--
 src/locales/en.json                       |  1 +
 src/locales/ja_JP.json                    |  3 ++-
 src/permission.js                         |  7 ++++--
 src/store/modules/user.js                 | 40 ++++++++++++++++++-------------
 src/store/mutation-types.js               |  1 +
 src/views/auth/Login.vue                  |  9 ++++---
 9 files changed, 42 insertions(+), 27 deletions(-)


[cloudstack-primate] 02/02: store: implement API caching for logged in user

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git

commit ab44b60fd386a7ad0b5c7bd693d624f940437b12
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sat May 23 03:39:03 2020 +0530

    store: implement API caching for logged in user
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 package-lock.json           |  2 +-
 src/permission.js           |  7 +++++--
 src/store/modules/user.js   | 40 ++++++++++++++++++++++++----------------
 src/store/mutation-types.js |  1 +
 4 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 5a5229e..4fa4a20 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "primate",
-  "version": "0.4.0",
+  "version": "0.5.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/src/permission.js b/src/permission.js
index 2bbc789..22dab80 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -25,7 +25,7 @@ import 'nprogress/nprogress.css' // progress bar style
 import message from 'ant-design-vue/es/message'
 import notification from 'ant-design-vue/es/notification'
 import { setDocumentTitle, domTitle } from '@/utils/domUtil'
-import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { ACCESS_TOKEN, APIS } from '@/store/mutation-types'
 
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
@@ -42,7 +42,10 @@ router.beforeEach((to, from, next) => {
       NProgress.done()
     } else {
       if (Object.keys(store.getters.apis).length === 0) {
-        message.loading('Discovering features...', 5)
+        const cachedApis = Vue.ls.get(APIS, {})
+        if (Object.keys(cachedApis).length === 0) {
+          message.loading('Loading...', 4)
+        }
         store
           .dispatch('GetInfo')
           .then(apis => {
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 6e2aa00..ad2c253 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,7 +19,7 @@ import Cookies from 'js-cookie'
 import Vue from 'vue'
 import md5 from 'md5'
 import { login, logout, api } from '@/api'
-import { ACCESS_TOKEN, CURRENT_PROJECT, DEFAULT_THEME, ASYNC_JOB_IDS } from '@/store/mutation-types'
+import { ACCESS_TOKEN, CURRENT_PROJECT, DEFAULT_THEME, APIS, ASYNC_JOB_IDS } from '@/store/mutation-types'
 
 const user = {
   state: {
@@ -54,6 +54,7 @@ const user = {
     },
     SET_APIS: (state, apis) => {
       state.apis = apis
+      Vue.ls.set(APIS, apis)
     },
     SET_FEATURES: (state, features) => {
       state.features = features
@@ -114,22 +115,29 @@ const user = {
 
     GetInfo ({ commit }) {
       return new Promise((resolve, reject) => {
-        api('listApis').then(response => {
-          const apis = {}
-          const apiList = response.listapisresponse.api
-          for (var idx = 0; idx < apiList.length; idx++) {
-            const api = apiList[idx]
-            const apiName = api.name
-            apis[apiName] = {
-              params: api.params,
-              response: api.response
+        const cachedApis = Vue.ls.get(APIS, {})
+        if (Object.keys(cachedApis).length > 0) {
+          console.log('Login detected, using cached APIs')
+          commit('SET_APIS', cachedApis)
+          resolve(cachedApis)
+        } else {
+          api('listApis').then(response => {
+            const apis = {}
+            const apiList = response.listapisresponse.api
+            for (var idx = 0; idx < apiList.length; idx++) {
+              const api = apiList[idx]
+              const apiName = api.name
+              apis[apiName] = {
+                params: api.params,
+                response: api.response
+              }
             }
-          }
-          commit('SET_APIS', apis)
-          resolve(apis)
-        }).catch(error => {
-          reject(error)
-        })
+            commit('SET_APIS', apis)
+            resolve(apis)
+          }).catch(error => {
+            reject(error)
+          })
+        }
 
         api('listUsers').then(response => {
           const result = response.listusersresponse.user[0]
diff --git a/src/store/mutation-types.js b/src/store/mutation-types.js
index 6afc2d2..9a92570 100644
--- a/src/store/mutation-types.js
+++ b/src/store/mutation-types.js
@@ -27,6 +27,7 @@ export const DEFAULT_FIXED_SIDEMENU = 'DEFAULT_FIXED_SIDEMENU'
 export const DEFAULT_FIXED_HEADER_HIDDEN = 'DEFAULT_FIXED_HEADER_HIDDEN'
 export const DEFAULT_CONTENT_WIDTH_TYPE = 'DEFAULT_CONTENT_WIDTH_TYPE'
 export const DEFAULT_MULTI_TAB = 'DEFAULT_MULTI_TAB'
+export const APIS = 'APIS'
 export const ASYNC_JOB_IDS = 'ASYNC_JOB_IDS'
 
 export const CONTENT_WIDTH_TYPE = {


[cloudstack-primate] 01/02: auth: translation menu in login form

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git

commit fc9f618bcb12d8e282c3844165a71b48efc38f42
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sat May 23 03:02:44 2020 +0530

    auth: translation menu in login form
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 src/components/header/TranslationMenu.vue | 2 --
 src/config/section/event.js               | 4 ++--
 src/locales/en.json                       | 1 +
 src/locales/ja_JP.json                    | 3 ++-
 src/views/auth/Login.vue                  | 9 ++++++---
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/components/header/TranslationMenu.vue b/src/components/header/TranslationMenu.vue
index 73e984e..a365208 100644
--- a/src/components/header/TranslationMenu.vue
+++ b/src/components/header/TranslationMenu.vue
@@ -16,7 +16,6 @@
 // under the License.
 
 <template>
-
   <a-dropdown>
     <span class="action ant-dropdown-link translation-menu">
       <font-awesome-icon :icon="['fas', 'language']" size="lg" />
@@ -44,7 +43,6 @@
       <a-menu-item key="ru_RU" :value="ruRU">Русский</a-menu-item>
     </a-menu>
   </a-dropdown>
-
 </template>
 
 <script>
diff --git a/src/config/section/event.js b/src/config/section/event.js
index 85234fa..24d5ed7 100644
--- a/src/config/section/event.js
+++ b/src/config/section/event.js
@@ -32,7 +32,7 @@ export default {
       api: 'archiveEvents',
       icon: 'book',
       label: 'Archive Event',
-      listView: true,
+      listView: false,
       dataView: true,
       args: ['ids'],
       mapping: {
@@ -45,7 +45,7 @@ export default {
       api: 'deleteEvents',
       icon: 'delete',
       label: 'Delete Event',
-      listView: true,
+      listView: false,
       dataView: true,
       args: ['ids'],
       mapping: {
diff --git a/src/locales/en.json b/src/locales/en.json
index 0faabc3..963a7fc 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -612,6 +612,7 @@
 "label.kubernetes.version.update": "Update Kubernetes Version",
 "label.link.domain.to.ldap": "Link Domain to LDAP",
 "label.local.storage":"Local Storage",
+"label.login":"Login",
 "label.make.project.owner": "Make account project owner",
 "label.management.ips":"Management IP Addresses",
 "label.management.server":"Management Server",
diff --git a/src/locales/ja_JP.json b/src/locales/ja_JP.json
index 61a4487..7680173 100644
--- a/src/locales/ja_JP.json
+++ b/src/locales/ja_JP.json
@@ -505,6 +505,7 @@
   "label.gslb.lb.remove": "\u3053\u306e GSLB \u304b\u3089\u8ca0\u8377\u5206\u6563\u3092\u524a\u9664",
   "label.instanciate.template.associate.profile.blade": "\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4f5c\u6210\u304a\u3088\u3073\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u3068\u30d6\u30ec\u30fc\u30c9\u306e\u95a2\u9023\u4ed8\u3051",
   "label.link.domain.to.ldap": "\u30c9\u30e1\u30a4\u30f3\u3092 LDAP \u306b\u30ea\u30f3\u30af\u3059\u308b",
+  "label.login": "ログオン",
   "label.make.project.owner": "\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u6240\u6709\u8005\u5316",
   "label.metrics": "\u30e1\u30c8\u30ea\u30c3\u30af\u30b9",
   "label.migrate.instance.to.host": "\u5225\u306e\u30db\u30b9\u30c8\u3078\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u79fb\u884c",
@@ -891,4 +892,4 @@
   "zoneId": "\u30be\u30fc\u30f3",
   "zoneid": "\u30be\u30fc\u30f3",
   "zonename": "\u30be\u30fc\u30f3"
-}
\ No newline at end of file
+}
diff --git a/src/views/auth/Login.vue b/src/views/auth/Login.vue
index 2e6f019..acfa06d 100644
--- a/src/views/auth/Login.vue
+++ b/src/views/auth/Login.vue
@@ -33,7 +33,7 @@
       <a-tab-pane key="cs">
         <span slot="tab">
           <a-icon type="safety" />
-          Portal Login
+          Portal {{ $t('label.login') }}
         </span>
         <a-form-item>
           <a-input
@@ -82,7 +82,7 @@
       <a-tab-pane key="saml" :disabled="idps.length === 0">
         <span slot="tab">
           <a-icon type="audit" />
-          Single-Sign-On
+          Single Sign-On
         </span>
         <a-form-item>
           <a-select v-decorator="['idp', { initialValue: selectedIdp } ]">
@@ -102,8 +102,9 @@
         class="login-button"
         :loading="state.loginBtn"
         :disabled="state.loginBtn"
-      >Log In</a-button>
+      >{{ $t('label.login') }}</a-button>
     </a-form-item>
+    <translation-menu/>
   </a-form>
 </template>
 
@@ -111,9 +112,11 @@
 import { api } from '@/api'
 import { mapActions } from 'vuex'
 import config from '@/config/settings'
+import TranslationMenu from '@/components/header/TranslationMenu'
 
 export default {
   components: {
+    TranslationMenu
   },
   data () {
     return {