mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Perfomace on actions improve on load image
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
(click)="goToPublicationDetail(publication.DocumentId)"
|
||||
>
|
||||
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
|
||||
<img src="{{publication.FileBase64}}" alt="image">
|
||||
<ion-img src="{{publication.FileBase64}}" alt="image"></ion-img>
|
||||
</div>
|
||||
<div *ngIf="publication.FileBase64.length < 30" class="post-img">
|
||||
<img src="/assets/icon/icon-no-image.svg" alt="image">
|
||||
|
||||
@@ -66,14 +66,15 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.folderId = this.folderId['ProcessId']
|
||||
}
|
||||
|
||||
this.getPublicationsIds()
|
||||
this.getPublicationDetail();
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
this.getPublicationsIds();
|
||||
}, 1000);
|
||||
|
||||
this.backgroundservice.registerBackService('Online',() => {
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.getPublicationDetail();
|
||||
this.getPublications();
|
||||
this.getPublicationsIds();
|
||||
|
||||
})
|
||||
|
||||
@@ -86,13 +87,13 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
this.getPublicationDetail();
|
||||
this.getPublications();
|
||||
this.getPublicationsIds();
|
||||
}
|
||||
|
||||
doRefresh = (event) => {
|
||||
setTimeout(() => {
|
||||
this.getPublicationDetail();
|
||||
this.getPublications();
|
||||
this.getPublicationsIds();
|
||||
event.target.complete();
|
||||
}, 3000);
|
||||
|
||||
@@ -120,6 +121,57 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getPublicationsIds() {
|
||||
|
||||
this.showLoader = true;
|
||||
const folderId = this.folderId
|
||||
|
||||
this.publications.GetPublicationsID(this.folderId).subscribe(res => {
|
||||
|
||||
console.log('publications ids', res)
|
||||
this.publicationList = new Array();
|
||||
|
||||
for(let i of res) {
|
||||
this.publications.GetPublicationById(i).subscribe(ress => {
|
||||
console.log('publications by ids', ress)
|
||||
let item: Publication = this.publicationPipe.itemList(ress)
|
||||
console.log('publications by ids 2', item)
|
||||
this.publicationList.push(item);
|
||||
})
|
||||
}
|
||||
|
||||
/* res.forEach(element => {
|
||||
console.log('publications elements', element)
|
||||
this.publications.GetPublicationById(element).subscribe(ress => {
|
||||
console.log('publications by ids', ress)
|
||||
let item: Publication = this.publicationPipe.itemList(ress)
|
||||
console.log('publications by ids 2', item)
|
||||
this.publicationList.push(ress);
|
||||
})
|
||||
|
||||
}); */
|
||||
|
||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
||||
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
this.getpublication = this.publicationList;
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
/* this.publicationList = new Array();
|
||||
|
||||
res.forEach(element => {
|
||||
console.log('getPublications', element)
|
||||
let item: Publication = this.publicationPipe.itemList(element)
|
||||
this.publicationList.push(item);
|
||||
});
|
||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
||||
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
this.getpublication = this.publicationList; */
|
||||
});
|
||||
}
|
||||
|
||||
getPublications() {
|
||||
|
||||
this.showLoader = true;
|
||||
@@ -135,6 +187,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
console.log('getPublications', element)
|
||||
let item: Publication = this.publicationPipe.itemList(element)
|
||||
this.publicationList.push(item);
|
||||
console.log('getPublications 222', item)
|
||||
|
||||
});
|
||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
||||
|
||||
@@ -144,7 +198,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.showLoader = false;
|
||||
}, (error) => {
|
||||
|
||||
if(error.status == '0') {
|
||||
if (error.status == '0') {
|
||||
this.getFromDB();
|
||||
}
|
||||
if (error.status == '404') {
|
||||
@@ -223,7 +277,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.getPublications();
|
||||
this.getPublicationsIds();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,20 @@ export class PublicationsService {
|
||||
return this.http.delete<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetPublicationsID(folder:any) {
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+ folder +'/posts/ids';
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("folderId", folder);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<Publication[]>(`${geturl}`, options)
|
||||
|
||||
}
|
||||
|
||||
GetPublications(id:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts';
|
||||
let params = new HttpParams();
|
||||
@@ -94,11 +108,11 @@ export class PublicationsService {
|
||||
const geturl = environment.apiURL + 'presidentialActions/posts/'+ publicationId;
|
||||
let params = new HttpParams();
|
||||
|
||||
/* params = params.set("id", publicationId); */
|
||||
params = params.set("id", publicationId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
/* params: params */
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user