Skip to content

Commit 660161e

Browse files
cursoragentlucaspar
andcommitted
Share dataset file tree modal refresh
Co-authored-by: Lucas Parzianello <lucaspar@users.noreply.github.com>
1 parent 7792e18 commit 660161e

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎gateway/sds_gateway/static/js/dataset/AuthorsManager.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,23 @@ class AuthorsManager {
237237
})
238238
}
239239

240+
static refreshFileTreeModal(handler) {
241+
const { filesSearchHandler } = handler
242+
if (!filesSearchHandler) {
243+
return false
244+
}
245+
246+
if (!filesSearchHandler.currentTree) {
247+
filesSearchHandler.handleSearch()
248+
return false
249+
}
250+
251+
filesSearchHandler.updateFilesTable({
252+
tree: filesSearchHandler.currentTree,
253+
})
254+
return true
255+
}
256+
240257
static getCurrentAuthorsWithDOMIds() {
241258
const authorsList = document.querySelector(".authors-list")
242259
const currentAuthors = []

‎gateway/sds_gateway/static/js/dataset/DatasetCreationHandler.js‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,7 @@ class DatasetCreationHandler extends BaseManager {
266266
* Handle file modal show
267267
*/
268268
onFileModalShow() {
269-
if (!this.filesSearchHandler) {
270-
return
271-
}
272-
if (!this.filesSearchHandler.currentTree) {
273-
this.filesSearchHandler.handleSearch()
274-
return
275-
}
276-
this.filesSearchHandler.updateFilesTable({
277-
tree: this.filesSearchHandler.currentTree,
278-
})
269+
window.AuthorsManager?.refreshFileTreeModal(this)
279270
}
280271

281272
/**

‎gateway/sds_gateway/static/js/dataset/DatasetEditingHandler.js‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,9 @@ class DatasetEditingHandler extends BaseManager {
211211
* Handle file modal show
212212
*/
213213
onFileModalShow() {
214-
if (!this.filesSearchHandler) {
215-
return
216-
}
217-
if (!this.filesSearchHandler.currentTree) {
218-
this.filesSearchHandler.handleSearch()
219-
return
214+
if (window.AuthorsManager?.refreshFileTreeModal(this)) {
215+
this.syncAllPendingFileRemovalStylesInTree()
220216
}
221-
this.filesSearchHandler.updateFilesTable({
222-
tree: this.filesSearchHandler.currentTree,
223-
})
224-
this.syncAllPendingFileRemovalStylesInTree()
225217
}
226218

227219
/**

0 commit comments

Comments
 (0)