Fix the reloading of file view after refreshing linked file
This commit is contained in:
@@ -27,7 +27,7 @@ module.exports = LinkedFilesController = {
|
||||
if error?
|
||||
logger.error {err: error, project_id, name, linkedFileData, parent_folder_id, user_id}, 'error writing linked file to disk'
|
||||
return Agent.handleError(error, req, res, next)
|
||||
EditorController.upsertFile project_id, parent_folder_id, name, fsPath, linkedFileData, "upload", user_id, (error) ->
|
||||
EditorController.upsertFile project_id, parent_folder_id, name, fsPath, linkedFileData, "upload", user_id, (error, file) ->
|
||||
return next(error) if error?
|
||||
res.send(204) # created
|
||||
res.json(new_file_id: file._id) # created
|
||||
}
|
||||
|
||||
@@ -19,3 +19,17 @@ define [
|
||||
, 0
|
||||
, this
|
||||
)
|
||||
|
||||
openFileById: (id) ->
|
||||
file = @ide.fileTreeManager.selectEntityById(id)
|
||||
@$scope.ui.view = "file"
|
||||
@$scope.openFile = null
|
||||
@$scope.$apply()
|
||||
window.setTimeout(
|
||||
() =>
|
||||
@$scope.openFile = file
|
||||
@$scope.$apply()
|
||||
@$scope.$digest()
|
||||
, 0
|
||||
, this
|
||||
)
|
||||
|
||||
@@ -49,8 +49,15 @@ define [
|
||||
$scope.refreshFile = (file) ->
|
||||
$scope.refreshing = true
|
||||
ide.fileTreeManager.refreshLinkedFile(file)
|
||||
.then () ->
|
||||
loadTextFileFilePreview()
|
||||
.then (response) ->
|
||||
{ data } = response
|
||||
new_file_id = data.new_file_id
|
||||
$timeout(
|
||||
() ->
|
||||
ide.binaryFilesManager.openFileById(new_file_id)
|
||||
, 1000
|
||||
)
|
||||
# loadTextFileFilePreview()
|
||||
.finally () ->
|
||||
$scope.refreshing = false
|
||||
|
||||
|
||||
@@ -112,6 +112,15 @@ define [
|
||||
entity.selected = false
|
||||
entity.selected = true
|
||||
|
||||
selectEntityById: (entity_id) ->
|
||||
@selected_entity_id = entity_id # For reselecting after a reconnect
|
||||
selected_entity = null
|
||||
@ide.fileTreeManager.forEachEntity (entity) ->
|
||||
if entity.id == entity_id
|
||||
selected_entity = entity
|
||||
entity.selected = true
|
||||
return selected_entity
|
||||
|
||||
toggleMultiSelectEntity: (entity) ->
|
||||
entity.multiSelected = !entity.multiSelected
|
||||
@$scope.multiSelectedCount = @multiSelectedCount()
|
||||
|
||||
Reference in New Issue
Block a user