Skip to content

Commit

Permalink
Remove util method for set editor value, replace calls with setEditor…
Browse files Browse the repository at this point in the history
…Value(value, -1)

Signed-off-by: Vasil Vasilev <vasil.vasilev@bosch.com>
  • Loading branch information
vvasilevbosch committed Nov 10, 2023
1 parent fd70011 commit 0d1dc7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
12 changes: 6 additions & 6 deletions ui/modules/operations/piggyback.ts
Expand Up @@ -94,8 +94,8 @@ export function onInsertTemplate(template) {
onServiceSelected();
dom.timeout.value = chosenTemplate.timeout;
dom.targetActorSelection.value = chosenTemplate.targetActorSelection;
Utils.setEditorValue(aceHeadersEditor, Utils.stringifyPretty(chosenTemplate.headers));
Utils.setEditorValue(aceCommandEditor, Utils.stringifyPretty(chosenTemplate.command));
aceHeadersEditor.setValue(Utils.stringifyPretty(chosenTemplate.headers), -1);
aceHeadersEditor.setValue(Utils.stringifyPretty(chosenTemplate.command), -1);
}

async function loadServicesAndInstances() {
Expand Down Expand Up @@ -203,7 +203,7 @@ function hasEditorError(editorSession) {
async function submitPiggybackCommand() {
if (isCommandValid()) {
dom.responseStatus.innerHTML = REQUEST_IN_PROGRESS_MESSAGE;
Utils.setEditorValue(aceResponse, '');
aceResponse.setEditorValue('', -1);
let path = buildPath(
dom.serviceSelector.value,
dom.instanceSelector.value,
Expand All @@ -224,19 +224,19 @@ async function submitPiggybackCommand() {
.catch(err => reject(err));
} catch (err) {
onRequestDone();
Utils.setEditorValue(aceResponse, err.message);
aceResponse.setEditorValue(err.message, -1);
dom.responseStatus.innerHTML = REQUEST_ERROR_MESSAGE;
}
});
promise.then((result: any) => {
onRequestDone();
result.json().then(resultJson => {
Utils.setEditorValue(aceResponse, Utils.stringifyPretty(resultJson));
aceResponse.setEditorValue(Utils.stringifyPretty(resultJson), -1);
dom.responseStatus.innerHTML = result.status;
});
}).catch(err => {
onRequestDone();
Utils.setEditorValue(aceResponse, err.message);
aceResponse.setEditorValue(err.message, -1);
dom.responseStatus.innerHTML = REQUEST_ERROR_MESSAGE;
});

Expand Down
9 changes: 0 additions & 9 deletions ui/modules/utils.ts
Expand Up @@ -317,15 +317,6 @@ export function createAceEditor(domId, sessionMode, readOnly = false, wrap = fal
return result;
}

/**
* Sets value of ace editor
* @param {Object} aceEditor editor instance
* @param {String} value value to set on the ace editor
*/
export function setEditorValue(aceEditor, value) {
aceEditor.setValue(value, -1);
}

/**
* Creates a autocomplete input field
* @param {String} selector selector for the input field
Expand Down

0 comments on commit 0d1dc7b

Please sign in to comment.