Skip to content

Commit

Permalink
Merge pull request #224 from Accenture/feature/116-implement-delete-f…
Browse files Browse the repository at this point in the history
…rom-server

Feature/116 implement delete from server
  • Loading branch information
anasilva105 authored Nov 1, 2024
2 parents 80b0de7 + b9dc257 commit e1e5074
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 96 deletions.
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
{
"command": "sfmc-devtools-vscode.copytobu",
"title": "mcdev: Copy to Business Unit..."
},
{
"command": "sfmc-devtools-vscode.delete",
"title": "mcdev: Delete From Server"
}
],
"menus": {
Expand All @@ -71,6 +75,10 @@
{
"command": "sfmc-devtools-vscode.copytobu",
"when": "sfmc-devtools-vscode.config.isproject && editorIsOpen && resourcePath =~ /\\\\retrieve\\\\.*\\\\.*/"
},
{
"command": "sfmc-devtools-vscode.delete",
"when": "sfmc-devtools-vscode.config.isproject && editorIsOpen && resourcePath =~ /\\\\retrieve\\\\/ && resourceExtname =~ /.(json|html|sql|ssjs|md|amp|txt)/"
}
],
"editor/context": [
Expand All @@ -88,6 +96,11 @@
"command": "sfmc-devtools-vscode.copytobu",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\.*\\\\.*/",
"group": "devtools"
},
{
"command": "sfmc-devtools-vscode.delete",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\/ && (resourceExtname =~ /.(json|html|sql|ssjs|md|amp|txt)/ || resourceDirname =~ /asset\\\\[a-zA-Z]*/)",
"group": "devtools"
}
],
"explorer/context": [
Expand All @@ -105,6 +118,11 @@
"command": "sfmc-devtools-vscode.copytobu",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\.*\\\\.*/",
"group": "devtools"
},
{
"command": "sfmc-devtools-vscode.delete",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\/ && (resourceExtname =~ /.(json|html|sql|ssjs|md|amp|txt)/ || resourceDirname =~ /asset\\\\[a-zA-Z]*/)",
"group": "devtools"
}
],
"editor/title/context": [
Expand All @@ -122,6 +140,11 @@
"command": "sfmc-devtools-vscode.copytobu",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\.*\\\\.*/",
"group": "devtools"
},
{
"command": "sfmc-devtools-vscode.delete",
"when": "sfmc-devtools-vscode.config.isproject && resourcePath =~ /\\\\retrieve\\\\/ && resourceExtname =~ /.(json|html|sql|ssjs|md|amp|txt)/",
"group": "devtools"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/config/devtools.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const extensionName = "sfmc-devtools-vscode";
const requiredFiles = [".mcdevrc.json", ".mcdev-auth.json"];
const recommendedExtensions = ["IBM.output-colorizer"];
const menuCommands = ["retrieve", "deploy", "copytobu"];
const menuCommands = ["retrieve", "deploy", "copytobu", "delete"];
const delayTimeUpdateStatusBar = 10000; // 10 seconds

export { extensionName, requiredFiles, recommendedExtensions, menuCommands, delayTimeUpdateStatusBar };
23 changes: 22 additions & 1 deletion src/devtools/commands/standard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { TDevTools } from "@types";
*/
enum StandardCommandsAlias {
retrieve = "r",
deploy = "d"
deploy = "d",
delete = "del"
}

/**
Expand Down Expand Up @@ -49,6 +50,9 @@ class StandardCommands extends Commands {
case "deploy":
config = this.deploy(parameters);
break;
case "delete":
config = this.delete(parameters);
break;
}
return config;
}
Expand Down Expand Up @@ -105,6 +109,23 @@ class StandardCommands extends Commands {

return { alias: deployAlias, config: deployConfig };
}

/**
* Standard Command 'delete' execution
*
* @param {TDevTools.ICommandParameters[]} parameters - command parameters
* @returns {TDevTools.ICommandConfig} command configuration
*/
delete(parameters: TDevTools.ICommandParameters[]): TDevTools.ICommandConfig {
console.log("== StandardCommands: Delete ==");
// command alias
const deleteAlias = StandardCommandsAlias.delete;

// command parameters configuration
const deleteConfig = parameters.map(parameter => [this.configureParameters(parameter), parameter.projectPath]);

return { alias: deleteAlias, config: deleteConfig };
}
}

export default StandardCommands;
Loading

0 comments on commit e1e5074

Please sign in to comment.