mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Merge branch 'feature/viewer-attachment' of https://bitbucket.org/equilibriumito/gabinete-digital-fo into feature/viewer-attachment
This commit is contained in:
@@ -99,7 +99,6 @@ export class ListBoxService {
|
||||
|
||||
display(list: CustomCalendarEvent[], selectedDate) {
|
||||
|
||||
|
||||
let days = {};
|
||||
const year: Year[] = []
|
||||
|
||||
@@ -174,6 +173,14 @@ export class ListBoxService {
|
||||
const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true})
|
||||
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
||||
} else {
|
||||
if( cloneEvent.start.getFullYear() == cloneSelectedDate.getFullYear() && cloneEvent.start.getDate() == cloneSelectedDate.getDate() && cloneEvent.start.getMonth() == cloneSelectedDate.getMonth()) {
|
||||
// console.log("00_00")
|
||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
||||
} else {
|
||||
// console.log('0000000000000000000000000',cloneEvent.start.getTime(), cloneSelectedDate.getTime())
|
||||
// console.log('0000000000000000000000000',cloneEvent.start, cloneSelectedDate)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -151,15 +151,6 @@ export class ChatSystemService {
|
||||
} catch(error) {}
|
||||
}
|
||||
|
||||
setMainChangeDetector(x:Function) {
|
||||
this.mainChangeDetector = x
|
||||
}
|
||||
|
||||
runMainChangeDetector() {
|
||||
console.log("change")
|
||||
// this.mainChangeDetector()
|
||||
}
|
||||
|
||||
loadChat() {
|
||||
if (SessionStore.user?.ChatData?.data) {
|
||||
this.ReLoadChat()
|
||||
|
||||
@@ -25,7 +25,6 @@ import { ChatSystemService } from './chat-system.service';
|
||||
import { ViewedMessageService } from './viewed-message.service'
|
||||
import * as FIFOProcessQueue from 'fifo-process-queue';
|
||||
import { NotificationsService } from '../notifications.service';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -85,7 +84,6 @@ export class RoomService {
|
||||
|
||||
sortRoomList = () => { }
|
||||
chatServiceDeleteRoom = (roomId) => { }
|
||||
private changeDetector: Function = () => {}
|
||||
|
||||
constructor(
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
@@ -192,11 +190,6 @@ export class RoomService {
|
||||
|
||||
}
|
||||
|
||||
setChangeDetector(x:Function) {
|
||||
console.log("set change detector")
|
||||
this.changeDetector = x
|
||||
}
|
||||
|
||||
get online() {
|
||||
|
||||
if (!this.isGroup) {
|
||||
@@ -391,6 +384,7 @@ export class RoomService {
|
||||
this.name = ChatMessage.msg
|
||||
}
|
||||
|
||||
this.sortRoomList()
|
||||
// this.changeDetector()
|
||||
setTimeout(() => {
|
||||
done()
|
||||
|
||||
@@ -1206,11 +1206,23 @@ export class EventsService {
|
||||
})
|
||||
)
|
||||
} else {
|
||||
const calendar = this.DetectCalendars(calendarId)
|
||||
const header = this.makeHeader(calendar)
|
||||
|
||||
options = {
|
||||
headers: header,
|
||||
params: params
|
||||
};
|
||||
|
||||
return this.http.delete(`${puturl}`, options).pipe(
|
||||
catchError(err => {
|
||||
|
||||
this.offlinemanager.storeRequestData('eventDelete', arrayReq);
|
||||
throw new Error(err);
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
throw('header not found')
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -202,9 +202,6 @@ export class NotificationsService {
|
||||
this.active = true
|
||||
console.log('NOtification Listener', notification)
|
||||
this.storenotification(notification)
|
||||
this.chatNotification(notification)
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
@@ -216,7 +213,6 @@ export class NotificationsService {
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
this.chatNotification(notification)
|
||||
// Handle the received message, e.g., show a notification
|
||||
});
|
||||
}
|
||||
@@ -400,12 +396,4 @@ export class NotificationsService {
|
||||
}
|
||||
|
||||
|
||||
chatNotification(_notification) {
|
||||
const notification = this.NotificationHolderService.stractureNotificationObject(_notification)
|
||||
|
||||
if (notification?.notification?.data?.Service === "chat" || notification?.Service === "chat") {
|
||||
this.ChatController.ChatSystemService.runMainChangeDetector()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HolderService } from './holder.service';
|
||||
|
||||
describe('HolderService', () => {
|
||||
let service: HolderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(HolderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HolderService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublicationHolderService } from './publication-holder.service';
|
||||
|
||||
describe('PublicationHolderService', () => {
|
||||
let service: PublicationHolderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PublicationHolderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,99 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PublicationFormMV } from 'src/app/shared/publication/upload/upload-streaming.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PublicationHolderService {
|
||||
|
||||
count = 0
|
||||
PublicationFormMV: {
|
||||
id: string,
|
||||
percentage: number,
|
||||
retry: boolean,
|
||||
retryFunction: Function
|
||||
}[] = []
|
||||
|
||||
constructor() {
|
||||
|
||||
window['upload-header-set-percentage'] = (id: string, percentage: number) => {
|
||||
this.PublicationFormMV = this.PublicationFormMV.map((e)=> {
|
||||
if(e.id == id) {
|
||||
console.log("percentage", percentage)
|
||||
e.percentage = percentage
|
||||
}
|
||||
return e
|
||||
})
|
||||
|
||||
|
||||
this.uploadPercentage()
|
||||
}
|
||||
|
||||
window['upload-header-set-add'] = (id: string, percentage: number, save: Function) => {
|
||||
this.remove(id)
|
||||
this.PublicationFormMV.push({id, percentage, retry: false, retryFunction: save})
|
||||
this.uploadPercentage()
|
||||
}
|
||||
|
||||
|
||||
window['upload-header-set-remove'] = (id: string) => {
|
||||
this.remove(id)
|
||||
}
|
||||
|
||||
|
||||
window['upload-header-set-retry'] = (id: string) => {
|
||||
|
||||
this.PublicationFormMV = this.PublicationFormMV.map((e)=> {
|
||||
if(e.id == id) {
|
||||
e.retry = true
|
||||
}
|
||||
return e
|
||||
})
|
||||
|
||||
this.uploadPercentage()
|
||||
}
|
||||
|
||||
window['upload-header-remove-retry'] = (id: string) => {
|
||||
this.uploadPercentage()
|
||||
|
||||
this.PublicationFormMV = this.PublicationFormMV.map((e)=> {
|
||||
if(e.id == id) {
|
||||
e.retry = false
|
||||
}
|
||||
return e
|
||||
})
|
||||
|
||||
|
||||
this.uploadPercentage()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
this.PublicationFormMV = this.PublicationFormMV.filter((e)=> e.id != id)
|
||||
this.uploadPercentage()
|
||||
}
|
||||
|
||||
hasPublication() {
|
||||
return this.PublicationFormMV.length >= 1
|
||||
}
|
||||
|
||||
|
||||
uploadPercentage = () => {
|
||||
|
||||
const percentageArray = this.PublicationFormMV.map((e) => e.percentage)
|
||||
|
||||
// Check if the array is not empty
|
||||
if (percentageArray.length === 0) {
|
||||
this.count = 0
|
||||
} else {
|
||||
let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0);
|
||||
|
||||
// Calculate the average percentage
|
||||
let averagePercentage = sum / percentageArray.length;
|
||||
|
||||
this.count = Math.ceil(averagePercentage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ import { v4 as uuidv4 } from 'uuid'
|
||||
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
||||
import { CMAPIService } from '../shared/repository/CMAPI/cmapi.service';
|
||||
import { HubConnectionBuilder } from '@microsoft/signalr';
|
||||
import { ok, err, Result } from 'neverthrow';
|
||||
import { ok, err as Err, Result } from 'neverthrow';
|
||||
import { environment } from 'src/environments/environment';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -90,7 +91,7 @@ class ReconnectingWebSocketSignalR {
|
||||
}
|
||||
|
||||
this.connection = new signalR.HubConnectionBuilder()
|
||||
.withUrl('https://gdcmapi-dev.dyndns.info/FileHub', {
|
||||
.withUrl( environment.fileHub, {
|
||||
transport: signalR.HttpTransportType.LongPolling,
|
||||
accessTokenFactory: () => SessionStore.user.Authorization
|
||||
})
|
||||
@@ -139,7 +140,7 @@ class ReconnectingWebSocketSignalR {
|
||||
if (!this.stop && (!error || error.message !== "Connection stopped by client.")) {
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, 1000); // Ajuste o atraso conforme necessário
|
||||
}, 3000); // Ajuste o atraso conforme necessário
|
||||
|
||||
}
|
||||
|
||||
@@ -147,14 +148,30 @@ class ReconnectingWebSocketSignalR {
|
||||
}
|
||||
|
||||
commit(path): Promise<Result<true, false>> {
|
||||
console.log('committing')
|
||||
return new Promise((resolve, reject) => {
|
||||
this.connection.invoke("CommitUpload", path).then((e) => {
|
||||
console.log("commit message", e)
|
||||
resolve(ok(true))
|
||||
}).catch(err => {
|
||||
resolve(err(false))
|
||||
console.error(err.toString())
|
||||
});
|
||||
if(this.isOpen) {
|
||||
try {
|
||||
console.log('this.connection.invoke', this.connection)
|
||||
this.connection.invoke("CommitUpload", path).then((e) => {
|
||||
console.log("commit message", e)
|
||||
resolve(ok(true))
|
||||
}).catch(err => {
|
||||
console.error('upload catch commit error')
|
||||
resolve(Err(false))
|
||||
console.error(err.toString())
|
||||
});
|
||||
} catch(error) {
|
||||
resolve(Err(false))
|
||||
console.error('upload commit error')
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.onConnect.push(()=> {
|
||||
resolve(this.commit(path))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -390,32 +407,17 @@ export class ObjectMergeNotification{
|
||||
watchCount = 0
|
||||
|
||||
constructor() {
|
||||
// this.socket.onDisconnectCallback(()=> {
|
||||
// console.log("run watch")
|
||||
// this.runWatch = true
|
||||
// this.watch()
|
||||
// })
|
||||
this.socket.onDisconnectCallback(()=> {
|
||||
//console.log("run watch")
|
||||
this.runWatch = true
|
||||
//this.watch()
|
||||
})
|
||||
|
||||
// this.socket.onConnectCallback(()=> {
|
||||
this.socket.onConnectCallback(() => {
|
||||
console.log("open trigger")
|
||||
this.runWatch = false
|
||||
})
|
||||
|
||||
// console.log("open trigger")
|
||||
// this.runWatch = false
|
||||
// })
|
||||
|
||||
// this.socket.subscribe((data: socketResponse) => {
|
||||
// if(data.IsCompleted == true) {
|
||||
// console.log("==================!!!====================")
|
||||
// try {
|
||||
// this.callbacks[data.Guid](data)
|
||||
// delete this.callbacks[data.Guid]
|
||||
// } catch (error) {}
|
||||
// } else {
|
||||
// console.log("else", data)
|
||||
// }
|
||||
// })
|
||||
|
||||
// this.socket.connect();
|
||||
// this.watch()
|
||||
}
|
||||
|
||||
connect() {
|
||||
@@ -430,33 +432,33 @@ export class ObjectMergeNotification{
|
||||
|
||||
async watch() {
|
||||
|
||||
// this.watchCount = 0;
|
||||
this.watchCount = 0;
|
||||
|
||||
// if(this.runWatch) {
|
||||
// setTimeout(async () => {
|
||||
// for(const [key, funx] of Object.entries(this.callbacks)) {
|
||||
if(this.runWatch) {
|
||||
setTimeout(async () => {
|
||||
for(const [key, funx] of Object.entries(this.callbacks)) {
|
||||
|
||||
// const request = await this.CMAPIService.getVideoHeader(key)
|
||||
const request = await this.CMAPIService.getVideoHeader(key)
|
||||
|
||||
// if(request.isOk()) {
|
||||
// funx()
|
||||
// delete this.callbacks[key]
|
||||
// }
|
||||
// }
|
||||
if(request.isOk()) {
|
||||
funx()
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
}
|
||||
|
||||
// this.watchCount++
|
||||
// if(this.watchCount <= 15) {
|
||||
// this.watch()
|
||||
// } else {
|
||||
// this.runWatch = false
|
||||
// }
|
||||
this.watchCount++
|
||||
if(this.watchCount <= 15) {
|
||||
this.watch()
|
||||
} else {
|
||||
this.runWatch = false
|
||||
}
|
||||
|
||||
// }, 1000)
|
||||
}, 1000)
|
||||
|
||||
|
||||
// } else {
|
||||
// console.log("end loop============================")
|
||||
// }
|
||||
} else {
|
||||
console.log("end loop============================")
|
||||
}
|
||||
}
|
||||
|
||||
subscribe(GUID, callback:Function) {
|
||||
|
||||
Reference in New Issue
Block a user