Skip to content

Commit

Permalink
Merge pull request #5 from kaplanPRO/development
Browse files Browse the repository at this point in the history
version 0.3.2
  • Loading branch information
csengor authored Feb 1, 2021
2 parents 2585bb5 + dc5255f commit a4ddc5b
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 69 deletions.
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kaplan-desktop",
"productName": "Kaplan Desktop",
"version": "0.3.1",
"version": "0.3.2",
"description": "An open-source CAT tool.",
"homepage": "https://kaplan.pro",
"main": "src/main.js",
Expand Down Expand Up @@ -63,6 +63,6 @@
"@electron-forge/maker-rpm": "6.0.0-beta.54",
"@electron-forge/maker-squirrel": "6.0.0-beta.54",
"@electron-forge/maker-zip": "6.0.0-beta.54",
"electron": "^11.2.0"
"electron": "^11.2.1"
}
}
2 changes: 1 addition & 1 deletion app/src/import-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</tr>
<tr>
<th></th>
<td><input type="submit" value="Import"/></td>
<td><button type="submit" >Import</button></td>
</tr>
</table>
</form>
Expand Down
8 changes: 8 additions & 0 deletions app/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ button.active, button:active, tr.active {
color: #FFFFFF;
font-weight: bold;
}
button.cancel {
border: 1px solid red;
color: red;
}
button.cancel:active {
background-color: red;
color: #FFFFFF;
}
button:disabled {
background-color: #96b6c6;
border: 1px dotted #96b6c6;
Expand Down
36 changes: 27 additions & 9 deletions app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,22 @@ function fireOnReady() {
tr.appendChild(td);
packageTable.appendChild(tr);

tr = document.createElement("tr");
td = document.createElement("td");
td.setAttribute("colspan", 2);
button = document.createElement("button");
button.type = "button";
button.textContent = "Cancel";
button.classList.add("cancel");
button.onclick = () => {
overlay.style.display = "none";
document.forms[0].removeAttribute("project-package");
}
td.appendChild(button);
tr.appendChild(td);
packageTable.appendChild(tr);
}
document.getElementById("btn-create-new-project-package").onclick = function() {
pathToKPP = window.setFile([]);

let xhttp = new XMLHttpRequest();

let queryURL = "http://127.0.0.1:8000/project/"
Expand All @@ -541,17 +553,14 @@ function fireOnReady() {
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
openPackageMenu("create_new_project_package",
JSON.parse(this.responseText).files,
pathToKPP);
JSON.parse(this.responseText).files);
}
}

xhttp.open("GET", queryURL, true);
xhttp.send();
}
document.getElementById("btn-create-return-project-package").onclick = function() {
pathToKPP = window.setFile([]);

let xhttp = new XMLHttpRequest();

let queryURL = "http://127.0.0.1:8000/project/"
Expand All @@ -561,8 +570,7 @@ function fireOnReady() {
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
openPackageMenu("create_return_project_package",
JSON.parse(this.responseText).files,
pathToKPP);
JSON.parse(this.responseText).files);
}
}

Expand Down Expand Up @@ -620,13 +628,22 @@ function fireOnReady() {
})
if (filesToPackage.length == 0) {
overlay.style.display = "none";
this.removeAttribute("project-package");
return false;
}

let queryURL = "http://127.0.0.1:8000/project/"
+ filesView.getAttribute("cur-p-id");

let parameters = new FormData();
parameters.append("project_package", this.getAttribute("project-package"));
if (this.getAttribute("project-package")) {
parameters.append("project_package", this.getAttribute("project-package"));
} else {
const filterList = [
{name: 'Kaplan Project Packages', extensions: ['kpp']}
]
parameters.append("project_package", window.setFile(filterList));
}
parameters.append("files", filesToPackage.join(";"));
parameters.append("task", this.getAttribute("task"));

Expand All @@ -635,6 +652,7 @@ function fireOnReady() {
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
overlay.style.display = "none";
document.forms[0].removeAttribute("project-package");
}
}
xhttp.open("POST", queryURL, true);
Expand Down
12 changes: 12 additions & 0 deletions app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ ipcMain.on('update-settings', (event, arg) => {
event.returnValue = 'Settings updated.';
})

ipcMain.on('disconnect-mysql', (event, arg) => {
const pathToSettings = path.join(app.getPath('userData'), 'settings.json');
let settings = JSON.parse(fs.readFileSync(pathToSettings));

delete(settings.mysql)

fs.writeFileSync(pathToSettings, JSON.stringify(settings))
process.env.KAPLAN_SETTINGS = JSON.stringify(settings)

event.returnValue = 'MySQL settings deleted.';
})

