Closed michael-conway closed 8 years ago
/**
* GET operation gets a file as a String
* parms
* irodsPath - irods path
* @return
*/
def show() {
log.info("index() gets content of a file")
def irodsAccount = request.irodsAccount
def irodsPath = params.irodsPath
if (!irodsAccount) throw new IllegalArgumentException("no irodsAccount in request")
if (!irodsPath) throw new IllegalArgumentException("no irodsPath in request")
log.info("irodsPath:${irodsPath}")
String responseData = fileService.stringFromFile(irodsPath)
render responseData
}
/**
* POST handling file upload from a string
* parms
* data - string contents
* irodsPath - file path
*/
def save() {
log.info("save action in file controller")
def irodsAccount = request.irodsAccount
if (!irodsAccount) throw new IllegalStateException("no irodsAccount in request")
def irodsPath = params.irodsPath
if (!irodsPath) throw new IllegalArgumentException("no irodsPath in request")
log.info("irodsPath:${irodsPath}")
def data = params.data
if (!irodsPath) throw new IllegalArgumentException("no irodsPath in request")
fileService.stringToFile(data, irodsPath, irodsAccount)
render(status:200)
}
Add in place editing of certain file types (e.g. text, csv) as a tab in the home page for data objects
This mirrors the iPlant Discovery Environment implementation that uses code mirror
https://codemirror.net/