Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display body as note on open ticket action #1244

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
margin-top: 8px;
}

.body {
.note {
margin-top: 8px;
}
24 changes: 12 additions & 12 deletions src/components/flow/routers/ticket/TicketRouterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
assignee: FormEntry;
topic: FormEntry;
subject: StringEntry;
body: StringEntry;
note: StringEntry;
resultName: StringEntry;
}

Expand All @@ -51,7 +51,7 @@
assignee?: User;
topic?: Topic;
subject?: string;
body?: string;
note?: string;
resultName?: string;
},
submitting = false
Expand All @@ -74,8 +74,8 @@
updates.subject = validate(i18n.t('forms.subject', 'Subject'), keys.subject, []);
}

if (keys.hasOwnProperty('body')) {
updates.body = validate(i18n.t('forms.body', 'Body'), keys.body, []);
if (keys.hasOwnProperty('note')) {
updates.note = validate(i18n.t('forms.note', 'Note'), keys.note, []);
}

if (keys.hasOwnProperty('resultName')) {
Expand Down Expand Up @@ -103,8 +103,8 @@
return this.handleUpdate({ subject }, submitting);
}

private handleBodyUpdate(body: string): boolean {
return this.handleUpdate({ body });
private handleNoteUpdate(note: string): boolean {
return this.handleUpdate({ note });

Check warning on line 107 in src/components/flow/routers/ticket/TicketRouterForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/flow/routers/ticket/TicketRouterForm.tsx#L107

Added line #L107 was not covered by tests
}

private handleResultNameUpdate(value: string): void {
Expand All @@ -124,7 +124,7 @@
const valid = this.handleUpdate(
{
subject: this.state.subject.value,
body: this.state.body.value,
note: this.state.note.value,
resultName: this.state.resultName.value
},
true
Expand Down Expand Up @@ -185,12 +185,12 @@
/>
</div>
</div>
<div className={styles.body}>
<div className={styles.note}>
<TextInputElement
name={i18n.t('forms.body', 'Body')}
placeholder={i18n.t('forms.enter_a_body', 'Enter a body (optional)')}
entry={this.state.body}
onChange={this.handleBodyUpdate}
name={i18n.t('forms.note', 'Note')}
placeholder={i18n.t('forms.enter_a_note', 'Enter a note (optional)')}
entry={this.state.note}
onChange={this.handleNoteUpdate}
autocomplete={true}
textarea={true}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ exports[`TicketRouterForm render should render 1`] = `
</div>
</div>
<div
class="body"
class="note"
>
<div
class="ele"
Expand All @@ -105,9 +105,9 @@ exports[`TicketRouterForm render should render 1`] = `
class="wrapper normal"
>
<input
data-testid="Body"
name="Body"
placeholder="Enter a body (optional)"
data-testid="Note"
name="Note"
placeholder="Enter a note (optional)"
value="Where are my cookies"
/>
</div>
Expand Down Expand Up @@ -275,7 +275,7 @@ exports[`TicketRouterForm updates should save changes 1`] = `
</div>
</div>
<div
class="body"
class="note"
>
<div
class="ele"
Expand All @@ -284,9 +284,9 @@ exports[`TicketRouterForm updates should save changes 1`] = `
class="wrapper normal"
>
<input
data-testid="Body"
name="Body"
placeholder="Enter a body (optional)"
data-testid="Note"
name="Note"
placeholder="Enter a note (optional)"
value="Where are my cookies"
/>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/flow/routers/ticket/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export const getOriginalAction = (settings: NodeEditorSettings): OpenTicket => {

export const nodeToState = (settings: NodeEditorSettings): TicketRouterFormState => {
let subject = { value: '@run.flow.name' };
let body = { value: '' };
let note = { value: '' };
let resultName = { value: 'Result' };
let assignee: FormEntry = { value: null };
let topic: FormEntry = { value: null };

if (getType(settings.originalNode) === Types.split_by_ticket) {
const action = getOriginalAction(settings) as OpenTicket;
subject = { value: action.subject };
body = { value: action.body };
note = { value: action.body };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still body in flow def

topic = { value: action.topic };
assignee = { value: action.assignee };
resultName = { value: action.result_name };
Expand All @@ -37,7 +37,7 @@ export const nodeToState = (settings: NodeEditorSettings): TicketRouterFormState
assignee,
topic,
subject,
body,
note,
resultName,
valid: true
};
Expand All @@ -58,7 +58,7 @@ export const stateToNode = (
const newAction: OpenTicket = {
uuid,
type: Types.open_ticket,
body: state.body.value,
body: state.note.value,
topic: state.topic.value,
assignee: state.assignee.value,
result_name: state.resultName.value
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/cs/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Příjemce",
"email_recipient_placeholder": "Komu",
"email_recipient_prompt": "Zadejte e-mailovou adresu",
"enter_a_body": "Zadejte obsah zprávy",
"enter_a_note": "Zadejte poznámku (volitelný)",
"enter_a_subject": "Zadejte předmět",
"enter_a_url": "Zadejte URL",
"enter_field_value": "Zadejte novou hodnotu pro [[field]]",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Minimální hodnota",
"must_be_less_than": "musí být menší než",
"name": "Název",
"note": "Poznámku",
"operand": "Operand",
"operator": "operátor",
"pdf_url": "URL adresa PDF dokumentu",
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Recipient",
"email_recipient_placeholder": "To",
"email_recipient_prompt": "Enter email address",
"enter_a_body": "Enter a body (optional)",
"enter_a_note": "Enter a note (optional)",
"enter_a_subject": "Enter a subject",
"enter_a_url": "Enter a URL",
"enter_field_value": "Enter a new value for [[field]]",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Minimum value",
"must_be_less_than": "must be less than",
"name": "Name",
"note": "Note",
"operand": "Operand",
"operator": "operator",
"pdf_url": "PDF Document URL",
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/es/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Destinatario",
"email_recipient_placeholder": "Para",
"email_recipient_prompt": "Introducir la dirección de correo electrónico",
"enter_a_body": "Introducir cuerpo (opcional)",
"enter_a_note": "Introducir nota (opcional)",
"enter_a_subject": "Introducir asunto",
"enter_a_url": "Introducir URL",
"enter_field_value": "Ingrese un nuevo valor para [[field]]",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Valor mínimo",
"must_be_less_than": "debe ser menor que",
"name": "Nombre",
"note": "Nota",
"operand": "Operando",
"operator": "operador",
"pdf_url": "URL de Documento PDF",
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/fr/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Bénéficiaire",
"email_recipient_placeholder": "À",
"email_recipient_prompt": "Entrer l'adresse e-mail",
"enter_a_body": "Entrez un corps",
"enter_a_note": "Entrez une note (facultatif)",
"enter_a_subject": "Entrez un sujet",
"enter_a_url": "Entrez une URL",
"enter_field_value": "Enter a new value for [[field]]",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Valeur minimum",
"must_be_less_than": "doit être inférieur à",
"name": "Nom",
"note": "Note",
"operand": "Opérande",
"operator": "opérateur",
"pdf_url": "PDF Document URL",
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/mn/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Хүлээн авагч",
"email_recipient_placeholder": "руу",
"email_recipient_prompt": "Имэйл хаягаа оруулна уу",
"enter_a_body": "Их биеийг оруулна уу",
"enter_a_note": "Тэмдэглэл оруулна уу",
"enter_a_subject": "Сэдвийг оруулна уу",
"enter_a_url": "URL оруулна уу",
"enter_field_value": "[[field]]-д шинэ утга оруулна уу",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Хамгийн бага утга",
"must_be_less_than": "-аас бага байх ёстой",
"name": "Нэр",
"note": "тэмдэглэл",
"operand": "Операнд",
"operator": "оператор",
"pdf_url": "PDF баримт бичгийн URL",
Expand Down
3 changes: 2 additions & 1 deletion src/config/i18n/pt-br/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Destinatário",
"email_recipient_placeholder": "Para",
"email_recipient_prompt": "Insira o endereço de email",
"enter_a_body": "Insira um corpo",
"enter_a_note": "Insira uma nota (opcional)",
"enter_a_subject": "Insira um assunto",
"enter_a_url": "Insira um URL",
"enter_field_value": "Insira um novo valor para [[field]]",
Expand Down Expand Up @@ -250,6 +250,7 @@
"minimum_value": "Valor mínimo",
"must_be_less_than": "deve ser menor que",
"name": "Nome",
"note": "Nota",
"operand": "Operando",
"operator": "operador",
"pdf_url": "PDF Document URL",
Expand Down
Loading