diff --git a/.gitignore b/.gitignore index bdbfda835..09710ff35 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ derby.log !releng/buildpacks/**/bin/ # Ignore Neo SDK -resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/ \ No newline at end of file +resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/* +!resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/differ.sh diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/changes.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/changes.js new file mode 100644 index 000000000..07e9325f0 --- /dev/null +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/changes.js @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2022 SAP SE or an SAP affiliate company and XSK contributors + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, v2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and XSK contributors + * SPDX-License-Identifier: Apache-2.0 + */ +require.config({ paths: { vs: "/services/v4/web/ide-monaco/monaco-editor/min/vs" } }); +let editors = []; +migrationLaunchView.controller("ChangesViewController", [ + "$scope", + "$http", + "$messageHub", + "$timeout", + "migrationDataState", + function ($scope, $http, $messageHub, $timeout, migrationDataState) { + $scope.migrationDataState = migrationDataState; + $scope.isVisible = false; + $scope.dataLoaded = false; + let viewWidth = document.querySelectorAll(".changes-body")[0].clientWidth | 100; + $scope.isDiffViewSplit = viewWidth > 1100 ? true : false; + $scope.data = []; + + function startMigration() { + body = { + neo: { + hostName: migrationDataState.neoHostName, + subaccount: migrationDataState.neoSubaccount, + }, + hana: { + databaseSchema: migrationDataState.schemaName, + username: migrationDataState.dbUsername, + password: migrationDataState.dbPassword, + }, + connectionId: migrationDataState.connectionId, + workspace: migrationDataState.selectedWorkspace, + du: migrationDataState.selectedDeliveryUnits, + processInstanceId: migrationDataState.processInstanceId, + }; + + $http + .post("/services/v4/js/ide-migration/server/migration/api/migration-rest-api.mjs/continue-process", JSON.stringify(body), { + headers: { "Content-Type": "application/json" }, + }) + .then((response) => { + const timer = setInterval(function () { + $http + .post( + "/services/v4/js/ide-migration/server/migration/api/migration-rest-api.mjs/get-process", + JSON.stringify(body), + { + headers: { "Content-Type": "application/json" }, + } + ) + .then( + function (response) { + clearInterval(timer); + let diffViewData = response.data.diffViewData; + // Add additional keys needed by AngularJS + for (let i = 0; i < diffViewData.length; i++) { + diffViewData[i]["id"] = `m-${i}`; + diffViewData[i]["collapsed"] = false; + diffViewData[i]["excluded"] = false; + } + // Set data variable + $scope.data = diffViewData; + // Set full width for better experience + $scope.$parent.setFullWidthEnabled(true); + // Show data + $scope.dataLoaded = true; + $scope.$apply(); + }, + function (response) { + clearInterval(timer); + if (response.data) { + if ("error" in response.data) { + if ("message" in response.data.error) { + $messageHub.announceAlertError(defaultErrorTitle, response.data.error.message); + } else { + $messageHub.announceAlertError(defaultErrorTitle, defaultErrorDesc); + } + console.error(`HTTP $response.status`, response.data.error); + } else { + $messageHub.announceAlertError(defaultErrorTitle, defaultErrorDesc); + } + } else { + $messageHub.announceAlertError(defaultErrorTitle, defaultErrorDesc); + } + errorOccurred(); + } + ); + }, 1000); + }); + } + + $scope.createDiffEditor = function (index) { + $timeout(function () { + createDiffView( + $scope.data[index].id, + $scope.data[index].type, + $scope.data[index].original, + $scope.data[index].modified, + $scope.isDiffViewSplit + ); + }); + }; + + $scope.startMigration = function () { + // TODO + for (let i = 0; i < $scope.data.length; i++) { + if (!$scope.data[i].excluded) { + console.log("Migrating file:", $scope.data[i].file); + } + } + $scope.$parent.migrateClicked(); + }; + + $scope.splitDiffView = function () { + $scope.isDiffViewSplit = true; + for (let i = 0; i < editors.length; i++) { + editors[i].updateOptions({ renderSideBySide: true }); + } + }; + + $scope.inlineDiffView = function () { + $scope.isDiffViewSplit = false; + for (let i = 0; i < editors.length; i++) { + editors[i].updateOptions({ renderSideBySide: false }); + } + }; + + $scope.previousClicked = function () { + $scope.$parent.previousClicked(); + }; + + $messageHub.on( + "migration.changes", + function (msg) { + if ("isVisible" in msg.data) { + $scope.$apply(function () { + $scope.dataLoaded = false; + $scope.isVisible = msg.data.isVisible; + if (msg.data.isVisible) { + $scope.$parent.setBottomNavEnabled(false); + } else { + $scope.data = []; + editors = []; + } + }); + if (msg.data.isVisible) { + startMigration(); + } + } + }.bind(this) + ); + }, +]); + +function createDiffView(containerId, filetype, originalTxt, modifiedTxt, renderSideBySide = true) { + require(["vs/editor/editor.main"], function () { + let container = document.getElementById(containerId); + let containerLoading = document.querySelector(`#${containerId} > p:first-of-type`); + monaco.editor.setTheme(monacoTheme); + let diffEditor = monaco.editor.createDiffEditor(container, { + automaticLayout: true, + readOnly: true, + scrollBeyondLastLine: false, + enableSplitViewResizing: false, + renderSideBySide: renderSideBySide, + }); + + const updateHeight = () => { + const topBorder = parseInt(getComputedStyle(container).getPropertyValue("border-top-width"), 10); + const bottomBorder = parseInt(getComputedStyle(container).getPropertyValue("border-bottom-width"), 10); + const contentHeight = diffEditor.getModifiedEditor().getContentHeight() + topBorder + bottomBorder; + container.style.height = `${contentHeight}px`; + }; + + diffEditor.getModifiedEditor().onDidContentSizeChange(updateHeight); + diffEditor.setModel({ + original: monaco.editor.createModel(originalTxt, filetype), + modified: monaco.editor.createModel(modifiedTxt, filetype), + }); + + editors.push(diffEditor); + containerLoading.remove(); + }); +} diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/delivery-unit.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/delivery-unit.js index 79c0014ef..f98a6932e 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/delivery-unit.js +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/delivery-unit.js @@ -186,7 +186,7 @@ migrationLaunchView.controller("DeliveryUnitViewController", [ $scope.duDropdownText = $scope.duSelectedUItext.length ? $scope.duSelectedUItext.join(", ") : $scope.duDropdownInitText; $scope.selectAllText = migrationDataState.selectedDeliveryUnits.length == $scope.deliveryUnitList.length ? "Unselect all" : "Select all"; - $scope.$parent.setFinishEnabled(true); + $scope.$parent.setNextEnabled(true); }; $messageHub.on( @@ -201,16 +201,12 @@ migrationLaunchView.controller("DeliveryUnitViewController", [ $scope.descriptionText = descriptionList[0]; $scope.isVisible = msg.data.isVisible; if (msg.data.isVisible) { - if (migrationDataState.selectedDeliveryUnits) { - $scope.$parent.setFinishEnabled(true); - } else { - $scope.$parent.setFinishEnabled(false); - } + $scope.$parent.setFullWidthEnabled(false); $scope.$parent.setBottomNavEnabled(false); $scope.$parent.setPreviousVisible(true); $scope.$parent.setPreviousEnabled(true); - $scope.$parent.setNextVisible(false); - $scope.$parent.setFinishVisible(true); + $scope.$parent.setNextEnabled(false); + $scope.$parent.setNextVisible(true); } }); if (msg.data.isVisible) { diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/hana-credentials.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/hana-credentials.js index 1e8c7f65a..5b8373fbb 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/hana-credentials.js +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/hana-credentials.js @@ -111,6 +111,7 @@ migrationLaunchView.controller("HanaCredentialsViewController", [ $scope.databaseSelected = function (database) { migrationDataState.schemaName = database; $scope.databasesDropdownText = database; + $scope.userInput(); }; $messageHub.on( diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/migration-launch.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/migration-launch.js index 8067e9129..195f22bcb 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/migration-launch.js +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/migration-launch.js @@ -9,7 +9,7 @@ * SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and XSK contributors * SPDX-License-Identifier: Apache-2.0 */ -var migrationLaunchView = angular.module("migration-launch", ['angularFileUpload']); +var migrationLaunchView = angular.module("migration-launch", ["angularFileUpload"]); migrationLaunchView.factory("$messageHub", [ function () { @@ -83,12 +83,15 @@ migrationLaunchView.controller("MigrationLaunchViewController", [ topicId: "migration.hana-credentials", }, { id: 3, name: "Delivery Units", topicId: "migration.delivery-unit" }, - { id: 4, name: "Migration", topicId: "migration.start-migration" }, + { id: 4, name: "Changes", topicId: "migration.changes" }, + { id: 5, name: "Migration", topicId: "migration.start-migration" }, ]; $scope.zipsteps = [ { id: 1, name: "Upload ZIP file", topicId: "migration.upload-zip-migration" }, { id: 2, name: "Migration", topicId: "migration.start-zip-migration" }, ]; + + $scope.fullWidthEnabled = false; $scope.onStatisticsPage = true; $scope.migrationFromZip = false; $scope.bottomNavHidden = false; @@ -112,7 +115,7 @@ migrationLaunchView.controller("MigrationLaunchViewController", [ $scope.setFinishVisible(true); $scope.setBottomNavEnabled(false); $scope.currentStep = $scope.zipsteps[0]; - } + }; $scope.setFinishVisible = function (visible) { $scope.finishVisible = visible; @@ -122,6 +125,10 @@ migrationLaunchView.controller("MigrationLaunchViewController", [ $scope.finishDisabled = !enabled; }; + $scope.setFullWidthEnabled = function (enabled) { + $scope.fullWidthEnabled = enabled; + }; + $scope.setNextVisible = function (visible) { $scope.nextVisible = visible; }; @@ -185,7 +192,7 @@ migrationLaunchView.controller("MigrationLaunchViewController", [ } }; - $scope.finishClicked = function () { + $scope.migrateClicked = function () { $messageHub.message($scope.currentStep.topicId, { isVisible: false }); $scope.currentStep = $scope.steps[$scope.steps.length - 1]; $messageHub.message($scope.currentStep.topicId, { isVisible: true }); @@ -204,6 +211,6 @@ migrationLaunchView.controller("MigrationLaunchViewController", [ else return "inactive"; }; - $messageHub.on("migration.launch", function (msg) { }.bind(this)); + $messageHub.on("migration.launch", function (msg) {}.bind(this)); }, ]); diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/neo-credentials.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/neo-credentials.js index 6cd7b9d42..07f679652 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/neo-credentials.js +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/neo-credentials.js @@ -77,8 +77,6 @@ migrationLaunchView.controller("NeoCredentialsViewController", [ $scope.regionSelected = function (regionObject) { migrationDataState.neoHostName = regionObject.region; $scope.regionDropdownText = regionObject.name; - - $scope.$parent.setFinishEnabled(true); }; $scope.filterRegions = function () { @@ -120,7 +118,6 @@ migrationLaunchView.controller("NeoCredentialsViewController", [ $scope.$parent.setPreviousVisible(false); $scope.$parent.setPreviousEnabled(true); $scope.$parent.setNextVisible(true); - $scope.$parent.setFinishVisible(false); } }); } diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/start-migration.js b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/start-migration.js index 440ff8948..28e8a10a4 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/start-migration.js +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/js/start-migration.js @@ -98,6 +98,7 @@ migrationLaunchView.controller("StartMigrationViewController", [ if ("isVisible" in msg.data) { $scope.$apply(function () { $scope.isVisible = msg.data.isVisible; + if (msg.data.isVisible) $scope.$parent.setFullWidthEnabled(false); }); if (msg.data.isVisible) { startMigration(); @@ -105,24 +106,28 @@ migrationLaunchView.controller("StartMigrationViewController", [ } }.bind(this) ); - $messageHub.on('migration.start-zip-migration', function (msg) { - if ("isVisible" in msg.data) { - $scope.$apply(function () { - $scope.isZipMigrationVisible = msg.data.isVisible; - }); - } - if ("migrationFinished" in msg.data) { - $scope.$apply(function () { - $scope.migrationFinished = msg.data.migrationFinished; - if ("workspace" in msg.data) - migrationDataState.selectedWorkspace = msg.data.workspace; - $scope.progressTitle = titleList[1]; - $scope.statusMessage = ("status" in msg.data) ? msg.data.status : ("workspace" in msg.data) - ? `Successfully migrated uploaded Delivery Unit(s)! Go to workspace "${msg.data.workspace}" and publish them.` : - "Successfully migrated uploaded Delivery Unit(s)!"; - - }); - } - }.bind(this)); + $messageHub.on( + "migration.start-zip-migration", + function (msg) { + if ("isVisible" in msg.data) { + $scope.$apply(function () { + $scope.isZipMigrationVisible = msg.data.isVisible; + }); + } + if ("migrationFinished" in msg.data) { + $scope.$apply(function () { + $scope.migrationFinished = msg.data.migrationFinished; + if ("workspace" in msg.data) migrationDataState.selectedWorkspace = msg.data.workspace; + $scope.progressTitle = titleList[1]; + $scope.statusMessage = + "status" in msg.data + ? msg.data.status + : "workspace" in msg.data + ? `Successfully migrated uploaded Delivery Unit(s)! Go to workspace "${msg.data.workspace}" and publish them.` + : "Successfully migrated uploaded Delivery Unit(s)!"; + }); + } + }.bind(this) + ); }, ]); diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/migration-launch.html b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/migration-launch.html index d93f21906..ccdd57d90 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/migration-launch.html +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/migration-launch.html @@ -38,6 +38,9 @@ + + + @@ -45,6 +48,7 @@ + @@ -83,11 +87,12 @@
-
+
+
diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/partials/changes.html b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/partials/changes.html new file mode 100644 index 000000000..66f01e63f --- /dev/null +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/partials/changes.html @@ -0,0 +1,52 @@ + +
+

