Skip to content

Commit

Permalink
Merge pull request #293 from redhat-developer/gh-fix-wording
Browse files Browse the repository at this point in the history
update the information messages for all the commands
  • Loading branch information
mohitsuman authored Oct 16, 2022
2 parents 9e06c3a + 43a4cc3 commit ff615e1
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/functions/function-command/build-and-deploy-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function showInputBox(promptMessage: string, inputValidMessage: string, na

async function functionBuilder(image: string, name: string): Promise<ImageAndBuild> {
const builder = await showInputBox(
'Provide Buildpack builder, either an as a an image name or a mapping name.',
'Provide Buildpack builder (image name or mapping name)',
'Provide full image name in the form [registry]/[namespace]/[name]:[tag] (e.g quay.io/boson/image:latest)',
name,
);
Expand All @@ -67,7 +67,7 @@ async function functionImage(
funcData = yaml.safeLoadAll(funcYaml);
if (funcData?.[0].namespace?.trim() && funcData?.[0].namespace !== namespace && funcName) {
checkNamespace = await vscode.window.showInformationMessage(
`Function namespace (declared in func.yaml) is different from the current active namespace. Deploy function ${funcName} to namespace ${namespace}?`,
`Function namespace (declared in func.yaml) is different from the current active namespace. Are you sure to deploy function:${funcName} to namespace:${namespace}?`,
'Ok',
'Cancel',
);
Expand Down Expand Up @@ -149,7 +149,7 @@ export async function buildFunction(context?: FunctionNode): Promise<CliExitData
return result;
}
const status = await vscode.window.showWarningMessage(
`The Function ${command.cliArguments[0]}: ${context.getName()} is already active.`,
`The Build for function:${context.getName()} is already active.`,
'Restart',
);
if (status === 'Restart') {
Expand Down Expand Up @@ -197,7 +197,7 @@ export async function deployFunction(context?: FunctionNode): Promise<CliExitDat
const name = `Deploy: ${context.getName()}`;
if (STILL_EXECUTING_COMMAND.get(name)) {
const status = await vscode.window.showWarningMessage(
`The Function ${command.cliArguments[0]}: ${context.getName()} is already active.`,
`The Build for function:${context.getName()} is already active`,
'Restart',
);
if (status === 'Restart') {
Expand Down
2 changes: 1 addition & 1 deletion src/functions/function-command/configure-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function configureFunction(action: ConfigAction, objectToConfigure?
if (!objectToConfigure) {
// eslint-disable-next-line no-param-reassign
objectToConfigure = await vscode.window.showQuickPick([ENV_VARIABLES, VOLUMES], {
placeHolder: 'Select what you want to configure',
placeHolder: 'Configure your function',
});
if (!objectToConfigure) {
return null;
Expand Down
6 changes: 3 additions & 3 deletions src/functions/function-command/create-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const defaultField = [functionName, selectLanguage, selectTemplate, selectLocati

export const def: WizardDefinition = {
title: `Create Function`,
description: 'This will create new project including func.yaml in it.',
description: 'This will create new function project including func.yaml in it.',
showDirtyState: true,
pages: [
{
Expand All @@ -146,7 +146,7 @@ export const def: WizardDefinition = {
{
value: parameters.selectLocation,
id: createFunctionID.select_location,
message: 'Provide path to create function',
message: 'Provide path to create function.',
},
items,
);
Expand Down Expand Up @@ -209,7 +209,7 @@ export const def: WizardDefinition = {
{
cancellable: false,
location: vscode.ProgressLocation.Notification,
title: `Function Successfully created`,
title: `Creating Function ${data.functionName} `,
},
async () => {
const result: CliExitData = await executeCmdCli.executeExec(
Expand Down
2 changes: 1 addition & 1 deletion src/functions/function-command/get-url-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function urlFunction(context?: FunctionNode): Promise<unknown> {
}
if (!context.url) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
window.showErrorMessage('Fail to get URL');
window.showErrorMessage('Failed to get URL');
return null;
}
return commands.executeCommand('vscode.open', Uri.parse(context.url));
Expand Down
12 changes: 6 additions & 6 deletions src/functions/function-command/invoke-function-def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const invokeNamespace: WizardPageFieldDefinition = {
export const invokeID: WizardPageFieldDefinition = {
id: invokeFunctionID.invoke_ID,
label: 'ID',
placeholder: 'Automatically generated. (optional)',
placeholder: 'Automatically generated (optional)',
type: 'textbox',
};

Expand Down Expand Up @@ -81,7 +81,7 @@ export const invokePath: WizardPageFieldDefinition = {
export const invokeContextType: WizardPageFieldDefinition = {
id: invokeFunctionID.invoke_context_type,
label: 'Content-Type',
placeholder: 'Content Type of the data.',
placeholder: 'The MIME type of the value contained in data(content)',
initialValue: 'text/plain',
type: 'combo',
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Expand Down Expand Up @@ -179,21 +179,21 @@ export const invokeSource: WizardPageFieldDefinition = {
id: invokeFunctionID.invoke_source,
label: 'Source',
initialValue: '/boson/fn',
placeholder: 'Source value for the request data.',
placeholder: 'A sender name for the request.',
type: 'textbox',
};

export const invokeType = {
id: invokeFunctionID.invoke_type,
label: 'Type',
initialValue: 'boson.fn',
placeholder: 'Source value for the request data.',
placeholder: 'A type for the request.',
type: 'textbox',
};

export const invokeDataText: WizardPageSectionDefinition = {
id: invokeFunctionID.invoke_data_desc,
label: 'Data to send in the request. (default "Hello World")',
label: 'Data (content) for this request. (default "Hello World")',
childFields: [
{
id: invokeFunctionID.invoke_data_mode,
Expand Down Expand Up @@ -236,7 +236,7 @@ export const invokeDataFile: WizardPageSectionDefinition = {
canSelectMany: false,
canSelectFiles: true,
canSelectFolders: false,
openLabel: 'Select file',
openLabel: 'Select the file',
},
},
],
Expand Down
4 changes: 3 additions & 1 deletion src/functions/function-command/invoke-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ export const def: WizardDefinition = {
const result: CliExitData = await executeCmdCli.executeExec(invokeCommand);
if (result.error) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
vscode.window.showErrorMessage(`Fail invoke Function: ${getStderrString(result.error)}`);
vscode.window.showErrorMessage(
`Invoking the Function:${functionName} failed with the following error: ${getStderrString(result.error)}`,
);
telemetryLogError('Invoke_error', getStderrString(result.error));
return false;
}
Expand Down
5 changes: 1 addition & 4 deletions src/functions/function-command/run-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ async function executeRunCommand(command: CliCommand, context: FunctionNode, nam
}
return null;
}
const status = await window.showWarningMessage(
`The Function ${command.cliArguments[0]}: ${context.getName()} is already active.`,
'Restart',
);
const status = await window.showWarningMessage(`The Run for function:${context.getName()} is already active.`, 'Restart');
if (status === 'Restart') {
CACHED_CHILDPROCESS.get(name)?.kill('SIGTERM');
restartRunCommand.set(context.getName(), true);
Expand Down
10 changes: 3 additions & 7 deletions src/functions/function-command/undeploy-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,22 @@ export async function undeployFunction(context: FunctionNode): Promise<string> {
if (!context) {
return null;
}
const response = await vscode.window.showWarningMessage(
`Do you want to undeploy Function Name: ${context.getName()}`,
'Yes',
'No',
);
const response = await vscode.window.showWarningMessage(`Do you want to undeploy Function: ${context.getName()}`, 'Yes', 'No');
if (response === 'No') {
return null;
}
await vscode.window.withProgress(
{
cancellable: false,
location: vscode.ProgressLocation.Notification,
title: `Undeploying function ${context.getName()}.`,
title: `Undeploying function ${context.getName()}...`,
},
async () => {
const result: CliExitData = await executeCmdCli.executeExec(FuncAPI.deleteFunc(context.getName()));
if (result.error) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
vscode.window.showErrorMessage(
`Failed to undeploy function ${context.getName()} - error ${getStderrString(result.error)}`,
`Failed to undeploy function:${context.getName()} with the following error: ${getStderrString(result.error)}`,
);
telemetryLogError('Function_undeploy_error', getStderrString(result.error));
return null;
Expand Down
2 changes: 1 addition & 1 deletion test/functions/function-command/create-function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ suite('Function/Create', () => {
});
expect(result).deep.equal({
items: [
{ severity: 4, template: { content: 'Provide path to create function', id: 'selectLocation' } },
{ severity: 4, template: { content: 'Provide path to create function.', id: 'selectLocation' } },
{
severity: 4,
template: { content: 'A folder with this name already exists. Please use a different name.', id: 'functionName' },
Expand Down

0 comments on commit ff615e1

Please sign in to comment.