const template = [
{
label: 'View',
Expand Down
2 changes: 1 addition & 1 deletion app/src/new-cloud-tm.html
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
</tr>
<tr>
<th></th>
<td><input type="submit" value="Create"/></td>
<td><button type="submit">Create</button></td>
</tr>
</table>
</form>
Expand Down
2 changes: 1 addition & 1 deletion app/src/new-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
</td>
</tr>
<tr>
<th><label for="select-cloud-tms">Translation Memory:</label></th>
<th><label for="select-cloud-tms">Cloud TM:</label></th>
<td>
<select id="select-cloud-tms" name="cloud-translation-memories">
</select>
Expand Down
2 changes: 1 addition & 1 deletion app/src/new-tb.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
</tr>
<tr>
<th></th>
<td><input type="submit" value="Create"/></td>
<td><button type="submit">Create</button></td>
</tr>
</table>
</form>
Expand Down
2 changes: 1 addition & 1 deletion app/src/new-tm.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
</tr>
<tr>
<th></th>
<td><input type="submit" value="Create"/></td>
<td><button type="submit">Create</button></td>
</tr>
</table>
</form>
Expand Down
5 changes: 5 additions & 0 deletions app/src/settings-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ function fireOnReady() {
})
}
})
}

document.getElementById('btn-disconnect').onclick = () => {
console.log(ipcRenderer.sendSync('disconnect-mysql', 'delete-mysql-settings'))
ipcRenderer.sendTo(1, 'kaplan-index', 'mysql-updated');
location.reload();
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/src/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<th></th>
<td><button type="submit">Connect</button></th>
</tr>
<tr>
<th></th>
<td><button id="btn-disconnect" class="cancel" type="button">Disconnect</button></th>
</tr>
</table>
</form>
</div>
Expand Down
84 changes: 33 additions & 51 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,17 @@
fs-extra "^9.0.1"

"@electron/get@^1.0.1", "@electron/get@^1.6.0", "@electron/get@^1.9.0":
version "1.12.2"
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.12.2.tgz#6442066afb99be08cefb9a281e4b4692b33764f3"
integrity sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==
version "1.12.3"
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.12.3.tgz#fa2723385c4b565a34c4c82f46087aa2a5fbf6d0"
integrity sha512-NFwSnVZQK7dhOYF1NQCt+HGqgL1aNdj0LUSx75uCqnZJqyiWCVdAMFV4b4/kC8HjUJAnsvdSEmjEt4G2qNQ9+Q==
dependencies:
debug "^4.1.1"
env-paths "^2.2.0"
filenamify "^4.1.0"
fs-extra "^8.1.0"
got "^9.6.0"
progress "^2.0.3"
sanitize-filename "^1.6.2"
semver "^6.2.0"
sumchecker "^3.0.1"
optionalDependencies:
global-agent "^2.0.2"
Expand Down Expand Up @@ -340,14 +341,14 @@
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==

"@types/node@*":
version "14.14.21"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e"
integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==
version "14.14.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18"
integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==

"@types/node@^12.0.12":
version "12.19.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.14.tgz#59e5029a3c2aea34f68b717955381692fd47cafb"
integrity sha512-2U9uLN46+7dv9PiS8VQJcHhuoOjiDPZOLAt0WuA1EanEknIMae+2QbMhayF7cgGqjvRVIfNpt+6jLPczJZFiRw==
version "12.19.15"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.15.tgz#0de7e978fb43db62da369db18ea088a63673c182"
integrity sha512-lowukE3GUI+VSYSu6VcBXl14d61Rp5hA1D+61r16qnwC0lYNSqdxcvRh0pswejorHfS+HgwBasM8jLXz0/aOsw==

"@types/responselike@*", "@types/responselike@^1.0.0":
version "1.0.0"
Expand Down Expand Up @@ -781,9 +782,9 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:
integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=

core-js@^3.6.5:
version "3.8.2"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.8.2.tgz#0a1fd6709246da9ca8eff5bb0cbd15fba9ac7044"
integrity sha512-FfApuSRgrR6G5s58casCBd9M2k+4ikuu4wbW6pJyYU7bd9zvFc9qf7vr5xmrZOhT9nn+8uwlH1oRR9jTnFoA3A==
version "3.8.3"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.8.3.tgz#c21906e1f14f3689f93abcc6e26883550dd92dd0"
integrity sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q==

[email protected], core-util-is@~1.0.0:
version "1.0.2"
Expand Down Expand Up @@ -1061,10 +1062,10 @@ electron-winstaller@^4.0.1:
lodash.template "^4.2.2"
temp "^0.9.0"

electron@^11.2.0:
version "11.2.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-11.2.0.tgz#f8577ea4c9ba94068850256145be26b0b89a5dd7"
integrity sha512-weszOPAJPoPu6ozL7vR9enXmaDSqH+KE9iZODfbGdnFgtVfVdfyedjlvEGIUJkLMPXM1y/QWwCl2dINzr0Jq5Q==
electron@^11.2.1:
version "11.2.1"
resolved "https://registry.yarnpkg.com/electron/-/electron-11.2.1.tgz#8641dd1a62911a1144e0c73c34fd9f37ccc65c2b"
integrity sha512-Im1y29Bnil+Nzs+FCTq01J1OtLbs+2ZGLLllaqX/9n5GgpdtDmZhS/++JHBsYZ+4+0n7asO+JKQgJD+CqPClzg==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"
Expand Down Expand Up @@ -1303,14 +1304,14 @@ fs-extra@^8.1.0:
universalify "^0.1.0"

fs-extra@^9.0.0, fs-extra@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc"
integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^1.0.0"
universalify "^2.0.0"

fs-minipass@^1.2.5:
version "1.2.7"
Expand Down Expand Up @@ -2283,17 +2284,17 @@ onetime@^5.1.0:
mimic-fn "^2.1.0"

open@^7.2.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/open/-/open-7.3.1.tgz#111119cb919ca1acd988f49685c4fdd0f4755356"
integrity sha512-f2wt9DCBKKjlFbjzGb8MOAW8LH8F0mrs1zc7KTjAJ9PZNQbfenzWbNP1VZJvw6ICMG9r14Ah6yfwPn7T7i646A==
version "7.4.0"
resolved "https://registry.yarnpkg.com/open/-/open-7.4.0.tgz#ad95b98f871d9acb0ec8fecc557082cc9986626b"
integrity sha512-PGoBCX/lclIWlpS/R2PQuIR4NJoXh6X5AwVzE7WXnWRGvHg7+4TBCgsujUgiPpm0K1y4qvQeWnCWVTpTKZBtvA==
dependencies:
is-docker "^2.0.0"
is-wsl "^2.1.1"

ora@^5.0.0, ora@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-5.2.0.tgz#de10bfd2d15514384af45f3fa9d9b1aaf344fda1"
integrity sha512-+wG2v8TUU8EgzPHun1k/n45pXquQ9fHnbXVetl9rRgO6kjZszGGbraF3XPTIdgeA+s1lbRjSEftAnyT0w8ZMvQ==
version "5.3.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-5.3.0.tgz#fb832899d3a1372fe71c8b2c534bbfe74961bb6f"
integrity sha512-zAKMgGXUim0Jyd6CXK9lraBnD3H5yPGBPPOkC23a2BG6hsm4Zu6OQSjQuEtV0BHDf4aKHcUFvJiGRrFuW3MG8g==
dependencies:
bl "^4.0.3"
chalk "^4.1.0"
Expand Down Expand Up @@ -2837,13 +2838,6 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

sanitize-filename@^1.6.2:
version "1.6.3"
resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378"
integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==
dependencies:
truncate-utf8-bytes "^1.0.0"

sax@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
Expand All @@ -2859,6 +2853,11 @@ semver-compare@^1.0.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

semver@^6.2.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2:
version "7.3.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97"
Expand Down Expand Up @@ -3221,13 +3220,6 @@ trim-repeated@^1.0.0:
dependencies:
escape-string-regexp "^1.0.2"

truncate-utf8-bytes@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b"
integrity sha1-QFkjkJWS1W94pYGENLC3hInKXys=
dependencies:
utf8-byte-length "^1.0.1"

tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
Expand Down Expand Up @@ -3270,11 +3262,6 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==

universalify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==

universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
Expand Down Expand Up @@ -3302,11 +3289,6 @@ username@^5.1.0:
execa "^1.0.0"
mem "^4.3.0"

utf8-byte-length@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61"
integrity sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=

util-deprecate@^1.0.1, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down
1 change: 0 additions & 1 deletion backend/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def get_project_metadata(self):
translation_memories = {}
termbases = {}
for project_tm in self.language_resources.all():
print(project_tm.path)
if project_tm.role == 'tm':
translation_memories[len(translation_memories)] = project_tm.path
elif project_tm.role == 'tb':
Expand Down
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Django==2.2.14
kaplan==0.8.1
kaplan==0.8.2
mysql-connector-python==8.0.22

0 comments on commit a4ddc5b

Please sign in to comment.