mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
Generated
+7
-1
@@ -16001,6 +16001,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"rxjs-compat": {
|
||||
"version": "6.6.7",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.6.7.tgz",
|
||||
"integrity": "sha512-szN4fK+TqBPOFBcBcsR0g2cmTTUF/vaFEOZNuSdfU8/pGFnNmmn2u8SystYXG1QMrjOPBc6XTKHMVfENDf6hHw=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
@@ -18827,7 +18832,8 @@
|
||||
},
|
||||
"ssri": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "",
|
||||
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
|
||||
"integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"figgy-pudding": "^3.5.1"
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"moment": "^2.29.1",
|
||||
"ngx-socket-io": "^3.2.0",
|
||||
"rxjs": "~6.6.3",
|
||||
"rxjs-compat": "^6.6.7",
|
||||
"sharp": "^0.25.4",
|
||||
"socket.io-client": "^2.3.0",
|
||||
"tslib": "^2.0.0",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface Message {
|
||||
author: string;
|
||||
message: string;
|
||||
}
|
||||
@@ -21,6 +21,9 @@ import { NewchatPage } from './newchat/newchat.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { EditGroupPage } from 'src/app/shared/chat/edit-group/edit-group.page';
|
||||
import * as Rx from "rxjs/Rx";
|
||||
import { Message } from 'src/app/models/message.model';
|
||||
import { Observable, Subject } from "rxjs/Rx";
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat',
|
||||
@@ -78,8 +81,15 @@ export class ChatPage implements OnInit {
|
||||
|
||||
*/
|
||||
|
||||
SERVER_URL = 'wss://www.tabularium.pt/websocket';
|
||||
ws:any;
|
||||
subject: any;
|
||||
public messages: Subject<any>;
|
||||
|
||||
message = {
|
||||
"msg": "connect",
|
||||
"version": "1",
|
||||
"support": ["1"]
|
||||
};
|
||||
|
||||
|
||||
/* Fim websockets variables*/
|
||||
constructor(
|
||||
@@ -89,12 +99,13 @@ export class ChatPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private storage:Storage,
|
||||
private resolver: ComponentFactoryResolver,
|
||||
|
||||
){
|
||||
this.headers = new HttpHeaders();
|
||||
/* this.headers = this.headers.set('X-User-Id', 'GqjNWiLrGEHRna7Zn');
|
||||
this.headers = this.headers.set('X-Auth-Token', 'SJwIgtlqfloPK696fpc2VBvyDluipuIHKB_0Q6-9ycJ'); */
|
||||
chatService.messages.subscribe(msg => {
|
||||
console.log("Response from websocket: " + msg);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.segment = "Contactos";
|
||||
|
||||
@@ -103,49 +114,16 @@ export class ChatPage implements OnInit {
|
||||
console.log(this.loggedUser);
|
||||
this.load();
|
||||
});
|
||||
this.storage.get('userDataKey').then(val=> {
|
||||
let t = JSON.parse(unescape(atob(val)));
|
||||
this.loggedUser=t;
|
||||
//this.load();
|
||||
})
|
||||
|
||||
console.log(this.roomId);
|
||||
this.connect();
|
||||
|
||||
}
|
||||
|
||||
/* websocket functions */
|
||||
connect() {
|
||||
this.ws = new WebSocket(this.SERVER_URL, []);
|
||||
console.log(this.ws);
|
||||
//this.sendMsg();
|
||||
|
||||
/* this.ws.onmessage = handleMessageReceived;
|
||||
this.ws.onerror = handleError; */
|
||||
/* Fim websocket functions */
|
||||
}
|
||||
handleMessageReceived(data) {
|
||||
// Simply call logMessage(), passing the received data.
|
||||
/* logMessage(data.data); */
|
||||
}
|
||||
handleConnected(data) {
|
||||
// Create a log message which explains what has happened and includes
|
||||
// the url we have connected too.
|
||||
var logMsg = 'Connected to server: ' + data.target.url;
|
||||
// Add the message to the log.
|
||||
/* logMessage(logMsg) */
|
||||
}
|
||||
handleError(err) {
|
||||
// Print the error to the console so we can debug it.
|
||||
console.log("Error: ", err);
|
||||
}
|
||||
logMessage(msg) {
|
||||
// $apply() ensures that the elements on the page are updated
|
||||
// with the new message.
|
||||
/* $scope.$apply(function() { */
|
||||
//Append out new message to our message log. The \n means new line.
|
||||
/* $scope.messageLog = $scope.messageLog + msg + "\n"; */
|
||||
// Update the scrolling (defined below).
|
||||
/*updateScrolling();*/
|
||||
/* S */
|
||||
sendMsg() {
|
||||
console.log("new message from client to websocket: ", this.message);
|
||||
this.chatService.messages.next(this.message);
|
||||
this.message.msg = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +156,7 @@ export class ChatPage implements OnInit {
|
||||
}
|
||||
openMessagesPage(rid) {
|
||||
if( window.innerWidth <= 1024){
|
||||
this.openMessagesModal(rid);
|
||||
//this.openMessagesModal(rid);
|
||||
}
|
||||
else{
|
||||
this.closeAllDesktopComponents();
|
||||
@@ -236,9 +214,8 @@ export class ChatPage implements OnInit {
|
||||
onSegmentChange(){
|
||||
this.load();
|
||||
}
|
||||
doRefresh(ev:any){
|
||||
doRefresh(){
|
||||
this.load();
|
||||
ev.target.complete();
|
||||
}
|
||||
load(){
|
||||
switch (this.segment)
|
||||
@@ -310,6 +287,7 @@ export class ChatPage implements OnInit {
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async selectContact(){
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
@@ -318,6 +296,7 @@ export class ChatPage implements OnInit {
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async newGroup(){
|
||||
const modal = await this.modalController.create({
|
||||
component: NewGroupPage,
|
||||
@@ -383,4 +362,5 @@ export class ChatPage implements OnInit {
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,12 +77,11 @@ openExpedientDetailPage(data){
|
||||
|
||||
|
||||
let result = await this.processes.GetTasksList("Despacho", false).toPromise();
|
||||
let despachos = result.reverse().filter(data => data.activityInstanceName == "Despacho (Paralelo)");
|
||||
|
||||
console.log(result);
|
||||
|
||||
this.despachoList = new Array();
|
||||
|
||||
await result.forEach( (element, index) => {
|
||||
await despachos.forEach( (element, index) => {
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
|
||||
@@ -158,7 +158,8 @@ export class GabineteDigitalPage implements OnInit {
|
||||
let expedientes = await this.processesbackend.GetTasksList("Expediente", false).toPromise();
|
||||
this.count_exp_dailywork = Object.keys(expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
|
||||
|
||||
let despachos = await this.processesbackend.GetTasksList("Despacho", false).toPromise();
|
||||
let result = await this.processesbackend.GetTasksList("Despacho", false).toPromise();
|
||||
let despachos = result.reverse().filter(data => data.activityInstanceName == "Despacho (Paralelo)");
|
||||
this.count_desp_dailywork = Object.keys(despachos).length;
|
||||
|
||||
let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from "rxjs"
|
||||
import { AuthService } from './auth.service';
|
||||
import { HttpService } from './http.service';
|
||||
import { StorageService } from './storage.service';
|
||||
import { HttpClient, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { Message } from 'src/app/models/message.model';
|
||||
import { Observable, Subject } from "rxjs/Rx";
|
||||
import { WebsocketService } from './websocket.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -18,17 +20,20 @@ export class ChatService {
|
||||
X_User_Id:any;
|
||||
X_Auth_Token:any;
|
||||
|
||||
SERVER_URL = 'wss://www.tabularium.pt/websocket';
|
||||
public messages: Subject<any>;
|
||||
|
||||
|
||||
constructor(
|
||||
private http:HttpClient,
|
||||
private httpService: HttpService,
|
||||
private authService: AuthService,
|
||||
private storage: Storage,
|
||||
private storageService:StorageService,) {
|
||||
private storageService:StorageService,
|
||||
private wsService: WebsocketService,
|
||||
)
|
||||
{
|
||||
this.headers = new HttpHeaders();
|
||||
/* this.headers = this.headers.set('X-User-Id', 'GqjNWiLrGEHRna7Zn');
|
||||
this.headers = this.headers.set('X-Auth-Token', 'dAM0ZOTAy8jzQA_vS25z2IrnSc6sYLfi5rmaa35YNUz'); */
|
||||
-
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.headers = this.headers.set('X-User-Id', res.userId);
|
||||
this.headers = this.headers.set('X-Auth-Token', res.authToken);
|
||||
@@ -36,6 +41,16 @@ export class ChatService {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
|
||||
this.messages = <Subject<any>>this.wsService.connect(this.SERVER_URL).map((response: MessageEvent): any => {
|
||||
let data = JSON.parse(response.data);
|
||||
console.log(data);
|
||||
|
||||
return {
|
||||
id: data.id,
|
||||
msg: data.msg
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* getUser(){
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import * as io from 'socket.io-client';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Socket } from 'ngx-socket-io';
|
||||
import * as Rx from "rxjs/Rx";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -11,11 +9,35 @@ export class WebsocketService {
|
||||
message = '';
|
||||
messages = [];
|
||||
currentUser = '';
|
||||
private subject: Rx.Subject<MessageEvent>;
|
||||
|
||||
constructor(private socket: Socket) { }
|
||||
constructor() { }
|
||||
|
||||
connect(){
|
||||
return this.socket.connect();
|
||||
public connect(url): Rx.Subject<MessageEvent> {
|
||||
if (!this.subject) {
|
||||
this.subject = this.create(url);
|
||||
console.log("Successfully connected: " + url);
|
||||
}
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
private create(url): Rx.Subject<MessageEvent> {
|
||||
let ws = new WebSocket(url);
|
||||
|
||||
let observable = Rx.Observable.create((obs: Rx.Observer<MessageEvent>) => {
|
||||
ws.onmessage = obs.next.bind(obs);
|
||||
ws.onerror = obs.error.bind(obs);
|
||||
ws.onclose = obs.complete.bind(obs);
|
||||
return ws.close.bind(ws);
|
||||
});
|
||||
let observer = {
|
||||
next: (data: Object) => {
|
||||
if (ws.readyState === WebSocket.OPEN) {
|
||||
ws.send(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Rx.Subject.create(observer, observable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,10 +77,11 @@ export class DespachosPage implements OnInit {
|
||||
this.despachoList = new Array();
|
||||
|
||||
let result = await this.processes.GetTasksList("Despacho", false).toPromise();
|
||||
let despachos = result.reverse().filter(data => data.activityInstanceName == "Despacho (Paralelo)");
|
||||
|
||||
console.log(result);
|
||||
|
||||
await result.forEach( (element, index) => {
|
||||
await despachos.forEach( (element, index) => {
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
|
||||
@@ -18,19 +18,16 @@ export class HeaderPage implements OnInit {
|
||||
loggeduser: User;
|
||||
|
||||
constructor(
|
||||
private router: Router,private modalController: ModalController,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
authService: AuthService) {
|
||||
|
||||
authService: AuthService
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
|
||||
router.events.subscribe((val) => {
|
||||
this.showSearch=false;
|
||||
this.modalController.dismiss()
|
||||
//this.modalController.dismiss();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
Reference in New Issue
Block a user