@byu-oit/vue-decision-processing-components 8.37.2 → 8.37.3

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.
@@ -72,6 +72,14 @@
72
72
  ...mapGetters(['flagByValue']),
73
73
  flag () { return this.flagByValue(this.flagValue) },
74
74
  btnClass () {
75
+ if (this.flag.state != null && this.flag.state != '') {
76
+ return {
77
+ 'btn' : true,
78
+ 'btn-sm' : true,
79
+ 'btn-outline-secondary' : ['indeterminate', 'pass'].includes(this.flag.state.toLowerCase()),
80
+ 'btn-outline-danger' : ['fail', 'error'].includes(this.flag.state.toLowerCase())
81
+ }
82
+ }
75
83
  const set = this.flag.isSet
76
84
  const cleared = this.flag.isCleared
77
85
  return {
@@ -83,6 +91,9 @@
83
91
  }
84
92
  },
85
93
  btnText () {
94
+ if (this.flag.state != null && this.flag.state != '') {
95
+ return ['pass', 'indeterminate'].includes(this.flag.state.toLowerCase()) ? 'set flag' : 'clear flag'
96
+ }
86
97
  return this.flag.isActive ? 'clear flag' : 'set flag'
87
98
  },
88
99
  flagIcon () {
@@ -90,7 +101,7 @@
90
101
  if (this.flag == null){
91
102
  return faSquare
92
103
  }
93
- if (this.flag.state != null){
104
+ if (this.flag.state != null && this.flag.state != '') {
94
105
  switch (this.flag.state.toLowerCase()){
95
106
  case 'pass':
96
107
  return faCheck
@@ -111,7 +122,7 @@
111
122
  if (this.flag == null){
112
123
  return `bg-${this.flagIndeterminateColor}`
113
124
  }
114
- if (this.flag.state != null){
125
+ if (this.flag.state != null && this.flag.state != ''){
115
126
  switch (this.flag.state.toLowerCase()){
116
127
  case 'pass':
117
128
  return `bg-${this.flagPassColor}`
package/FlagDialog.vue CHANGED
@@ -38,7 +38,7 @@
38
38
  </div>
39
39
  <span class="modal-footer">
40
40
  <button v-if="editing" class="btn btn-outline-primary" @click="updateFlag">Save</button>
41
- <button v-else class="btn btn-outline-primary" @click="startEditing">{{flag.isSet ? flag.isCleared ? 'Reset' : 'Clear' : 'Set'}} Flag</button>
41
+ <button v-else class="btn btn-outline-primary" @click="startEditing">{{ startEditingText() }} Flag</button>
42
42
  <button class="btn btn-outline-secondary" @click="close">Cancel</button>
43
43
  </span>
44
44
  </div>
@@ -72,14 +72,6 @@ export default {
72
72
  note: ''
73
73
  }
74
74
  },
75
- watch: {
76
- flag (newValue) {
77
- // Go straight to editing if the flag is unset, no status to display
78
- if (newValue.isActive !== undefined && !newValue.isActive) {
79
- this.editing = true
80
- }
81
- }
82
- },
83
75
  methods: {
84
76
  ...mapActions(['flagUpdate']),
85
77
  beforeOpen (event) {
@@ -99,14 +91,27 @@ export default {
99
91
  this.editing = true
100
92
  },
101
93
  updateFlag () {
102
- const {isSet, isCleared} = this.flag
103
- const newFlagState = isSet ? isCleared ? 'set' : 'clear' : 'set'
94
+ let newFlagState;
95
+ if (this.flag.state != null && this.flag.state != '') {
96
+ newFlagState = ['indeterminate', 'pass'].includes(this.flag.state.toLowerCase()) ? 'set' : 'clear'
97
+ }
98
+ else {
99
+ const {isSet, isCleared} = this.flag
100
+ newFlagState = isSet ? isCleared ? 'set' : 'clear' : 'set'
101
+ }
104
102
  return this.flagUpdate({
105
103
  applicationUuid: this.appId,
106
104
  flagState: newFlagState,
107
105
  flagValue: this.flag.value,
108
106
  note: this.note
109
107
  }).then(() => this.$modal.hide('flag-modal'))
108
+ },
109
+ startEditingText () {
110
+ const state = this.flag.state
111
+ if (state != null && state != '') {
112
+ return ['indeterminate', 'pass'].includes(state.toLowerCase()) ? 'Set' : 'Clear'
113
+ }
114
+ return this.flag.isSet ? this.flag.isCleared ? 'Reset' : 'Clear' : 'Set'
110
115
  }
111
116
  }
112
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.37.2",
3
+ "version": "8.37.3",
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",