mirror of https://github.com/rancher/dashboard.git
PR changes addressed, cleaned up unnecessary nonsense
This commit is contained in:
parent
61ba52f406
commit
7ae1878c38
|
|
@ -28,11 +28,6 @@ export default {
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
|
||||||
selectValue: {
|
|
||||||
type: String,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
|
|
||||||
optionLabel: {
|
optionLabel: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'label',
|
default: 'label',
|
||||||
|
|
@ -48,16 +43,6 @@ export default {
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
textValue: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
|
|
||||||
placeholder: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
|
|
||||||
reduce: {
|
reduce: {
|
||||||
default: (e) => {
|
default: (e) => {
|
||||||
if (e && typeof e === 'object' && e.value !== undefined) {
|
if (e && typeof e === 'object' && e.value !== undefined) {
|
||||||
|
|
@ -71,27 +56,20 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return { selected: this.value || null };
|
||||||
selected: this.selectValue || null,
|
|
||||||
string: this.textValue,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
serviceNameNew() {
|
serviceNameNew() {
|
||||||
let isNew = false;
|
if (this.value !== null) {
|
||||||
|
const findSelected = this.options.find(option => this.value === option.metadata.name);
|
||||||
|
|
||||||
if (this.selected !== null) {
|
if (!findSelected) {
|
||||||
const findSelected = this.options.find(name => this.selected.includes(name.id));
|
return true;
|
||||||
|
|
||||||
if (findSelected === undefined && findSelected !== '') {
|
|
||||||
isNew = true;
|
|
||||||
} else {
|
|
||||||
isNew = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isNew;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -105,31 +83,25 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
change() {
|
change() {
|
||||||
if (this.selected !== null && this.selected.metadata !== undefined) {
|
const selectedOption = this.options.find(option => option.metadata.id === this.selected.serviceAccount);
|
||||||
this.$emit('input', this.selected.metadata.name);
|
|
||||||
} else {
|
if (selectedOption) {
|
||||||
for (let i = 0; i < this.options.length; i++) {
|
this.$emit('input', selectedOption.metadata.name);
|
||||||
if (this.selected !== null && this.selected.includes(this.options[i].id)) {
|
|
||||||
this.$emit('input', this.options[i].metadata.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
blurCreate(e) {
|
blurCreate(e) {
|
||||||
const searched = e;
|
const searched = e;
|
||||||
|
|
||||||
if (searched !== undefined && searched !== '') {
|
if (searched) {
|
||||||
this.selected = searched;
|
this.selected = searched;
|
||||||
this.$emit('input', searched);
|
this.$emit('input', searched);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clearSearch(event) {
|
clearSearch(event) {
|
||||||
if (event.pointerId === 1) {
|
this.selected = null;
|
||||||
this.selected = null;
|
this.$emit('input', null);
|
||||||
this.$emit('input', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue