fix publication loaders

This commit is contained in:
Peter Maquiran
2022-12-28 14:52:42 +01:00
parent fe6a3099a9
commit a4063a8839
5 changed files with 54 additions and 77 deletions
@@ -15,7 +15,7 @@
<!-- Left -->
<div class="aside-left app-default-padding d-flex flex-grow-1 flex-column width-30 ">
<!-- Header -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-progress-bar type="indeterminate" *ngIf="showLoader || skeletonLoader"></ion-progress-bar>
<ion-toolbar >
<div class="main-header">
@@ -37,14 +37,11 @@
</div>
</div>
<!-- <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> -->
</div>
</ion-toolbar>
<!-- Content -->
<div *ngIf="!skeletonLoader" class="aside overflow-y-auto d-flex flex-wrap width-100">
<div class="aside overflow-y-auto d-flex flex-wrap width-100">
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
*ngFor="let evento of publicationsEventFolderList">
<ion-item lines="none"
+38 -52
View File
@@ -75,7 +75,6 @@ export class PublicationsPage implements OnInit {
) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
this.skeletonLoader = true;
}
ngOnInit() {
@@ -147,14 +146,9 @@ export class PublicationsPage implements OnInit {
this.skeletonLoader = true;
this.getFromDB()
this.publications.GetPublicationFolderList().subscribe(async res => {
let publicationsEventFolderList = new Array();
let publicationsTravelFolderList = new Array();
res.forEach(data => {
let folder: PublicationFolder = {
const folders: any = res.map((data): PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
@@ -162,24 +156,14 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.addActionToDB(folder)
if (data.ActionType == "Evento") {
publicationsEventFolderList.push(folder);
}
else {
publicationsTravelFolderList.push(folder);
}
});
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento')
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
await this.storage.set('actionsEvents', publicationsEventFolderList);
await this.storage.set('actionsViagens', publicationsTravelFolderList);
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
await this.storage.set('actionsViagens', this.publicationsTravelFolderList);
this.getFromDB()
} else {
this.getFromDB()
@@ -190,7 +174,6 @@ export class PublicationsPage implements OnInit {
this.loadList = false
}, (error) => {
// this.getFromDB();
this.showLoader = false;
this.skeletonLoader = false;
this.loadList = false
@@ -217,16 +200,28 @@ export class PublicationsPage implements OnInit {
}
}
getPublicationFolderMap(events: any):PublicationFolder[] {
return events.map((data) : PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
});
}
getFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
this.storage.get('actionsEvents').then((events = []) => {
if(Array.isArray(events)) {
events.forEach(data => {
let folder: PublicationFolder = {
const folders: PublicationFolder[] = events.map((data) : PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
@@ -234,18 +229,18 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.publicationsEventFolderList.push(folder);
this.showLoader = false;
});
this.showLoader = false;
this.publicationsEventFolderList = folders
}
});
this.storage.get('actionsViagens').then((viagens = []) => {
if(Array.isArray(viagens)) {
viagens.forEach(data => {
let folder: PublicationFolder = {
const folders: PublicationFolder[] = viagens.map((data): PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
@@ -253,23 +248,18 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.publicationsTravelFolderList.push(folder);
this.showLoader = false;
});
this.publicationsTravelFolderList = folders
this.showLoader = false;
}
});
} else {
this.sqliteservice.getAllActions().then((actions: any[] = []) => {
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
actions.forEach(data => {
let folder: PublicationFolder = {
const folders: any = actions.map((data): PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
@@ -277,16 +267,12 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
if (data.ActionType == "Evento") {
this.publicationsEventFolderList.push(folder);
}
else {
this.publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
});
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento')
this.showLoader = false;
})
}
}
-3
View File
@@ -12,9 +12,6 @@ export const environment = {
apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
// apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
// apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */
// apiChatUrl: 'https://www.tabularium.pt/api/v1/',
production: true,
domain: 'gabinetedigital.local',
defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local
+8 -11
View File
@@ -1,22 +1,19 @@
import { versionData } from '../../version/git-version'
export const environment = {
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'https://gd-api.oapr.gov.ao/api/',
//apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
//apiURL: 'https://gd-api.oapr.gov.ao/api/',
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
//apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
//apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */
// apiChatUrl: 'https://www.tabularium.pt/api/v1/',
//apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
//apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
production: true,
domain: 'paulo.pinto@gabinetedigital.local',
defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local
defaultuserpwd: 'M@p2022', //tabteste@006,
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local
defaultuserpwd: 'tabteste@006', //tabteste@006,
chatOffline: true,
presidencia: false,
version: versionData,
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "e350cd24d",
"SHA": "e350cd24da31173a89cef80b84961576a8d7cebe",
"shortSHA": "fe6a3099a",
"SHA": "fe6a3099a9e52ebc4417844b213e0206f27d71e5",
"branch": "develop_bitOut-fix",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Dec 28 14:05:59 2022 +0100'",
"lastCommitMessage": "add husky",
"lastCommitNumber": "4589",
"lastCommitTime": "'Wed Dec 28 14:15:49 2022 +0100'",
"lastCommitMessage": "add prepare script",
"lastCommitNumber": "4590",
"change": "",
"changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package.json",
"changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/publications/publications.page.html\n\tmodified: src/app/pages/publications/publications.page.ts\n\tmodified: src/environments/environment.prod.ts\n\tmodified: src/environments/environment.ts",
"changeAuthor": "peter.maquiran"
}