Kind: Class
Source: Frontend/src/app/services/common/files.service.ts (line 33)
Part of: Frontend
FilesService manages file-related UI actions and data requests in the frontend. It handles upload popup state, file metadata lookups, parent-file queries, tag and category retrieval, and download actions.
Methods
| Method | Signature | Returns |
|---|---|---|
extractFilesExtension | extractFilesExtension(fileName: string, fileType: string) | string |
getTypesList | getTypesList() | any[] |
fetchDownloadFilePath | fetchDownloadFilePath(APIUrl: string) | number |
openUploadFilePopup | openUploadFilePopup(relatedToId: number, relatedToTypeId: number, companyBranchId: number, parentFileID: number, supplierId: number) | void |
closeUploadPopup | closeUploadPopup() | void |
openUploadLogoPopup | openUploadLogoPopup() | void |
GetFilesByParentFileID | GetFilesByParentFileID(CompanyBranchID: number, ParentFileID: number, listNum: number, startRecord: number, pageSize: number, filter: string) | void |
GetTagsListByType | GetTagsListByType(CompanyBranchID: number, listNum: number, supplierId: number) | void |
GetCategoriesList | GetCategoriesList() | void |
DownloadFiles | DownloadFiles(IDs: number[]) | void |
getFilesByIdService | getFilesByIdService(id: number) | void |
LoadtAttached | LoadtAttached(id: number, type: number) | void |
unAttachFile | unAttachFile(id: undefined, type: undefined, fileID: undefined) | void |
LoadAttachments | LoadAttachments(id: number, type: number) | void |
LoadAllDocuments | LoadAllDocuments(type: number) | void |
getUsersPermission | getUsersPermission(relatedToId: number, relatedToTypeId: number) | void |
getOneDriveFilesList | getOneDriveFilesList(parentId: string) | void |
ShareFile | ShareFile(entity: OneDriveShareFiles) | void |
ShareFiles | ShareFiles(entity: OneDriveShareFiles[]) | void |
UploadFile | UploadFile(entity: FileData, acctualFile: File) | void |
UploadFiles | UploadFiles(entity: FileData[], acctualFiles: File[]) | void |
UploadDataFile | UploadDataFile(entity: FileData) | void |
UploadDataFiles | UploadDataFiles(entity: FileData[]) | void |
_UploadFiles | _UploadFiles(entities: FileData[], acctualFiles: File[]) | void |
newUploadFile | newUploadFile(entities: FileData, acctualFile: File) | void |
saveFilesService | saveFilesService(entity: FileData) | void |
newSaveFiles | newSaveFiles(entities: FileData[]) | void |
AttachFiles | AttachFiles(RelatedToID: number, RelatedToType: number, FilesIDList: number[]) | void |
AttachSharedFiles | AttachSharedFiles(files: AttachedfileView[]) | void |
UploadWordTemplate | UploadWordTemplate(acctualFile: File) | void |
UploadFileByModule | UploadFileByModule(entity: FileData, acctualFile: File, moduleId: number) | void |
DownloadImage | DownloadImage(id: string, fileTypeId: number) | void |
revokeObjectURL | revokeObjectURL(url: string) | void |
deleteFilesService | deleteFilesService(IDs: number[]) | void |
getRolesByLibraryId | getRolesByLibraryId(LibraryId: number) | void |
getPermissionsByLibraryId | getPermissionsByLibraryId(LibraryId: number) | void |
saveLibraryRoles | saveLibraryRoles(LibraryRoles: FilesRoles[]) | void |
getOldCloud | getOldCloud() | void |
moveToNewCloud | moveToNewCloud(data: any[]) | void |
updateOldCloud | updateOldCloud(data: any[]) | void |
updateFileCategory | updateFileCategory(fileCategory: EditAttachedCategory) | void |
Properties
| Property | Type |
|---|---|
headersProxy | any |
TypesList | any[] |
_uploadMultiPopupOpend | UploadFilePopup |
uploadMultiPopupOpend | any |
_uploadPopupOpend | boolean |
uploadPopupOpend | any |
_uploadLogoPopupOpend | boolean |
uploadLogoPopupOpend | any |
Where it refuses work
FilesServicestops the work with an early return whenfileExtension.includes("jpeg") || fileExtension.includes("jpg") || fileExtension.includes….FilesServicestops the work with an early return whenAPIUrl.includes('production-api').
Diagram
mermaidgraph LR Component --> FilesService FilesService --> UploadPopup[Upload Popup] FilesService --> LogoUploadPopup[Logo Upload Popup] FilesService --> FileMetadata[File Types and Extensions] FilesService --> FileQueries[Files, Tags, Categories] FilesService --> Download[Download Files]
Usage
tsimport { Component } from '@angular/core';
import { FilesService } from '../services/common/files.service';
@Component({
selector: 'app-file-manager',
template: `
<button (click)="openUpload()">Upload file</button>
<button (click)="download()">Download</button>
`
})
export class FileManagerComponent {
constructor(private readonly filesService: FilesService) {}
openUpload(): void {
this.filesService.openUploadFilePopup();
}
download(): void {
this.filesService.DownloadFiles();
}
loadFileMetadata(): void {
const extension = this.filesService.extractFilesExtension();
const types = this.filesService.getTypesList();
console.log({ extension, types });
}
}
AI Coding Instructions
- Keep file popup actions inside
FilesServiceby callingopenUploadFilePopup,closeUploadPopup, oropenUploadLogoPopupfrom components. - Use
extractFilesExtensionandgetTypesListwhen preparing file upload or filtering UI state. - Call
GetFilesByParentFileID,GetTagsListByType, andGetCategoriesListthrough this service rather than duplicating file lookup logic in components. - Keep download behavior routed through
DownloadFilesand path-related handling throughfetchDownloadFilePath.
Used by
37 references from 37 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (37)
MrqDetailsComponent—Frontend/src/app/components/MRQ/mrq-details/mrq-details.component.ts:1BillOfMaterialsDetailsComponent—Frontend/src/app/components/bill-of-materials/bill-of-materials-details/bill-of-materials-details.component.ts:1NewBranchComponent—Frontend/src/app/components/configuration/company/main-branch/new.branch.component.ts:1ProductCategoriesComponent—Frontend/src/app/components/configuration/products/product-categories/product-categories.component.ts:1ProductsDetailsComponent—Frontend/src/app/components/configuration/products/products-details/products-details.component.ts:1OverallAnalysisYearMap—Frontend/src/app/components/dashboard/_principalReport/principal-report.component.ts:1NewActivityComponent—Frontend/src/app/components/dashboard/my-desk/activities/new-activity/new-activity.component.ts:1TopicComponent—Frontend/src/app/components/dashboard/my-desk/activities/topic/topic.component.ts:1
…and 29 more.
Was this page helpful?