Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit b02c233

Browse files
kalvarez2oodamien
authored andcommitted
Fix for Issue #836, bulk import apps
1 parent 9271398 commit b02c233

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

ui/src/app/apps/apps-bulk-import/properties/apps-bulk-import-properties.component.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,16 @@ describe('AppsBulkImportPropertiesComponent', () => {
122122
}, 1000);
123123
});
124124

125+
it('should split the properties by new lines', () => {
126+
[
127+
{properties: '', force: true, expectedProp: ['']},
128+
{properties: 'a=a', force: false, expectedProp: ['a=a']},
129+
{properties: 'bar', force: false, expectedProp: ['bar']},
130+
{properties: 'foo=bar=bar', force: false, expectedProp: ['foo=bar=bar']},
131+
{properties: 'foo=bar\nbar', force: false, expectedProp: ['foo=bar', 'bar']}
132+
].forEach(r => {
133+
const propsRequest = component.prepareBulkImportRequest(r.properties, r.properties);
134+
expect(propsRequest.properties).toEqual(r.expectedProp);
135+
} );
136+
});
125137
});

ui/src/app/apps/apps-bulk-import/properties/apps-bulk-import-properties.component.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,23 @@ export class AppsBulkImportPropertiesComponent implements OnDestroy {
8080
} catch (e) {
8181
}
8282
}
83-
83+
prepareBulkImportRequest(force, importProps:string){
84+
return {
85+
force: force,
86+
properties: importProps.split('\n'),
87+
uri: ''
88+
};
89+
}
8490
/**
8591
* Bulk Import Apps.
8692
* Submit the parameters
8793
*/
8894
submit() {
89-
const busy = this.appsService.bulkImportApps({
90-
force: this.form.get('force').value,
91-
properties: this.form.get('properties').value.toString().split('/n'),
92-
uri: ''
93-
}).pipe(takeUntil(this.ngUnsubscribe$))
95+
const reqImportBulkApps = this.prepareBulkImportRequest(
96+
this.form.get('force').value,
97+
this.form.get('properties').value.toString());
98+
const busy = this.appsService.bulkImportApps(reqImportBulkApps)
99+
.pipe(takeUntil(this.ngUnsubscribe$))
94100
.subscribe(data => {
95101
this.notificationService.success('Apps Imported.');
96102
this.router.navigate(['apps']);

0 commit comments

Comments
 (0)