1
1
<template >
2
2
<q-page class =" flex" >
3
+ <!-- Right drawer displaying history table -->
4
+ <q-drawer
5
+ v-model =" historyVisible"
6
+ :width =" historyWidth"
7
+ side =" right"
8
+ behavior =" desktop"
9
+ overlay
10
+ >
11
+ <div class =" row fit" >
12
+ <div class =" col" >
13
+ <q-table
14
+ :data =" history"
15
+ :columns =" historyColumns"
16
+ :pagination.sync =" scriptsPagination"
17
+ wrap-cells
18
+ row-key =" index"
19
+ hide-bottom
20
+ hide-header
21
+ >
22
+ <!-- Template showing command date -->
23
+ <template v-slot :body-cell-date =" props " >
24
+ <q-td
25
+ :props =" props"
26
+ auto-width
27
+ class =" text-no-wrap"
28
+ >
29
+ {{ props.value}}
30
+ </q-td >
31
+ </template >
32
+ <!-- Template showing workflow steps -->
33
+ <template v-slot :body-cell-steps =" props " >
34
+ <q-td
35
+ :props =" props"
36
+ auto-width
37
+ class =" text-no-wrap"
38
+ >
39
+ {{ props.row.currentWorkflowIndex +1 }}/{{ props.row.currentCommandMaster.workflow ? props.row.currentCommandMaster.workflow.length + 1 : 1 }}
40
+ </q-td >
41
+ </template >
42
+ <!-- Template showing friendly command name and 'Cmdlet' which gets executed -->
43
+ <template v-slot :body-cell-commandName =" props " >
44
+ <q-td :props =" props" >
45
+ <div >
46
+ {{ props.row.currentCommandMaster.friendlyName ? props.row.currentCommandMaster.friendlyName[language] ? props.row.currentCommandMaster.friendlyName[language] : props.row.currentCommandMaster.friendlyName.default : '' }}
47
+ </div >
48
+ <div >
49
+ {{ props.row.currentCommandMaster.commandName }}
50
+ </div >
51
+ </q-td >
52
+ </template >
53
+ <!-- Template showing results button -->
54
+ <template v-slot :body-cell-results =" props " >
55
+ <q-td
56
+ :props =" props"
57
+ auto-width
58
+ >
59
+ <q-btn
60
+ flat
61
+ @click =" showCommandDiag(props.row)"
62
+ >{{ $t('launch') }}</q-btn >
63
+ </q-td >
64
+ </template >
65
+ <!-- Template showing execute button -->
66
+ <template v-slot :body-cell-execute =" props " >
67
+ <q-td
68
+ :props =" props"
69
+ auto-width
70
+ >
71
+ <q-btn
72
+ flat
73
+ @click =" showCommandDiag(props.row)"
74
+ >{{ $t('launch') }}</q-btn >
75
+ </q-td >
76
+ </template >
77
+ </q-table >
78
+ </div >
79
+ </div >
80
+ </q-drawer >
3
81
<!-- Dialog window is shown when command is selected with 'Execute' button -->
4
82
<q-dialog
5
83
v-model =" displayCommandDiag"
430
508
</template >
431
509
432
510
<script >
433
- import { exportFile } from ' quasar'
511
+ import { exportFile , date } from ' quasar'
434
512
import { mapGetters } from ' vuex'
435
513
import { QMarkdown } from ' @quasar/quasar-ui-qmarkdown'
436
514
import Prism from ' vue-prismjs'
@@ -489,14 +567,22 @@ export default {
489
567
' Switch' : [' q-toggle' , false ]
490
568
}, // Column definitions for scripts table
491
569
scriptsColumns: [
492
- { name: ' icon' , align: ' center' , label: ' Icon' , field : row => row .icon , sortable: true , classes: ' gt-xs' },
493
- { name: ' commandName' , required: true , label: ' Command Name' , align: ' left' , field : row => row .commandName , format : val => ` ${ val} ` , sortable: true , classes: ' text-no-wrap' },
494
- { name: ' friendlyName' , label: ' Friendly Name' , align: ' left' , field : row => row .friendlyName ? row .friendlyName [(this .$i18n .locale )] ? row .friendlyName [(this .$i18n .locale )] : row .friendlyName [' default' ] : ' ' , format : val => ` ${ val} ` , sortable: true , classes: ' hidden' },
495
- { name: ' description' , align: ' left' , label: ' Description' , field : row => row .description ? row .description [(this .$i18n .locale )] ? row .description [(this .$i18n .locale )] : row .description .default : ' ' , sortable: true , classes: ' gt-sm' },
496
- { name: ' spacer' , align: ' center' , label: ' Spacer' , field: ' ' , sortable: false },
497
- { name: ' favorite' , align: ' center' , label: ' Icon' , field: ' star' , sortable: true , classes: ' gt-xs' },
498
- { name: ' help' , align: ' center' , label: ' Icon' , field: ' help' , sortable: true , classes: ' gt-xs' },
499
- { name: ' execute' , label: ' Execute' , field: ' Execute' , sortable: true , sort : (a , b ) => parseInt (a, 10 ) - parseInt (b, 10 ) }
570
+ { name: ' icon' , label: ' Icon' , classes: ' gt-xs' },
571
+ { name: ' commandName' , label: ' Command Name' , align: ' left' , field : row => row .commandName , classes: ' text-no-wrap' },
572
+ { name: ' friendlyName' , label: ' Friendly Name' , field : row => row .friendlyName ? row .friendlyName [(this .$i18n .locale )] ? row .friendlyName [(this .$i18n .locale )] : row .friendlyName [' default' ] : ' ' , classes: ' hidden' },
573
+ { name: ' description' , label: ' Description' , align: ' left' , field : row => row .description ? row .description [(this .$i18n .locale )] ? row .description [(this .$i18n .locale )] : row .description .default : ' ' , classes: ' gt-sm' },
574
+ { name: ' spacer' , label: ' Spacer' },
575
+ { name: ' favorite' , label: ' Icon' , classes: ' gt-xs' },
576
+ { name: ' help' , label: ' Icon' , classes: ' gt-xs' },
577
+ { name: ' execute' , label: ' Execute' }
578
+ ],
579
+ historyColumns: [
580
+ { name: ' date' , label: ' Date' , field : row => date .formatDate (row .date , ' YYYY-MM-DD HH:mm:ss' ), classes: ' gt-xs' },
581
+ { name: ' steps' , label: ' Steps' },
582
+ { name: ' commandName' , label: ' Command Name' , align: ' left' , classes: ' text-no-wrap' },
583
+ { name: ' spacer' , label: ' Spacer' },
584
+ { name: ' results' , label: ' Results' },
585
+ { name: ' execute' , label: ' Execute' }
500
586
],
501
587
// table pagination options for scripts table
502
588
scriptsPagination: { rowsPerPage: 0 },
@@ -505,7 +591,7 @@ export default {
505
591
}
506
592
},
507
593
computed: {
508
- ... mapGetters (' lazystore' , [' getLanguage' , ' getSearch' , ' getScriptsArray' , ' getDefinitions' , ' getCommandMaximized' , ' getAlwaysConfirm' , ' getHistoryLength' , ' getHistory' ]),
594
+ ... mapGetters (' lazystore' , [' getLanguage' , ' getSearch' , ' getScriptsArray' , ' getDefinitions' , ' getCommandMaximized' , ' getAlwaysConfirm' , ' getHistoryLength' , ' getHistoryVisible ' , ' getHistory' ]),
509
595
language : function () {
510
596
return this .getLanguage
511
597
},
@@ -532,6 +618,14 @@ export default {
532
618
historyLength : function () {
533
619
return this .getHistoryLength
534
620
},
621
+ historyVisible: {
622
+ get () {
623
+ return this .getHistoryVisible
624
+ },
625
+ set (val) {
626
+ this .$store .dispatch (' lazystore/setHistoryVisible' , val)
627
+ }
628
+ },
535
629
history: {
536
630
get () {
537
631
return this .getHistory
@@ -541,6 +635,9 @@ export default {
541
635
this .$store .dispatch (' lazystore/setHistory' , history)
542
636
}
543
637
},
638
+ historyWidth : function () {
639
+ return this .$q .screen .width
640
+ },
544
641
resultsColumns: {
545
642
get () {
546
643
let columns = [
@@ -868,6 +965,7 @@ export default {
868
965
}
869
966
// Save to history
870
967
this .history = {
968
+ date: new Date (),
871
969
currentCommand: this .currentCommand ,
872
970
currentCommandMaster: this .currentCommandMaster ,
873
971
currentWorkflowIndex: this .currentWorkflowIndex ,
0 commit comments