@byu-oit/vue-decision-processing-components 8.36.2 → 8.37.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
  <script>
31
31
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
32
- import { faCheck, faHourglassHalf, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'
32
+ import { faCheck, faExclamationTriangle, faSquare, faMinus, faHourglassHalf } from '@fortawesome/free-solid-svg-icons'
33
33
  import { mapState, mapGetters } from 'vuex'
34
34
 
35
35
  export default {
@@ -44,19 +44,70 @@
44
44
  endorsementPendingFlag () { return this.flagByValue('EP') },
45
45
  endorsementDeniedFlag () { return this.flagByValue('ED') },
46
46
  endorsementIssuesFlag () { return this.flagByValue('EI') },
47
+ endorsementNewFlag () { return this.flagByValue('endorsement')},
47
48
  icon () {
49
+ if (this.endorsementNewFlag != null){
50
+ switch(this.endorsementNewFlag.state.toLowerCase()){
51
+ case 'pass':
52
+ return faCheck
53
+ case 'fail':
54
+ return faMinus
55
+ case 'error':
56
+ return faExclamationTriangle
57
+ case 'indeterminate':
58
+ return faSquare
59
+ default:
60
+ return faExclamationTriangle
61
+ }
62
+ }
63
+ //BELOW THIS IS THE OLD SYSTEM'S FLAG LOGIC (before the 'state' column was added)
48
64
  if (this.endorsementDeniedFlag.isActive) return faExclamationTriangle
49
65
  else if (this.endorsementIssuesFlag.isActive) return faExclamationTriangle
50
66
  else if (this.endorsementPendingFlag.isActive) return faHourglassHalf
51
67
  return faCheck
52
68
  },
53
69
  statusClass () {
70
+ if (this.endorsementNewFlag != null){
71
+ switch(this.endorsementNewFlag.state.toLowerCase()){
72
+ case 'pass':
73
+ return { 'text-success': true }
74
+ case 'fail':
75
+ return { 'text-danger': true }
76
+ case 'error':
77
+ return { 'text-danger': true, 'font-weight-bold': true }
78
+ case 'indeterminate':
79
+ return { 'text-dark': true }
80
+ default:
81
+ return { 'text-danger': true, 'font-weight-bold': true }
82
+ }
83
+ }
84
+ //BELOW THIS IS THE OLD SYSTEM'S FLAG LOGIC (before the 'state' column was added)
54
85
  if (this.endorsementDeniedFlag.isActive) return { 'text-danger': true }
55
86
  else if (this.endorsementIssuesFlag.isActive) return { 'text-danger': true }
56
87
  else if (this.endorsementPendingFlag.isActive) return { 'text-dark': true, 'font-weight-bold': true }
57
88
  return { 'text-success': true }
58
89
  },
59
90
  endorsementStatus () {
91
+ if (this.endorsementNewFlag != null) {
92
+ if (this.endorsementNewFlag.message != null && this.endorsementNewFlag.message.length > 0) {
93
+ return this.endorsementNewFlag.message
94
+ }
95
+ else {
96
+ switch (this.endorsementNewFlag.state.toLowerCase()) {
97
+ case 'pass':
98
+ return 'Everything looks good!'
99
+ case 'fail':
100
+ return 'Requires additional attention.'
101
+ case 'error':
102
+ return 'An error occurred. Try again later.'
103
+ case 'indeterminate':
104
+ return 'No data available.'
105
+ default:
106
+ return 'An error occurred. Try again later.'
107
+ }
108
+ }
109
+ }
110
+ //BELOW THIS IS THE OLD SYSTEM'S FLAG LOGIC (before the 'state' column was added)
60
111
  if (this.endorsementDeniedFlag.isActive) return `Endorsement Denied`
61
112
  else if (this.endorsementIssuesFlag.isActive) return `Endorsement Issues`
62
113
  else if (this.endorsementPendingFlag.isActive) return `Endorsement Pending`
@@ -23,6 +23,7 @@
23
23
  <button :class="btnClass" @click="flagModal">
24
24
  {{btnText}}
25
25
  </button>
26
+ <!-- <slot name="refreshButton"></slot>-->
26
27
  </div>
27
28
  <div v-if="hasSummary" class="summary">
28
29
  <slot name="summary"></slot>
@@ -32,13 +33,11 @@
32
33
  <slot></slot>
33
34
  </div>
34
35
  </div>
35
- </span>
36
36
  </template>
37
37
  <script>
38
38
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
39
- import { faCheck, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'
39
+ import { faCheck,faExclamationTriangle,faSquare,faMinus } from '@fortawesome/free-solid-svg-icons'
40
40
  import { mapGetters } from 'vuex'
41
-
42
41
  import ExpandIndicator from './ExpandIndicator'
43
42
 
44
43
  export default {
@@ -58,7 +57,11 @@
58
57
  },
59
58
  'flagActiveColor': { type: String },
60
59
  'flagInactiveColor': { type: String },
61
- 'hideIfUnset': { type: Boolean }
60
+ 'hideIfUnset': { type: Boolean },
61
+ 'flagPassColor': { type: String, default: 'success' },
62
+ 'flagErrorColor': { type: String, default: 'dark' },
63
+ 'flagFailColor': { type: String, default: 'danger' },
64
+ 'flagIndeterminateColor': { type: String, default: 'secondary' }
62
65
  },
63
66
  data () {
64
67
  return {
@@ -83,9 +86,46 @@
83
86
  return this.flag.isActive ? 'clear flag' : 'set flag'
84
87
  },
85
88
  flagIcon () {
89
+ //If there is no flag set, the state is 'indeterminate'
90
+ if (this.flag == null){
91
+ return faSquare
92
+ }
93
+ if (this.flag.state != null){
94
+ switch (this.flag.state.toLowerCase()){
95
+ case 'pass':
96
+ return faCheck
97
+ case 'fail':
98
+ return faMinus
99
+ case 'error':
100
+ return faExclamationTriangle
101
+ case 'indeterminate':
102
+ return faSquare
103
+ default:
104
+ return faExclamationTriangle
105
+ }
106
+ }
86
107
  return this.flag.isActive ? faExclamationTriangle : faCheck
87
108
  },
88
109
  flagBg () {
110
+ //If there is no flag set, the state is 'indeterminate'
111
+ if (this.flag == null){
112
+ return `bg-${this.flagIndeterminateColor}`
113
+ }
114
+ if (this.flag.state != null){
115
+ switch (this.flag.state.toLowerCase()){
116
+ case 'pass':
117
+ return `bg-${this.flagPassColor}`
118
+ case 'fail':
119
+ return `bg-${this.flagFailColor}`
120
+ case 'error':
121
+ return `bg-${this.flagErrorColor}`
122
+ case 'indeterminate':
123
+ return `bg-${this.flagIndeterminateColor}`
124
+ default:
125
+ return `bg-${this.flagErrorColor}`
126
+ }
127
+ }
128
+
89
129
  const stateAware = this.flagActiveColor && this.flagInactiveColor
90
130
  if (!stateAware) return `bg-${this.flagType}`
91
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.36.2",
3
+ "version": "8.37.0-0",
4
4
  "description": "Vue components shared between decision processing systems for the CES schools.",
5
5
  "dependencies": {
6
6
  "@fortawesome/fontawesome-free": "^5.15.4",
package/parsers/packet.js CHANGED
@@ -12,6 +12,8 @@ export const parseFlag = f => {
12
12
  const clearedBy = get(f, 'id_cleared_by.description')
13
13
  const clearedById = get(f, 'id_cleared_by.value')
14
14
  const type = get(f, 'type.value')
15
+ const state = get(f, 'state.value')
16
+ const message = get(f, 'message.value')
15
17
  return {
16
18
  dateTimeCleared,
17
19
  setBy,
@@ -21,7 +23,9 @@ export const parseFlag = f => {
21
23
  dateTimeSet,
22
24
  clearedBy,
23
25
  clearedById,
24
- type
26
+ type,
27
+ state,
28
+ message
25
29
  }
26
30
  }
27
31
 
@@ -17,14 +17,21 @@ const blockingVirtualFlag = flags => {
17
17
  }
18
18
 
19
19
  const endorseVirtualFlag = flags => {
20
+ // Get new endorsement flag data
21
+ const endorsementNewFlag = flags.filter(f => f.value === 'endorsement')
22
+ if(endorsementNewFlag.length > 0) return endorsementNewFlag[0]
23
+
24
+ // Maintain old functionality
20
25
  const edFlag = flags.filter(f => f.value === 'ED').filter(f => f.isActive)
21
26
  const eiFlag = flags.filter(f => f.value === 'EI').filter(f => f.isActive)
22
27
  const allFlags = edFlag.concat(eiFlag)
23
28
  if (allFlags.length > 0) return allFlags[0]
24
- const value = 'endorse'
29
+
30
+ // Default if no flag data is found
31
+ const value = 'endorsement'
25
32
  const name = 'Endorsement Problem'
26
33
  const type = 'Process'
27
- return { value, name, type, isActive: false, isSet: false, isCleared: false, isBlocking: true }
34
+ return { value, name, type, isActive: false, isSet: false, isCleared: false, isBlocking: true, state: 'indeterminate' }
28
35
  }
29
36
 
30
37
  // getters
@@ -38,7 +45,7 @@ export const getters = {
38
45
  const flags = getters.flags
39
46
  if (flagValue === 'blocking') {
40
47
  return blockingVirtualFlag(flags)
41
- } else if (flagValue === 'endorse') {
48
+ } else if (flagValue === 'endorsement') {
42
49
  return endorseVirtualFlag(flags)
43
50
  }
44
51
  const flag = flags.find(({ value }) => value === flagValue)
@@ -86,7 +93,9 @@ export const convertFlag = flag => {
86
93
  dateTimeSet,
87
94
  setBy,
88
95
  dateTimeCleared,
89
- clearedBy
96
+ clearedBy,
97
+ state,
98
+ message
90
99
  } = flag
91
100
  const isBlocking = /process|wait/i.test(type)
92
101
  return {
@@ -100,7 +109,9 @@ export const convertFlag = flag => {
100
109
  setBy,
101
110
  dateTimeCleared,
102
111
  clearedBy,
103
- isBlocking
112
+ isBlocking,
113
+ state,
114
+ message
104
115
  }
105
116
  }
106
117