Skip to content

Commit db3e8f9

Browse files
committed
96252: Extract upload-specific code from SharedModule
1 parent 3739fa4 commit db3e8f9

29 files changed

Lines changed: 104 additions & 54 deletions

src/app/admin/admin.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { AdminSearchModule } from './admin-search-page/admin-search.module';
1010
import { AdminSidebarSectionComponent } from './admin-sidebar/admin-sidebar-section/admin-sidebar-section.component';
1111
import { ExpandableAdminSidebarSectionComponent } from './admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component';
1212
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
13+
import { UploadModule } from '../shared/upload/upload.module';
1314

1415
const ENTRY_COMPONENTS = [
1516
// put only entry components that use custom decorator
@@ -25,7 +26,8 @@ const ENTRY_COMPONENTS = [
2526
AccessControlModule,
2627
AdminSearchModule.withEntryComponents(),
2728
AdminWorkflowModuleModule.withEntryComponents(),
28-
SharedModule
29+
SharedModule,
30+
UploadModule,
2931
],
3032
declarations: [
3133
AdminCurationTasksComponent,

src/app/collection-page/collection-page.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
2525
StatisticsModule.forRoot(),
2626
EditItemPageModule,
2727
CollectionFormModule,
28-
ComcolModule
28+
ComcolModule,
2929
],
3030
declarations: [
3131
CollectionPageComponent,
@@ -38,7 +38,7 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
3838
],
3939
providers: [
4040
SearchService,
41-
]
41+
],
4242
})
4343
export class CollectionPageModule {
4444

src/app/collection-page/edit-collection-page/edit-collection-page.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ComcolModule } from '../../shared/comcol/comcol.module';
2525
CollectionFormModule,
2626
ResourcePoliciesModule,
2727
FormModule,
28-
ComcolModule
28+
ComcolModule,
2929
],
3030
declarations: [
3131
EditCollectionPageComponent,

src/app/community-page/community-page.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const DECLARATIONS = [CommunityPageComponent,
3636
CommunityPageRoutingModule,
3737
StatisticsModule.forRoot(),
3838
CommunityFormModule,
39-
ComcolModule
39+
ComcolModule,
4040
],
4141
declarations: [
4242
...DECLARATIONS

src/app/community-page/edit-community-page/edit-community-page.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ComcolModule } from '../../shared/comcol/comcol.module';
2121
EditCommunityPageRoutingModule,
2222
CommunityFormModule,
2323
ComcolModule,
24-
ResourcePoliciesModule
24+
ResourcePoliciesModule,
2525
],
2626
declarations: [
2727
EditCommunityPageComponent,

src/app/core/core.module.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { ObjectSelectService } from '../shared/object-select/object-select.servi
2323
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
2424
import { CSSVariableService } from '../shared/sass-helper/sass-helper.service';
2525
import { SidebarService } from '../shared/sidebar/sidebar.service';
26-
import { UploaderService } from '../shared/uploader/uploader.service';
2726
import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service';
2827
import { AuthenticatedGuard } from './auth/authenticated.guard';
2928
import { AuthStatus } from './auth/models/auth-status.model';
@@ -233,12 +232,10 @@ const PROVIDERS = [
233232
SubmissionResponseParsingService,
234233
SubmissionJsonPatchOperationsService,
235234
JsonPatchOperationsBuilder,
236-
UploaderService,
237235
UUIDService,
238236
NotificationsService,
239237
WorkspaceitemDataService,
240238
WorkflowItemDataService,
241-
UploaderService,
242239
DSpaceObjectDataService,
243240
ConfigurationDataService,
244241
DSOChangeAnalyzer,

src/app/shared/uploader/uploader.service.ts renamed to src/app/core/drag.service.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree and available online at
5+
*
6+
* http://www.dspace.org/license/
7+
*/
8+
19
import { Injectable } from '@angular/core';
210

3-
@Injectable()
4-
export class UploaderService {
11+
@Injectable({
12+
providedIn: 'root'
13+
})
14+
export class DragService {
515
private _overrideDragOverPage = false;
616

717
public overrideDragOverPage() {

src/app/item-page/bitstreams/upload/upload-bitstream.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RemoteData } from '../../../core/data/remote-data';
44
import { Item } from '../../../core/shared/item.model';
55
import { map, take, switchMap } from 'rxjs/operators';
66
import { ActivatedRoute, Router } from '@angular/router';
7-
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
7+
import { UploaderOptions } from '../../../shared/upload/uploader/uploader-options.model';
88
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
99
import { ItemDataService } from '../../../core/data/item-data.service';
1010
import { AuthService } from '../../../core/auth/auth.service';
@@ -14,7 +14,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
1414
import { Bundle } from '../../../core/shared/bundle.model';
1515
import { BundleDataService } from '../../../core/data/bundle-data.service';
1616
import { getFirstSucceededRemoteDataPayload, getFirstCompletedRemoteData } from '../../../core/shared/operators';
17-
import { UploaderComponent } from '../../../shared/uploader/uploader.component';
17+
import { UploaderComponent } from '../../../shared/upload/uploader/uploader.component';
1818
import { RequestService } from '../../../core/data/request.service';
1919
import { getBitstreamModuleRoute } from '../../../app-routing-paths';
2020
import { getEntityEditRoute } from '../../item-page-routing-paths';

src/app/item-page/item-page.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { OrcidPageComponent } from './orcid-page/orcid-page.component';
4646
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
4747
import { OrcidSyncSettingsComponent } from './orcid-page/orcid-sync-settings/orcid-sync-settings.component';
4848
import { OrcidQueueComponent } from './orcid-page/orcid-queue/orcid-queue.component';
49+
import { UploadModule } from '../shared/upload/upload.module';
4950

5051

5152
const ENTRY_COMPONENTS = [
@@ -94,7 +95,8 @@ const DECLARATIONS = [
9495
JournalEntitiesModule.withEntryComponents(),
9596
ResearchEntitiesModule.withEntryComponents(),
9697
NgxGalleryModule,
97-
NgbAccordionModule
98+
NgbAccordionModule,
99+
UploadModule,
98100
],
99101
declarations: [
100102
...DECLARATIONS,

src/app/my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
1616
import { NotificationsService } from '../../shared/notifications/notifications.service';
1717
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
1818
import { getMockScrollToService } from '../../shared/mocks/scroll-to-service.mock';
19-
import { UploaderService } from '../../shared/uploader/uploader.service';
19+
import { DragService } from '../../core/drag.service';
2020
import { HostWindowService } from '../../shared/host-window.service';
2121
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
22-
import { UploaderComponent } from '../../shared/uploader/uploader.component';
22+
import { UploaderComponent } from '../../shared/upload/uploader/uploader.component';
2323
import { HttpXsrfTokenExtractor } from '@angular/common/http';
2424
import { CookieService } from '../../core/services/cookie.service';
2525
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
@@ -59,7 +59,7 @@ describe('MyDSpaceNewSubmissionComponent test', () => {
5959
NgbModal,
6060
ChangeDetectorRef,
6161
MyDSpaceNewSubmissionComponent,
62-
UploaderService,
62+
DragService,
6363
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
6464
{ provide: CookieService, useValue: new CookieServiceMock() },
6565
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },

0 commit comments

Comments
 (0)