clarin-eric / switchboard

The Switchboard: a web application serving as a broker between data sets and data processing/analysis tools.
Other
6 stars 2 forks source link

Generic 'incoming file' endpoint for the front end #25

Closed twagoo closed 4 years ago

twagoo commented 5 years ago

Currently multiple 'endpoints' or routes are defined for various 'incoming files' scenarios. See App.js:

...
      <Route exact path="/vlo/:fileURL/:fileMimetype"
        render={(props) => <DropArea onToolsChange={this.handleToolsChange}
            onResourcesChange={this.handleResourcesChange} caller="VLO"        {...props} /> } />       
      <Route path="/vcr/:fileURL"
        render={(props) => <DropArea onToolsChange={this.handleToolsChange}
            onResourcesChange={this.handleResourcesChange} caller="VCR"        {...props} /> } />
      <Route path="/fcs/:fileURL"
        render={(props) => <DropArea onToolsChange={this.handleToolsChange}
            onResourcesChange={this.handleResourcesChange} caller="FCS"        {...props} /> } />       
      <Route path="/b2drop/:fileURL"
        render={(props) => <DropArea onToolsChange={this.handleToolsChange}
            onResourcesChange={this.handleResourcesChange} caller="B2DROP"        {...props} /> } />
...

Better scalability as well as more compact code could be achieved by defining a more generic route. For instance, a parameters based pattern could be used. E.g.:

/incoming/origin/:originId/uri/:fileURL/type/:fileMimetype/language/:fileLanguage

so that tool Y could submit resource hdl:X by redirecting the browser to

https://switchboard.clarin.eu/#/incoming/origin/X/uri/Y

This is just a proposal for illustration purposes; there may be better strategies, which can be discussed in this context.

emanueldima commented 4 years ago

Version 2.1.0 accepts any url of the form #/<origin>/<url>, #/<origin>/<url>/<mimetype> or#/<origin>/<url>/<mimetype>/<language>, so I think we can close this issue and discuss separately about designing a new API entry with parameters (and possibly multiple input parameters).