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 --> <!-- Left -->
<div class="aside-left app-default-padding d-flex flex-grow-1 flex-column width-30 "> <div class="aside-left app-default-padding d-flex flex-grow-1 flex-column width-30 ">
<!-- Header --> <!-- Header -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="showLoader || skeletonLoader"></ion-progress-bar>
<ion-toolbar > <ion-toolbar >
<div class="main-header"> <div class="main-header">
@@ -37,14 +37,11 @@
</div> </div>
</div> </div>
<!-- <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> -->
</div> </div>
</ion-toolbar> </ion-toolbar>
<!-- Content --> <!-- 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" <ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
*ngFor="let evento of publicationsEventFolderList"> *ngFor="let evento of publicationsEventFolderList">
<ion-item lines="none" <ion-item lines="none"
+42 -56
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.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.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
this.skeletonLoader = true;
} }
ngOnInit() { ngOnInit() {
@@ -148,13 +147,8 @@ export class PublicationsPage implements OnInit {
this.getFromDB() this.getFromDB()
this.publications.GetPublicationFolderList().subscribe(async res => { this.publications.GetPublicationFolderList().subscribe(async res => {
const folders: any = res.map((data): PublicationFolder => {
return {
let publicationsEventFolderList = new Array();
let publicationsTravelFolderList = new Array();
res.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId, ProcessId: data.ProcessId,
Description: data.Description, Description: data.Description,
Detail: data.Detail, Detail: data.Detail,
@@ -162,24 +156,14 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd, DateEnd: data.DateEnd,
ActionType: data.ActionType, 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')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
await this.storage.set('actionsEvents', publicationsEventFolderList); await this.storage.set('actionsEvents', this.publicationsEventFolderList);
await this.storage.set('actionsViagens', publicationsTravelFolderList); await this.storage.set('actionsViagens', this.publicationsTravelFolderList);
this.getFromDB() this.getFromDB()
} else { } else {
this.getFromDB() this.getFromDB()
@@ -190,7 +174,6 @@ export class PublicationsPage implements OnInit {
this.loadList = false this.loadList = false
}, (error) => { }, (error) => {
// this.getFromDB();
this.showLoader = false; this.showLoader = false;
this.skeletonLoader = false; this.skeletonLoader = false;
this.loadList = false this.loadList = false
@@ -217,16 +200,10 @@ export class PublicationsPage implements OnInit {
} }
} }
getFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { getPublicationFolderMap(events: any):PublicationFolder[] {
this.publicationsEventFolderList = new Array(); return events.map((data) : PublicationFolder => {
this.publicationsTravelFolderList = new Array(); return {
this.storage.get('actionsEvents').then((events = []) => {
if(Array.isArray(events)) {
events.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId, ProcessId: data.ProcessId,
Description: data.Description, Description: data.Description,
Detail: data.Detail, Detail: data.Detail,
@@ -234,18 +211,36 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd, DateEnd: data.DateEnd,
ActionType: data.ActionType, ActionType: data.ActionType,
} }
this.publicationsEventFolderList.push(folder);
this.showLoader = false;
}); });
} }
getFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('actionsEvents').then((events = []) => {
if(Array.isArray(events)) {
const folders: PublicationFolder[] = events.map((data) : PublicationFolder => {
return {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
});
this.showLoader = false;
this.publicationsEventFolderList = folders
}
}); });
this.storage.get('actionsViagens').then((viagens = []) => { this.storage.get('actionsViagens').then((viagens = []) => {
if(Array.isArray(viagens)) { if(Array.isArray(viagens)) {
viagens.forEach(data => { const folders: PublicationFolder[] = viagens.map((data): PublicationFolder => {
let folder: PublicationFolder = { return {
ProcessId: data.ProcessId, ProcessId: data.ProcessId,
Description: data.Description, Description: data.Description,
Detail: data.Detail, Detail: data.Detail,
@@ -253,23 +248,18 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd, DateEnd: data.DateEnd,
ActionType: data.ActionType, ActionType: data.ActionType,
} }
this.publicationsTravelFolderList.push(folder);
this.showLoader = false;
}); });
this.publicationsTravelFolderList = folders
this.showLoader = false;
} }
}); });
} else { } else {
this.sqliteservice.getAllActions().then((actions: any[] = []) => { this.sqliteservice.getAllActions().then((actions: any[] = []) => {
const folders: any = actions.map((data): PublicationFolder => {
return {
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
actions.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId, ProcessId: data.ProcessId,
Description: data.Description, Description: data.Description,
Detail: data.Detail, Detail: data.Detail,
@@ -277,16 +267,12 @@ export class PublicationsPage implements OnInit {
DateEnd: data.DateEnd, DateEnd: data.DateEnd,
ActionType: data.ActionType, 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', apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
// apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', // apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
// apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', // 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, production: true,
domain: 'gabinetedigital.local', domain: 'gabinetedigital.local',
defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@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' import { versionData } from '../../version/git-version'
export const environment = { export const environment = {
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', // apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'https://gd-api.oapr.gov.ao/api/', //apiURL: 'https://gd-api.oapr.gov.ao/api/',
//apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/', apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/', // apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket', // apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/', //apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket', //apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
//apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
//apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', 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, production: true,
domain: 'paulo.pinto@gabinetedigital.local', domain: 'paulo.pinto@gabinetedigital.local',
defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local
defaultuserpwd: 'M@p2022', //tabteste@006, defaultuserpwd: 'tabteste@006', //tabteste@006,
chatOffline: true, chatOffline: true,
presidencia: false, presidencia: false,
version: versionData, version: versionData,
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "e350cd24d", "shortSHA": "fe6a3099a",
"SHA": "e350cd24da31173a89cef80b84961576a8d7cebe", "SHA": "fe6a3099a9e52ebc4417844b213e0206f27d71e5",
"branch": "develop_bitOut-fix", "branch": "develop_bitOut-fix",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Dec 28 14:05:59 2022 +0100'", "lastCommitTime": "'Wed Dec 28 14:15:49 2022 +0100'",
"lastCommitMessage": "add husky", "lastCommitMessage": "add prepare script",
"lastCommitNumber": "4589", "lastCommitNumber": "4590",
"change": "", "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" "changeAuthor": "peter.maquiran"
} }