Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Fix files under sub path show up in root SDB view (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayitbeegh authored Sep 26, 2019
1 parent 377aee0 commit a4d90e9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dashboard/app/actions/manageSafetyDepositBoxActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function fetchSecureFilePathKeys(path, token) {
let files = response.data['secure_file_summaries'];
let keys = [];
files.forEach(file => {
keys.push(file["name"])
keys.push(file["path"])
});
dispatch(updateSecureFilePathKeys(keys))
})
Expand Down
24 changes: 21 additions & 3 deletions dashboard/app/reducers/manageSafetyDepositBoxReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,27 @@ export default createReducer(initialState, {
},
[action.FETCHED_SECURE_FILE_KEYS]: (state, payload) => {
let updatedKeys = state.keysForSecureDataPath
payload.forEach((key) =>
updatedKeys[key] = {type: 'file'}
)
const navigatedPathComponentCount = state.navigatedPath.split("/").length
payload.forEach((key) => {
// For example let's say navigatedPath = "app/sdb/" and the file structure looks like this:
//
// app/sdb
// |--file1.txt filePath = "sdb/file1.txt"
// |--folder
// |--file2.txt filePath = "sdb/folder/file2.txt"
//
// navigatedPath has 3 components ["app", "sdb", ""]
// file1.txt has 2 components ["sdb", "file1.txt"] because no category
// file2.txt has 3 components ["sdb", "folder", "file2.txt"]
// So file in the current folder level would have fewer components than navigatedPath
const filePathComponents = key.split("/")
if (filePathComponents.length > navigatedPathComponentCount - 1) {
const subPath = filePathComponents[navigatedPathComponentCount - 2]
updatedKeys[subPath + "/"] = {type: 'object'}
} else {
updatedKeys[filePathComponents[filePathComponents.length - 1]] = {type: 'file'}
}
})

return Object.assign({}, state, {
hasFetchedFileKeys: true,
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
# limitations under the License.
#

version=3.32.2
version=3.32.3
groupId=com.nike.cerberus
artifactId=cms

0 comments on commit a4d90e9

Please sign in to comment.