Skip to content

Commit

Permalink
Resolve typepscript errors in StringList.vue
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Rak <[email protected]>
  • Loading branch information
rak-phillip committed Sep 23, 2024
1 parent 39928dd commit 2a6058d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default defineComponent({
return this.t('generic.invalidCron');
}
try {
const hint = cronstrue.toString(this.value.toString());
const hint = cronstrue.toString(this.value || '');
return hint;
} catch (e) {
Expand Down Expand Up @@ -332,7 +332,7 @@ export default defineComponent({
v-bind="$attrs"
:maxlength="_maxlength"
:disabled="isDisabled"
:value="value.toString()"
:value="value || ''"
:placeholder="_placeholder"
autocapitalize="off"
:class="{ conceal: type === 'multiline-password' }"
Expand Down
20 changes: 6 additions & 14 deletions pkg/rancher-components/src/components/StringList/StringList.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import { PropType, defineComponent } from 'vue';
import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
import { findStringIndex, hasDuplicatedStrings } from '@shell/utils/array';
import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
type Error = 'duplicate';
type ErrorMessages = Record<Error, string>;
Expand Down Expand Up @@ -30,19 +29,15 @@ const CLASS = {
* Manage a list of strings
*/
export default defineComponent({
name: 'StringList',
components: { LabeledInput },
props: {
props: {
/**
* The items source
*/
items: {
type: Array as PropType<string[]>,
default() {
return [];
},
type: Array as PropType<string[]>,
default: () => [],
},
/**
* Determines if items with same text will be treated differently, depending on the letters case
Expand Down Expand Up @@ -77,10 +72,8 @@ export default defineComponent({
* Custom Error messages
*/
errorMessages: {
type: Object as PropType<ErrorMessages>,
default() {
return {} as ErrorMessages;
},
type: Object as PropType<ErrorMessages>,
default: () => ({} as ErrorMessages),
},
/**
* Enables bulk addition and defines the delimiter to split the input string.
Expand Down Expand Up @@ -415,7 +408,6 @@ export default defineComponent({
this.$emit('change', items);
},
},
});
</script>

Expand Down

0 comments on commit 2a6058d

Please sign in to comment.