Skip to content

Commit e8f455b

Browse files
sreenathsJohanAhlen
authored andcommitted
[ui] Vue 3 - Migrated StatusIndicator component
1 parent 53780d5 commit e8f455b

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

desktop/core/src/desktop/js/components/StatusIndicator.vue

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,42 @@
2525

2626
<script lang="ts">
2727
import HueIcon from './HueIcon.vue';
28-
import Vue from 'vue';
29-
import Component from 'vue-class-component';
30-
import { Prop } from 'vue-property-decorator';
28+
29+
import { defineComponent } from 'vue';
3130
3231
// TODO: Support additional statuses
3332
// TODO: Support spinner
34-
const ICON_MAPPING = {
33+
const ICON_MAPPING: { [value: string]: string } = {
3534
success: 'hi-status-success',
3635
error: 'hi-status-error',
3736
warning: 'hi-status-warning',
3837
stopped: 'hi-status-stopped'
3938
};
4039
41-
@Component({
42-
components: { HueIcon }
43-
})
44-
export default class StatusIndicator extends Vue {
45-
@Prop({ required: true, default: 'unknown' })
46-
value: string;
40+
export default defineComponent({
41+
components: {
42+
HueIcon
43+
},
4744
48-
get icon(): string | null {
49-
return ICON_MAPPING[this.value.toLowerCase()];
50-
}
45+
props: {
46+
value: {
47+
type: String,
48+
required: true,
49+
default: 'unknown'
50+
}
51+
},
52+
53+
computed: {
54+
icon(): string | undefined {
55+
return ICON_MAPPING[this.value.toLowerCase()];
56+
},
5157
52-
get spin(): boolean {
53-
const lowerValue = this.value.toLowerCase();
54-
return lowerValue === 'started' || lowerValue === 'running';
58+
spin(): boolean {
59+
const lowerValue = this.value.toLowerCase();
60+
return lowerValue === 'started' || lowerValue === 'running';
61+
}
5562
}
56-
}
63+
});
5764
</script>
5865

5966
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)