Skip to content

Commit

Permalink
Fixed latest code generation
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.0.3
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
computate committed Dec 1, 2023
1 parent a7fbf2c commit 2a39a36
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 118 deletions.
5 changes: 5 additions & 0 deletions bin/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cd $HOME/.local/src/smartvillage-platform
env SITE_NAME=smartvillage-platform SITE_PATH=$HOME/.local/src/smartvillage-platform COMPUTATE_SRC=$HOME/.local/src/computate SITE_LANG=enUS $HOME/.local/src/computate/bin/enUS/generate.sh

5 changes: 5 additions & 0 deletions bin/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cd $HOME/.local/src/smartvillage-platform
env SITE_NAME=smartvillage-platform SITE_PATH=$HOME/.local/src/smartvillage-platform COMPUTATE_SRC=$HOME/.local/src/computate SITE_LANG=enUS $HOME/.local/src/computate/bin/enUS/watch.sh

Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ public Future<Void> promiseDeepSiteHtmPage() {
Promise<Void> promise2 = Promise.promise();
promiseSiteHtmPage(promise2);
promise2.future().onSuccess(a -> {
promise.complete();
super.promiseDeepSiteHtmGenPage(siteRequest_).onSuccess(b -> {
promise.complete();
}).onFailure(ex -> {
promise.fail(ex);
});
}).onFailure(ex -> {
promise.fail(ex);
});
Expand All @@ -167,7 +171,7 @@ public Future<Void> promiseSiteHtmPage(Promise<Void> promise) {
return promise.future();
}

public Future<Void> promiseDeepForClass(SiteRequestEnUS siteRequest_) {
@Override public Future<Void> promiseDeepForClass(SiteRequestEnUS siteRequest_) {
return promiseDeepSiteHtmPage(siteRequest_);
}

Expand All @@ -176,6 +180,7 @@ public Future<Void> promiseDeepForClass(SiteRequestEnUS siteRequest_) {
/////////////////

public void siteRequestSiteHtmPage(SiteRequestEnUS siteRequest_) {
super.siteRequestSiteHtmGenPage(siteRequest_);
}

public void siteRequestForClass(SiteRequestEnUS siteRequest_) {
Expand All @@ -186,7 +191,7 @@ public void siteRequestForClass(SiteRequestEnUS siteRequest_) {
// obtain //
/////////////

public Object obtainForClass(String var) {
@Override public Object obtainForClass(String var) {
String[] vars = StringUtils.split(var, ".");
Object o = null;
for(String v : vars) {
Expand All @@ -207,15 +212,15 @@ public Object obtainSiteHtmPage(String var) {
SiteHtmPage oSiteHtmPage = (SiteHtmPage)this;
switch(var) {
default:
return null;
return super.obtainSiteHtmGenPage(var);
}
}

///////////////
// relate //
///////////////

public boolean relateForClass(String var, Object val) {
@Override public boolean relateForClass(String var, Object val) {
String[] vars = StringUtils.split(var, ".");
Object o = null;
for(String v : vars) {
Expand All @@ -232,7 +237,7 @@ public Object relateSiteHtmPage(String var, Object val) {
SiteHtmPage oSiteHtmPage = (SiteHtmPage)this;
switch(var) {
default:
return null;
return super.relateSiteHtmGenPage(var, val);
}
}

Expand All @@ -246,7 +251,7 @@ public static Object staticSetForClass(String entityVar, SiteRequestEnUS siteReq
public static Object staticSetSiteHtmPage(String entityVar, SiteRequestEnUS siteRequest_, String o) {
switch(entityVar) {
default:
return null;
return SiteHtmGenPage.staticSetSiteHtmGenPage(entityVar, siteRequest_, o);
}
}

Expand All @@ -260,7 +265,7 @@ public static Object staticSearchForClass(String entityVar, SiteRequestEnUS site
public static Object staticSearchSiteHtmPage(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
switch(entityVar) {
default:
return null;
return SiteHtmGenPage.staticSearchSiteHtmGenPage(entityVar, siteRequest_, o);
}
}

Expand All @@ -274,7 +279,7 @@ public static String staticSearchStrForClass(String entityVar, SiteRequestEnUS s
public static String staticSearchStrSiteHtmPage(String entityVar, SiteRequestEnUS siteRequest_, Object o) {
switch(entityVar) {
default:
return null;
return SiteHtmGenPage.staticSearchStrSiteHtmGenPage(entityVar, siteRequest_, o);
}
}

Expand All @@ -288,7 +293,7 @@ public static String staticSearchFqForClass(String entityVar, SiteRequestEnUS si
public static String staticSearchFqSiteHtmPage(String entityVar, SiteRequestEnUS siteRequest_, String o) {
switch(entityVar) {
default:
return null;
return SiteHtmGenPage.staticSearchFqSiteHtmGenPage(entityVar, siteRequest_, o);
}
}

Expand All @@ -298,6 +303,7 @@ public static String staticSearchFqSiteHtmPage(String entityVar, SiteRequestEnUS

@Override public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
return sb.toString();
}

Expand All @@ -311,7 +317,7 @@ public static String displayNameForClass(String var) {
public static String displayNameSiteHtmPage(String var) {
switch(var) {
default:
return null;
return SiteHtmGenPage.displayNameSiteHtmGenPage(var);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public void postSiteHtm(JsonObject body, ServiceRequest serviceRequest, Handler<
params.put("body", siteRequest.getJsonObject());
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down Expand Up @@ -891,7 +891,7 @@ public Future<Void> listPUTImportSiteHtm(ApiRequest apiRequest, SiteRequestEnUS
params.put("body", obj);
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void postSitePage(JsonObject body, ServiceRequest serviceRequest, Handler
params.put("body", siteRequest.getJsonObject());
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down Expand Up @@ -831,7 +831,7 @@ public Future<Void> listPUTImportSitePage(ApiRequest apiRequest, SiteRequestEnUS
params.put("body", obj);
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public void postSystemEvent(JsonObject body, ServiceRequest serviceRequest, Hand
params.put("body", siteRequest.getJsonObject());
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down Expand Up @@ -891,7 +891,7 @@ public Future<Void> listPUTImportSystemEvent(ApiRequest apiRequest, SiteRequestE
params.put("body", obj);
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public void postSiteUser(JsonObject body, ServiceRequest serviceRequest, Handler
params.put("body", siteRequest.getJsonObject());
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down Expand Up @@ -1149,7 +1149,7 @@ public Future<Void> listPUTImportSiteUser(ApiRequest apiRequest, SiteRequestEnUS
params.put("body", obj);
params.put("path", new JsonObject());
params.put("cookie", new JsonObject());
params.put("header", new JsonObject());
params.put("header", siteRequest.getServiceRequest().getParams().getJsonObject("header"));
params.put("form", new JsonObject());
JsonObject query = new JsonObject();
Boolean softCommit = Optional.ofNullable(siteRequest.getServiceRequest().getParams()).map(p -> p.getJsonObject("query")).map( q -> q.getBoolean("softCommit")).orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected void _userEmail(Wrap<String> w) {
*/
protected void _authClient(Wrap<JsonObject> w) {
JsonObject config = siteRequest_.getConfig();
w.o(config.getJsonObject(ConfigKeys.AUTH_CLIENTS).getJsonObject(config.getJsonObject(ConfigKeys.AUTH_CLIENTS).fieldNames().stream().findFirst().orElse(null)));
w.o(config.getJsonObject(ConfigKeys.AUTH_CLIENTS).getJsonObject(config.getString(ConfigKeys.AUTH_CLIENT)));
}

/**
Expand Down
34 changes: 26 additions & 8 deletions src/main/resources/templates/enUS/BaseModelGenPage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,30 @@
//calendar.render();
{{#block "websocket"}}{{/block}}
});
function jsWebsocketBaseModel(vars, $response) {
{{#block "jsWebsocket"}}{{/block}}
}
function jsTooltipBaseModel(e, feature) {
{{#block "jsTooltip"}}{{/block}}
}
function htmTooltipBaseModel(feature, layer) {
return `{{#block "htmTooltip"}}{{/block}}`;
}
</script>
{{/inline}}
{{#*inline "websocketBaseModelPage"}}
<!-- inline "websocketBaseModelPage" -->
websocketBaseModel(websocketBaseModelInner);
{{/inline}}
{{#*inline "jsWebsocketBaseModelPage"}}{{/inline}}
{{#*inline "jsTooltipBaseModelPage"}}{{/inline}}
{{#*inline "htmTooltipBaseModelPage"}}{{/inline}}
{{#partial "jsWebsocket"}}{{> jsWebsocketBaseModelPage}}{{/partial}}
{{#partial "jsTooltip"}}{{> jsTooltipBaseModelPage}}{{/partial}}
{{#partial "htmTooltip"}}{{> htmTooltipBaseModelPage}}{{/partial}}
{{#*inline "htmUrlBaseModel"}}{{pageUri}}?q={{query.q}}&amp;rows={{#if rows}}{{rows}}{{else}}{{pagination.rows}}{{/if}}&amp;rows={{#if start}}{{start}}{{else}}{{pagination.start}}{{/if}}{{#each query.fq}}{{#eq fq this}}{{else}}&fq={{fq}}:{{val}}{{/eq}}{{/each}}{{#each query.sort}}{{#eq sort this}}{{else}}&sort={{var}} {{order}}{{/eq}}{{/each}}{{/inline}}
{{#*inline "htmHeadBaseModelPage"}}{{#block "htmTitle"}}{{/block}}{{#block "htmMeta"}}{{/block}}{{#block "htmStyle"}}{{/block}}{{#block "htmScripts"}}{{/block}}{{#block "htmScript"}}{{/block}}{{/inline}}
{{#*inline "htmBodySearchBaseModelPage"}} <!-- #*inline "htmBodySearchBaseModelPage" -->
Expand Down Expand Up @@ -744,19 +762,19 @@
id="{{classApiMethodMethod}}_archived"
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
class="classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
class="{{classApiMethodMethod}}_archived classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
name="setArchived"
{{else}}
{{#eq 'Page' classApiMethodMethod}}
class="classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
class="{{classApiMethodMethod}}_archived classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
name="setArchived"
{{else}}
class="setArchived valueArchived classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
class="{{classApiMethodMethod}}_archived setArchived valueArchived classBaseModel inputBaseModel{{pk}}Archived w3-input w3-border "
name="setArchived"
{{/eq}}
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
onchange="var confirmResponse = confirm('Are you sure you want to archive that?'); if(confirmResponse) { patch{{classSimpleName}}Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: 'pk:{{pk}}' }], 'setArchived', $(this).prop('checked'), function() { addGlow($('#{{classApiMethodMethod}}_archived')); }, function() { addError($('#{{classApiMethodMethod}}_archived')); }); }"
onchange="var confirmResponse = confirm('Are you sure you want to archive that?'); if(confirmResponse) { patch{{classSimpleName}}Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: 'pk:{{pk}}' }], 'setArchived', $(this).prop('checked'), function() { addGlow($('.{{classApiMethodMethod}}_archived')); }, function() { addError($('.{{classApiMethodMethod}}_archived')); }); }"
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
{{#if baseModel_.archived}}
Expand Down Expand Up @@ -808,19 +826,19 @@
id="{{classApiMethodMethod}}_deleted"
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
class="classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
class="{{classApiMethodMethod}}_deleted classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
name="setDeleted"
{{else}}
{{#eq 'Page' classApiMethodMethod}}
class="classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
class="{{classApiMethodMethod}}_deleted classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
name="setDeleted"
{{else}}
class="setDeleted valueDeleted classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
class="{{classApiMethodMethod}}_deleted setDeleted valueDeleted classBaseModel inputBaseModel{{pk}}Deleted w3-input w3-border "
name="setDeleted"
{{/eq}}
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
onchange="var confirmResponse = confirm('Are you sure you want to delete that?'); if(confirmResponse) { patch{{classSimpleName}}Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: 'pk:{{pk}}' }], 'setDeleted', $(this).prop('checked'), function() { addGlow($('#{{classApiMethodMethod}}_deleted')); }, function() { addError($('#{{classApiMethodMethod}}_deleted')); }); }"
onchange="var confirmResponse = confirm('Are you sure you want to delete that?'); if(confirmResponse) { patch{{classSimpleName}}Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: 'pk:{{pk}}' }], 'setDeleted', $(this).prop('checked'), function() { addGlow($('.{{classApiMethodMethod}}_deleted')); }, function() { addError($('.{{classApiMethodMethod}}_deleted')); }); }"
{{/eq}}
{{#eq 'Page' classApiMethodMethod}}
{{#if baseModel_.deleted}}
Expand Down
Loading

0 comments on commit 2a39a36

Please sign in to comment.