Skip to content

Commit

Permalink
Enable sources from local Fullsync databases #407
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesGrimont committed Jun 5, 2021
1 parent 2cdf268 commit 1b2fafb
Show file tree
Hide file tree
Showing 4 changed files with 369 additions and 210 deletions.
4 changes: 2 additions & 2 deletions _c8oProject/mobilePages/modalActions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ scriptContent:
public getHtmlName(comment: string, name: string){
let error = null;
if(comment != undefined){
var lang = (window.localStorage.getItem("lang") == undefined || window.localStorage.getItem("lang") == "undefined" || window.localStorage.getItem("lang") == "") ? "en" : window.localStorage.getItem("lang");
var lang = this.global.settings.language == undefined ? (window.localStorage.getItem("lang") == undefined || window.localStorage.getItem("lang") == "undefined" || window.localStorage.getItem("lang") == "") ? "en" : window.localStorage.getItem("lang") : this.global.settings.language;
let jObj = null;
try{
jObj = JSON.parse(comment);
Expand Down Expand Up @@ -115,7 +115,7 @@ scriptContent:
public getHtmlComment(str: string){
if(str != undefined){
var lang = (window.localStorage.getItem("lang") == undefined || window.localStorage.getItem("lang") == "undefined" || window.localStorage.getItem("lang") == "") ? "en" : window.localStorage.getItem("lang") ;
var lang = this.global.settings.language == undefined ? (window.localStorage.getItem("lang") == undefined || window.localStorage.getItem("lang") == "undefined" || window.localStorage.getItem("lang") == "") ? "en" : window.localStorage.getItem("lang") : this.global.settings.language;
let jObj = null;
let error = null;
try{
Expand Down
14 changes: 5 additions & 9 deletions _c8oProject/mobilePages/viewerPage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
changeDetection: OnPush
comment: Form Visualisator
menu: C8Oforms.MobileApplication.Application.Menu
scriptContent:
Expand All @@ -7,10 +6,8 @@ scriptContent:
- com.twinsoft.convertigo.beans.common.FormatedContent:
: |
'/*Begin_c8o_PageImport*/
//import { Observable, Subject} from ''rxjs'';
//import ''rxjs/add/observable/zip'';
import { Content } from ''ionic-angular'';
//import { Observable, Subject } from ''rxjs'';
import { delay } from ''rxjs/operators'';
import { of, zip } from ''rxjs'';
Expand Down Expand Up @@ -47,6 +44,7 @@ scriptContent:
}
/*End_c8o_PageImport*/
/*Begin_c8o_PageDeclaration*/
public formsList: Array<object> = [];
public formsSubmit = {};
public actions = {};
Expand Down Expand Up @@ -127,7 +125,8 @@ scriptContent:
startSyncDatabases(databaseObject){
for(let databaseName in databaseObject){
if(databaseObject[databaseName]){
this.c8o.callJsonObject("fs://"+databaseName+".replicate_pull",{"continuous": true})
this.c8o.log.debug("beforeCall "+ databaseName + " status");
this.c8o.callJsonObject("fs://"+databaseName+".replicate_pull",{"continuous": true, "heartbeat": false, "timeout": false, "batch_size": 1000, "retry": true, "batches_limit": 10})
.then((res, parameters)=>{
this.c8o.log.debug("startSyncDatabases "+ databaseName + " status");
console.log("status", res);
Expand Down Expand Up @@ -447,10 +446,8 @@ scriptContent:
var functionKeyWord = "function";
let doc = await page.c8o.callJsonObject("fs://"+sources.fullSyncArgs.connectorName+".get", {docid:"_design/"+params["ddoc"]}).async();
doc = doc["views"][params.view].map;
console.log("there doc", doc);
var functionStr = doc.substring(doc.indexOf(commentBegin) + commentBegin.length, doc.indexOf(commentEnd)).trim();
functionStr = functionStr.substring(functionStr.indexOf(varName)+varName.length);
console.log("functionStr", functionStr);
var str = functionStr.substring(functionStr.indexOf(functionKeyWord)+functionKeyWord.length);
// get the next "{" char
str = str.substring(0,str.indexOf("{"));
Expand All @@ -476,10 +473,8 @@ scriptContent:
var varName = "var c8oformPostQuery = ";
let doc = await page.c8o.callJsonObject("fs://"+sources.fullSyncArgs.connectorName+".get", {docid:"_design/"+params["ddoc"]}).async();
doc = doc["views"][params.view].map;
console.log("there doc", doc);
var functionStr = doc.substring(doc.indexOf(commentBegin) + commentBegin.length, doc.indexOf(commentEnd)).trim();
functionStr = functionStr.substring(functionStr.indexOf(varName)+varName.length);
console.log("functionStr", functionStr);
var args =[response, type, variables];
return eval("("+functionStr+").apply(this,args)");
}
Expand Down Expand Up @@ -562,6 +557,7 @@ scriptContent:
let res2 = {...response};
func(res2);
})
page.ref.detectChanges();
return null;
})
}
Expand Down
2 changes: 1 addition & 1 deletion _c8oProject/mobileSharedComponents/datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
position:relative;
'
↓Image [mobile.components.UIDynamicElement-1608568353495]:
beanData: '{"ionBean":"Image","url":"plain:assets\/images\/svg\/component\/icn_flash.svg"}'
beanData: '{"ionBean":"Image","url":"plain:child.connector != undefined ? ''assets\/images\/svg\/component\/icn_offline.svg'' : ''assets\/images\/svg\/component\/icn_flash.svg''"}'
selfClose: true
tagName: img
↓Style [mobile.components.UIStyle-1608568353498]:
Expand Down
Loading

0 comments on commit 1b2fafb

Please sign in to comment.