Skip to content

Commit

Permalink
mongo-multipleaggregators
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorioMonari committed Jun 21, 2023
1 parent 5620a69 commit 605ad1c
Show file tree
Hide file tree
Showing 176 changed files with 6,542 additions and 3,390 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/5_RELEASES
/6_API_my2sec_executable_OLD
/6_API_my2sec
/backup
/backup
/2_PAC/backup
27 changes: 26 additions & 1 deletion 1_ActivityWatchProducer/CSS/reusableComponents.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ REUSABLE COMPONENTS
border-radius: 50%;
background: conic-gradient(
#0000 10%,
#8f44fd
#000000
);
-webkit-mask:
radial-gradient(
Expand All @@ -130,3 +130,28 @@ REUSABLE COMPONENTS
transform: rotate(1turn);
}
}

.spinner_inline{

/*CENTER ELEMENT*/
display: block;
margin-left: 0;
margin-right: 0;


width: 24px;
height: 24px;
border-radius: 50%;
background: conic-gradient(
#0000 10%,
#ffffff
);
-webkit-mask:
radial-gradient(
farthest-side,
#0000 calc(100% - 4px),
#000
0
);
animation: spin 0.8s infinite linear;
}
128 changes: 128 additions & 0 deletions 1_ActivityWatchProducer/CSS/taskdashboard_material.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
.task-container{
width: 25%;
background: white;
font-family: Arial, Helvetica, sans-serif;
display:flex;
flex-flow: column;
/*height:100%;*/
align-items: stretch;
/*resize: horizontal;*/
/*overflow: auto;*/
}
.task-header_OLD{
transform: translateY(3px);
border-radius: 5px;
height: 5vh;
background: rgb(42,45,46);
display:flex;
align-items: center;
justify-content: center;
margin:auto;
width:94%;
/*padding-top:1.5%;
padding-bottom: 1.5%;*/
padding-left: 2%;
padding-right: 2%;
color:white;
}
.task-header{
height: 5vh;

display:flex;
align-items: center;

margin:auto;
width:94%;
/*padding-top:1.5%;
padding-bottom: 1.5%;*/
padding-left: 2%;
padding-right: 2%;

}
.task-header h3{
margin:0;
}
#task-wrapper{
margin:auto;
border-width:0px;
border-style: solid;
border-color:black;
width: 90%;
height: 20vh;
overflow-y:scroll;
padding: 2%;
/*overflow: scroll;*/
background: white;
flex: 1 1 auto;

}
#task-info{
width:100%;
}

/*LOADING BAR*/
.task-loading-wrapper{

}
.task-loading_box{
display:block;
position: relative;
width: 98%;
height:5px;
border: 1px solid var(--main_color);
border-radius: 10px;
padding:2px;
}
.task-loading_bar{
border-radius: 10px;
width:100px;
height: 5px;
background-color: var(--main_color);
/*animation: load 1s infinite linear;*/
animation: none;

}
@keyframes load{
from {
width: 0px;
}to{
width: 100px;
}
}



