Skip to content

Commit

Permalink
fix #1139 fix #1136 applypatch
Browse files Browse the repository at this point in the history
  • Loading branch information
lwtnb-wrk committed Aug 24, 2023
1 parent fdb663e commit 937601a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 68 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

# Versão [1.3.21]

## Correções

### Erro Validate Patch Fail. Please input patch file. (arquivos zip) [#1136](https://github.com/totvs/tds-vscode/issues/1136)

Corrigido de validação de patch em arquivos Zip.

### Erro "Get organization list could not be executed" ao aplicar patch em ambiente TSS [#1139](https://github.com/totvs/tds-vscode/issues/1139)

Corrigido problema que causava erro ao aplicar patch em ambiente TSS.

### Não permite aplicar patch com fontes mais antigos que o do RPO

Removida a trava adicionada que estava impedindo a aplicação de patches com fontes mais antigos de o do RPO.

### Validação de patch não finaliza no Linux/MaoOS

Após validação no Linux/MacOS a ação de aplicação de patch não estava sendo liberada.

# Versão [1.3.20]

## Correções
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tds-vscode",
"displayName": "TOTVS Developer Studio for VSCode (AdvPL, TLPP e 4GL)",
"description": "%tds.package.description%",
"version": "1.3.20",
"version": "1.3.21",
"publisher": "TOTVS",
"author": {
"name": "TOTVS",
Expand Down Expand Up @@ -82,7 +82,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.11.3-deprecations.1",
"@totvs/tds-da": "^1.2.62",
"@totvs/tds-ls": "^1.2.73",
"@totvs/tds-ls": "^1.2.74",
"@types/react": "^16.14.20",
"@types/vscode": "^1.63.1",
"@vscode/debugadapter": "^1.51.1",
Expand Down
25 changes: 8 additions & 17 deletions src/patch/formApplyPatch.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,15 @@

window.addEventListener('message', event => {
const message = event.data; // The JSON data our extension sent
//console.log("formApplyPatch receive: " + message.command);
switch (message.command) {
case 'setCurrentServer':
const server = message.serverCurrent;
document.getElementById('serverNameID').value = server.name;
document.getElementById('serverAddressID').value = server.address + ":" + server.port;
document.getElementById('serverEnvironmentID').value = server.environment
break;
case 'addFilepath':
addFile(message.file);
break;
case 'patchValidationRet':
//console.log("patchValidationRet");
const file = message.file.toLowerCase();
//console.log("file: "+file);
var patchs = tableAPI.data();
Expand Down Expand Up @@ -301,14 +298,7 @@
var ext = getExtension(filename);
//console.log("ext: "+ext);

if (ext.toLowerCase() === 'zip') {
vscode.postMessage({
command: 'extractPatchsFiles',
files: [fullPath]
})
} else {
fnProc(filename, fullPath);
}
fnProc(filename, fullPath);
}

function getFilename(filePath) {
Expand Down Expand Up @@ -362,14 +352,15 @@
//console.log("hasOld: "+hasOld);
if (hasOld) {
//console.log("ApplyOldID: "+(document.getElementById('ApplyOldID').checked?"checked":"not checked"));
document.getElementById('OutputMessage').style = "color: red";
if (!document.getElementById('ApplyOldID').checked) {
document.getElementById('OutputMessage').style = "color: red";
document.getElementById('OutputMessage').innerHTML = "There are patches with resources older than RPO. To apply those patches you must enable 'Apply old files' checkbox.";
return;
// warning: has Old resource
document.getElementById('OutputMessage').innerHTML = "There are patches with resources older than RPO.";
} else {
// has Old resource but user agreed to apply anyway
validationOk = true;
// warning: has Old resource but user choose to overwrite anyway
document.getElementById('OutputMessage').innerHTML = "There are patches with resources older than RPO and they will overwrite newer resources in RPO.";
}
validationOk = true;
}
//console.log("validationInProgress: "+validationInProgress);
//console.log("validationOk: "+validationOk);
Expand Down
52 changes: 3 additions & 49 deletions src/patch/patchApply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,54 +201,6 @@ export function patchApply(

break;

case "extractPatchsFiles":
// msg emitida com tempo, pois o processo de verificação do zip
// é muito rápido (zip de expedição contiuna com +40M e 4 ptm, leva < 2 seg)

vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window,
cancellable: false,
title: `${localize(
"tds.vscode.starting.build.patch",
"Checking zip files"
)}`,
},
async (progress) => {
progress.report({ increment: 0 });

await extractPatchsFiles(message.files).then(
async (files) => {
if (files.length === 0) {
vscode.window.showWarningMessage(
"No patch file found in zip files."
);
} else {
const step = 100 / (files.length + 2);

for await (const element of files) {
progress.report({
increment: step,
});

if (currentPanel) {
currentPanel.webview.postMessage({
command: "addFilepath",
file: element,
});
}
}
}
},
(reason: any) => {
vscode.window.showErrorMessage(reason);
}
);
progress.report({ increment: 100 });
}
);
break;

case "showDuplicateWarning":
vscode.window.showWarningMessage(
"Already selected. File: " + message.filename
Expand Down Expand Up @@ -468,7 +420,9 @@ async function doValidatePatch(
var patchFilePath = patchFile.path;
var retMessage = "No validation errors";
var oldResource = false;
if (patchFilePath.startsWith("/")) {
if (patchFilePath.startsWith("/") && patchFilePath.length > 2 && patchFilePath.at(2) === ':') {
// se formato for windows /d:/totvs/patch/12.1.2210/expedicao_continua_12_1_2210_atf_tttm120_hp.ptm
// remove a / inicial
patchFilePath = patchFilePath.substring(1);
}
if (!response.error) {
Expand Down

0 comments on commit 937601a

Please sign in to comment.