-
Notifications
You must be signed in to change notification settings - Fork 14
[OGUI-1783] Backend download post request #3139
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
Open
Houwie7000
wants to merge
16
commits into
dev
Choose a base branch
from
feature/QCG/OGUI-1783/prepare-download-post
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
95a5088
Classes + JSdoc types added.
Houwie7000 146af18
fixed types
Houwie7000 2a0ea62
Post download handler works
Houwie7000 74b0853
Added Api tests
Houwie7000 4731299
Appeal to eslint
Houwie7000 f2a4272
Documentation changes
Houwie7000 afcdf76
change name to combat git issue
Houwie7000 eb37754
Change downloadEngine to lower case, vscode and git were not happy ot…
Houwie7000 d472cc2
Add license
Houwie7000 489dc00
Object tests + license
Houwie7000 4d3aa4a
Fix test
Houwie7000 dd99118
Added tests for tab and layout
Houwie7000 2cf0c0c
wip get download
Houwie7000 cca21e8
Post-get works, fixed objectId option
Houwie7000 a840d30
linting
Houwie7000 ae467df
Enum fixes
Houwie7000 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 hidden or 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 hidden or 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
57 changes: 57 additions & 0 deletions
57
QualityControl/lib/utils/download/classes/DownloadConfigMapper.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
QualityControl/lib/utils/download/classes/data/DownloadConfigData.js
This file contains hidden or 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,48 @@ | ||
| import { DownloadMode } from '../../enum/DownloadMode.js'; | ||
|
|
||
| export class DownloadConfigData { | ||
| /** | ||
| * constructor | ||
| * @param {string[]} tabIds | ||
| * @param {string[]} objectIds | ||
| * @param {string[]} archiveNameTemplateOptions | ||
| * @param {string[]} objectNameTemplateOptions | ||
| * @param {string} downloadMode | ||
| * @param {boolean} pathNameStructure | ||
| */ | ||
| // eslint-disable-next-line @stylistic/js/max-len | ||
| constructor(tabIds, objectIds, archiveNameTemplateOptions, objectNameTemplateOptions, downloadMode, pathNameStructure) { | ||
| this.tabIds = tabIds, | ||
| this.objectIds = objectIds, | ||
| this.archiveNameTemplateOptions = archiveNameTemplateOptions, | ||
| this.objectNameTemplateOptions = objectNameTemplateOptions, | ||
| this.downloadMode = downloadMode, | ||
| this.pathNameStructure = pathNameStructure; | ||
| } | ||
|
|
||
| tabIds; | ||
|
|
||
| objectIds; | ||
|
|
||
| archiveNameTemplateOptions; | ||
|
|
||
| objectNameTemplateOptions; | ||
|
|
||
| downloadMode; | ||
|
|
||
| pathNameStructure; | ||
|
|
||
| /** | ||
| * mapper from plain object to instance of DownloadConfigData. | ||
| * @static | ||
| * @param {any} downloadConfigPlain | ||
| * @returns {DownloadConfigData} | ||
| */ | ||
| static mapFromPlain(downloadConfigPlain) { | ||
| if (!downloadConfigPlain || typeof downloadConfigPlain !== 'object') { | ||
| throw new Error('invalid DownloadConfig'); | ||
| } | ||
| // eslint-disable-next-line @stylistic/js/max-len | ||
| return new DownloadConfigData(Array.isArray(downloadConfigPlain.tabIds) ? downloadConfigPlain.tabIds : downloadConfigPlain.tabIds?.split(',') ?? [], Array.isArray(downloadConfigPlain.objectIds) ? downloadConfigPlain.objectIds : downloadConfigPlain.objectIds?.split(',') ?? [], Array.isArray(downloadConfigPlain.archiveNameTemplateOptions) ? downloadConfigPlain.archiveNameTemplateOptions : downloadConfigPlain.archiveNameTemplateOptions?.split(',') ?? [], Array.isArray(downloadConfigPlain.objectNameTemplateOptions) ? downloadConfigPlain.objectNameTemplateOptions : downloadConfigPlain.objectNameTemplateOptions?.split(',') ?? [], downloadConfigPlain?.downloadMode ?? DownloadMode.object, downloadConfigPlain?.pathNameStructure == 'true' ? true : false); | ||
| } | ||
| } |
67 changes: 67 additions & 0 deletions
67
QualityControl/lib/utils/download/classes/data/LayoutData.js
This file contains hidden or 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,67 @@ | ||
| import { LayoutDomain } from '../../classes/domain/LayoutDomain.js'; | ||
| import { TabData } from './TabData.js'; | ||
| export class LayoutData { | ||
| /** | ||
| * constructor | ||
| * @param {string} id | ||
| * @param {string} name | ||
| * @param {number} owner_id | ||
| * @param {string} owner_name | ||
| * @param {TabData[]} tabs | ||
| * @param {any[]} collaborators | ||
| * @param {boolean} displayTimestamp | ||
| * @param {number} autoTabChange | ||
| * @param {boolean} isOfficial | ||
| */ | ||
| constructor(id, name, owner_id, owner_name, tabs, collaborators, displayTimestamp, autoTabChange, isOfficial) { | ||
| this.id = id; | ||
| this.name = name, | ||
| this.owner_id = owner_id, | ||
| this.owner_name = owner_name, | ||
| this.tabs = tabs, | ||
| this.collaborators = collaborators, | ||
| this.displayTimestamp = displayTimestamp, | ||
| this.autoTabChange = autoTabChange, | ||
| this.isOfficial = isOfficial; | ||
| } | ||
|
|
||
| id; | ||
|
|
||
| name; | ||
|
|
||
| owner_id; | ||
|
|
||
| owner_name; | ||
|
|
||
| tabs; | ||
|
|
||
| collaborators; | ||
|
|
||
| displayTimestamp; | ||
|
|
||
| autoTabChange; | ||
|
|
||
| isOfficial; | ||
|
|
||
| /** | ||
| * map to an instance of LayoutData from a plain object. | ||
| * @static | ||
| * @param {any} layoutPlain | ||
| * @returns {LayoutData} | ||
| */ | ||
| static mapFromPlain(layoutPlain) { | ||
| if (!layoutPlain || typeof layoutPlain !== 'object' || layoutPlain.id == undefined) { | ||
| throw new Error('invalid layout'); | ||
| } | ||
| // eslint-disable-next-line @stylistic/js/max-len | ||
| return new LayoutData(layoutPlain.id, layoutPlain.name, Number(layoutPlain.owner_id), layoutPlain.owner_name, Array.isArray(layoutPlain.tabs) ? layoutPlain.tabs.map(TabData.mapFromPlain) : [], Array.isArray(layoutPlain.collaborators) ? layoutPlain.collaborators : [], Boolean(layoutPlain.displayTimestamp), Number(layoutPlain.autoTabChange), Boolean(layoutPlain.isOfficial)); | ||
| } | ||
|
|
||
| /** | ||
| * mapper to Domain model | ||
| * @returns {LayoutDomain} Resulting LayoutDomain. | ||
| */ | ||
| mapToDomain() { | ||
| return new LayoutDomain(this.id, this.name, this.tabs.map((tab) => tab.mapToDomain())); | ||
| } | ||
| } |
66 changes: 66 additions & 0 deletions
66
QualityControl/lib/utils/download/classes/data/ObjectData.js
This file contains hidden or 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,66 @@ | ||
| import { ObjectDomain } from '../../classes/domain/ObjectDomain.js'; | ||
| export class ObjectData { | ||
| /** | ||
| * constructor | ||
| * @param {string} id | ||
| * @param {number} x | ||
| * @param {number} y | ||
| * @param {number} h | ||
| * @param {number} w | ||
| * @param {string} name | ||
| * @param {string[]} options | ||
| * @param {boolean} autoSize | ||
| * @param {boolean} ignoreDefaults | ||
| */ | ||
| constructor(id, x, y, h, w, name, options, autoSize, ignoreDefaults) { | ||
| this.id = id, | ||
| this.x = x, | ||
| this.y = y, | ||
| this.h = h, | ||
| this.w = w, | ||
| this.name = name; | ||
| this.options = options, | ||
| this.autoSize = autoSize, | ||
| this.ignoreDefaults = ignoreDefaults; | ||
| } | ||
|
|
||
| id; | ||
|
|
||
| x; | ||
|
|
||
| y; | ||
|
|
||
| h; | ||
|
|
||
| w; | ||
|
|
||
| name; | ||
|
|
||
| options; | ||
|
|
||
| autoSize; | ||
|
|
||
| ignoreDefaults; | ||
|
|
||
| /** | ||
| * mapper to map from plain object to instance of ObjectData. | ||
| * @static | ||
| * @param {any} objectPlain | ||
| * @returns {ObjectData} | ||
| */ | ||
| static mapFromPlain(objectPlain) { | ||
| if (!objectPlain || typeof objectPlain !== 'object') { | ||
| throw new Error('invalid object'); | ||
| } | ||
| // eslint-disable-next-line @stylistic/js/max-len | ||
| return new ObjectData(objectPlain.id, Number(objectPlain.x ?? 0), Number(objectPlain.y ?? 0), Number(objectPlain.h ?? 0), Number(objectPlain.w ?? 0), objectPlain.name, Array.isArray(objectPlain.options) ? objectPlain.options : [], Boolean(objectPlain.autoSize), Boolean(objectPlain.ignoreDefaults)); | ||
| } | ||
|
|
||
| /** | ||
| * mapper to domain model. | ||
| * @returns {ObjectDomain} | ||
| */ | ||
| mapToDomain() { | ||
| return new ObjectDomain(this.id, this.name); | ||
| } | ||
| } |
This file contains hidden or 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,48 @@ | ||
| import { TabDomain } from '../domain/TabDomain.js'; | ||
| import { ObjectData } from './ObjectData.js'; | ||
|
|
||
| export class TabData { | ||
| /** | ||
| * constructor | ||
| * @param {string} id | ||
| * @param {string} name | ||
| * @param {ObjectData[]} objects | ||
| * @param {number} columns | ||
| */ | ||
| constructor(id, name, objects, columns) { | ||
| this.id = id, | ||
| this.name = name, | ||
| this.objects = objects, | ||
| this.columns = columns; | ||
| } | ||
|
|
||
| id; | ||
|
|
||
| name; | ||
|
|
||
| objects; | ||
|
|
||
| columns; | ||
|
|
||
| /** | ||
| * mapFromPlain, map to an instance of TabData from a plain object. | ||
| * @static | ||
| * @param {any} tabPlain | ||
| * @returns {TabData} | ||
| */ | ||
| static mapFromPlain(tabPlain) { | ||
| if (!tabPlain || typeof tabPlain !== 'object') { | ||
| throw new Error('invalid tab'); | ||
| } | ||
| // eslint-disable-next-line @stylistic/js/max-len | ||
| return new TabData(tabPlain.id, tabPlain.name, Array.isArray(tabPlain.objects) ? tabPlain.objects.map(ObjectData.mapFromPlain) : [], Number(tabPlain.columns)); | ||
| } | ||
|
|
||
| /** | ||
| * mapper to Domain model. | ||
| * @returns {TabDomain} | ||
| */ | ||
| mapToDomain() { | ||
| return new TabDomain(this.id, this.name, this.objects.map((object) => object.mapToDomain())); | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
QualityControl/lib/utils/download/classes/domain/DownloadConfigDomain.js
This file contains hidden or 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,34 @@ | ||
| export class DownloadConfigDomain { | ||
| /** | ||
| * constructor | ||
| * @param {string[]} tabIds | ||
| * @param {string[]} objectIds | ||
| * @param {NameTemplateOption[]} archiveNameTemplateOptions | ||
| * @param {NameTemplateOption[]} objectNameTemplateOptions | ||
| * @param {DownloadMode} downloadMode | ||
| * @param {boolean} pathNameStructure | ||
| */ | ||
| constructor( | ||
| tabIds, objectIds, archiveNameTemplateOptions, | ||
| objectNameTemplateOptions, downloadMode, pathNameStructure, | ||
| ) { | ||
| this.tabIds = tabIds, | ||
| this.objectIds = objectIds, | ||
| this.archiveNameTemplateOptions = archiveNameTemplateOptions, | ||
| this.objectNameTemplateOptions = objectNameTemplateOptions, | ||
| this.downloadMode = downloadMode, | ||
| this.pathNameStructure = pathNameStructure; | ||
| } | ||
|
|
||
| tabIds; | ||
|
|
||
| objectIds; | ||
|
|
||
| archiveNameTemplateOptions; | ||
|
|
||
| objectNameTemplateOptions; | ||
|
|
||
| downloadMode; | ||
|
|
||
| pathNameStructure; | ||
| } |
22 changes: 22 additions & 0 deletions
22
QualityControl/lib/utils/download/classes/domain/LayoutDomain.js
This file contains hidden or 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,22 @@ | ||
| // eslint-disable-next-line no-unused-vars | ||
| import { TabDomain } from './TabDomain.js'; | ||
|
|
||
| export class LayoutDomain { | ||
| /** | ||
| * constructor | ||
| * @param {string} id - id | ||
| * @param {string} name - name | ||
| * @param {TabDomain[]} tabs - tabs | ||
| */ | ||
| constructor(id, name, tabs) { | ||
| this.id = id, | ||
| this.name = name, | ||
| this.tabs = tabs; | ||
| } | ||
|
|
||
| id; | ||
|
|
||
| name; | ||
|
|
||
| tabs; | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.