mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix slow publication
This commit is contained in:
@@ -79,6 +79,7 @@ export class PublicationsPage implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
const pathname = window.location.pathname
|
const pathname = window.location.pathname
|
||||||
|
this.getActions();
|
||||||
|
|
||||||
this.router.events.forEach((event) => {
|
this.router.events.forEach((event) => {
|
||||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||||
@@ -140,10 +141,10 @@ export class PublicationsPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
getActions() {
|
getActions() {
|
||||||
this.showLoader = false
|
this.showLoader = true
|
||||||
|
|
||||||
this.publications.GetPublicationFolderList().subscribe(async res => {
|
this.publications.GetPublicationFolderList().subscribe(async res => {
|
||||||
this.showLoader = true;
|
this.showLoader = false;
|
||||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
|
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
|
||||||
|
|
||||||
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
|
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
|
||||||
@@ -166,13 +167,13 @@ export class PublicationsPage implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addActionToStorage(events, viagens) {
|
// addActionToStorage(events, viagens) {
|
||||||
|
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
this.storage.set('actionsEvents', events);
|
// this.storage.set('actionsEvents', events);
|
||||||
this.storage.set('actionsViagens', viagens);
|
// this.storage.set('actionsViagens', viagens);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
addActionToDB(folder) {
|
addActionToDB(folder) {
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-arrow-left.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-arrow-left.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="div-title flex-grow-1">
|
<div *ngIf="publicationItem[folderId]" class="div-title flex-grow-1">
|
||||||
<ion-label class="title">{{item.Description}}</ion-label>
|
<ion-label class="title">{{publicationItem[folderId].Description}}</ion-label>
|
||||||
<p class="item-content-detail">{{item.Detail}}</p>
|
<p class="item-content-detail">{{publicationItem[folderId].Detail}}</p>
|
||||||
<p class="item-content-date">{{item.DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
|
<p class="item-content-date">{{publicationItem[folderId].DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="p.userPermission([p.permissionList.Actions.createPost])" class="actions-icon cursor-pointer" (click)="AddPublication('2',item.ProcessId)">
|
<div *ngIf="p.userPermission([p.permissionList.Actions.createPost]) && publicationItem[folderId]" class="actions-icon cursor-pointer" (click)="AddPublication('2',publicationItem[folderId].ProcessId)">
|
||||||
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-add.svg'></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-add.svg'></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-add.svg'></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-add.svg'></ion-icon>
|
||||||
@@ -27,14 +27,14 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="background-white">
|
<ion-content class="background-white">
|
||||||
<!-- <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||||
<ion-refresher-content>
|
<ion-refresher-content>
|
||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher> -->
|
</ion-refresher>
|
||||||
<div class="main-container background-white height-100 overflow-y-auto">
|
<div class="main-container background-white height-100 overflow-y-auto">
|
||||||
<ion-content>
|
<ion-content *ngIf="publicationItem[folderId]">
|
||||||
<ion-card *ngFor="let publication of getpublication let i = index"
|
<ion-card *ngFor="let publication of publicationList[folderId] let i = index"
|
||||||
(click)="goToPublicationDetail(publication.DocumentId)"
|
(click)="goToPublicationDetail(publication.DocumentId)"
|
||||||
>
|
>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { forkJoin } from 'rxjs';
|
|||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { PermissionService } from 'src/app/services/permission.service';
|
import { PermissionService } from 'src/app/services/permission.service';
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-publications',
|
selector: 'app-view-publications',
|
||||||
@@ -24,8 +25,9 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
showLoader = true;
|
showLoader = true;
|
||||||
loading: any;
|
loading: any;
|
||||||
|
|
||||||
publicationList: Publication[] = new Array();
|
publicationList: {[key: string]: Publication[] } = {};
|
||||||
item: PublicationFolder;
|
publicationItem: {[key: string]: PublicationFolder } = {};
|
||||||
|
|
||||||
defaultImage = "/assets/icon/icon-no-image.svg";
|
defaultImage = "/assets/icon/icon-no-image.svg";
|
||||||
folderId: string;
|
folderId: string;
|
||||||
id: string;
|
id: string;
|
||||||
@@ -46,9 +48,16 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
private httpErroHandle: HttpErrorHandle) {
|
private httpErroHandle: HttpErrorHandle,
|
||||||
|
private storage: Storage,) {
|
||||||
|
|
||||||
|
if(!this.publicationList[this.folderId]) {
|
||||||
|
this.publicationList[this.folderId] = []
|
||||||
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getFromDB();
|
||||||
|
|
||||||
this.item = new PublicationFolder();
|
|
||||||
this.activatedRoute.paramMap.subscribe(params => {
|
this.activatedRoute.paramMap.subscribe(params => {
|
||||||
|
|
||||||
|
|
||||||
@@ -66,6 +75,14 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
if (typeof (this.folderId) == 'object') {
|
if (typeof (this.folderId) == 'object') {
|
||||||
this.folderId = this.folderId['ProcessId']
|
this.folderId = this.folderId['ProcessId']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!this.publicationList[this.folderId]) {
|
||||||
|
this.publicationList[this.folderId] = []
|
||||||
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getFromDB();
|
||||||
//this.testForkJoin()
|
//this.testForkJoin()
|
||||||
this.getPublicationDetail();
|
this.getPublicationDetail();
|
||||||
this.getPublicationsIds();
|
this.getPublicationsIds();
|
||||||
@@ -87,22 +104,22 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.folderId = this.folderId['ProcessId']
|
this.folderId = this.folderId['ProcessId']
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (typeof (this.id == 'object') {
|
if(!this.publicationList[this.folderId]) {
|
||||||
// this.id = this.id['ProcessId']
|
this.publicationList[this.folderId] = []
|
||||||
// }
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
//this.testForkJoin()
|
}
|
||||||
//this.getPublicationDetail();
|
|
||||||
// this.getPublications();
|
this.getFromDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
doRefresh = (event) => {
|
doRefresh = (event) => {
|
||||||
//setTimeout(() => {
|
//setTimeout(() => {
|
||||||
//this.testForkJoin()
|
//this.testForkJoin()
|
||||||
this.getPublicationDetail();
|
this.getPublicationDetail();
|
||||||
this.getPublicationsIds();
|
this.getPublicationsIds();
|
||||||
try {
|
try {
|
||||||
event?.target?.complete();
|
event?.target?.complete();
|
||||||
} catch(error) {}
|
} catch(error) {}
|
||||||
//}, 3000);
|
//}, 3000);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -117,147 +134,52 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
this.publications.GetPresidentialAction(this.folderId).subscribe(res => {
|
|
||||||
|
|
||||||
this.item = res;
|
|
||||||
this.sqliteservice.updatePublicationsDetails(this.folderId, JSON.stringify(res));
|
|
||||||
}, (error) => {
|
|
||||||
this.httpErroHandle.httpStatusHandle(error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// goes to fork
|
|
||||||
// getPublicationsIds() {
|
|
||||||
|
|
||||||
// this.showLoader = true;
|
|
||||||
// const folderId = this.folderId
|
|
||||||
|
|
||||||
// this.publications.GetIdsPublicationsImages(this.id).subscribe(res => {
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// this.publicationList = new Array();
|
|
||||||
|
|
||||||
getPublicationsIds() {
|
|
||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
|
this.publications.GetPresidentialAction(folderId).subscribe(res=>{
|
||||||
|
|
||||||
|
|
||||||
this.publicationList = new Array();
|
|
||||||
|
|
||||||
res.forEach(element => {
|
|
||||||
|
|
||||||
this.publications.GetPublicationById(element).subscribe(ress => {
|
|
||||||
|
|
||||||
let item: Publication = this.publicationPipe.itemList(ress)
|
|
||||||
|
|
||||||
this.publicationList.push(item);
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
|
||||||
|
|
||||||
|
|
||||||
this.getpublication = this.publicationList;
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
|
this.publicationItem[folderId] = res
|
||||||
|
this.storage.set(folderId+"name", res)
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
if(error.status == 0) {
|
// this.httpErroHandle.httpStatusHandle(error)
|
||||||
this.getFromDB()
|
|
||||||
} else {
|
|
||||||
this.httpErroHandle.httpStatusHandle(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPublications() {
|
|
||||||
|
|
||||||
this.showLoader = true;
|
|
||||||
const folderId = this.folderId
|
|
||||||
this.getFromDB();
|
|
||||||
this.publications.GetPublications(this.folderId).subscribe(res => {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.publicationList = new Array();
|
|
||||||
|
|
||||||
res.forEach(element => {
|
|
||||||
|
|
||||||
let item: Publication = this.publicationPipe.itemList(element)
|
|
||||||
this.publicationList.push(item);
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
|
||||||
|
|
||||||
this.getpublication = this.publicationList;
|
|
||||||
|
|
||||||
this.showLoader = false;
|
|
||||||
}, (error) => {
|
|
||||||
|
|
||||||
if (error.status == '0') {
|
|
||||||
this.getFromDB();
|
|
||||||
}
|
|
||||||
if (error.status == '404') {
|
|
||||||
this.error = 'Sem publicações disponíveis!';
|
|
||||||
this.publicationList = [];
|
|
||||||
} else {
|
|
||||||
this.httpErroHandle.httpStatusHandle(error)
|
|
||||||
}
|
|
||||||
this.showLoader = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
testForkJoin() {
|
|
||||||
forkJoin([
|
|
||||||
this.getPublicationsIds(),
|
|
||||||
this.getPublications(),
|
|
||||||
|
|
||||||
|
|
||||||
]).subscribe(allResults => {
|
|
||||||
this.publicationList = allResults[2]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
|
const folderId = this.folderId
|
||||||
this.sqliteservice.getActionById(this.folderId).then((publications) => {
|
this.storage.get(folderId).then((viewPublications) => {
|
||||||
|
this.publicationList[folderId] = viewPublications
|
||||||
this.item = this.isJson(publications[0].publicationsDetails);
|
})
|
||||||
|
this.storage.get(folderId+"name").then((viewPublications) => {
|
||||||
let publicationArray = [];
|
this.publicationItem[folderId] = viewPublications
|
||||||
this.isJson(publications[0].publications).forEach(element => {
|
|
||||||
let publicationlis = {
|
|
||||||
DateIndex: element.DateIndex,
|
|
||||||
DatePublication: element.DatePublication,
|
|
||||||
DocumentId: element.DocumentId,
|
|
||||||
FileBase64: element.FileBase64,
|
|
||||||
FileExtension: element.FileExtension,
|
|
||||||
Message: element.Message,
|
|
||||||
OrganicEntityId: element.OrganicEntityId,
|
|
||||||
OriginalFileName: element.OriginalFileName,
|
|
||||||
ProcessId: element.ProcessId
|
|
||||||
}
|
|
||||||
publicationArray.push(publicationlis);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.publicationList = publicationArray;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
isJson(str) {
|
async getPublicationsIds() {
|
||||||
|
|
||||||
|
this.showLoader = true;
|
||||||
|
const folderId = this.folderId
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSON.parse(str);
|
const res = await this.publications.GetPublicationsImages(folderId).toPromise();
|
||||||
} catch (e) {
|
let publicationList = []
|
||||||
return str;
|
|
||||||
|
for (let element of res) {
|
||||||
|
let ress = await this.publications.GetPublicationById(element).toPromise();
|
||||||
|
let item: Publication = this.publicationPipe.itemList(ress)
|
||||||
|
publicationList.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showLoader = false;
|
||||||
|
|
||||||
|
this.publicationList[folderId] = publicationList
|
||||||
|
this.storage.set(folderId, publicationList);
|
||||||
|
this.getpublication = publicationList;
|
||||||
|
} catch(error) {
|
||||||
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
return JSON.parse(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async AddPublication(publicationType: any, folderId: any) {
|
async AddPublication(publicationType: any, folderId: any) {
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<ion-header class="ion-no-border">
|
<ion-header class="ion-no-border">
|
||||||
<div class="main-header">
|
<div class="main-header">
|
||||||
<div class="title-content">
|
<div class="title-content">
|
||||||
<div *ngIf="item" class="div-title width-100 flex-grow-1">
|
<div *ngIf="publicationItem[folderId]" class="div-title width-100 flex-grow-1">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{item.Description}}</ion-label>
|
<ion-label>{{publicationItem[folderId].Description}}</ion-label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions-icon">
|
<div class="actions-icon">
|
||||||
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
||||||
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(item.ProcessId)">
|
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(publicationItem[folderId].ProcessId)">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="p.userPermission([p.permissionList.Actions.deletePost])" class="btn-no-color" (click)="deletePublication(item.ProcessId)">
|
<button *ngIf="p.userPermission([p.permissionList.Actions.deletePost])" class="btn-no-color" (click)="deletePublication(publicationItem[folderId].ProcessId)">
|
||||||
<ion-icon class="delete" src='assets/images/theme/gov/icons-delete.svg'></ion-icon>
|
<ion-icon class="delete" src='assets/images/theme/gov/icons-delete.svg'></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn-no-color cursor-pointer" (click)="doRefresh($event)">
|
<button class="btn-no-color cursor-pointer" (click)="doRefresh($event)">
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="div-body width-100">
|
<div class="div-body width-100">
|
||||||
<p class="item-content-detail">{{item.Detail}}</p>
|
<p class="item-content-detail">{{publicationItem[folderId].Detail}}</p>
|
||||||
<p class="item-content-date">{{ item.DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
|
<p class="item-content-date">{{ publicationItem[folderId].DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
<ion-refresher-content>
|
<ion-refresher-content>
|
||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<div class="main-container px-20">
|
<div class="main-container px-20" *ngIf="publicationItem[folderId]">
|
||||||
<ion-card *ngFor="let publication of publicationList let i = index"
|
<ion-card *ngFor="let publication of publicationList[folderId] let i = index"
|
||||||
(click)="viewPublicationDetail(publication.DocumentId)">
|
(click)="viewPublicationDetail(publication.DocumentId)">
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<div class="post-img">
|
<div class="post-img">
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
</ion-list> -->
|
</ion-list> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- fab placed to the bottom end -->
|
<!-- fab placed to the bottom end -->
|
||||||
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create])" vertical="bottom" horizontal="end">
|
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create]) && publicationItem[folderId]" vertical="bottom" horizontal="end">
|
||||||
<ion-fab-button title="Nova Publicação" (click)="AddPublication('2',item.ProcessId)">
|
<ion-fab-button title="Nova Publicação" (click)="AddPublication('2',publicationItem[folderId].ProcessId)">
|
||||||
<ion-icon name="add"></ion-icon>
|
<ion-icon name="add"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
</ion-fab>
|
</ion-fab>
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
showLoader: boolean;
|
showLoader: boolean;
|
||||||
loading: any;
|
loading: any;
|
||||||
|
|
||||||
publicationList: Publication[];
|
publicationList: {[key: string]: Publication[] } = {};
|
||||||
item: PublicationFolder;
|
publicationItem: {[key: string]: PublicationFolder } = {};
|
||||||
getpublication = [];
|
getpublication = [];
|
||||||
error: any;
|
error: any;
|
||||||
|
|
||||||
@@ -47,7 +47,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
public p:PermissionService,
|
public p:PermissionService,
|
||||||
private httpErrorHandle: HttpErrorHandle
|
private httpErrorHandle: HttpErrorHandle
|
||||||
) {
|
) {
|
||||||
this.item = new PublicationFolder();
|
if(!this.publicationList[this.folderId]) {
|
||||||
|
this.publicationList[this.folderId] = []
|
||||||
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -55,10 +58,12 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.folderId = this.folderId['ProcessId']
|
this.folderId = this.folderId['ProcessId']
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.getPublicationsIds();
|
if(!this.publicationList[this.folderId]) {
|
||||||
|
this.publicationList[this.folderId] = []
|
||||||
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
|
}
|
||||||
|
|
||||||
window['app-view-publications-page-doRefresh'] = this.doRefresh
|
window['app-view-publications-page-doRefresh'] = this.doRefresh
|
||||||
this.getPublicationDetail();
|
|
||||||
|
|
||||||
this.getFromDB();
|
this.getFromDB();
|
||||||
}
|
}
|
||||||
@@ -68,13 +73,16 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
if(typeof(this.folderId) == 'object') {
|
if(typeof(this.folderId) == 'object') {
|
||||||
this.folderId = this.folderId['ProcessId']
|
this.folderId = this.folderId['ProcessId']
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getFromDB();
|
|
||||||
//setTimeout(()=>{
|
|
||||||
this.getPublicationDetail();
|
|
||||||
this.getPublicationsIds();
|
|
||||||
|
|
||||||
//}, 100)
|
if(!this.publicationList[this.folderId]) {
|
||||||
|
this.publicationList[this.folderId] = []
|
||||||
|
this.publicationItem[this.folderId] = new PublicationFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getFromDB();
|
||||||
|
|
||||||
|
this.getPublicationDetail();
|
||||||
|
this.getPublicationsIds();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,7 +90,6 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
doRefresh =(event) => {
|
doRefresh =(event) => {
|
||||||
|
|
||||||
this.getPublicationDetail();
|
this.getPublicationDetail();
|
||||||
|
|
||||||
this.getPublicationsIds();
|
this.getPublicationsIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,50 +99,51 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
|
const folderId = this.folderId
|
||||||
|
this.publications.GetPresidentialAction(folderId).subscribe(res=>{
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
this.item = res;
|
this.publicationItem[folderId] = res
|
||||||
|
this.storage.set(folderId+"name", res)
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
// this.httpErroHandle.httpStatusHandle(error)
|
// this.httpErroHandle.httpStatusHandle(error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPublicationsIds() {
|
async getPublicationsIds() {
|
||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
|
|
||||||
|
|
||||||
|
try {
|
||||||
this.publicationList = new Array();
|
const res = await this.publications.GetPublicationsImages(folderId).toPromise();
|
||||||
|
let publicationList = []
|
||||||
res.forEach(element => {
|
|
||||||
|
for (let element of res) {
|
||||||
this.publications.GetPublicationById(element).subscribe(ress => {
|
let ress = await this.publications.GetPublicationById(element).toPromise();
|
||||||
|
let item: Publication = this.publicationPipe.itemList(ress)
|
||||||
let item: Publication = this.publicationPipe.itemList(ress)
|
publicationList.push(item);
|
||||||
|
}
|
||||||
this.publicationList.push(item);
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.storage.remove(folderId);
|
|
||||||
this.storage.set(this.folderId, this.publicationList);
|
|
||||||
|
|
||||||
|
|
||||||
this.getpublication = this.publicationList;
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
},() => {
|
|
||||||
|
this.publicationList[folderId] = publicationList
|
||||||
|
this.storage.set(folderId, publicationList);
|
||||||
|
this.getpublication = publicationList;
|
||||||
|
} catch(error) {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
this.getFromDB();
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
this.storage.get(this.folderId).then((viewPublications) => {
|
const folderId = this.folderId
|
||||||
this.publicationList = viewPublications;
|
this.storage.get(folderId).then((viewPublications) => {
|
||||||
|
this.publicationList[folderId] = viewPublications
|
||||||
|
})
|
||||||
|
this.storage.get(folderId+"name").then((viewPublications) => {
|
||||||
|
this.publicationItem[folderId] = viewPublications
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "f218b1a66",
|
"shortSHA": "9a1976f54",
|
||||||
"SHA": "f218b1a666a0f8cbeae975bc375279c14d5d8464",
|
"SHA": "9a1976f54373e5ed0686998c46bcc00e427d1b88",
|
||||||
"branch": "no_bug_movemente",
|
"branch": "no_bug_movemente",
|
||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Mon Feb 27 20:17:03 2023 +0100'",
|
"lastCommitTime": "'Mon Feb 27 20:17:47 2023 +0100'",
|
||||||
"lastCommitMessage": "improve publication",
|
"lastCommitMessage": "fix",
|
||||||
"lastCommitNumber": "4843",
|
"lastCommitNumber": "4844",
|
||||||
"change": "",
|
"change": "",
|
||||||
"changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/environments/environment.ts",
|
"changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/publications/publications.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.html\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user