Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
fix: remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
vmutafov committed Mar 8, 2022
1 parent c88dbe2 commit 38c381d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,28 @@ migrationLaunchView.controller("ChangesViewController", [
.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 => {
.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" },
})
$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) {
console.log("!!! res: " + JSON.stringify(response));
clearInterval(timer);
let demoData = response.data.diffViewData;
// let demoData = [
// {
// file: "some/test/file.html",
// type: "html",
// original: `<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />`,
// modified: `<meta http-equiv="Content-Type" content="javascript" />`,
// },
// {
// type: "html",
// file: "another/test/file.html",
// original: `<body></body>`,
// modified: `<body>
// <div class="main-container">
// <h1>Simple heading</h1>
// <h2>Simple secondary heading</h2>
// <h3>Enough changes</h3>
// </div>
// </body>`,
// },
// ];
let diffViewData = response.data.diffViewData;
// Add additional keys needed by AngularJS
for (let i = 0; i < demoData.length; i++) {
demoData[i]["id"] = `m-${i}`;
demoData[i]["collapsed"] = false;
demoData[i]["excluded"] = false;
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 = demoData;
$scope.data = diffViewData;
// Set full width for better experience
$scope.$parent.setFullWidthEnabled(true);
// Show data
Expand All @@ -110,8 +94,7 @@ migrationLaunchView.controller("ChangesViewController", [
}
);
}, 1000);
})

});
}

$scope.createDiffEditor = function (index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -211,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));
},
]);
Original file line number Diff line number Diff line change
Expand Up @@ -106,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)
);
},
]);
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ <h1 class="section-title" ng-hide="dataLoaded">Calculating changes...</h1>
<div class="panel panel-default" ng-show="dataLoaded">
<div class="flex-panel">
<button class="btn btn-big btn-primary left" ng-click="previousClicked()">Previous</button>
<p class="left">{{ data.length }} file(s) will be changed.
<!-- <p class="left">{{ data.length }} file(s) will be changed.
{{data.length > 0 ? ' If you want to exclude a file from the migration, click on "Exclude".' : ""}}
</p>
</p> -->
<p class="left">{{ data.length }} file(s) will be changed.</p>
<div class="btn-group left" role="group" ng-show="data.length">
<button type="button" class="btn btn-big btn-default" ng-click="splitDiffView()"
ng-class="{active:isDiffViewSplit===true}">Split</button>
Expand All @@ -40,8 +41,8 @@ <h1 class="section-title" ng-hide="dataLoaded">Calculating changes...</h1>
ng-class="{true:'fa-chevron-right', false:'fa-chevron-down'}[file.collapsed]"></i>
</button>
<p>{{ file.file }}</p>
<button class="btn btn-big" ng-class="{true:'btn-primary', false:'btn-danger'}[file.excluded]"
ng-click="file.excluded = !file.excluded">{{file.excluded === true ? "Include" : "Exclude"}}</button>
<!-- <button class="btn btn-big" ng-class="{true:'btn-primary', false:'btn-danger'}[file.excluded]"
ng-click="file.excluded = !file.excluded">{{file.excluded === true ? "Include" : "Exclude"}}</button> -->
</div>
<div id="{{ file.id }}" class="diff-view" ng-hide="file.collapsed" ng-init="createDiffEditor($index)">
<p>Loading...</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,15 @@ export class DiffToolService {
fileName: fileName
}

console.log("!!! VM: res: " + JSON.stringify(res));
return res;
})
.filter(x => x != null);

const root = "/Users/c5326377/work/target/dirigible/repository/root";
const root = this._getRepositoryRootPath();
const diffResult = rawDiffResult.map(rawDiffResult => {
const originalPath = rawDiffResult.firstFolderFile.replace(root, "");
console.log("!!! VM: orig: " + originalPath);
const original = (originalPath !== "") ? repository.getResource(originalPath).getText() : "";
const modifiedPath = rawDiffResult.secondFolderFile.replace(root, "");
console.log("!!! VM: mod: " + modifiedPath);
const modified = (modifiedPath !== "") ? repository.getResource(modifiedPath).getText() : "";
const file = rawDiffResult.fileName.replace(root, "").replace("_unmodified", "");
const type = file.substring(file.lastIndexOf(".") + 1);
Expand All @@ -74,7 +71,12 @@ export class DiffToolService {
}
})

console.log("!!!! VM: diff: " + JSON.stringify(diffResult));
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions resources/resources-neo-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<version>${neo-java-web-sdk.version}</version>
<type>zip</type>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk</outputDirectory>
<overWrite>true</overWrite>
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
</configuration>
Expand All @@ -54,31 +54,31 @@
<artifactId>javax.activation</artifactId>
<version>${neo-java-web-sdk.javax.activation.version}</version>
<type>jar</type>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd</outputDirectory>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${neo-java-web-sdk.jaxb.version}</version>
<type>jar</type>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd</outputDirectory>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${neo-java-web-sdk.jaxb.version}</version>
<type>jar</type>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd</outputDirectory>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${neo-java-web-sdk.jaxb.version}</version>
<type>jar</type>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/tools/lib/cmd</outputDirectory>
<outputDirectory>src/main/resources/META-INF/dirigible/resources-neo-sdk/sdk/tools/lib/cmd</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
Expand Down

0 comments on commit 38c381d

Please sign in to comment.