chore: server release and more demodata
This commit is contained in:
@@ -228,6 +228,8 @@ jobs:
|
||||
cp sasjs/utils/favicon.ico ../client/dist/favicon.ico
|
||||
sasjs c -t server
|
||||
rm -rf sasjsbuild/tests
|
||||
server_apploc="/Public/app/dc"
|
||||
sed -i "s|apploc=\"[^\"]*\"|apploc=\"${server_apploc}\"|g" sasjsbuild/services/web/index.html
|
||||
sasjs b -t server
|
||||
cp sasjsbuild/server.json.zip ./sasjs_server.json.zip
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"serverUrl": "https://sas9.4gl.io",
|
||||
"serverUrl": "https://sas.4gl.io",
|
||||
"serverType": "SASJS",
|
||||
"httpsAgentOptions": {
|
||||
"rejectUnauthorized": false,
|
||||
|
||||
@@ -13,8 +13,13 @@
|
||||
<h4> SAS Macros </h4>
|
||||
@li mpeinit.sas
|
||||
@li mf_getengine.sas
|
||||
@li mf_getuser.sas
|
||||
@li mf_increment.sas
|
||||
@li mf_nobs.sas
|
||||
@li mf_uid.sas
|
||||
@li mp_abort.sas
|
||||
@li mp_binarycopy.sas
|
||||
@li mp_replace.sas
|
||||
@li mx_createwebservice.sas
|
||||
|
||||
@author 4GL Apps Ltd
|
||||
@@ -29,6 +34,7 @@
|
||||
%let dcdemoflag=1;
|
||||
%let demolib=PUBLIC;
|
||||
options dlcreatedir;
|
||||
%mpeinit()
|
||||
|
||||
/* to enable - delete here */
|
||||
%let dcdemoflag=0;
|
||||
@@ -40,9 +46,6 @@ libname &demolib "%sysfunc(pathname(&dc_libref))/&demolib";
|
||||
,msg=%str(Job not configured. See comments in the code.)
|
||||
)
|
||||
|
||||
%mpeinit()
|
||||
options replace;
|
||||
|
||||
data work.cars_ext(index=(carspk=(make model PRODUCTIONDATE) /unique));
|
||||
attrib
|
||||
MAKE length= $13
|
||||
@@ -55,6 +58,8 @@ data work.cars_ext(index=(carspk=(make model PRODUCTIONDATE) /unique));
|
||||
NOTES length= $30
|
||||
CHECKBOXVAR length= $3
|
||||
PRODUCTIONDATE length= 8 format=DATE9.
|
||||
EDITOR length= $30
|
||||
APPROVER length= $30
|
||||
;
|
||||
set sashelp.cars;
|
||||
retain comment 'n/a';
|
||||
@@ -69,6 +74,8 @@ data work.cars_ext(index=(carspk=(make model PRODUCTIONDATE) /unique));
|
||||
else POTENTIALBUY='No';
|
||||
make=cats(make);
|
||||
model=cats(model);
|
||||
EDITOR='SYSTEM';
|
||||
APPROVER='n/a';
|
||||
|
||||
array cntrs (4) $ 60 _temporary_ ( "Germany" "France" "Poland" "Italy");
|
||||
if origin='USA' then country='USA';
|
||||
@@ -85,12 +92,16 @@ data work.COUNTRIES(index=(countriespk=(origin country) /unique));
|
||||
attrib
|
||||
ORIGIN length= $6
|
||||
COUNTRY length= $30
|
||||
EDITOR length= $30
|
||||
APPROVER length= $30
|
||||
;
|
||||
infile cards dsd;
|
||||
input
|
||||
ORIGIN :$char.
|
||||
COUNTRY :$char.
|
||||
;
|
||||
EDITOR='SYSTEM';
|
||||
APPROVER='n/a';
|
||||
datalines4;
|
||||
Europe,Germany
|
||||
Europe,France
|
||||
@@ -102,6 +113,11 @@ Asia,Korea
|
||||
;;;;
|
||||
run;
|
||||
|
||||
data work.jobdata;
|
||||
length message job $100;
|
||||
call missing(of _all_);
|
||||
run;
|
||||
|
||||
%let engine_type=%mf_getengine(&demolib);
|
||||
%put &=engine_type;
|
||||
%if &engine_type=CAS %then %do;
|
||||
@@ -113,17 +129,25 @@ run;
|
||||
table.tableExists result=r2 / name="COUNTRIES" caslib="PUBLIC";
|
||||
if r2.exists then
|
||||
table.dropTable / name="COUNTRIES" caslib="PUBLIC" quiet=TRUE;
|
||||
|
||||
table.tableExists result=r3 / name="JOBDATA" caslib="PUBLIC";
|
||||
if r3.exists then
|
||||
table.dropTable / name="JOBDATA" caslib="PUBLIC" quiet=TRUE;
|
||||
quit;
|
||||
proc casutil;
|
||||
load data=work.CARS_EXT outcaslib="PUBLIC" casout="CARS_EXT" promote;
|
||||
load data=work.COUNTRIES outcaslib="PUBLIC" casout="COUNTRIES" promote;
|
||||
load data=work.COUNTRIES outcaslib="PUBLIC" casout="JOBDATA" promote;
|
||||
run;
|
||||
%end;
|
||||
%else %do;
|
||||
options replace;
|
||||
data &demolib..CARS_EXT; set work.cars_ext;
|
||||
data &demolib..COUNTRIES; set work.countries;run;
|
||||
data &demolib..COUNTRIES; set work.countries;
|
||||
data &demolib..JOBDATA; set work.JOBDATA;run;
|
||||
%end;
|
||||
|
||||
%let apploc=%mf_getapploc(&_program);
|
||||
%let demolib=%upcase(&demolib);
|
||||
proc sql;
|
||||
delete from &dc_libref..mpe_tables
|
||||
@@ -135,6 +159,10 @@ data append;
|
||||
LIBREF="&demolib";
|
||||
LOADTYPE='UPDATE';
|
||||
NUM_OF_APPROVALS_REQUIRED=1;
|
||||
PRE_EDIT_HOOK="&apploc/demo/PREEDIT";
|
||||
POST_EDIT_HOOK="&apploc/demo/POSTEDIT";
|
||||
PRE_APPROVE_HOOK="&apploc/demo/PREAPPROVE";
|
||||
POST_APPROVE_HOOK="&apploc/demo/POSTAPPROVE";
|
||||
DSN='CARS_EXT'; BUSKEY='MAKE MODEL PRODUCTIONDATE'; output;
|
||||
DSN='COUNTRIES'; BUSKEY='ORIGIN COUNTRY'; output;
|
||||
run;
|
||||
@@ -242,7 +270,6 @@ insert into &dc_libref..MPE_VALIDATIONS set
|
||||
)
|
||||
|
||||
/* programmatic values for COUNTRY (Dynamic Dropdown) */
|
||||
|
||||
filename vldtr temp;
|
||||
data _null_;
|
||||
file vldtr ;
|
||||
@@ -269,7 +296,7 @@ data _null_;
|
||||
put ' if first.display_index then forced_value=1;';
|
||||
put 'run;';
|
||||
run;
|
||||
%mx_createwebservice(path=%mf_getapploc(&_program)/demo
|
||||
%mx_createwebservice(path=&apploc/demo
|
||||
,name=origin,code=vldtr
|
||||
)
|
||||
proc sql;
|
||||
@@ -279,9 +306,81 @@ insert into &dc_libref..MPE_VALIDATIONS set
|
||||
,base_ds="CARS_EXT"
|
||||
,base_col="ORIGIN"
|
||||
,rule_type='HARDSELECT_HOOK'
|
||||
,rule_value="%mf_getapploc(&_program)/demo/origin"
|
||||
,rule_value="&apploc/demo/origin"
|
||||
,rule_active=1
|
||||
,tx_to='31DEC5999:23:59:59'dt;
|
||||
|
||||
/* PRE_EDIT JOB */
|
||||
%let fvar=XXXXXXXXXXX; /* cannot substitute macvars in parmcards */
|
||||
filename ft15f001 temp;
|
||||
parmcards4;
|
||||
proc sql;
|
||||
insert into XXXXXXXXXXX.JOBDATA values(
|
||||
"&orig_libds (%mf_nobs(work.out) obs) fetched for editing %trim(
|
||||
)by %mf_getUser() at %mf_uid()","&pgmloc");
|
||||
;;;;
|
||||
filename f1 temp;
|
||||
%mp_binarycopy(inref=ft15f001, outref=f1)
|
||||
%mp_replace("%sysfunc(pathname(f1))", findvar=fvar, replacevar=demolib)
|
||||
%mx_createwebservice(path=&apploc/demo,name=PREEDIT,code=f1)
|
||||
filename ft15f001 clear;
|
||||
|
||||
/* POST EDIT JOB */
|
||||
filename ft15f001 temp;
|
||||
parmcards4;
|
||||
|
||||
/* modify staging_ds to apply changes */
|
||||
data work.staging_ds;
|
||||
set work.staging_ds;
|
||||
if "%scan(&orig_libds,1,.)"="XXXXXXXXXXX" then do;
|
||||
if "%scan(&orig_libds,2,.)" in ('CARS_EXT','COUNTRIES')
|
||||
then EDITOR="%mf_getuser()";
|
||||
end;
|
||||
run;
|
||||
|
||||
proc sql;
|
||||
insert into XXXXXXXXXXX.JOBDATA values(
|
||||
"&orig_libds (%mf_nobs(work.staging_ds) obs) staged %trim(
|
||||
)by %mf_getUser() at %mf_uid()","&pgmloc");
|
||||
;;;;
|
||||
filename f2 temp;
|
||||
%mp_binarycopy(inref=ft15f001, outref=f2)
|
||||
%mp_replace("%sysfunc(pathname(f2))", findvar=fvar, replacevar=demolib)
|
||||
%mx_createwebservice(path=&apploc/demo,name=POSTEDIT,code=f2)
|
||||
filename ft15f001 clear;
|
||||
|
||||
/* PRE APPROVE JOB */
|
||||
filename ft15f001 temp;
|
||||
parmcards4;
|
||||
/* modify staging_ds to apply changes */
|
||||
data work.staging_ds;
|
||||
set work.staging_ds;
|
||||
if "%scan(&orig_libds,1,.)"="XXXXXXXXXXX" then do;
|
||||
if "%scan(&orig_libds,2,.)" in ('CARS_EXT','COUNTRIES')
|
||||
then APPROVER="%mf_getuser()";
|
||||
end;
|
||||
run;
|
||||
proc sql;
|
||||
insert into XXXXXXXXXXX.JOBDATA values(
|
||||
"&orig_libds (%mf_nobs(work.staging_ds) obs) under review by %trim(
|
||||
)by %mf_getUser() at %mf_uid()","&pgmloc");
|
||||
;;;;
|
||||
filename f3 temp;
|
||||
%mp_binarycopy(inref=ft15f001, outref=f3)
|
||||
%mp_replace("%sysfunc(pathname(f3))", findvar=fvar, replacevar=demolib)
|
||||
%mx_createwebservice(path=&apploc/demo,name=PREAPPROVE,code=f3)
|
||||
filename ft15f001 clear;
|
||||
|
||||
/* POST APPROVE JOB */
|
||||
filename ft15f001 temp;
|
||||
parmcards4;
|
||||
proc sql;
|
||||
insert into XXXXXXXXXXX.JOBDATA values(
|
||||
"&orig_libds (%mf_nobs(work.staging_ds) obs) approved by %trim(
|
||||
)by %mf_getUser() at %mf_uid()","&pgmloc");
|
||||
;;;;
|
||||
filename f4 temp;
|
||||
%mp_binarycopy(inref=ft15f001, outref=f4)
|
||||
%mp_replace("%sysfunc(pathname(f4))", findvar=fvar, replacevar=demolib)
|
||||
%mx_createwebservice(path=&apploc/demo,name=POSTAPPROVE,code=f4)
|
||||
filename ft15f001 clear;
|
||||
Reference in New Issue
Block a user