Skip to content

UploadFileComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/files/upload-file/upload-file.component.ts (line 21)

Part of: Pams

UploadFileComponent manages file-upload UI state in the PAMS web client. It initializes upload-related data, synchronizes with an upload popup, loads tags and permissions, and handles post-upload updates.

Implements: OnInit

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
resizeWindowresizeWindow()void
getNumberFormattedgetNumberFormatted(x: undefined)string
selectTextselectText(e: undefined)void
stopPropagationstopPropagation(e: undefined)void
traceTypesListNametraceTypesListName(value: number)string
syncWithUploadPopupsyncWithUploadPopup()void
onUploadedonUploaded()void
GetTagsListByTypeGetTagsListByType(Type: number, supplierId: number)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
alertsAlertsComponent
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[]
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
  Init[ngOnInit] --> Resize[resizeWindow]
  Init --> Tags[GetTagsListByType]
  Init --> Permissions[getUsersPermission]
  UserAction[User interaction] --> Select[selectText]
  UserAction --> Stop[stopPropagation]
  UploadPopup[Upload popup] --> Sync[syncWithUploadPopup]
  UploadComplete[Upload completed] --> Uploaded[onUploaded]
  Uploaded --> Tags
  Display[Upload display] --> Format[getNumberFormatted]
  Display --> Trace[traceTypesListName]

Usage

ts
import { UploadFileComponent } from './upload-file.component';

function refreshUploadState(component: UploadFileComponent): void {
  component.GetTagsListByType();
  component.getUsersPermission();
  component.syncWithUploadPopup();
}

function handleUploadComplete(component: UploadFileComponent): void {
  component.onUploaded();

  const formattedValue = component.getNumberFormatted();
  console.log(formattedValue);
}

AI Coding Instructions

  • Keep upload initialization logic in ngOnInit() and preserve the existing lifecycle flow.
  • Call syncWithUploadPopup() when popup state or upload context changes.
  • Refresh dependent tag and permission data through GetTagsListByType() and getUsersPermission() after relevant changes.
  • Use stopPropagation() for UI events that must not reach parent handlers.
  • Keep post-upload handling in onUploaded() so upload completion updates remain in one place.

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)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1

Was this page helpful?

Download as PDF