[CST-7216] Design fixes and parameter changed

This commit is contained in:
Sufiyan Shaikh
2022-11-10 19:31:32 +05:30
committed by Francesco Pio Scognamiglio
parent e47b42bc89
commit 98da08ead0
4 changed files with 20 additions and 7 deletions

View File

@@ -20,10 +20,15 @@
</small> </small>
</div> </div>
<ui-switch [checkedLabel]="'admin.metadata-import.page.toggle.upload' | translate" <ui-switch color="#ebebeb"
[checkedLabel]="'admin.metadata-import.page.toggle.upload' | translate"
[uncheckedLabel]="'admin.metadata-import.page.toggle.url' | translate" [uncheckedLabel]="'admin.metadata-import.page.toggle.url' | translate"
[checked]="isUpload" [checked]="isUpload"
(change)="toggleUpload()" ></ui-switch> (change)="toggleUpload()" ></ui-switch>
<small class="form-text text-muted">
{{'admin.batch-import.page.toggle.help' | translate}}
</small>
<ds-file-dropzone-no-uploader <ds-file-dropzone-no-uploader
*ngIf="isUpload" *ngIf="isUpload"

View File

@@ -178,10 +178,10 @@ describe('BatchImportPageComponent', () => {
proceed.click(); proceed.click();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('metadata-import script is invoked with --u and the file url', () => { it('metadata-import script is invoked with --url and the file url', () => {
const parameterValues: ProcessParameter[] = [ const parameterValues: ProcessParameter[] = [
Object.assign(new ProcessParameter(), { name: '--add' }), Object.assign(new ProcessParameter(), { name: '--add' }),
Object.assign(new ProcessParameter(), { name: '--u', value: 'example.fileURL.com' }) Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' })
]; ];
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]); expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]);
}); });
@@ -200,10 +200,10 @@ describe('BatchImportPageComponent', () => {
proceed.click(); proceed.click();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('metadata-import script is invoked with --u and the file url and -v validate-only', () => { it('metadata-import script is invoked with --url and the file url and -v validate-only', () => {
const parameterValues: ProcessParameter[] = [ const parameterValues: ProcessParameter[] = [
Object.assign(new ProcessParameter(), { name: '--add' }), Object.assign(new ProcessParameter(), { name: '--add' }),
Object.assign(new ProcessParameter(), { name: '--u', value: 'example.fileURL.com' }), Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' }),
Object.assign(new ProcessParameter(), { name: '-v', value: true }), Object.assign(new ProcessParameter(), { name: '-v', value: true }),
]; ];
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]); expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]);

View File

@@ -84,7 +84,11 @@ export class BatchImportPageComponent {
*/ */
public importMetadata() { public importMetadata() {
if (this.fileObject == null && isEmpty(this.fileURL)) { if (this.fileObject == null && isEmpty(this.fileURL)) {
this.notificationsService.error(this.translate.get('admin.metadata-import.page.error.addFile')); if (this.isUpload) {
this.notificationsService.error(this.translate.get('admin.metadata-import.page.error.addFile'));
} else {
this.notificationsService.error(this.translate.get('admin.metadata-import.page.error.addFileUrl'));
}
} else { } else {
const parameterValues: ProcessParameter[] = [ const parameterValues: ProcessParameter[] = [
Object.assign(new ProcessParameter(), { name: '--add' }) Object.assign(new ProcessParameter(), { name: '--add' })
@@ -93,7 +97,7 @@ export class BatchImportPageComponent {
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--zip', value: this.fileObject.name })); parameterValues.push(Object.assign(new ProcessParameter(), { name: '--zip', value: this.fileObject.name }));
} else { } else {
this.fileObject = null; this.fileObject = null;
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--u', value: this.fileURL })); parameterValues.push(Object.assign(new ProcessParameter(), { name: '--url', value: this.fileURL }));
} }
if (this.dso) { if (this.dso) {
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--collection', value: this.dso.uuid })); parameterValues.push(Object.assign(new ProcessParameter(), { name: '--collection', value: this.dso.uuid }));

View File

@@ -568,6 +568,8 @@
"admin.batch-import.page.help": "Select the Collection to import into. Then, drop or browse to a Simple Archive Format (SAF) zip file that includes the Items to import", "admin.batch-import.page.help": "Select the Collection to import into. Then, drop or browse to a Simple Archive Format (SAF) zip file that includes the Items to import",
"admin.batch-import.page.toggle.help": "It is possible to perform import either with file upload or via URL, use above toggle to set the input source",
"admin.metadata-import.page.dropMsg": "Drop a metadata CSV to import", "admin.metadata-import.page.dropMsg": "Drop a metadata CSV to import",
"admin.batch-import.page.dropMsg": "Drop a batch ZIP to import", "admin.batch-import.page.dropMsg": "Drop a batch ZIP to import",
@@ -584,6 +586,8 @@
"admin.metadata-import.page.error.addFile": "Select file first!", "admin.metadata-import.page.error.addFile": "Select file first!",
"admin.metadata-import.page.error.addFileUrl": "Insert file url first!",
"admin.batch-import.page.error.addFile": "Select Zip file first!", "admin.batch-import.page.error.addFile": "Select Zip file first!",
"admin.metadata-import.page.toggle.upload": "Upload", "admin.metadata-import.page.toggle.upload": "Upload",