File

files-repository/files-repository.component.ts

Metadata

Index

Properties
Methods

Constructor

constructor(filesRepositoryService: FilesRepositoryService, inventoryBinaryService: InventoryBinaryService, modalService: ModalService, alertService: AlertService, bsModalService: BsModalService, fileService: FilesService, translateService: TranslateService)
Parameters :
Name Type Optional
filesRepositoryService FilesRepositoryService No
inventoryBinaryService InventoryBinaryService No
modalService ModalService No
alertService AlertService No
bsModalService BsModalService No
fileService FilesService No
translateService TranslateService No

Methods

Async onDataSourceModifier
onDataSourceModifier(dataSourceModifier: DataSourceModifier)
Parameters :
Name Type Optional
dataSourceModifier DataSourceModifier No
Async onDeleteItem
onDeleteItem(selectedItem: Row)
Parameters :
Name Type Optional
selectedItem Row No
Returns : unknown
Async onDeleteItems
onDeleteItems(selectedItemsIds: string[])
Parameters :
Name Type Optional
selectedItemsIds string[] No
Returns : unknown
Async onDownloadItem
onDownloadItem(selectedItem: IManagedObjectBinary)
Parameters :
Name Type Optional
selectedItem IManagedObjectBinary No
Returns : unknown
openFileUploadComponent
openFileUploadComponent()
Returns : void

Properties

actionControls
Type : ActionControl[]
Default value : [ { text: gettext('Delete'), icon: 'trash', type: BuiltInActionType.Delete, showIf: selectedItem => !this.filesRepositoryService.hasApplicationStorageFragment(selectedItem), callback: selectedItem => this.onDeleteItem(selectedItem) }, { text: gettext('Download'), icon: 'download', type: BuiltInActionType.Export, callback: selectedItem => this.onDownloadItem(selectedItem as IManagedObjectBinary) } ]
bulkActionControls
Type : BulkActionControl[]
Default value : [ { type: BuiltInActionType.Delete, callback: selectedItemIds => this.onDeleteItems(selectedItemIds) } ]
columns
Type : Column[]
Default value : this.filesRepositoryService.getColumns()
dataGrid
Type : DataGridComponent
Decorators :
@ViewChild(DataGridComponent, {static: true})
destroy$
Type : Subject<boolean>
Default value : new Subject<boolean>()
displayOptions
Type : DisplayOptions
Default value : { bordered: false, striped: true, filter: true, gridHeader: true, hover: true }
infiniteScroll
Type : LoadMoreMode
Default value : 'auto'
isLoading
Default value : true
loadingItemsLabel
Type : string
Default value : gettext('Loading files…')
loadMoreItemsLabel
Type : string
Default value : gettext('Load more files')
managementTitle
Type : string
Default value : gettext('Management')
noDataMessage
Default value : gettext('No files to display.')
noDataSubtitle
Default value : gettext('Add a new file by clicking below.')
noResultsMessage
Default value : gettext('No results to display.')
noResultsSubtitle
Default value : gettext('Refine your search terms or check your spelling.')
pagination
Type : Pagination
Default value : this.filesRepositoryService.getPagination()
refresh
Type : EventEmitter<void>
Default value : new EventEmitter<void>()
returnedDataSize
Type : number
selectable
Default value : true
serverSideDataCallback
Type : ServerSideDataCallback
title
Type : string
Default value : gettext('Files repository')
<c8y-title>
  {{ title | translate }}
</c8y-title>

<c8y-breadcrumb>
  <c8y-breadcrumb-item
    icon="c8y-management"
    [label]="managementTitle | translate"
  ></c8y-breadcrumb-item>
  <c8y-breadcrumb-item [label]="title | translate"></c8y-breadcrumb-item>
</c8y-breadcrumb>

<c8y-action-bar-item [placement]="'right'">
  <button
    class="btn btn-link"
    title="{{ 'Upload files' | translate }}"
    *c8yIfAllowed="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE']; allowAny: true"
    (click)="openFileUploadComponent()"
    data-cy="c8y-files-repository--open-file-upload-component"
  >
    <i c8yIcon="upload"></i>
    {{ 'Upload files' | translate }}
  </button>
</c8y-action-bar-item>

<c8y-help src="/docs/standard-tenant/managing-data/#file-repository"></c8y-help>

<div class="content-fullpage border-top border-bottom">
  <c8y-data-grid
    [title]="title"
    [loadMoreItemsLabel]="loadMoreItemsLabel"
    [loadingItemsLabel]="loadingItemsLabel"
    [displayOptions]="displayOptions"
    [columns]="columns"
    [pagination]="pagination"
    [infiniteScroll]="infiniteScroll"
    [serverSideDataCallback]="serverSideDataCallback"
    [actionControls]="actionControls"
    [selectable]="selectable"
    [showSearch]="true"
    [refresh]="refresh"
    [bulkActionControls]="bulkActionControls"
  >
    <c8y-ui-empty-state
      [icon]="stats?.size > 0 ? 'search' : 'c8y-archive'"
      [title]="stats?.size > 0 ? (noResultsMessage | translate) : (noDataMessage | translate)"
      [subtitle]="stats?.size > 0 ? (noResultsSubtitle | translate) : (noDataSubtitle | translate)"
      *emptyStateContext="let stats"
      [horizontal]="stats?.size > 0"
    >
      <p *ngIf="stats?.size === 0">
        <button
          class="btn btn-primary"
          title="{{ 'Upload file' | translate }}"
          type="button"
          (click)="openFileUploadComponent()"
        >
          <i c8yIcon="plus-circle"></i>
          {{ 'Upload file' | translate }}
        </button>
      </p>
    </c8y-ui-empty-state>

    <c8y-column name="name">
      <ng-container *c8yCellRendererDef="let context">
        <span title="{{ context.value }}">
          <div class="d-flex j-c-between a-i-center">
            {{ context.value }}
            <c8y-file-preview
              class="m-l-auto"
              [mo]="context.item"
            >
              <button
                class="btn btn-emphasis btn-icon"
                [title]="'Preview file' | translate"
                type="button"
                customButton
              >
                <i c8yIcon="search"></i>
              </button>
            </c8y-file-preview>
          </div>
        </span>
      </ng-container>
    </c8y-column>

    <c8y-column name="length">
      <ng-container *c8yCellRendererDef="let context">
        <span title="{{ context.value }} B">
          {{ context.value | bytes }}
        </span>
      </ng-container>
    </c8y-column>

    <c8y-column name="lastUpdated">
      <ng-container *c8yCellRendererDef="let context">
        <span title="{{ context.value | c8yDate }}">
          {{ context.value | c8yDate }}
        </span>
      </ng-container>
    </c8y-column>
  </c8y-data-grid>
</div>

results matching ""

    No results matching ""