Skip to content

Commit 91d6127

Browse files
alisonlhartQalthos
andauthored
Remove 'Add Pattern' webview and jsonValidation (#2174)
* Remove add pattern webview and json validation * Trigger RTD build again * Update src/features/contentCreator/types.ts Co-authored-by: Kate Case <[email protected]> --------- Co-authored-by: Kate Case <[email protected]>
1 parent c7a04e9 commit 91d6127

File tree

14 files changed

+7
-548
lines changed

14 files changed

+7
-548
lines changed

.sonarcloud.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ sonar.cpd.exclusions=\
1515
src/webview/apps/contentCreator/createExecutionEnvPageApp.ts, \
1616
src/webview/apps/lightspeed/roleExplanation/main.ts, \
1717
src/features/lightspeed/vue/views/helloWorld.ts, \
18-
webviews/AddPatternPageApp.vue,\
1918
src/features/contentCreator/vue/views/createExecutionEnvPanel.ts,\
2019
src/features/contentCreator/vue/views/createDevcontainerPanel.ts, \
21-
webviews/add-pattern.ts, \
2220
src/features/contentCreator/vue/views/createDevfilePanel.ts, \
2321
webviews/CreateDevfileApp.vue, \
24-
src/features/contentCreator/vue/views/addPatternPagePanel.ts, \
2522
src/features/contentCreator/vue/views/panelUtils.ts, \
2623
test/ui/*.ts, \
2724
test/unit/lightspeed/utils/handleApiError.test.ts, \

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@
220220
"ansible-navigator.json"
221221
],
222222
"url": "https://raw.githubusercontent.com/ansible/ansible-navigator/main/src/ansible_navigator/data/ansible-navigator.json"
223-
},
224-
{
225-
"fileMatch": [
226-
"patterns/*/meta/pattern.json"
227-
],
228-
"url": "https://raw.githubusercontent.com/ansible/pattern-service/main/specifications/pattern-schema/pattern-schema-latest.json"
229223
}
230224
],
231225
"yamlValidation": [
@@ -372,10 +366,6 @@
372366
"command": "ansible.content-creator.add-plugin",
373367
"title": "Ansible: Add a Plugin"
374368
},
375-
{
376-
"command": "ansible.content-creator.add-pattern",
377-
"title": "Ansible: Add a Pattern"
378-
},
379369
{
380370
"command": "ansible.content-creator.create-role",
381371
"title": "Ansible: Add Role"

src/extension.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import { MainPanel as ExplanationPanel } from "./features/lightspeed/vue/views/e
8282
import { MainPanel as HelloWorldPanel } from "./features/lightspeed/vue/views/helloWorld";
8383
import { MainPanel as createAnsibleCollectionPanel } from "./features/contentCreator/vue/views/createAnsibleCollectionPanel";
8484
import { MainPanel as createAnsibleProjectPanel } from "./features/contentCreator/vue/views/createAnsibleProjectPanel";
85-
import { MainPanel as addPatternPanel } from "./features/contentCreator/vue/views/addPatternPagePanel";
8685
import { MainPanel as addPluginPanel } from "./features/contentCreator/vue/views/addPluginPagePanel";
8786
import { MainPanel as createRolePanel } from "./features/contentCreator/vue/views/createRolePanel";
8887
import { MainPanel as createDevcontainerPanel } from "./features/contentCreator/vue/views/createDevcontainerPanel";
@@ -585,15 +584,6 @@ export async function activate(context: ExtensionContext): Promise<void> {
585584
),
586585
);
587586