#log-times-panel-wrapper{
width:100%;
}
#log-times-container{
width: 90%;
height: 47vh;
overflow: scroll;
padding-left: 2%;
padding-right: 2%;
margin:auto;
border-width:0px;
border-style: solid;
border-color:black;
}
.log_time_cell-logged_time{
display:flex;
align-items: center;
}
.work-day-cell{
background: rgb(42,45,46);
width: 96%;
padding: 2%;
border-radius: 6px;
}
.work-day-date{
color:white;
}
.log_time_cell{
border-radius: 6px;
background: white;
width: 99%;
padding: 0.5%;
margin-bottom: 2%;
}
3 changes: 3 additions & 0 deletions 1_ActivityWatchProducer/JS/Initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class Initializer{
this.log.info("----------< Init SCAN MANAGER >----------")
//await initControlPanel();
var scanManager=new ScanManager(this.get_jsap());
//console.log(scanManager.secondsToTimeString(60))

await scanManager.init_start_scan_button(); //! DO NOT AWAIT INIT SCAN MANAGER, IT IS POLLING SO IT WILL BLOCK CODE EXECUTION UNTIL AW API IS STARTED
await scanManager.init_update_button();
this.log.info("Scan manager initialized")
this.log.debug(`Scan status: ${scanManager.is_scan_running()}`)
Expand Down
4 changes: 4 additions & 0 deletions 1_ActivityWatchProducer/JS/account/UserInfoConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class UserInfoConsumer {
//log.info("New UserInfoConsumer created!")
}

get_userEmail(){
return this.usermail
}

logspan_usermail(element){
document.getElementById(element).innerHTML=this.usermail;
}
Expand Down
38 changes: 37 additions & 1 deletion 1_ActivityWatchProducer/JS/clients/AwQueryManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,43 @@ class AwQueryManager{
}

//------------------MAIN QUERY--------------------
async get_aw_messages(){
//?UPDATED FOR MONGO
async get_aw_messages_jsonarr(){
//Get buckets and time interval
var bucketsJson= await this.get_useful_buckets();
var startTime=await this.producerBucketClient.get_last_update();
var stopTime=await this.producerBucketClient.get_last_stop();
this.log.debug("Start Time: "+startTime)
this.log.debug("Stop Time: "+stopTime)

//TODO: CONTROLLA SE FUNZIONA SENZA IL PRIMO START TIME
var events={};
if(startTime!=null){
//TODO: TEST BUGFIX
//!BUGFIX: TAKE NOW IF STOPTIME IS NULL
if(stopTime==null){
stopTime=new Date().toISOString();
}
//Adjust interval
startTime=new Date(startTime);
startTime.setSeconds(startTime.getSeconds()-10)
startTime=startTime.toISOString();
stopTime=new Date(stopTime);
stopTime.setSeconds(stopTime.getSeconds()+10)
stopTime=stopTime.toISOString();
//Get timeinterval events
events= await this.get_useful_events(bucketsJson,startTime,stopTime);
}else{
//Get all events
events= await this.get_all_useful_events(bucketsJson);
}

//return json events
return events
}

//!DEPRECATED, SENDS STRING MESSAGE DIRECTLY TO SEPA. CAN LEAD TO SLOW EXECUTION AND INSTABILITY
async get_aw_messages_stringarr_formatted4sepa(){
//Get buckets and time interval
var bucketsJson= await this.get_useful_buckets();
var startTime=await this.producerBucketClient.get_last_update();
Expand Down
65 changes: 65 additions & 0 deletions 1_ActivityWatchProducer/JS/clients/MongoDbClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
class MongoDbClient {
constructor(jsap){
this.router_url=jsap.extended.AwProducer.endpoints.MongoDbRouter
this.config={
headers:{
'Content-Type': 'application/json'
}
}
}

async test_datasource(){
var res=false
try{
await this.ping()
res=true;
}catch(e){
res=false
}
return res;
}
async ping(){
var path="/mongodb/api";
var res = await axios.get(this.router_url+path,this.config)
return res.data
}

async insertManyFiles(fileArr){
if(!fileArr){throw new Error("FileArr cannot be null")}
var path="/mongodb/api/insertMany";
try{
const result = await axios.post(this.router_url+path,fileArr,this.config);
//console.log(file);
return result.data;
}catch(e){
console.log(e);
}
}

async insertFile(file){
if(!file){throw new Error("File cannot be null")}
var path="/mongodb/api/insert";
try{
const result = await axios.post(this.router_url+path,file,this.config);
//console.log(file);
return result.data;
}catch(e){
console.log(e);
}
}


async deleteFileByObjectId(id){
throw new Error("Not implemented yet")
}

async getFileByObjectId(id){
throw new Error("Not implemented yet")
}

async getFile(query,options){
throw new Error("Not implemented yet")
}


}
2 changes: 2 additions & 0 deletions 1_ActivityWatchProducer/JS/clients/My2secApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class My2secApiClient{
//console.log(this.my2secapi_host)
//this.host="127.0.0.1:5000";
//RESET: apps_current.csv / apps_selection da cancellare
this.getAWClient='{"watcher-api-request":{"getAction":"GetAWClient"}}' //CURRENT EVENTS (not filtered)
this.startAction='{"watcher-api-request":{"requestAction":{"watchers-management":"START_ALL"}}}' //START SCAN
this.stopAction='{"watcher-api-request":{"requestAction":{"watchers-management":"STOP_ALL"}}}' //STOP SCAN
this.getAppsCurrentCSV='{"watcher-api-request":{"getAction":"GetCurrentCSV"}}' //CURRENT EVENTS (not filtered)
Expand All @@ -38,6 +39,7 @@ class My2secApiClient{

//==============================
//API ACTIONS
async getAwClient(){return await this.action("getAWClient")}
async startWatchers(){ return await this.action("startAction") }
async stopWatchers(){ return await this.action("stopAction") }
async getAppsCurrentCsv(){ return await this.action("getAppsCurrentCSV") }
Expand Down
Loading

0 comments on commit 605ad1c

Please sign in to comment.