sasjs / cli

Command line interface for creating, compiling, and building SAS® projects
https://cli.sasjs.io
MIT License
37 stars 5 forks source link

sasjs web optimisations for Viya #707

Closed allanbowe closed 3 years ago

allanbowe commented 3 years ago

Our current approach for streaming apps involves compiling each web file (CSS, JS, HTML, PNG etc) as a streaming service, SAS 9 STP or Viya.

With Viya however we actually have the ability to load these files as files rather than services. This reduces complexity, aids debugging, and most importantly - means that we can retain a fixed URL when opening the homepage (rather than a temporary job UUID).

The following parts need to be changed:

Deploy Servicepack

This needs to be able to deploy non ".sas" files as native content using the files API

sasjs web

When compiling the clickme page, for Viya, we need to change the underlying urls to _file= rather than _program=. The default behaviour of redirecting the output via the /files/files/UUID/content endpoint can be prevented by adding the _debug=2 url parameter. This will serve the content through an iframe, preserving the URL. To fix the dimensions of the iframe, we will need to inject the following code in the HTML page:

<script>
window.frameElement.style="height:100%;width:100%;";
window.frameElement.setAttribute("allowfullscreen","")
window.frameElement.setAttribute("frameborder","0")
window.frameElement.setAttribute("marginheight","0")
window.frameElement.setAttribute("marginwidth","0")
window.frameElement.setAttribute("scrolling","auto")
</script>

sasjs compile (build.sas program)

We need to add a macro to the precode (mv_createfile.sas) and invoke it (instead of mv_createwebservice.sas eg as follows:

%mv_createfile(path=$(appLoc)/services/web,name=somefile.js,inref=sasjs)

Log message

At the end of the build.sas program, rather than directing users to the $url/SASJobExecution/?_program=/appLoc/services/clickme service, we should send them to $url/SASJobExecution/?_file=/appLoc/services/clickme&_debug=2

ghost commented 3 years ago

:tada: This issue has been resolved in version 2.29.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: