-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACA-4679] Added code changes and env variables to enable DownloadPrompt and FileAutoDownload features on ACA #3127
Merged
DenysVuika
merged 9 commits into
develop
from
dev-swapnil-ACA-4679-enable-file-download
Apr 20, 2023
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0cc8187
[ACA-4679] Added docker variables, app.config.json.tpl config and add…
swapnil-verma-gl b44f47e
[ACA-4679] Added defaults for downloadPrompt for viewer and fileAutoD…
swapnil-verma-gl 33505a3
[ACA-4679] Added unit test cases for FileAutoDownloadService
swapnil-verma-gl 62b6e46
[ACA-4679] Updated env variable references from NonResponsiveDialog t…
swapnil-verma-gl a038773
[ACA-4679] Added missing licence header on new files
swapnil-verma-gl 7f35de6
[ACA-4679] Added env variable configuration for GithubActions jobs
swapnil-verma-gl d318764
[ACA-4679] Added env variable configuration for GithubActions jobs
swapnil-verma-gl 8934014
[ACA-4679] Removed unneeded env variable configuration for GithubActi…
swapnil-verma-gl 958ba89
[ACA-4679] Updated .env file configuration in README.md
swapnil-verma-gl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
projects/aca-shared/src/lib/services/aca-file-auto-download.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/*! | ||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Alfresco Example Content Application | ||
* | ||
* This file is part of the Alfresco Example Content Application. | ||
* If the software was purchased under a paid Alfresco license, the terms of | ||
* the paid license agreement will prevail. Otherwise, the software is | ||
* provided under the following open source license terms: | ||
* | ||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Alfresco Example Content Application is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { TestBed } from '@angular/core/testing'; | ||
import { AcaFileAutoDownloadService, initialState, LibTestingModule } from '@alfresco/aca-shared'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { AppConfigService } from '@alfresco/adf-core'; | ||
import { FileAutoDownloadComponent } from '@alfresco/adf-content-services'; | ||
import { provideMockStore } from '@ngrx/store/testing'; | ||
|
||
describe('AcaFileAutoDownloadService', () => { | ||
let service: AcaFileAutoDownloadService; | ||
let appConfig: AppConfigService; | ||
|
||
const mockDialogRef = { | ||
open: jasmine.createSpy('open') | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [LibTestingModule], | ||
providers: [provideMockStore({ initialState }), { provide: MatDialog, useValue: mockDialogRef }] | ||
}); | ||
|
||
service = TestBed.inject(AcaFileAutoDownloadService); | ||
appConfig = TestBed.inject(AppConfigService); | ||
}); | ||
|
||
it('shouldFileAutoDownload should return true if fileSize exceeds configured threshold and file auto download is enabled', () => { | ||
appConfig.config.viewer = { | ||
enableFileAutoDownload: true, | ||
fileAutoDownloadSizeThresholdInMB: 10 | ||
}; | ||
const shouldAutDownloadFlag = service.shouldFileAutoDownload(11000000); | ||
expect(shouldAutDownloadFlag).toBe(true); | ||
}); | ||
|
||
it('shouldFileAutoDownload should return false if fileSize does not exceeds configured threshold and file auto download is enabled', () => { | ||
appConfig.config.viewer = { | ||
enableFileAutoDownload: true, | ||
fileAutoDownloadSizeThresholdInMB: 10 | ||
}; | ||
const shouldAutDownloadFlag = service.shouldFileAutoDownload(500000); | ||
expect(shouldAutDownloadFlag).toBe(false); | ||
}); | ||
|
||
it('shouldFileAutoDownload should return false if fileSize exceeds configured threshold but file auto download is disabled', () => { | ||
appConfig.config.viewer = { | ||
enableFileAutoDownload: false, | ||
fileAutoDownloadSizeThresholdInMB: 10 | ||
}; | ||
const shouldAutDownloadFlag = service.shouldFileAutoDownload(11000000); | ||
expect(shouldAutDownloadFlag).toBe(false); | ||
}); | ||
|
||
it('autoDownloadFile should open FileAutoDownload dialog when called', () => { | ||
const nodeEntity: any = { entry: { isFile: true } }; | ||
service.autoDownloadFile(nodeEntity); | ||
expect(mockDialogRef.open).toHaveBeenCalledWith(FileAutoDownloadComponent, { disableClose: true, data: nodeEntity }); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update main readme file with these variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the README.md file. The values I added to that file are -
APP_CONFIG_ENABLE_DOWNLOAD_PROMPT=true
APP_CONFIG_ENABLE_DOWNLOAD_PROMPT_REMINDERS=true
APP_CONFIG_DOWNLOAD_PROMPT_DELAY=
<time>
APP_CONFIG_DOWNLOAD_PROMPT_REMINDER_DELAY=
<time>
APP_CONFIG_ENABLE_FILE_AUTO_DOWNLOAD=true
APP_CONFIG_FILE_AUTO_DOWNLOAD_SIZE_THRESHOLD_IN_MB=
<file-size>
Please validate if these are correct or if we should add the actual values instead.