Skip to content

Commit b89488e

Browse files
committed
Fully functional history tab
1 parent 461b796 commit b89488e

File tree

3 files changed

+131
-101
lines changed

3 files changed

+131
-101
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lazy-admin",
3-
"version": "0.3.7",
3+
"version": "0.4.0",
44
"description": "GUI for PowerShell scripts to simplify day to day IT tasks.",
55
"productName": "Lazy Admin",
66
"cordovaId": "eu.houby-studio.lazy-admin",

src/pages/ScriptsPage.vue

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<q-drawer
55
v-model="historyVisible"
66
:width="historyWidth"
7+
@hide="resetAllParams"
78
side="right"
89
behavior="desktop"
910
overlay
@@ -509,7 +510,7 @@
509510
</template>
510511

511512
<script>
512-
import { exportFile, date } from 'quasar'
513+
import { exportFile, date, extend } from 'quasar'
513514
import { mapGetters } from 'vuex'
514515
import { QMarkdown } from '@quasar/quasar-ui-qmarkdown'
515516
import Prism from 'vue-prismjs'
@@ -671,13 +672,14 @@ export default {
671672
this.displayCommandDiag = !this.displayCommandDiag
672673
},
673674
historyShowCommandDiag (commandCtx) {
674-
console.log(commandCtx)
675-
// Mutates history object, need to create new instance
676-
// this.currentCommand = commandCtx.currentCommand
677-
// this.currentCommandMaster = commandCtx.currentCommandMaster
678-
// this.currentWorkflowIndex = commandCtx.currentWorkflowIndex
679-
// this.returnParams = commandCtx.returnParams
680-
// this.displayCommandDiag = !this.displayCommandDiag
675+
// Restore required objects from history, so user can run command again
676+
this.currentCommand = extend({}, commandCtx.currentCommand)
677+
this.currentCommandMaster = extend({}, commandCtx.currentCommandMaster)
678+
this.currentWorkflowIndex = commandCtx.currentWorkflowIndex
679+
this.returnParams = extend({}, commandCtx.returnParams)
680+
this.results = extend({}, commandCtx.results)
681+
this.$set(this.resultsSelected, [this.currentWorkflowIndex], [])
682+
this.displayCommandDiag = !this.displayCommandDiag
681683
},
682684
showHelpDiag (helpCtx) {
683685
this.externalHelpFile = this.$t('loadingHelp')
@@ -702,12 +704,11 @@ export default {
702704
this.displayResultsDiag = !this.displayResultsDiag
703705
},
704706
historyShowResultsDiag (resultspCtx) {
705-
// this.$set(this.currentWorkflowIndex, [this.currentWorkflowIndex], [])
706-
// this.$set(this.results[this.currentWorkflowIndex], [this.currentWorkflowIndex], [])
707-
// TODO: Won't this change values from history?
707+
this.currentCommand = extend({}, resultspCtx.currentCommand)
708+
this.currentCommandMaster = extend({}, resultspCtx.currentCommandMaster)
708709
this.currentWorkflowIndex = resultspCtx.currentWorkflowIndex
709-
this.results = resultspCtx.results
710-
710+
this.results = extend({}, resultspCtx.results)
711+
this.$set(this.resultsSelected, [this.currentWorkflowIndex], [])
711712
this.displayResultsDiag = !this.displayResultsDiag
712713
},
713714
showPreExecuteCheck () {
@@ -829,6 +830,7 @@ export default {
829830
},
830831
// Processes selected results to parameters and pushes next workflow step to current command dialog
831832
nextWorkflowStep () {
833+
this.displayCommandDiag = true
832834
this.displayResultsDiag = false
833835
this.currentCommand = this.currentCommandMaster.workflow[this.currentWorkflowIndex] // Set current workflow step as currentCommand
834836
// For each parameter expected in passedParameters, loop through all of them and then throigh all selections to either join them to single string or insert as numbered parameters separately to returnParams

0 commit comments

Comments
 (0)