Skip to content

Commit 7bf3c4e

Browse files
committed
Adapt application OS on pasting on server nodes.
Bug: DCS-1082 Change-Id: I475569d2b838cb96284c3674fc6958f9656d2ced
1 parent 0e852c3 commit 7bf3c4e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

ui/webapp/src/app/modules/instance/components/instance-node-card/instance-node-card.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { CLIENT_NODE_NAME, EMPTY_INSTANCE_NODE_CONFIGURATION } from '../../../..
1515
import { EventWithCallback } from '../../../../models/event';
1616
import { ApplicationConfiguration, ApplicationDto, ApplicationTemplateDescriptor, ApplicationType, InstanceNodeConfiguration, InstanceNodeConfigurationDto, MinionDto, MinionStatusDto, ProductDto } from '../../../../models/gen.dtos';
1717
import { EditAppConfigContext, ProcessConfigDto } from '../../../../models/process.model';
18-
import { getAppOs } from '../../../shared/utils/manifest.utils';
18+
import { getAppOs, updateAppOs } from '../../../shared/utils/manifest.utils';
1919
import { ApplicationService } from '../../services/application.service';
2020
import { ApplicationTemplateVariableDialogComponent, VariableInput } from '../application-template-variable-dialog/application-template-variable-dialog.component';
2121

@@ -332,6 +332,11 @@ export class InstanceNodeCardComponent implements OnInit, OnDestroy {
332332
return;
333333
}
334334

335+
// change OS if required
336+
if (!this.isClientApplicationsNode()) {
337+
appConfig.application = updateAppOs(appConfig.application, this.minionConfig.os);
338+
}
339+
335340
const productKey = this.processConfig.instance.product;
336341
const appKey = appConfig.application;
337342

ui/webapp/src/app/modules/shared/utils/manifest.utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ export function getAppOs(appKey: ManifestKey): OperatingSystem {
1919
return OperatingSystem[osName];
2020
}
2121

22+
export function updateAppOs(appKey: ManifestKey, os: OperatingSystem): ManifestKey {
23+
const fullName = appKey.name;
24+
const lastSlashIdx = fullName.lastIndexOf('/') + 1;
25+
const osName = fullName.substring(lastSlashIdx).toUpperCase();
26+
const oldOs = OperatingSystem[osName];
27+
if (oldOs === os) {
28+
return appKey;
29+
} else {
30+
return { name: fullName.substring(0, lastSlashIdx) + os.toLowerCase(), tag: appKey.tag };
31+
}
32+
}
33+
2234
/**
2335
* Sorts the given array of records by tags
2436
*/

0 commit comments

Comments
 (0)