Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
"typescript": "^2.8.1"
},
"dependencies": {
"azure-devops-node-api": "^6.5.0",
"guid-typescript": "^1.0.7",
"jsonc-parser": "^2.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"os": "^0.1.1",
"url": "^0.11.0",
"azure-devops-node-api": "^6.5.0",
"vss-web-extension-sdk": "^5.131.0"
}
}
8 changes: 6 additions & 2 deletions src/Common/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import * as os from 'os';

let separator = os.platform() === "win32" ? "\\" : "/";

export const PICKLIST_NO_ACTION = "PICKLIST_NO_ACTION";
export const defaultEncoding = "utf-8";
export const defaultConfigurationFilename = "configuration.json";
export const defaultLogFileName = "output\\processMigrator.log";
export const defaultProcessFilename = "output\\process.json";
export const defaultLogFileName = "output" + separator + "processMigrator.log";
export const defaultProcessFilename = "output" + separator + "process.json";
export const paramMode = "mode";
export const paramConfig = "config";
export const paramSourceToken = "sourceToken";
Expand Down
18 changes: 11 additions & 7 deletions src/Common/ProcessImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ export class ProcessImporter {
) {
logger.logVerbose(`Start import inherited group changes`);
for (const section of page.sections) {
for (const group of section.groups) {
for (let groupIndex = 0; groupIndex < section.groups.length; groupIndex++) {
let group = section.groups[groupIndex];
if (group.inherited && group.overridden) {
const updatedGroup: WITProcessDefinitionsInterfaces.Group = Utility.toCreateGroup(group);
const updatedGroup: WITProcessDefinitionsInterfaces.Group = Utility.toCreateGroup(group, groupIndex);
await this._editGroup(updatedGroup, page, section, group, witLayout, payload);
}
}
Expand All @@ -265,7 +266,8 @@ export class ProcessImporter {
) {
logger.logVerbose(`Start import custom groups and all controls`);
for (const section of page.sections) {
for (const group of section.groups) {
for (let groupIndex = 0; groupIndex < section.groups.length; groupIndex++) {
let group = section.groups[groupIndex];
let newGroup: WITProcessDefinitionsInterfaces.Group;

if (group.isContribution === true && this._config.options.skipImportFormContributions === true) {
Expand Down Expand Up @@ -303,7 +305,7 @@ export class ProcessImporter {
}
else {
// special handling for HTML control - we must create a group containing the HTML control at same time.
const createGroup: WITProcessDefinitionsInterfaces.Group = Utility.toCreateGroup(group);
const createGroup: WITProcessDefinitionsInterfaces.Group = Utility.toCreateGroup(group, groupIndex);
createGroup.controls = group.controls;
await this._createGroup(createGroup, page, section, witLayout, payload);
}
Expand All @@ -313,15 +315,17 @@ export class ProcessImporter {

if (!group.inherited) {
//create the group if it's not inherited
const createGroup = Utility.toCreateGroup(group);
const createGroup = Utility.toCreateGroup(group, groupIndex);
newGroup = await this._createGroup(createGroup, page, section, witLayout, payload);
group.id = newGroup.id;
}

for (const control of group.controls) {
for (let controlIndex = 0; controlIndex < group.controls.length; controlIndex++) {
let control = group.controls[controlIndex];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - use const than let ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to changing to const control = groups.controls[controlIndex];? It looks like the compiler won't allow changing const controlIndex = 0; controlIndex < group.controls.length; controlIndex++ because it can't be incremented as constant.


if (!control.inherited || control.overridden) {
try {
let createControl: WITProcessDefinitionsInterfaces.Control = Utility.toCreateControl(control);
let createControl: WITProcessDefinitionsInterfaces.Control = Utility.toCreateControl(control, controlIndex);

if (control.controlType === "WebpageControl" || (control.isContribution === true && this._config.options.skipImportFormContributions === true)) {
// Skip web page control for now since not supported in inherited process.
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Utility {
/**Convert group from getLayout group interface to WITProcessDefinitionsInterfaces.Group
* @param group
*/
public static toCreateGroup(group: WITProcessDefinitionsInterfaces.Group): WITProcessDefinitionsInterfaces.Group {
public static toCreateGroup(group: WITProcessDefinitionsInterfaces.Group, order: number): WITProcessDefinitionsInterfaces.Group {
let createGroup: WITProcessDefinitionsInterfaces.Group = {
id: group.id,
inherited: group.inherited,
Expand All @@ -76,7 +76,7 @@ export class Utility {
controls: null,
contribution: group.contribution,
height: group.height,
order: null,
order: order,
overridden: null
}
return createGroup;
Expand All @@ -85,7 +85,7 @@ export class Utility {
/**Convert control from getLayout control interface to WITProcessDefinitionsInterfaces.Control
* @param control
*/
public static toCreateControl(control: WITProcessDefinitionsInterfaces.Control): WITProcessDefinitionsInterfaces.Control {
public static toCreateControl(control: WITProcessDefinitionsInterfaces.Control, order: number): WITProcessDefinitionsInterfaces.Control {
let createControl: WITProcessDefinitionsInterfaces.Control = {
id: control.id,
inherited: control.inherited,
Expand All @@ -98,7 +98,7 @@ export class Utility {
isContribution: control.isContribution,
contribution: control.contribution,
height: control.height,
order: null,
order: order,
overridden: null
}
return createControl;
Expand Down