Calculating changes...

+

Please wait while we calculate what changes need to be made +

+
+
+
+
+
+
+ + +

{{ data.length }} file(s) will be changed.

+
+ + +
+ +
+
+
    +
  • +
    + +

    {{ file.file }}

    + +
    +
    +

    Loading...

    +
    +
  • +
+
\ No newline at end of file diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/diff-tool-executor.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/diff-tool-executor.mjs new file mode 100644 index 000000000..e778ddac1 --- /dev/null +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/diff-tool-executor.mjs @@ -0,0 +1,82 @@ +import { configurations as config } from "@dirigible/core"; +import { repository } from "@dirigible/platform"; +import { MigrationToolExecutor } from "./migration-tool-executor"; + +const differPath = config.get("user.dir") + "/target/dirigible/resources-neo-sdk/differ.sh"; + +export class DiffToolService { + + constructor() { + this.migrationToolExecutor = new MigrationToolExecutor(); + } + + diffFolders(firstFolderName, secondFolderName) { + const script = `${differPath} ${firstFolderName} ${secondFolderName}`; + + const rawCommandResult = this.migrationToolExecutor.execute(script); + + const lines = rawCommandResult.split('\n'); + const rawDiffResult = lines + .map(line => { + const splits = line.split("==="); + + if (!splits[0] && !splits[1]) { + return null; + } + + splits[0] = splits[0] || ""; + splits[1] = splits[1] || ""; + + const modificationType = splits[2] || ""; + let fileName = ""; + + if (modificationType.startsWith("A")) { + splits[1] = splits[0]; + splits[0] = ""; + fileName = splits[1]; + } else if (modificationType.startsWith("R")) { + splits[0] = splits[0]; + splits[1] = splits[1]; + fileName = splits[1]; + } else if (modificationType.startsWith("M")) { + splits[0] = splits[0]; + splits[1] = splits[0].replace("_unmodified", ""); + fileName = splits[0]; + } + + const res = { + firstFolderFile: splits[0], + secondFolderFile: splits[1], + fileName: fileName + } + + return res; + }) + .filter(x => x != null); + + const root = this._getRepositoryRootPath(); + const diffResult = rawDiffResult.map(rawDiffResult => { + const originalPath = rawDiffResult.firstFolderFile.replace(root, ""); + const original = (originalPath !== "") ? repository.getResource(originalPath).getText() : ""; + const modifiedPath = rawDiffResult.secondFolderFile.replace(root, ""); + const modified = (modifiedPath !== "") ? repository.getResource(modifiedPath).getText() : ""; + const file = rawDiffResult.fileName.replace(root, "").replace("_unmodified", ""); + const type = file.substring(file.lastIndexOf(".") + 1); + + return { + original, + modified, + file, + type + } + }) + + return diffResult; + } + + _getRepositoryRootPath() { + const StaticObjects = Java.type("org.eclipse.dirigible.commons.config.StaticObjects"); + const repositoryRoot = StaticObjects.get(StaticObjects.REPOSITORY).getParameter("REPOSITORY_ROOT_FOLDER"); + return repositoryRoot; + } +} \ No newline at end of file diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-rest-api.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-rest-api.mjs index fb7817af1..667b278ab 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-rest-api.mjs +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-rest-api.mjs @@ -116,6 +116,9 @@ function getProcessState(ctx, req, res) { response.workspaces = JSON.parse(workspacesJson); response.deliveryUnits = JSON.parse(deliveryUnitsJson); response.connectionId = connectionId; + } else if (migrationState === "MIGRATION_EXECUTED") { + const diffViewData = processService.getVariable(processInstanceIdString, "diffViewData"); + response.diffViewData = JSON.parse(diffViewData); } res.print(JSON.stringify(response)); diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-service.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-service.mjs index c86e72ae7..ff6123b7d 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-service.mjs +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/migration-service.mjs @@ -108,6 +108,7 @@ export class MigrationService { copyFilesLocally(workspaceName, lists) { const workspaceCollection = this._getOrCreateTemporaryWorkspaceCollection(workspaceName); + const unmodifiedWorkspaceCollection = this._getOrCreateTemporaryWorkspaceCollection(workspaceName + "_unmodified"); const hdbFacade = new XSKHDBCoreFacade(); const locals = []; @@ -124,6 +125,12 @@ export class MigrationService { } let content = this.repo.getContentForObject(file._name, file._packageName, file._suffix); + const unmodifiedProjectCollection = this._getOrCreateTemporaryProjectCollection( + unmodifiedWorkspaceCollection, + projectName + ); + const unmodifiedLocalResource = unmodifiedProjectCollection.createResource(fileRunLocation, content); + if (this._isFileCalculationView(fileRunLocation)) { content = this._transformColumnObject(content); } @@ -492,25 +499,19 @@ export class MigrationService { for (const resName of resNames) { var path = collection.getPath() + "/" + resName; let oldProjectRelativePath = parentPath + "/" + resName; + if (path.endsWith(".hdbtablefunction") || path.endsWith(".hdbscalarfunction")) { let resource = collection.getResource(resName); let content = resource.getText(); + let visitor = new HanaVisitor(content); visitor.visit(); visitor.removeSchemaRefs(); visitor.removeViewRefs(); - let newProjectRelativePath = parentPath + "/" + resName; - this.tableFunctionPaths.push(newProjectRelativePath); - console.log("Creating new file at: " + newProjectRelativePath); - let newFile = project.createFile(newProjectRelativePath); - newFile.setText(visitor.content); - console.log("Creating new resource at: " + resName); - let newResource = collection.createResource(resName, [0]); - newResource.setText(visitor.content); - console.log("deleting file at: " + path); - project.deleteFile(oldProjectRelativePath); - console.log("deleting resource at: " + path); - resource.delete(); + + resource.setText(visitor.content); + project.getFile(oldProjectRelativePath).setText(visitor.content); + this.tableFunctionPaths.push(oldProjectRelativePath); } } diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-databases-service.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-databases-service.mjs index 9aae51e1d..4495e56bd 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-databases-service.mjs +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-databases-service.mjs @@ -12,7 +12,7 @@ import { configurations as config } from "@dirigible/core"; import { MigrationToolExecutor } from "./migration-tool-executor"; -const neoClientPath = config.get("user.dir") + "/target/dirigible/resources-neo-sdk/tools/neo.sh"; +const neoClientPath = config.get("user.dir") + "/target/dirigible/resources-neo-sdk/sdk/tools/neo.sh"; export class NeoDatabasesService { constructor() { diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-tunnel-service.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-tunnel-service.mjs index 20b4949c4..961957428 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-tunnel-service.mjs +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/api/neo-tunnel-service.mjs @@ -12,7 +12,7 @@ import { configurations as config } from "@dirigible/core"; import { MigrationToolExecutor } from "./migration-tool-executor"; -const neoClientPath = config.get("user.dir") + "/target/dirigible/resources-neo-sdk/tools/neo.sh"; +const neoClientPath = config.get("user.dir") + "/target/dirigible/resources-neo-sdk/sdk/tools/neo.sh"; export class NeoTunnelService { constructor() { diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/calculate-differences-task.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/calculate-differences-task.mjs new file mode 100644 index 000000000..407e60ce9 --- /dev/null +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/calculate-differences-task.mjs @@ -0,0 +1,5 @@ +export class CalculateDifferencesTask { + run() { + + } +} \ No newline at end of file diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/migrationProcess.bpmn b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/migrationProcess.bpmn index 279f09a33..8944d77f7 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/migrationProcess.bpmn +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/migrationProcess.bpmn @@ -51,12 +51,19 @@ + + + + + + + + - @@ -64,6 +71,9 @@ + + + @@ -156,6 +166,12 @@ + + + + + + @@ -215,19 +231,27 @@ + + + + - + - + + + + + - - + + @@ -237,20 +261,20 @@ - - - - - - - + + + + + + + diff --git a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/populate-projects-task.mjs b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/populate-projects-task.mjs index e3d46d493..3c72482ed 100644 --- a/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/populate-projects-task.mjs +++ b/modules/ide/ide-migration/src/main/resources/META-INF/dirigible/ide-migration/server/migration/process/populate-projects-task.mjs @@ -1,6 +1,9 @@ import { process } from "@dirigible/bpm"; import { MigrationService } from "../api/migration-service.mjs"; import { MigrationTask } from "./task.mjs"; +import { configurations as config } from "@dirigible/core"; +import { TrackService } from "../api/track-service"; +import { DiffToolService } from "../api/diff-tool-executor.mjs"; export class PopulateProjectsTask extends MigrationTask { execution = process.getExecutionContext(); @@ -26,6 +29,14 @@ export class PopulateProjectsTask extends MigrationTask { migrationService.addFilesWithoutGenerated(userData, workspace, localFiles); migrationService.addGeneratedFiles(userData, deliveryUnit, workspace, localFiles); migrationService.modifyFiles(workspace, localFiles); + + process.setVariable(this.execution.getId(), "migrationState", "MIGRATION_EXECUTED"); + this.trackService.updateMigrationStatus("MIGRATION EXECUTED"); + + const workspaceHolderFolder = config.get("user.dir") + "/target/dirigible/repository/root" + const diffTool = new DiffToolService(); + const diffViewData = diffTool.diffFolders(`${workspaceHolderFolder}/${workspace}_unmodified`, `${workspaceHolderFolder}/${workspace}`); + process.setVariable(this.execution.getId(), "diffViewData", JSON.stringify(diffViewData)); } } } diff --git a/resources/resources-neo-sdk/pom.xml b/resources/resources-neo-sdk/pom.xml index 7858c4ddb..5936f8734 100644 --- a/resources/resources-neo-sdk/pom.xml +++ b/resources/resources-neo-sdk/pom.xml @@ -1,45 +1,46 @@ - - 4.0.0 + + 4.0.0 - - com.sap.xsk - xsk-resources-parent - 0.15.0-SNAPSHOT - ../pom.xml - + + com.sap.xsk + xsk-resources-parent + 0.15.0-SNAPSHOT + ../pom.xml + - XSK - Resources - Neo SDK - xsk-resources-neo-sdk - 0.15.0-SNAPSHOT - jar + XSK - Resources - Neo SDK + xsk-resources-neo-sdk + 0.15.0-SNAPSHOT + jar - - - - org.apache.maven.plugins - maven-dependency-plugin - ${maven-dependency-plugin.version} - - - unpack - generate-resources - - unpack - - - - - com.sap.cloud - neo-java-web-sdk - ${neo-java-web-sdk.version} - zip - src/main/resources/META-INF/dirigible/resources-neo-sdk - true - - - - + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + unpack + generate-resources + + unpack + + + + + com.sap.cloud + neo-java-web-sdk + ${neo-java-web-sdk.version} + zip + src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk + true + + + + copy generate-resources @@ -53,7 +54,7 @@ javax.activation ${neo-java-web-sdk.javax.activation.version} jar - src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd + src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd true @@ -61,7 +62,7 @@ jaxb-api ${neo-java-web-sdk.jaxb.version} jar - src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd + src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd true @@ -69,7 +70,7 @@ jaxb-core ${neo-java-web-sdk.jaxb.version} jar - src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd + src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd true @@ -77,19 +78,19 @@ jaxb-impl ${neo-java-web-sdk.jaxb.version} jar - src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd + src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd true - - - - + + + + - - ../../licensing-header.txt - + + ../../licensing-header.txt + \ No newline at end of file diff --git a/resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/differ.sh b/resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/differ.sh new file mode 100755 index 000000000..640a7d2ad --- /dev/null +++ b/resources/resources-neo-sdk/src/main/resources/META-INF/dirigible/resources-neo-sdk/differ.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +while read STATUS ADDR1 ADDR2 +do + echo "$ADDR1===$ADDR2===$STATUS" +done < <(git diff --name-status $1/ $2/)