From 1baa16f7a6ee679f556896314cb9c5f372fc9089 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Jan 2020 01:46:43 +0100 Subject: encoding list --- app/client/modules/biggan/biggan.actions.js | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'app/client/modules/biggan/biggan.actions.js') diff --git a/app/client/modules/biggan/biggan.actions.js b/app/client/modules/biggan/biggan.actions.js index df78481..f09510c 100644 --- a/app/client/modules/biggan/biggan.actions.js +++ b/app/client/modules/biggan/biggan.actions.js @@ -155,7 +155,7 @@ export const load_directories = (id) => (dispatch) => { export const load_results = (id) => (dispatch) => { const module = bigganModule.name util.allProgress([ - actions.folder.index({ name: 'results' }), + actions.folder.index({ module, name: 'results' }), actions.file.index({ module, generated: 1, limit: 250 }), // actions.socket.list_directory({ module, dir: 'renders' }), // actions.socket.list_sequences({ module, dir: 'results' }), @@ -178,3 +178,38 @@ export const load_results = (id) => (dispatch) => { }) }) } + +export const load_encodings = () => dispatch => { + const module = bigganModule.name + util.allProgress([ + actions.folder.index({ module }), + actions.file.index({ + module, + datatype: 'image', + generated: 1, + }), + ], (folders, files) => { + console.log(folders, files) + const folder_name_lookup = {} + const encodings = {} + folders.forEach(folder => { + folder_name_lookup[folder.id] = folder.name + encodings[folder.name] = [] + }) + files.forEach(file => { + folder_name = folder_name_lookup[file.folder_id] + encodings[folder_name].push(file) + }) + folders.forEach(folder => { + if (!encodings[folder.name].length) { + delete encodings[folder_name] + } + }) + dispatch({ + type: types.biggan.load_encodings, + encodings + }) + + }) +} + -- cgit v1.2.3-70-g09d2