mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
added a condition on dynamic bullets
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
|
||||
</div> -->
|
||||
|
||||
<div class="dots-container">
|
||||
<div *ngIf="publication.Files.length > 2" class="dots-container">
|
||||
<span *ngFor="let files of publication.Files; let k = index"
|
||||
[class.dotsSwiper]="true"
|
||||
[class.active-dot]="swiperIndex === k"
|
||||
|
||||
@@ -288,6 +288,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.arrayOfFile = Publication.Files
|
||||
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
||||
|
||||
|
||||
|
||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||
const found = this.publicationIsPresent(publicationId, folderId)
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CacheServiceService } from './cache-service.service';
|
||||
|
||||
describe('CacheServiceService', () => {
|
||||
let service: CacheServiceService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(CacheServiceService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CacheService {
|
||||
// A HashMap to store the cache. The key is the page and the value is the data.
|
||||
private cache = new Map<string, any[]>();
|
||||
// BehaviorSubject that will contain the updated cache data.
|
||||
public cache$ = new BehaviorSubject<any[]>(null);
|
||||
|
||||
// The 'set' method for storing data in the cache.
|
||||
set(key: string, data: any[]): void {
|
||||
// We check if data already exists for this key.
|
||||
if (this.cache.has(key)) {
|
||||
// If it already exists, we throw an exception to prevent overwriting the data.
|
||||
throw new Error(`Data already exists for key '${key}'. Use a different key or delete the existing one first.`);
|
||||
}
|
||||
// If there is no data for this key, we store it in the cache and update the BehaviorSubject.
|
||||
this.cache.set(key, data);
|
||||
this.cache$.next(this.cache.get(key));
|
||||
}
|
||||
|
||||
// The 'get' method for retrieving data from the cache.
|
||||
get(key: string): any[] {
|
||||
// We retrieve the data from the cache and update the BehaviorSubject.
|
||||
const data = this.cache.get(key);
|
||||
this.cache$.next(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
// The 'clear' method to clear data from the cache.
|
||||
clear(key: string): void {
|
||||
// We remove the data from the cache and update the BehaviorSubject.
|
||||
this.cache.delete(key);
|
||||
this.cache$.next(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user