Skip to content

Commit c670768

Browse files
committed
Expose stderr from custom action. fixes publicarray/spksrc#23
publicarray/spksrc#23 (comment)
1 parent 6412ddb commit c670768

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ distributor="publicarray"
1010
distributor_url="https://github.com/publicarray/synoedit"
1111
support_url="https://github.com/publicarray/synoedit/issues/new"
1212
helpurl="https://github.com/publicarray/synoedit"
13-
checksum="d3d96c714976f8d1d1d96434cfac9a04"
13+
checksum="65c662c6325bc599e0853b60faf2624f"
1414
dsmuidir="ui"
1515
dsmappname="SYNO.SDS.SynoEdit.Application"
1616
dsmapppage="SYNO.SDS.SynoEdit.Application"

package/src/synoedit/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func ExecuteAction(appName string) string {
162162
filePath := GetFilePath(appName, app.Action.OutputFile)
163163
SaveFile(filePath, string(stdout))
164164
}
165-
return string(stdout) + stderr.String()
165+
return stderr.String()
166166
}
167167
logError("App not found in configuration!")
168168
return ""

package/ui/js/main.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ function addParameter(key, value) {
7979

8080
function displayModel(message, status) {
8181
model.style.display = 'block'
82+
modelText.innerText = message
8283
if (status === 1) {
8384
model.style.color = '#f00'
8485
} else {
8586
model.style.color = '#000'
8687
}
87-
modelText.innerText = message
8888
}
8989
function hideModel() {
9090
model.style.display = 'none'
@@ -229,12 +229,19 @@ actionForm.addEventListener('submit', function(e) {
229229
var param = addParameter('app', appSelector.value) + addParameter('ajax', 'true')
230230
debug('params', param)
231231
ajax('POST', 'action=true' + param, function (responseText) {
232+
displaySuccess('Done!')
233+
if (responseText.length > 0) {
234+
displayModel(responseText, 0)
235+
}
236+
232237
// Update editor content if viewing the file currently being modified
233238
var modifiedFile = configFiles[appSelector.value].Action.OutputFile
234239
if (modifiedFile !== '' && fileSelector.value == modifiedFile) {
235-
updateEditorContent(responseText)
240+
var param = addParameter('app', appSelector.value) + addParameter('file', modifiedFile)
241+
ajax('GET', param, function(responseText) {
242+
updateEditorContent(responseText)
243+
})
236244
}
237-
displaySuccess('Done!')
238245
})
239246
}, false)
240247

0 commit comments

Comments
 (0)