289289 </q-page-sticky >
290290 </q-card >
291291 </q-dialog >
292+ <!-- Dialog to show progress window -->
293+ <q-dialog
294+ v-model =" displayProgressDiag"
295+ transition-show =" slide-up"
296+ transition-hide =" slide-down"
297+ position =" bottom"
298+ full-width
299+ >
300+ <q-card
301+ class =" full-width"
302+ ref =" progressCard"
303+ >
304+ <q-card-section >
305+ <q-markdown
306+ :src =" scriptProgress"
307+ ref =" progressCode"
308+ />
309+ </q-card-section >
310+ </q-card >
311+ </q-dialog >
292312 <!-- Dialog to show results window -->
293313 <q-dialog
294314 v-model =" displayResultsDiag"
@@ -605,11 +625,13 @@ export default {
605625 results: {}, // Command result object displayed in Results Dialog
606626 resultsSelected: [[]], // Array of selected objects from Results Dialog
607627 resultsFilter: ' ' , // Filter for results table
628+ scriptProgress: ' ' , // Display current script execution progress
608629 externalHelpFile: ' ' , // Holds Help text loaded from external source
609630 displayCommandDiag: false , // Visibility state for command dialog
610631 displayHelpDiag: false , // Visibility state for help dialog
611632 displayResultsDiag: false , // Visibility state for results dialog
612633 displayPreExecuteCheck: false , // Visibility state for preexecute dialog
634+ displayProgressDiag: false , // Visibility state for progress dialog
613635 paramType: { // Table translating PowerShell variable types to Quasar components names and options
614636 ' String' : [' q-input' , ' text' ],
615637 ' Number' : [' q-input' , ' number' ],
@@ -645,7 +667,7 @@ export default {
645667 }
646668 },
647669 computed: {
648- ... mapGetters (' lazystore' , [' getLanguage' , ' getSearchScripts' , ' getSearchHistory' , ' getScriptsArray' , ' getDefinitions' , ' getCommandMaximized' , ' getAlwaysConfirm' , ' getHistoryLength' , ' getHistoryVisible' , ' getHistory' , ' getDenseInput' , ' getDenseTable' , ' getLoginSkipped' , ' getCredentialsSaved' ]),
670+ ... mapGetters (' lazystore' , [' getLanguage' , ' getSearchScripts' , ' getSearchHistory' , ' getScriptsArray' , ' getDefinitions' , ' getCommandMaximized' , ' getAlwaysConfirm' , ' getHistoryLength' , ' getHistoryVisible' , ' getHistory' , ' getDenseInput' , ' getDenseTable' , ' getLoginSkipped' , ' getCredentialsSaved' , ' getDisplayProgress ' ]),
649671 language : function () {
650672 return this .getLanguage
651673 },
@@ -698,6 +720,9 @@ export default {
698720 denseTable : function () {
699721 return this .getDenseTable
700722 },
723+ displayProgress : function () {
724+ return this .getDisplayProgress
725+ },
701726 loginSkipped : function () {
702727 return this .getLoginSkipped
703728 },
@@ -899,6 +924,8 @@ export default {
899924 this .$q .loading .show ({
900925 message: ' <h6>' + this .$t (' cancelling' ) + ' </h6><p>' + this .$t (' pleaseWait' ) + ' </p>'
901926 })
927+ // Stop listening to output, hide progress dialog and reset dialog
928+ this .stopProgress ()
902929 // Kill current powershell proccess
903930 childProcess .exec (` taskkill /f /pid ${ this .$pwsh .shell .pid } ` , (error , stdout , stderr ) => {
904931 if (error) {
@@ -1027,12 +1054,9 @@ export default {
10271054 // @"
10281055 // `
10291056 // }
1030- // console.log('Checking input: ', input)
10311057 if (input) {
1032- // console.log('input is here!')
10331058 // If parameter has additional text format, insert it
10341059 if (param .format ) {
1035- // console.log('format is here!')
10361060 tempResultCommand = tempResultCommand .replace (` {{${ param .parameter } }}` , ` ${ param .format } ` )
10371061 }
10381062 // If parameter was supplied, insert param in place of template variable
@@ -1063,6 +1087,27 @@ export default {
10631087 this .resultCommand = this .resultCommand .replace (/ (\r\n | \n | \r )/ gm , ' ;' )
10641088 }
10651089 },
1090+ async executionProgress (data ) {
1091+ // Do not display ending string, which starts with EOI hash or progress delimiter, which is EOIP
1092+ if (! data .startsWith (' EOI' )) {
1093+ this .scriptProgress += data
1094+ }
1095+ // Try to scroll if output is too long
1096+ setTimeout (() => {
1097+ try {
1098+ this .$refs .progressCard .$el .scrollTo (0 , this .$refs .progressCode .$el .clientHeight )
1099+ } catch { }
1100+ }, 100 )
1101+ },
1102+ async stopProgress () {
1103+ if (this .displayProgress || this .currentCommand .progress ) {
1104+ this .$pwsh .shell .streams .stdout .removeListener (' data' , this .executionProgress )
1105+ setTimeout (() => {
1106+ this .displayProgressDiag = false
1107+ this .scriptProgress = ' '
1108+ }, 1000 )
1109+ }
1110+ },
10661111 executeCommand () {
10671112 this .toggleLoading (true )
10681113 this .$pwsh .shell .clear ().then (() => {
@@ -1071,8 +1116,24 @@ export default {
10711116 } else {
10721117 this .$pwsh .shell .addCommand (this .resultCommand )
10731118 }
1119+ // Write output to progress window if it is still running after one second to prevent useless progress window flash for fast commands
1120+ if (this .displayProgress || this .currentCommand .progress ) {
1121+ this .$pwsh .shell .streams .stdout .on (' data' , this .executionProgress )
1122+ setTimeout (() => {
1123+ if (this .$pwsh .shell .invocationStateInfo === ' Running' ) {
1124+ this .displayProgressDiag = true
1125+ }
1126+ }, 1000 )
1127+ }
10741128 this .$pwsh .shell .invoke ().then (output => {
10751129 // Code block to handle PowerShell return data
1130+ // Stop listening to output, hide progress dialog and reset dialog
1131+ this .stopProgress ()
1132+ // If command emits progress end, split progress from results
1133+ if (this .currentCommand .progress || this .currentCommand .progress ) {
1134+ let splitOutput = output .split (' EOIP' , 2 )
1135+ output = splitOutput[splitOutput .length - 1 ]
1136+ }
10761137 let data
10771138 let params
10781139 let dataArray = []
@@ -1123,7 +1184,9 @@ export default {
11231184 this .toggleLoading ()
11241185 }).catch (error => {
11251186 // If PowerShell itself runs into problem and throws, catch and display error as raw output.
1126- console .log (error)
1187+ console .error (error)
1188+ // Stop listening to output, hide progress dialog and reset dialog
1189+ this .stopProgress ()
11271190 this .results [this .currentWorkflowIndex ] = {
11281191 error: true ,
11291192 returnType: ' raw' ,
0 commit comments