This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/secure data version ux (#138)
* working secure data version history tab for dashboard * bump version for ux release
- Loading branch information
Showing
22 changed files
with
679 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import React from 'react' | ||
import axios from 'axios' | ||
import * as actions from '../constants/actions' | ||
import * as messengerActions from '../actions/messengerActions' | ||
import ApiError from '../components/ApiError/ApiError' | ||
|
||
import log from 'logger' | ||
|
||
export function fetchVersionDataForSdb(safeDepositBodId, token) { | ||
return function(dispatch) { | ||
return axios({ | ||
url: `/v1/sdb-secret-version-paths/${safeDepositBodId}`, | ||
headers: {'X-Cerberus-Token': token}, | ||
timeout: 60 * 1000 // 1 minute | ||
}) | ||
.then((response) => { | ||
dispatch(updatePathsWithHistory(response.data)) | ||
}) | ||
.catch((response) => { | ||
let msg = 'Failed to fetch version data for sdb' | ||
log.error(msg, response) | ||
dispatch(messengerActions.addNewMessage(<ApiError message={msg} response={response} />)) | ||
}) | ||
} | ||
} | ||
|
||
export function updatePathsWithHistory(paths) { | ||
return { | ||
type: actions.FETCHED_VERSION_DATA_FOR_SDB, | ||
payload: paths | ||
} | ||
} | ||
|
||
export function fetchPathVersionData(path, token, pageNumber, perPage) { | ||
return function(dispatch) { | ||
return axios({ | ||
url: `/v1/secret-versions/${path}`, | ||
params: { | ||
limit: perPage, | ||
offset: Math.ceil(pageNumber * perPage) | ||
}, | ||
headers: {'X-Cerberus-Token': token}, | ||
timeout: 60 * 1000 // 1 minute | ||
}) | ||
.then((response) => { | ||
dispatch(updateVersionDataForPath(path, response.data)) | ||
}) | ||
.catch((response) => { | ||
let msg = 'Failed to fetch path version data' | ||
log.error(msg, response) | ||
dispatch(messengerActions.addNewMessage(<ApiError message={msg} response={response} />)) | ||
}) | ||
} | ||
} | ||
|
||
export function updateVersionDataForPath(path, data) { | ||
return { | ||
type: actions.FETCHED_VERSION_DATA_FOR_PATH, | ||
payload: { | ||
data: data, | ||
path: path | ||
} | ||
} | ||
} | ||
|
||
export function handleBreadCrumbHomeClick() { | ||
return { | ||
type: actions.CLEAR_VERSION_PATH_SELECTED, | ||
} | ||
} | ||
|
||
|
||
export function updatePerPage(perPage) { | ||
return { | ||
type: actions.UPDATE_VERSION_PATHS_PER_PAGE, | ||
payload: { | ||
perPage: perPage | ||
} | ||
} | ||
} | ||
|
||
export function updatePageNumber(pageNumber) { | ||
return { | ||
type: actions.UPDATE_VERSION_PATHS_PAGE_NUMBER, | ||
payload: { | ||
pageNumber: pageNumber | ||
} | ||
} | ||
} | ||
|
||
export function resetVersionBrowserState() { | ||
return { | ||
type: actions.RESET_VERSION_BROWSER_STATE | ||
} | ||
} | ||
|
||
export function fetchVersionedSecureDataForPath(path, versionId, token) { | ||
let request = { | ||
url: `/v1/secret/${path}`, | ||
headers: {'X-Cerberus-Token': token}, | ||
timeout: 60 * 1000 // 1 minute | ||
} | ||
|
||
if (versionId !== 'CURRENT') { | ||
request['params'] = { | ||
versionId: versionId | ||
} | ||
} | ||
|
||
return function(dispatch) { | ||
return axios(request) | ||
.then((response) => { | ||
dispatch(updateVersionedSecureDataForPath(versionId, response.data.data)) | ||
}) | ||
.catch((response) => { | ||
let msg = 'Failed to fetch versioned secure data for path' | ||
log.error(msg, response) | ||
dispatch(messengerActions.addNewMessage(<ApiError message={msg} response={response} />)) | ||
}) | ||
} | ||
} | ||
|
||
export function updateVersionedSecureDataForPath(versionId, secureData) { | ||
return { | ||
type: actions.ADD_SECURE_DATA_FOR_VERSION, | ||
payload: { | ||
versionId: versionId, | ||
secureData: secureData | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,10 @@ body { | |
user-select: none; | ||
} | ||
|
||
.btn { | ||
@extend .un-selectable; | ||
} | ||
|
||
.show-me-block { | ||
display: block; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import { Component } from 'react' | ||
|
||
export default class Loader extends Component { | ||
render() { | ||
return ( | ||
<div id='fountainG'> | ||
<div id='fountainG_1' className='fountainG'></div> | ||
<div id='fountainG_2' className='fountainG'></div> | ||
<div id='fountainG_3' className='fountainG'></div> | ||
<div id='fountainG_4' className='fountainG'></div> | ||
<div id='fountainG_5' className='fountainG'></div> | ||
<div id='fountainG_6' className='fountainG'></div> | ||
<div id='fountainG_7' className='fountainG'></div> | ||
<div id='fountainG_8' className='fountainG'></div> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.