588-
context.subscriptions.push(
589-
vscode.commands.registerCommand(
590-
"ansible.content-creator.add-pattern",
591-
() => {
592-
addPatternPanel.render(context);
593-
},
594-
),
595-
);
596-
597587
// open web-view for creating devfile
598588
context.subscriptions.push(
599589
vscode.commands.registerCommand(

src/features/contentCreator/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ export type PluginFormInterface = {
5959
isOverwritten: boolean;
6060
};
6161

62-
export type PatternFormInterface = {
63-
patternName: string;
64-
collectionPath: string;
65-
verbosity: string;
66-
isOverwritten: boolean;
67-
};
68-
6962
export type RoleFormInterface = {
7063
roleName: string;
7164
collectionPath: string;

src/features/contentCreator/vue/views/addPatternPagePanel.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/features/lightspeed/vue/views/ansibleCreatorUtils.ts

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
RoleFormInterface,
99
PluginFormInterface,
1010
PostMessageEvent,
11-
PatternFormInterface,
1211
} from "../../../contentCreator/types";
1312
import {
1413
getADEVersion,
@@ -33,101 +32,6 @@ export class AnsibleCreatorOperations {
3332
command = `ansible-creator add resource role ${roleName} ${url} --no-ansi`;
3433
return command;
3534
}
36-
public async getPatternAddCommand(
37-
patternName: string,
38-
collectionPath: string,
39-
): Promise<string> {
40-
let command = "";
41-
42-
command = `ansible-creator add resource pattern ${patternName} ${collectionPath} --no-ansi`;
43-
return command;
44-
}
45-
46-
public async runPatternAddCommand(
47-
payload: PatternFormInterface,
48-
webView: vscode.Webview,
49-
) {
50-
const { patternName, collectionPath, isOverwritten, verbosity } = payload;
51-
52-
const destinationPathUrl =
53-
collectionPath ||
54-
`${os.homedir()}/.ansible/collections/ansible_collections`;
55-
56-
let ansibleCreatorAddCommand = await this.getPatternAddCommand(
57-
patternName,
58-
destinationPathUrl,
59-
);
60-
61-
if (isOverwritten) {
62-
ansibleCreatorAddCommand += " --overwrite";
63-
} else {
64-
ansibleCreatorAddCommand += " --no-overwrite";
65-
}
66-
67-
const verbosityMap: Record<string, string> = {
68-
off: "",
69-
low: " -v",
70-
medium: " -vv",
71-
high: " -vvv",
72-
};
73-
const normalizedVerbosity = verbosity.toLowerCase();
74-
const verbosityFlag = verbosityMap[normalizedVerbosity] || "";
75-
ansibleCreatorAddCommand += verbosityFlag;
76-
77-
const extSettings = new SettingsManager();
78-
await extSettings.initialize();
79-
80-
const { command, env } = withInterpreter(
81-
extSettings.settings,
82-
ansibleCreatorAddCommand,
83-
"",
84-
);
85-
86-
let commandOutput = "";
87-
let commandResult: string;
88-
89-
const creatorVersion = await getCreatorVersion();
90-
if (!creatorVersion || creatorVersion === "failed") {
91-
commandOutput += `ansible-creator is not installed or not found in PATH.\n`;
92-
commandOutput += `Please install ansible-creator and try again.\n`;
93-
commandResult = "failed";
94-
await webView.postMessage({
95-
command: "execution-log",
96-
arguments: {
97-
commandOutput: commandOutput,
98-
projectUrl: destinationPathUrl,
99-
status: commandResult,
100-
},
101-
} as PostMessageEvent);
102-
return;
103-
}
104-
const minRequiredCreatorVersion: Record<string, string> = {
105-
role: "25.4.0",
106-
};
107-
const requiredCreatorVersion = minRequiredCreatorVersion["role"];
108-
109-
commandOutput += `----------------------------------------- ansible-creator logs ------------------------------------------\n`;
110-
111-
if (semver.gte(creatorVersion, requiredCreatorVersion)) {
112-
const ansibleCreatorExecutionResult = await runCommand(command, env);
113-
commandOutput += ansibleCreatorExecutionResult.output;
114-
commandResult = ansibleCreatorExecutionResult.status;
115-
} else {
116-
commandOutput += `Minimum ansible-creator version needed to add the role resource is ${requiredCreatorVersion}\n`;
117-
commandOutput += `The installed ansible-creator version on this system is ${creatorVersion}\n`;
118-
commandOutput += `Please upgrade to the latest version of ansible-creator and try again.`;
119-
commandResult = "failed";
120-
}
121-
122-
await webView.postMessage({
123-
command: "execution-log",
124-
arguments: {
125-
commandOutput: commandOutput,
126-
projectUrl: destinationPathUrl,
127-
status: commandResult,
128-
},
129-
} as PostMessageEvent);
130-
}
13135

13236
public async runRoleAddCommand(
13337
payload: RoleFormInterface,

src/features/lightspeed/vue/views/fileOperations.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ export class FileOperations {
115115
this.openFileInEditor(parsedUrl.toString());
116116
}
117117

118-
public async openFolderInWorkspacePattern(
119-
folderUrl: string,
120-
patternName: string,
121-
) {
122-
const patternFolderUrl = `${folderUrl}/extensions/patterns/${patternName}/playbooks/site.yml`;
123-
await this.openFolderInWorkspaceCore(patternFolderUrl);
124-
}
125-
126118
public async openFolderInWorkspaceProjects(folderUrl: string) {
127119
await this.openFolderInWorkspaceCore(folderUrl);
128120

src/features/lightspeed/vue/views/webviewMessageHandlers.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
AnsibleProjectFormInterface,
2424
RoleFormInterface,
2525
PluginFormInterface,
26-
PatternFormInterface,
2726
DevcontainerFormInterface,
2827
DevfileFormInterface,
2928
AnsibleExecutionEnvInterface,
@@ -90,7 +89,6 @@ export class WebviewMessageHandlers {
9089
"init-create": this.handleInitCreate.bind(this),
9190
"init-create-plugin": this.handleInitCreatePlugin.bind(this),
9291
"init-create-role": this.handleInitCreateRole.bind(this),
93-
"init-add-pattern": this.handleInitAddPattern.bind(this),
9492
"init-create-devcontainer": this.handleInitCreateDevcontainer.bind(this),
9593
"init-create-devfile": this.handleInitCreateDevfile.bind(this),
9694
"init-create-execution-env": this.handleInitCreateExecutionEnv.bind(this),
@@ -101,8 +99,6 @@ export class WebviewMessageHandlers {
10199
"init-open-log-file": this.handleInitOpenLogFile.bind(this),
102100
"init-open-scaffolded-folder":
103101
this.handleInitOpenScaffoldedFolder.bind(this),
104-
"init-open-scaffolded-folder-pattern":
105-
this.handleInitOpenScaffoldedFolderPattern.bind(this),
106102
"init-open-scaffolded-folder-plugin":
107103
this.handleInitOpenScaffoldedFolderPlugin.bind(this),
108104
"init-open-role-folder": this.handleInitOpenRoleFolder.bind(this),
@@ -242,10 +238,6 @@ export class WebviewMessageHandlers {
242238
const payload = message.payload as RoleFormInterface;
243239
await this.creatorOps.runRoleAddCommand(payload, webview);
244240
}
245-
private async handleInitAddPattern(message: any, webview: vscode.Webview) {
246-
const payload = message.payload as PatternFormInterface;
247-
await this.creatorOps.runPatternAddCommand(payload, webview);
248-
}
249241

250242
private async handleInitCreateDevcontainer(
251243
message: any,
@@ -307,13 +299,6 @@ export class WebviewMessageHandlers {
307299
payload.pluginType,
308300
);
309301
}
310-
private async handleInitOpenScaffoldedFolderPattern(message: any) {
311-
const payload = message.payload;
312-
await this.fileOps.openFolderInWorkspacePattern(
313-
payload.projectUrl,
314-
payload.patternName,
315-
);
316-
}
317302

318303
private async handleInitOpenRoleFolder(message: any) {
319304
const payload = message.payload;

0 commit comments

Comments
 (0)