Skip to content

UploadFileComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/files/upload-file/upload-file.component.ts (line 21)

Part of: Frontend

UploadFileComponent manages file-upload UI state and interactions in the Angular frontend. It handles initialization, window resizing, upload completion, file exclusion, text selection, and synchronization with the upload popup.

Implements: OnInit

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
resizeWindowresizeWindow()void
getNumberFormattedgetNumberFormatted(x: undefined)string
isMeDeveloperisMeDeveloper()boolean
selectTextselectText(e: undefined)void
stopPropagationstopPropagation(e: undefined)void
traceTypesListNametraceTypesListName(value: number)string
syncWithUploadPopupsyncWithUploadPopup()void
onUploadedonUploaded()void
excludeFileexcludeFile(file: undefined, index: number)void
GetTagsListByTypeGetTagsListByType(Type: number, supplierId: number)void
GetCategoriesListGetCategoriesList()void
getUsersPermissiongetUsersPermission()void
getFilesListgetFilesList(parentId: string)void
tracetrace(data: any)void
getFoldersListgetFoldersList(parentId: string, levelIndex: number)void
extractFilesExtensionextractFilesExtension(file: OneDriveFilesList)string
onChooseTagTypeonChooseTagType(e: undefined)void
saveNewFilesaveNewFile()void
selectFileselectFile(file: OneDriveFilesList)void
closePopupclosePopup()void
LinkTagLinkTag(doLinkDirectly: boolean)void
DeleteTagDeleteTag(idx: number)void
addCommentaddComment()void
DeleteCommentDeleteComment(idx: number)void
ngOnDestroyngOnDestroy()void
changeTabschangeTabs(targetTab: undefined)void
selectItemselectItem(e: any)void
onInitializedonInitialized(e: undefined)void

Properties

PropertyType
treeViewDxTreeViewComponent
uploadValidationDxValidationGroupComponent
TagReferenceToTypeIDnumber
TagReferenceToIDnumber
ParentFileIDnumber
tempSelectedDataFileFileData
SelectedDataFilesFileData[]
tempShareFileOneDriveShareFiles
ShareFilesOneDriveShareFiles[]
usersPermissionDriveUser[]
SelectedListOneDriveFilesList[]
FoldersListOneDriveFilesList[]
fileNameAndExtensionFileNameAndExtension[]
currentTabstring
newTagUploadNewFile
UploadedFilesFile[]
uploadPopupboolean
CompanyBranchIDnumber
selectedTagReferenceToTypeIDnumber
selectedTagReferenceToIDnumber
selectedTagRegistrationReferenceToSupplierIDnumber
displayNamePatternany
FileRelatedToTypesany
modalOptionsany
TypesListany[]
TagListsGeneralListView[][]
TagListDataSourcesDataSource[]
categoriesListDataSourcesany[]
Commentstring
subscriptionSubscription
DatagridHeightnumber
TotalFilesCountnumber
TotalFoldersCountnumber
updateTopContentany
updateBottomContentany
updateContentTimerany
updateContentany

Where it refuses work

  • UploadFileComponent stops the work with an early return when findIndex > -1.
  • UploadFileComponent stops the work with an early return when !this.selectedTagReferenceToID || this.selectedTagReferenceToID == 0.
  • UploadFileComponent stops the work with an early return when this.tempSelectedDataFile && this.tempSelectedDataFile.FileTags && this.tempSelectedDataF….
  • UploadFileComponent stops the work with an early return when !(this.Comment.trim() && this.Comment.trim().length > 0).

Diagram

mermaid
graph LR
  User[User interaction] --> Component[UploadFileComponent]
  Component --> Init[ngOnInit]
  Component --> Resize[resizeWindow]
  Component --> Popup[syncWithUploadPopup]
  Component --> Uploaded[onUploaded]
  Component --> Exclude[excludeFile]
  Component --> Display[getNumberFormatted]
  Component --> Types[traceTypesListName]
  Component --> Access[isMeDeveloper]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { UploadFileComponent } from './components/files/upload-file/upload-file.component';

@Component({
  selector: 'app-upload-page',
  template: `
    <app-upload-file #uploadFile></app-upload-file>

    <button type="button" (click)="openUploadPopup()">
      Open upload
    </button>
  `
})
export class UploadPageComponent {
  @ViewChild('uploadFile')
  uploadFileComponent!: UploadFileComponent;

  openUploadPopup(): void {
    this.uploadFileComponent.syncWithUploadPopup();
  }

  handleUploadComplete(): void {
    this.uploadFileComponent.onUploaded();
  }
}

AI Coding Instructions

  • Keep upload-related UI state changes inside UploadFileComponent methods rather than duplicating them in parent components.
  • Call syncWithUploadPopup() when external UI actions need to align with the upload popup state.
  • Preserve event handling through stopPropagation() when nested controls must not trigger parent click handlers.
  • Use onUploaded() after an upload completes so component state is updated through the existing flow.
  • Check isMeDeveloper() before rendering or enabling developer-specific behavior.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • TranslateHandlerFrontend/src/app/components/shared/shared.module.ts:1

Was this page helpful?

Download as PDF