Skip to content

Commit

Permalink
Fixes issue when selects have null values (#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgliss authored Feb 1, 2023
1 parent ab172fd commit a62a3bd
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 39 deletions.
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ export default {
CaseTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.case_type.id)) {
this.items = [this.case_type].concat(this.items)
if (this.case_type) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.case_type.id)) {
this.items = [this.case_type].concat(this.items)
}
}
this.total = response.data.total
Expand Down
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/data/query/QuerySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ export default {
QueryApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.query.id)) {
this.items = [this.query].concat(this.items)
if (this.query) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.query.id)) {
this.items = [this.query].concat(this.items)
}
}
this.total = response.data.total
Expand Down
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/data/source/SourceSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ export default {
SourceApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.source.id)) {
this.items = [this.source].concat(this.items)
if (this.source) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.source.id)) {
this.items = [this.source].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ export default {
SourceDataFormatApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.dataFormat.id)) {
this.items = [this.dataFormat].concat(this.items)
if (this.dataFormat) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.dataFormat.id)) {
this.items = [this.dataFormat].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ export default {
SourceEnvironmentApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.environment.id)) {
this.items = [this.environment].concat(this.items)
if (this.environment) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.environment.id)) {
this.items = [this.environment].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ export default {
SourceStatusApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.status.id)) {
this.items = [this.status].concat(this.items)
if (this.status) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.status.id)) {
this.items = [this.status].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ export default {
SourceTransportApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.transport.id)) {
this.items = [this.transport].concat(this.items)
if (this.transport) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.transport.id)) {
this.items = [this.transport].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ export default {
SourceTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.type.id)) {
this.items = [this.type].concat(this.items)
if (this.type) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.type.id)) {
this.items = [this.type].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ export default {
DocumentApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.template.id)) {
this.items = [this.template].concat(this.items)
if (this.template) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.template.id)) {
this.items = [this.template].concat(this.items)
}
}
this.total = response.data.total
Expand Down
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/incident/IncidentSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ export default {
IncidentApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.incident.id)) {
this.items = [this.incident].concat(this.items)
if (this.incident) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.incident.id)) {
this.items = [this.incident].concat(this.items)
}
}
this.total = response.data.total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ export default {
IncidentTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.incident_type.id)) {
this.items = [this.incident_type].concat(this.items)
if (this.incident_type) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.incident_type.id)) {
this.items = [this.incident_type].concat(this.items)
}
}
this.total = response.data.total
Expand Down
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/project/ProjectSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ export default {
ProjectApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.project.id)) {
this.items = [this.project].concat(this.items)
if (this.project) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.project.id)) {
this.items = [this.project].concat(this.items)
}
}
this.total = response.data.total
Expand Down
8 changes: 5 additions & 3 deletions src/dispatch/static/dispatch/src/tag_type/TagTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ export default {
TagTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.tag_type.id)) {
this.items = [this.tag_type].concat(this.items)
if (this.tag_type) {
// check to see if the current selection is available in the list and if not we add it
if (!this.items.find((match) => match.id === this.tag_type.id)) {
this.items = [this.tag_type].concat(this.items)
}
}
this.total = response.data.total
Expand Down

0 comments on commit a62a3bd

Please sign in to comment.