Compare commits
No commits in common. "0865ca1a935f287f2482442752bbd09ebc617ad0" and "945d88839ff38cfba1fc3a28da0d6a8f5b472cd6" have entirely different histories.
0865ca1a93
...
945d88839f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "farmmaps-lib-app",
|
"name": "farmmaps-lib-app",
|
||||||
"version": "3.2.1",
|
"version": "3.2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
@ -86,4 +86,4 @@
|
|||||||
"ts-node": "^8.8.1",
|
"ts-node": "^8.8.1",
|
||||||
"typescript": "~4.6.4"
|
"typescript": "~4.6.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,17 +1,17 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {Observable} from 'rxjs';
|
import { Observable , Observer } from 'rxjs';
|
||||||
import {IListItem} from '../models/list.item';
|
import {map} from 'rxjs/operators';
|
||||||
import {IItem} from '../models/item';
|
import { IListItem } from '../models/list.item';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import { IItem } from '../models/item';
|
||||||
import {AppConfig} from '../shared/app.config';
|
import { HttpClient } from "@angular/common/http";
|
||||||
import {ItemService} from './item.service';
|
import { AppConfig } from "../shared/app.config";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class FolderService {
|
export class FolderService {
|
||||||
|
|
||||||
constructor(public httpClient: HttpClient, public appConfig: AppConfig, public itemService: ItemService) {
|
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiEndpoint() {
|
ApiEndpoint() {
|
||||||
@ -19,24 +19,23 @@ export class FolderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFolder(code: string): Observable<IListItem> {
|
getFolder(code: string): Observable<IListItem> {
|
||||||
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`);
|
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMyRoots(): Observable<IListItem[]> {
|
getMyRoots(): Observable<IListItem[]> {
|
||||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`);
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFolderParents(code: string): Observable<IListItem[]> {
|
getFolderParents(code: string): Observable<IListItem[]> {
|
||||||
return this.itemService.getBreadcrumbs(code);
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildFolders(code: string): Observable<IListItem[]> {
|
getChildFolders(code: string): Observable<IListItem[]> {
|
||||||
const folderItemTypes = "FOLDER,FTP_FOLDER";
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`);
|
||||||
return this.itemService.getChildItemList(code, folderItemTypes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getItems(code: string,skip:number, take:number): Observable<IListItem[]> {
|
getItems(code: string,skip:number, take:number): Observable<IListItem[]> {
|
||||||
return this.itemService.getChildItemList(code, null, null, 1, true, null, null, skip, take);
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/list?skip=${skip}&take=${take}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
|
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
|
||||||
|
@ -8,7 +8,6 @@ import { IItemTask } from '../models/itemTask';
|
|||||||
import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http";
|
import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http";
|
||||||
import { AppConfig } from "../shared/app.config";
|
import { AppConfig } from "../shared/app.config";
|
||||||
import {ItemTypeService} from './itemtype.service';
|
import {ItemTypeService} from './itemtype.service';
|
||||||
import {IListItem} from '../models/list.item';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -85,7 +84,7 @@ export class ItemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level = 1, deep = true,
|
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level = 1, deep = true,
|
||||||
startDate?: Date, endDate?: Date, skip?: number, take?: number): Observable<IItem[]> {
|
startDate?: Date, endDate?: Date): Observable<IItem[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
if(itemType != null) {
|
if(itemType != null) {
|
||||||
params = params.append("it", itemType);
|
params = params.append("it", itemType);
|
||||||
@ -97,9 +96,6 @@ export class ItemService {
|
|||||||
params = params.append("deep", deep.toString());
|
params = params.append("deep", deep.toString());
|
||||||
if (startDate) params = params.append("sDate", startDate.toISOString());
|
if (startDate) params = params.append("sDate", startDate.toISOString());
|
||||||
if (endDate) params = params.append("eDate", endDate.toISOString());
|
if (endDate) params = params.append("eDate", endDate.toISOString());
|
||||||
|
|
||||||
if(skip) params = params.append("skip", skip);
|
|
||||||
if(take) params = params.append("take", take);
|
|
||||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,8 +181,4 @@ export class ItemService {
|
|||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getBreadcrumbs(itemCode: string): Observable<IListItem[]> {
|
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/breadcrumbs`);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user