Skip to content

Commit

Permalink
fix: incorrect mapping for Slack connection & notification template f…
Browse files Browse the repository at this point in the history
…orm (#1382)

* fix: incorrect mapping for Slack connection & notification template form

* gitignore tool versions
  • Loading branch information
adityathebe authored Sep 13, 2023
1 parent 03c1466 commit 2ef3ef5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ src/data/*.real.json
.idea/
.log/
.rgignore
.tool-versions

.next
*.log
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/Connections/connectionTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1488,17 +1488,17 @@ export const connectionTypes: ConnectionType[] = [
convertToFormSpecificValue: (data: Record<string, any>) => {
return {
...data,
fromName: data.properties?.fromName
fromName: data.properties?.BotName
} as Connection;
},
preSubmitConverter: (data: Record<string, string>) => {
return {
name: data.name,
username: data.username,
password: data.password,
url: `slack://$(password)@${data.username}?BotName=${data.fromName}`,
url: `slack://$(password)@${data.username}`,
properties: {
fromName: data.fromName
BotName: data.fromName
}
};
}
Expand Down
20 changes: 2 additions & 18 deletions src/components/Forms/Formik/FormikNotificationsTemplateField.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
import { useState } from "react";
import { FormikCodeEditor } from "./FormikCodeEditor";
import { Switch } from "../../Switch";

type Props = {
name: string;
};

export default function FormikNotificationsTemplateField({ name }: Props) {
const [templateOption, setTemplateOption] = useState<"Go Template" | "HTML">(
"Go Template"
);

return (
<div className="flex flex-col gap-2">
<label className={`block text-sm font-bold text-gray-700`}>
Template
Markdown Template
</label>
<div className="flex flex-row w-full">
<Switch
itemsClassName="w-auto"
onChange={(option) =>
setTemplateOption(option as "Go Template" | "HTML")
}
options={["Go Template", "HTML"]}
value={templateOption}
/>
</div>
<FormikCodeEditor
className="flex flex-col h-[200px]"
fieldName={name}
format={templateOption === "Go Template" ? "go" : "html"}
format={"markdown"}
/>
</div>
);
Expand Down

0 comments on commit 2ef3ef5

Please sign in to comment.