mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
96252: Extract upload-specific code from SharedModule
This commit is contained in:
@@ -10,6 +10,7 @@ import { AdminSearchModule } from './admin-search-page/admin-search.module';
|
|||||||
import { AdminSidebarSectionComponent } from './admin-sidebar/admin-sidebar-section/admin-sidebar-section.component';
|
import { AdminSidebarSectionComponent } from './admin-sidebar/admin-sidebar-section/admin-sidebar-section.component';
|
||||||
import { ExpandableAdminSidebarSectionComponent } from './admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component';
|
import { ExpandableAdminSidebarSectionComponent } from './admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component';
|
||||||
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
|
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
|
||||||
|
import { UploadModule } from '../shared/upload/upload.module';
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
// put only entry components that use custom decorator
|
// put only entry components that use custom decorator
|
||||||
@@ -25,7 +26,8 @@ const ENTRY_COMPONENTS = [
|
|||||||
AccessControlModule,
|
AccessControlModule,
|
||||||
AdminSearchModule.withEntryComponents(),
|
AdminSearchModule.withEntryComponents(),
|
||||||
AdminWorkflowModuleModule.withEntryComponents(),
|
AdminWorkflowModuleModule.withEntryComponents(),
|
||||||
SharedModule
|
SharedModule,
|
||||||
|
UploadModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AdminCurationTasksComponent,
|
AdminCurationTasksComponent,
|
||||||
|
@@ -25,7 +25,7 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
|
|||||||
StatisticsModule.forRoot(),
|
StatisticsModule.forRoot(),
|
||||||
EditItemPageModule,
|
EditItemPageModule,
|
||||||
CollectionFormModule,
|
CollectionFormModule,
|
||||||
ComcolModule
|
ComcolModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
CollectionPageComponent,
|
CollectionPageComponent,
|
||||||
@@ -38,7 +38,7 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
SearchService,
|
SearchService,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class CollectionPageModule {
|
export class CollectionPageModule {
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ import { ComcolModule } from '../../shared/comcol/comcol.module';
|
|||||||
CollectionFormModule,
|
CollectionFormModule,
|
||||||
ResourcePoliciesModule,
|
ResourcePoliciesModule,
|
||||||
FormModule,
|
FormModule,
|
||||||
ComcolModule
|
ComcolModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
EditCollectionPageComponent,
|
EditCollectionPageComponent,
|
||||||
|
@@ -36,7 +36,7 @@ const DECLARATIONS = [CommunityPageComponent,
|
|||||||
CommunityPageRoutingModule,
|
CommunityPageRoutingModule,
|
||||||
StatisticsModule.forRoot(),
|
StatisticsModule.forRoot(),
|
||||||
CommunityFormModule,
|
CommunityFormModule,
|
||||||
ComcolModule
|
ComcolModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
...DECLARATIONS
|
...DECLARATIONS
|
||||||
|
@@ -21,7 +21,7 @@ import { ComcolModule } from '../../shared/comcol/comcol.module';
|
|||||||
EditCommunityPageRoutingModule,
|
EditCommunityPageRoutingModule,
|
||||||
CommunityFormModule,
|
CommunityFormModule,
|
||||||
ComcolModule,
|
ComcolModule,
|
||||||
ResourcePoliciesModule
|
ResourcePoliciesModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
EditCommunityPageComponent,
|
EditCommunityPageComponent,
|
||||||
|
@@ -23,7 +23,6 @@ import { ObjectSelectService } from '../shared/object-select/object-select.servi
|
|||||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||||
import { CSSVariableService } from '../shared/sass-helper/sass-helper.service';
|
import { CSSVariableService } from '../shared/sass-helper/sass-helper.service';
|
||||||
import { SidebarService } from '../shared/sidebar/sidebar.service';
|
import { SidebarService } from '../shared/sidebar/sidebar.service';
|
||||||
import { UploaderService } from '../shared/uploader/uploader.service';
|
|
||||||
import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service';
|
import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service';
|
||||||
import { AuthenticatedGuard } from './auth/authenticated.guard';
|
import { AuthenticatedGuard } from './auth/authenticated.guard';
|
||||||
import { AuthStatus } from './auth/models/auth-status.model';
|
import { AuthStatus } from './auth/models/auth-status.model';
|
||||||
@@ -233,12 +232,10 @@ const PROVIDERS = [
|
|||||||
SubmissionResponseParsingService,
|
SubmissionResponseParsingService,
|
||||||
SubmissionJsonPatchOperationsService,
|
SubmissionJsonPatchOperationsService,
|
||||||
JsonPatchOperationsBuilder,
|
JsonPatchOperationsBuilder,
|
||||||
UploaderService,
|
|
||||||
UUIDService,
|
UUIDService,
|
||||||
NotificationsService,
|
NotificationsService,
|
||||||
WorkspaceitemDataService,
|
WorkspaceitemDataService,
|
||||||
WorkflowItemDataService,
|
WorkflowItemDataService,
|
||||||
UploaderService,
|
|
||||||
DSpaceObjectDataService,
|
DSpaceObjectDataService,
|
||||||
ConfigurationDataService,
|
ConfigurationDataService,
|
||||||
DSOChangeAnalyzer,
|
DSOChangeAnalyzer,
|
||||||
|
@@ -1,7 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* The contents of this file are subject to the license and copyright
|
||||||
|
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||||
|
* tree and available online at
|
||||||
|
*
|
||||||
|
* http://www.dspace.org/license/
|
||||||
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable({
|
||||||
export class UploaderService {
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class DragService {
|
||||||
private _overrideDragOverPage = false;
|
private _overrideDragOverPage = false;
|
||||||
|
|
||||||
public overrideDragOverPage() {
|
public overrideDragOverPage() {
|
@@ -4,7 +4,7 @@ import { RemoteData } from '../../../core/data/remote-data';
|
|||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { map, take, switchMap } from 'rxjs/operators';
|
import { map, take, switchMap } from 'rxjs/operators';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
|
import { UploaderOptions } from '../../../shared/upload/uploader/uploader-options.model';
|
||||||
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
|
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
@@ -14,7 +14,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
|||||||
import { Bundle } from '../../../core/shared/bundle.model';
|
import { Bundle } from '../../../core/shared/bundle.model';
|
||||||
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
||||||
import { getFirstSucceededRemoteDataPayload, getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstSucceededRemoteDataPayload, getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
import { UploaderComponent } from '../../../shared/uploader/uploader.component';
|
import { UploaderComponent } from '../../../shared/upload/uploader/uploader.component';
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { getBitstreamModuleRoute } from '../../../app-routing-paths';
|
import { getBitstreamModuleRoute } from '../../../app-routing-paths';
|
||||||
import { getEntityEditRoute } from '../../item-page-routing-paths';
|
import { getEntityEditRoute } from '../../item-page-routing-paths';
|
||||||
|
@@ -46,6 +46,7 @@ import { OrcidPageComponent } from './orcid-page/orcid-page.component';
|
|||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { OrcidSyncSettingsComponent } from './orcid-page/orcid-sync-settings/orcid-sync-settings.component';
|
import { OrcidSyncSettingsComponent } from './orcid-page/orcid-sync-settings/orcid-sync-settings.component';
|
||||||
import { OrcidQueueComponent } from './orcid-page/orcid-queue/orcid-queue.component';
|
import { OrcidQueueComponent } from './orcid-page/orcid-queue/orcid-queue.component';
|
||||||
|
import { UploadModule } from '../shared/upload/upload.module';
|
||||||
|
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
@@ -94,7 +95,8 @@ const DECLARATIONS = [
|
|||||||
JournalEntitiesModule.withEntryComponents(),
|
JournalEntitiesModule.withEntryComponents(),
|
||||||
ResearchEntitiesModule.withEntryComponents(),
|
ResearchEntitiesModule.withEntryComponents(),
|
||||||
NgxGalleryModule,
|
NgxGalleryModule,
|
||||||
NgbAccordionModule
|
NgbAccordionModule,
|
||||||
|
UploadModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
...DECLARATIONS,
|
...DECLARATIONS,
|
||||||
|
@@ -16,10 +16,10 @@ import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
|
|||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
import { getMockScrollToService } from '../../shared/mocks/scroll-to-service.mock';
|
import { getMockScrollToService } from '../../shared/mocks/scroll-to-service.mock';
|
||||||
import { UploaderService } from '../../shared/uploader/uploader.service';
|
import { DragService } from '../../core/drag.service';
|
||||||
import { HostWindowService } from '../../shared/host-window.service';
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||||
import { UploaderComponent } from '../../shared/uploader/uploader.component';
|
import { UploaderComponent } from '../../shared/upload/uploader/uploader.component';
|
||||||
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
||||||
import { CookieService } from '../../core/services/cookie.service';
|
import { CookieService } from '../../core/services/cookie.service';
|
||||||
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
|
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
|
||||||
@@ -59,7 +59,7 @@ describe('MyDSpaceNewSubmissionComponent test', () => {
|
|||||||
NgbModal,
|
NgbModal,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
MyDSpaceNewSubmissionComponent,
|
MyDSpaceNewSubmissionComponent,
|
||||||
UploaderService,
|
DragService,
|
||||||
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
|
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
|
||||||
{ provide: CookieService, useValue: new CookieServiceMock() },
|
{ provide: CookieService, useValue: new CookieServiceMock() },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
||||||
|
@@ -8,13 +8,13 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { UploaderOptions } from '../../shared/uploader/uploader-options.model';
|
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
|
||||||
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { SearchResult } from '../../shared/search/models/search-result.model';
|
import { SearchResult } from '../../shared/search/models/search-result.model';
|
||||||
import { CollectionSelectorComponent } from '../collection-selector/collection-selector.component';
|
import { CollectionSelectorComponent } from '../collection-selector/collection-selector.component';
|
||||||
import { UploaderComponent } from '../../shared/uploader/uploader.component';
|
import { UploaderComponent } from '../../shared/upload/uploader/uploader.component';
|
||||||
import { UploaderError } from '../../shared/uploader/uploader-error.model';
|
import { UploaderError } from '../../shared/upload/uploader/uploader-error.model';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -14,6 +14,7 @@ import { MyDSpaceNewSubmissionDropdownComponent } from './my-dspace-new-submissi
|
|||||||
import { MyDSpaceNewExternalDropdownComponent } from './my-dspace-new-submission/my-dspace-new-external-dropdown/my-dspace-new-external-dropdown.component';
|
import { MyDSpaceNewExternalDropdownComponent } from './my-dspace-new-submission/my-dspace-new-external-dropdown/my-dspace-new-external-dropdown.component';
|
||||||
import { ThemedMyDSpacePageComponent } from './themed-my-dspace-page.component';
|
import { ThemedMyDSpacePageComponent } from './themed-my-dspace-page.component';
|
||||||
import { SearchModule } from '../shared/search/search.module';
|
import { SearchModule } from '../shared/search/search.module';
|
||||||
|
import { UploadModule } from '../shared/upload/upload.module';
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
MyDSpacePageComponent,
|
MyDSpacePageComponent,
|
||||||
@@ -30,7 +31,8 @@ const DECLARATIONS = [
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
SearchModule,
|
SearchModule,
|
||||||
MyDspacePageRoutingModule,
|
MyDspacePageRoutingModule,
|
||||||
MyDspaceSearchModule.withEntryComponents()
|
MyDspaceSearchModule.withEntryComponents(),
|
||||||
|
UploadModule,
|
||||||
],
|
],
|
||||||
declarations: DECLARATIONS,
|
declarations: DECLARATIONS,
|
||||||
providers: [
|
providers: [
|
||||||
|
@@ -17,8 +17,8 @@ import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.mod
|
|||||||
import { ResourceType } from '../../../../core/shared/resource-type';
|
import { ResourceType } from '../../../../core/shared/resource-type';
|
||||||
import { hasValue, isNotEmpty } from '../../../empty.util';
|
import { hasValue, isNotEmpty } from '../../../empty.util';
|
||||||
import { NotificationsService } from '../../../notifications/notifications.service';
|
import { NotificationsService } from '../../../notifications/notifications.service';
|
||||||
import { UploaderOptions } from '../../../uploader/uploader-options.model';
|
import { UploaderOptions } from '../../../upload/uploader/uploader-options.model';
|
||||||
import { UploaderComponent } from '../../../uploader/uploader.component';
|
import { UploaderComponent } from '../../../upload/uploader/uploader.component';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import { NoContent } from '../../../../core/shared/NoContent.model';
|
import { NoContent } from '../../../../core/shared/NoContent.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
|
@@ -15,6 +15,7 @@ import { ThemedComcolPageBrowseByComponent } from './comcol-page-browse-by/theme
|
|||||||
import { ComcolRoleComponent } from './comcol-forms/edit-comcol-page/comcol-role/comcol-role.component';
|
import { ComcolRoleComponent } from './comcol-forms/edit-comcol-page/comcol-role/comcol-role.component';
|
||||||
import { SharedModule } from '../shared.module';
|
import { SharedModule } from '../shared.module';
|
||||||
import { FormModule } from '../form/form.module';
|
import { FormModule } from '../form/form.module';
|
||||||
|
import { UploadModule } from '../upload/upload.module';
|
||||||
|
|
||||||
const COMPONENTS = [
|
const COMPONENTS = [
|
||||||
ComcolPageContentComponent,
|
ComcolPageContentComponent,
|
||||||
@@ -28,9 +29,7 @@ const COMPONENTS = [
|
|||||||
ComcolPageBrowseByComponent,
|
ComcolPageBrowseByComponent,
|
||||||
ThemedComcolPageBrowseByComponent,
|
ThemedComcolPageBrowseByComponent,
|
||||||
ComcolRoleComponent,
|
ComcolRoleComponent,
|
||||||
|
|
||||||
ThemedComcolPageHandleComponent
|
ThemedComcolPageHandleComponent
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -40,10 +39,12 @@ const COMPONENTS = [
|
|||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormModule,
|
FormModule,
|
||||||
SharedModule
|
SharedModule,
|
||||||
|
UploadModule,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
...COMPONENTS
|
...COMPONENTS,
|
||||||
|
UploadModule,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ComcolModule { }
|
export class ComcolModule { }
|
||||||
|
@@ -17,7 +17,6 @@ import {
|
|||||||
} from '@ng-bootstrap/ng-bootstrap';
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { MissingTranslationHandler, TranslateModule } from '@ngx-translate/core';
|
import { MissingTranslationHandler, TranslateModule } from '@ngx-translate/core';
|
||||||
import { NgxPaginationModule } from 'ngx-pagination';
|
import { NgxPaginationModule } from 'ngx-pagination';
|
||||||
import { FileUploadModule } from 'ng2-file-upload';
|
|
||||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||||
import { MomentModule } from 'ngx-moment';
|
import { MomentModule } from 'ngx-moment';
|
||||||
import { ConfirmationModalComponent } from './confirmation-modal/confirmation-modal.component';
|
import { ConfirmationModalComponent } from './confirmation-modal/confirmation-modal.component';
|
||||||
@@ -30,7 +29,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
ImportBatchSelectorComponent
|
ImportBatchSelectorComponent
|
||||||
} from './dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component';
|
} from './dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component';
|
||||||
import { FileDropzoneNoUploaderComponent } from './file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
|
||||||
import { ItemListElementComponent } from './object-list/item-list-element/item-types/item/item-list-element.component';
|
import { ItemListElementComponent } from './object-list/item-list-element/item-types/item/item-list-element.component';
|
||||||
import { EnumKeysPipe } from './utils/enum-keys-pipe';
|
import { EnumKeysPipe } from './utils/enum-keys-pipe';
|
||||||
import { FileSizePipe } from './utils/file-size-pipe';
|
import { FileSizePipe } from './utils/file-size-pipe';
|
||||||
@@ -73,7 +71,6 @@ import { TruncatePipe } from './utils/truncate.pipe';
|
|||||||
import { TruncatableComponent } from './truncatable/truncatable.component';
|
import { TruncatableComponent } from './truncatable/truncatable.component';
|
||||||
import { TruncatableService } from './truncatable/truncatable.service';
|
import { TruncatableService } from './truncatable/truncatable.service';
|
||||||
import { TruncatablePartComponent } from './truncatable/truncatable-part/truncatable-part.component';
|
import { TruncatablePartComponent } from './truncatable/truncatable-part/truncatable-part.component';
|
||||||
import { UploaderComponent } from './uploader/uploader.component';
|
|
||||||
import { MockAdminGuard } from './mocks/admin-guard.service.mock';
|
import { MockAdminGuard } from './mocks/admin-guard.service.mock';
|
||||||
import { AlertComponent } from './alert/alert.component';
|
import { AlertComponent } from './alert/alert.component';
|
||||||
import {
|
import {
|
||||||
@@ -322,7 +319,6 @@ import { GoogleRecaptchaModule } from '../core/google-recaptcha/google-recaptcha
|
|||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FileUploadModule,
|
|
||||||
FormsModule,
|
FormsModule,
|
||||||
InfiniteScrollModule,
|
InfiniteScrollModule,
|
||||||
NgbNavModule,
|
NgbNavModule,
|
||||||
@@ -393,8 +389,6 @@ const COMPONENTS = [
|
|||||||
SidebarFilterComponent,
|
SidebarFilterComponent,
|
||||||
SidebarFilterSelectedOptionComponent,
|
SidebarFilterSelectedOptionComponent,
|
||||||
ThumbnailComponent,
|
ThumbnailComponent,
|
||||||
UploaderComponent,
|
|
||||||
FileDropzoneNoUploaderComponent,
|
|
||||||
ItemListPreviewComponent,
|
ItemListPreviewComponent,
|
||||||
ThemedItemListPreviewComponent,
|
ThemedItemListPreviewComponent,
|
||||||
MyDSpaceItemStatusComponent,
|
MyDSpaceItemStatusComponent,
|
||||||
@@ -479,7 +473,6 @@ const COMPONENTS = [
|
|||||||
ImportBatchSelectorComponent,
|
ImportBatchSelectorComponent,
|
||||||
ExportBatchSelectorComponent,
|
ExportBatchSelectorComponent,
|
||||||
ConfirmationModalComponent,
|
ConfirmationModalComponent,
|
||||||
VocabularyTreeviewComponent,
|
|
||||||
AuthorizedCollectionSelectorComponent,
|
AuthorizedCollectionSelectorComponent,
|
||||||
CurationFormComponent,
|
CurationFormComponent,
|
||||||
SearchResultListElementComponent,
|
SearchResultListElementComponent,
|
||||||
@@ -560,7 +553,6 @@ const ENTRY_COMPONENTS = [
|
|||||||
ImportBatchSelectorComponent,
|
ImportBatchSelectorComponent,
|
||||||
ExportBatchSelectorComponent,
|
ExportBatchSelectorComponent,
|
||||||
ConfirmationModalComponent,
|
ConfirmationModalComponent,
|
||||||
VocabularyTreeviewComponent,
|
|
||||||
SidebarSearchListElementComponent,
|
SidebarSearchListElementComponent,
|
||||||
PublicationSidebarSearchListElementComponent,
|
PublicationSidebarSearchListElementComponent,
|
||||||
CollectionSidebarSearchListElementComponent,
|
CollectionSidebarSearchListElementComponent,
|
||||||
|
38
src/app/shared/upload/upload.module.ts
Normal file
38
src/app/shared/upload/upload.module.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* The contents of this file are subject to the license and copyright
|
||||||
|
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||||
|
* tree and available online at
|
||||||
|
*
|
||||||
|
* http://www.dspace.org/license/
|
||||||
|
*/
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SharedModule } from '../shared.module';
|
||||||
|
import { FileUploadModule } from 'ng2-file-upload';
|
||||||
|
import { UploaderComponent } from './uploader/uploader.component';
|
||||||
|
import { FileDropzoneNoUploaderComponent } from './file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
||||||
|
|
||||||
|
const COMPONENTS = [
|
||||||
|
UploaderComponent,
|
||||||
|
FileDropzoneNoUploaderComponent,
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
FileUploadModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
...COMPONENTS,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
...COMPONENTS,
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
...COMPONENTS,
|
||||||
|
FileUploadModule,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class UploadModule {
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
import { RestRequestMethod } from '../../core/data/rest-request-method';
|
import { RestRequestMethod } from '../../../core/data/rest-request-method';
|
||||||
|
|
||||||
export class UploaderOptions {
|
export class UploaderOptions {
|
||||||
/**
|
/**
|
@@ -1,4 +1,4 @@
|
|||||||
import { MetadataMap } from '../../core/shared/metadata.models';
|
import { MetadataMap } from '../../../core/shared/metadata.models';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Properties to send to the REST API for uploading a bitstream
|
* Properties to send to the REST API for uploading a bitstream
|
@@ -4,16 +4,16 @@ import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/
|
|||||||
|
|
||||||
import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
|
import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
|
||||||
|
|
||||||
import { UploaderService } from './uploader.service';
|
import { DragService } from '../../../core/drag.service';
|
||||||
import { UploaderOptions } from './uploader-options.model';
|
import { UploaderOptions } from './uploader-options.model';
|
||||||
import { UploaderComponent } from './uploader.component';
|
import { UploaderComponent } from './uploader.component';
|
||||||
import { FileUploadModule } from 'ng2-file-upload';
|
import { FileUploadModule } from 'ng2-file-upload';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { createTestComponent } from '../testing/utils.test';
|
import { createTestComponent } from '../../testing/utils.test';
|
||||||
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
||||||
import { CookieService } from '../../core/services/cookie.service';
|
import { CookieService } from '../../../core/services/cookie.service';
|
||||||
import { CookieServiceMock } from '../mocks/cookie.service.mock';
|
import { CookieServiceMock } from '../../mocks/cookie.service.mock';
|
||||||
import { HttpXsrfTokenExtractorMock } from '../mocks/http-xsrf-token-extractor.mock';
|
import { HttpXsrfTokenExtractorMock } from '../../mocks/http-xsrf-token-extractor.mock';
|
||||||
|
|
||||||
describe('Chips component', () => {
|
describe('Chips component', () => {
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ describe('Chips component', () => {
|
|||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
ScrollToService,
|
ScrollToService,
|
||||||
UploaderComponent,
|
UploaderComponent,
|
||||||
UploaderService,
|
DragService,
|
||||||
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
|
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
|
||||||
{ provide: CookieService, useValue: new CookieServiceMock() },
|
{ provide: CookieService, useValue: new CookieServiceMock() },
|
||||||
],
|
],
|
@@ -6,12 +6,12 @@ import { uniqueId } from 'lodash';
|
|||||||
import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
|
import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
|
||||||
|
|
||||||
import { UploaderOptions } from './uploader-options.model';
|
import { UploaderOptions } from './uploader-options.model';
|
||||||
import { hasValue, isNotEmpty, isUndefined } from '../empty.util';
|
import { hasValue, isNotEmpty, isUndefined } from '../../empty.util';
|
||||||
import { UploaderService } from './uploader.service';
|
|
||||||
import { UploaderProperties } from './uploader-properties.model';
|
import { UploaderProperties } from './uploader-properties.model';
|
||||||
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
import { HttpXsrfTokenExtractor } from '@angular/common/http';
|
||||||
import { XSRF_COOKIE, XSRF_REQUEST_HEADER, XSRF_RESPONSE_HEADER } from '../../core/xsrf/xsrf.interceptor';
|
import { XSRF_COOKIE, XSRF_REQUEST_HEADER, XSRF_RESPONSE_HEADER } from '../../../core/xsrf/xsrf.interceptor';
|
||||||
import { CookieService } from '../../core/services/cookie.service';
|
import { CookieService } from '../../../core/services/cookie.service';
|
||||||
|
import { DragService } from '../../../core/drag.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-uploader',
|
selector: 'ds-uploader',
|
||||||
@@ -76,7 +76,7 @@ export class UploaderComponent {
|
|||||||
@HostListener('window:dragover', ['$event'])
|
@HostListener('window:dragover', ['$event'])
|
||||||
onDragOver(event: any) {
|
onDragOver(event: any) {
|
||||||
|
|
||||||
if (this.enableDragOverDocument && this.uploaderService.isAllowedDragOverPage()) {
|
if (this.enableDragOverDocument && this.dragService.isAllowedDragOverPage()) {
|
||||||
// Show drop area on the page
|
// Show drop area on the page
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if ((event.target as any).tagName !== 'HTML') {
|
if ((event.target as any).tagName !== 'HTML') {
|
||||||
@@ -85,9 +85,13 @@ export class UploaderComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private cdr: ChangeDetectorRef, private scrollToService: ScrollToService,
|
constructor(
|
||||||
private uploaderService: UploaderService, private tokenExtractor: HttpXsrfTokenExtractor,
|
private cdr: ChangeDetectorRef,
|
||||||
private cookieService: CookieService) {
|
private scrollToService: ScrollToService,
|
||||||
|
private dragService: DragService,
|
||||||
|
private tokenExtractor: HttpXsrfTokenExtractor,
|
||||||
|
private cookieService: CookieService
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@@ -10,7 +10,7 @@ import { SubmissionObject } from '../../core/submission/models/submission-object
|
|||||||
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
|
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
|
||||||
|
|
||||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||||
import { UploaderOptions } from '../../shared/uploader/uploader-options.model';
|
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
|
||||||
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
|
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
|
||||||
import { SectionDataObject } from '../sections/models/section-data.model';
|
import { SectionDataObject } from '../sections/models/section-data.model';
|
||||||
import { SubmissionService } from '../submission.service';
|
import { SubmissionService } from '../submission.service';
|
||||||
|
@@ -28,7 +28,7 @@ import { SubmissionJsonPatchOperationsServiceStub } from '../../../shared/testin
|
|||||||
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
||||||
import { SharedModule } from '../../../shared/shared.module';
|
import { SharedModule } from '../../../shared/shared.module';
|
||||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||||
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
|
import { UploaderOptions } from '../../../shared/upload/uploader/uploader-options.model';
|
||||||
|
|
||||||
describe('SubmissionUploadFilesComponent Component', () => {
|
describe('SubmissionUploadFilesComponent Component', () => {
|
||||||
|
|
||||||
|
@@ -60,6 +60,7 @@ import { PublisherPolicyComponent } from './sections/sherpa-policies/publisher-p
|
|||||||
import {
|
import {
|
||||||
PublicationInformationComponent
|
PublicationInformationComponent
|
||||||
} from './sections/sherpa-policies/publication-information/publication-information.component';
|
} from './sections/sherpa-policies/publication-information/publication-information.component';
|
||||||
|
import { UploadModule } from '../shared/upload/upload.module';
|
||||||
import {
|
import {
|
||||||
MetadataInformationComponent
|
MetadataInformationComponent
|
||||||
} from './sections/sherpa-policies/metadata-information/metadata-information.component';
|
} from './sections/sherpa-policies/metadata-information/metadata-information.component';
|
||||||
@@ -115,7 +116,8 @@ const DECLARATIONS = [
|
|||||||
FormModule,
|
FormModule,
|
||||||
NgbModalModule,
|
NgbModalModule,
|
||||||
NgbCollapseModule,
|
NgbCollapseModule,
|
||||||
NgbAccordionModule
|
NgbAccordionModule,
|
||||||
|
UploadModule,
|
||||||
],
|
],
|
||||||
declarations: DECLARATIONS,
|
declarations: DECLARATIONS,
|
||||||
exports: [
|
exports: [
|
||||||
|
Reference in New Issue
Block a user