summaryrefslogtreecommitdiff
path: root/src/store/api.js
AgeCommit message (Collapse)AuthorFilesLines
2024-04-26Implement response cachingEd Tanous1-1/+14
Bmcweb supports the If-None-Match and etag headers on responses. While for static files, we can do a direct set, for responses, there's no way to cache values. Add caching support by adding what seems to be a well supported axios package. Note the intent is that the cache expires immediately, such that the bmc will always be polled for results, and return 304 when not modified. Additionally, we currently cache these values in the session context, such that they can be reused on refresh. Tested: webui loads properly. Upon navigating to a logs page, and back, the network console shows the bmc returning nearly all redfish responses with 304, not modified. Change-Id: I2e8067a88a0352226db9f987d1508ab5bf266b92 Signed-off-by: Ed Tanous <ed@tanous.net>
2023-07-03Fix incorrect or missing parameters in functions of apiyubowei9821-8/+8
1."api.get()" need to add 'config' parameter for some circumstance need to modify configure. 2.The second param of api.delete() is payload not config. 3."api.patch()" need to add 'config' parameter for some circumstance need to modify configure. 4."api.put()" need to add 'config' parameter for some circumstance need to modify configure. Change-Id: I2df9eae468933c043dd9be1e12d2e2aeb9576ae8 Signed-off-by: Bowei Yu <yubowei0982@phytium.com.cn>
2023-04-05Fix popup-box authenticate on session disconnectEd Tanous1-0/+3
On the session Web UI page, when we disconnect the current session, instead of navigating to the login page, the browser populates the authentication window for basic authorization. If basic authentication is enabled, we are adding the www-authenticate header to unauthorizing requests. As per redfish, we have to set the "Accept" and "X-Requested-With" header for the request from Web UI. This patch set will add those headers. Tested: Logged in to the WebUI and navigated to the sessions page. Clicked "Disconnect" to the current session and the WebUI is navigated to login. page as expected. Change-Id: I61cccbf41e854683e6cd5aa80fa72593ae4aa698 Signed-off-by: Ed Tanous <edtanous@google.com>
2020-11-03Update linting packages to use latestDerick Montague1-6/+6
- 99% of changes were small syntax changes that were changed by the lint command. There were a couple of small manual changes to meet the property order patterns established as part of the vue:recommended guidelines. There are rules that were set from errors to warnings and new stories are being opened to address those issues. Testing: - Successfully ran npm run serve - Successfully ran npm run lint - Verified functionality works as expected, e.g. success and failure use cases - Resolved any JavaScript errors thrown to the console Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Ie082f31c73ccbe8a60afa8f88a9ef6dbf33d9fd2
2020-10-21Show error toast notification on unauthorized accessSukanya Pandey1-10/+4
-When 403 status code which is an unauthorized access occured -show error toast notification. Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com> Change-Id: I55fa7052073f87f28c3584b68fd4e84247a4237e
2020-10-19Add comments for imports that support dotenvYoshie Muranaka1-0/+4
We have set up exact match resolve aliases to support different dotenv build customizations. Added comments to the imports that should not be changed. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Ie371b42ec35f876ccb89ef976f7126d5234a1b47
2020-09-25Create separate file for Vue Router routesYoshie Muranaka1-2/+2
Separating routes into its own JS file to allow for easier env customizations. Update store resolve path to make sure right env stores modules are imported in every file. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I5c646c81fab54085198b2e179be80c954258f51c
2020-06-10Add batch actions and row action to Event LogsYoshie Muranaka1-0/+15
Adds ability to export and delete event logs by row or in a table batch action. - Modifications to TableRowAction component to allow single row export functionality Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Ica50dd0868ac85cc2d6925a9448858b40da9c529
2020-06-10Fix duplicate navigation errorYoshie Muranaka1-0/+7
Adding a check to the 403 response api iterceptor before routing to the Unauthorized page. The router throws a NavigationDuplicated error when attempting to navigate to the same page. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Ib34d4d73a326440f609dd97d0dd677ff96b7b3a6
2020-05-16Add logout commit for 401 responseYoshie Muranaka1-0/+3
Change the authentication logout from router to api interceptor, so that if a user accidentally navigates to login page by clicking the browser back button, they aren't automatically logged out. Logouts would occur when hitting a 401 response or if the user clicks the logout button from app header. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I6290070b63e724b75b3ac2fc39b3c7e814fbfc3e
2020-04-08Add SSL Certificates pageYoshie Muranaka1-2/+2
Adds ability to view, add, replace, and delete SSL certificates in GUI. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I5cf9fa7bbd588dfb22f2431eed0b5976ff860703
2020-02-22Add batch actions to local user tableYoshie Muranaka1-0/+3
- Create TableToolbar component for table batch actions - Added Toast warning type and toast title message translations - Update vue-i18n package to latest v8.15.3 to use improved pluarlization features Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I455beba4f56b8209b1201bbc5ff3f616e960d189
2020-01-29Add login form validationDerick Montague1-1/+5
- Sending incorrect credentials returns a 401 and we don't want the page to redirect if we are trying to login. Wrapped the redirect in an if block. - Returning a promise used by the logout action, which is needed when not redirecting the page. Didn't add to the if block since other errors that use the router to redirect will need the Promise returned also, e.g. 403. Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I6db706ef7c71ed13baed95dc4264e6ae11d13ad3
2020-01-29Add interceptor for 403 responseDerick Montague1-0/+6
This is a simple solution that is in parity with the current BMC functionality. Once we have mapped permissions, we can create a more elegant solution. Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Id3ea36ba812462be04a450f84f98d0237d6c7c3d
2020-01-29Redirect user to login on 401 responseDerick Montague1-0/+8
Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I58609486956239d90a0dfec630f249dc3fa28ea2
2020-01-29Add host status pluginYoshie Muranaka1-6/+1
- Create WebSocket and get host state changes from server - Changed webpack devServer to https to allow for secure WebSocket creation (wss) - Updates to AppHeader to visually indicate changes in host state - Cleaned up api.js file - Check if user is logged in when creating WebSocket - Adds check if user is already authenticated so WebSocket is created when browser refreshed. - Add appliation header styles - Add sass loader config changes to allow sass variables to be used in single file components URL must use https protocol when running locally or the page will not load. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I35e89bdc09e1aa35a6215ef952409a8ed16dd9e1
2020-01-27Add singlequote override and fix filesDerick Montague1-1/+1
Based on phosphor-webui and JavaScript common practices we are setting ESLint to required single quote for JS files and double quote for SCSS files. This commit adds the ESLint override to the prettier rules and runs the npm lint script that fixes the files that violate the rule. Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I50cba77b2d0797595ce94258029608efa8665005
2020-01-27Add cookie based login authenticationYoshie Muranaka1-1/+3
- Changed POST request data structure to match backend requirements for set-cookie in response header - Added withCredentials property to default axios config - Modifying proxied response to remove 'Secure' flag so browser can create Cookie while running locally - Add logout api request - Add js-cookie package to manage browser cookies - Update the babel preset config to include useBuiltIns, which resolves MIME type errors when overlaying - Disable vue-router history mode to use routher hash mode to resolves 404 errors when refreshing certain pages. This is expected behavior with history mode enabled. Server configuration changes are required to support HTML5 history mode: https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I5d43f36ef546962474b6cc8fff89564f29048fde
2020-01-23Add login and logout functionalityDerick Montague1-10/+5
- Add AuthenticationStore - Add ability to login and logout - Add route navigation guard - Add login styles - Add temporary authentication for api call - Add Login directory - Add index.js In order to login a .env.development.local file that contains BASE_URL="https://<ip address> or <FQDN>" Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I88b93e287e66f4bae82a1ec2934cdef12d78264e
2020-01-22Add proxy dev server for local developmentYoshie Muranaka1-0/+34
Adding proxy server to vue config to handle API requests for local development. You need to create a .env.development.local file with BASE_URL, VUE_APP_USERNAME, VUE_APP_PASSWORD defined. Temporarily adding authentication to defaults until login flow is functional. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Ib1a1a992508fb9567af66ecb5775638e6ae6ee8d