Skip to content

Commit 9a3de43

Browse files
silverwindlafriks
andauthored
Reorder blocks in vue SFCs (#26874)
The [recommended order](https://vuejs.org/guide/scaling-up/sfc.html) for SFC blocks is script -> template -> style, which we were violating because template and script were swapped. I do find script first also easier to read because the imports are on top, letting me immideatly see a component's dependencies. This is a pure cut-paste refactor with some removal of some empty lines. --------- Co-authored-by: Lauris BH <[email protected]>
1 parent 79f7329 commit 9a3de43

13 files changed

+661
-679
lines changed

web_src/js/components/ActionRunStatus.vue

+10-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
Please also update the template file above if this vue is modified.
33
action status accepted: success, skipped, waiting, blocked, running, failure, cancelled, unknown
44
-->
5-
<template>
6-
<span class="gt-df gt-ac" :data-tooltip-content="localeStatus" v-if="status">
7-
<SvgIcon name="octicon-check-circle-fill" class="text green" :size="size" :class-name="className" v-if="status === 'success'"/>
8-
<SvgIcon name="octicon-skip" class="text grey" :size="size" :class-name="className" v-else-if="status === 'skipped'"/>
9-
<SvgIcon name="octicon-clock" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'waiting'"/>
10-
<SvgIcon name="octicon-blocked" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'blocked'"/>
11-
<SvgIcon name="octicon-meter" class="text yellow" :size="size" :class-name="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
12-
<SvgIcon name="octicon-x-circle-fill" class="text red" :size="size" v-else-if="['failure', 'cancelled', 'unknown'].includes(status)"/>
13-
</span>
14-
</template>
15-
165
<script>
176
import {SvgIcon} from '../svg.js';
187

@@ -38,3 +27,13 @@ export default {
3827
},
3928
};
4029
</script>
30+
<template>
31+
<span class="gt-df gt-ac" :data-tooltip-content="localeStatus" v-if="status">
32+
<SvgIcon name="octicon-check-circle-fill" class="text green" :size="size" :class-name="className" v-if="status === 'success'"/>
33+
<SvgIcon name="octicon-skip" class="text grey" :size="size" :class-name="className" v-else-if="status === 'skipped'"/>
34+
<SvgIcon name="octicon-clock" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'waiting'"/>
35+
<SvgIcon name="octicon-blocked" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'blocked'"/>
36+
<SvgIcon name="octicon-meter" class="text yellow" :size="size" :class-name="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
37+
<SvgIcon name="octicon-x-circle-fill" class="text red" :size="size" v-else-if="['failure', 'cancelled', 'unknown'].includes(status)"/>
38+
</span>
39+
</template>

web_src/js/components/ActivityHeatmap.vue

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
<template>
2-
<div class="total-contributions">
3-
{{ locale.contributions_in_the_last_12_months }}
4-
</div>
5-
<calendar-heatmap
6-
:locale="locale"
7-
:no-data-text="locale.no_contributions"
8-
:tooltip-unit="locale.contributions"
9-
:end-date="endDate"
10-
:values="values"
11-
:range-color="colorRange"
12-
@day-click="handleDayClick($event)"
13-
/>
14-
</template>
151
<script>
162
import {CalendarHeatmap} from 'vue3-calendar-heatmap';
173
@@ -67,3 +53,17 @@ export default {
6753
},
6854
};
6955
</script>
56+
<template>
57+
<div class="total-contributions">
58+
{{ locale.contributions_in_the_last_12_months }}
59+
</div>
60+
<calendar-heatmap
61+
:locale="locale"
62+
:no-data-text="locale.no_contributions"
63+
:tooltip-unit="locale.contributions"
64+
:end-date="endDate"
65+
:values="values"
66+
:range-color="colorRange"
67+
@day-click="handleDayClick($event)"
68+
/>
69+
</template>

web_src/js/components/ContextPopup.vue

+24-25
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
<template>
2-
<div ref="root">
3-
<div v-if="loading" class="ui active centered inline loader"/>
4-
<div v-if="!loading && issue !== null">
5-
<p><small>{{ issue.repository.full_name }} on {{ createdAt }}</small></p>
6-
<p><svg-icon :name="icon" :class="['text', color]"/> <strong>{{ issue.title }}</strong> #{{ issue.number }}</p>
7-
<p>{{ body }}</p>
8-
<div>
9-
<div
10-
v-for="label in labels"
11-
:key="label.name"
12-
class="ui label"
13-
:style="{ color: label.textColor, backgroundColor: label.color }"
14-
>
15-
{{ label.name }}
16-
</div>
17-
</div>
18-
</div>
19-
<div v-if="!loading && issue === null">
20-
<p><small>{{ i18nErrorOccurred }}</small></p>
21-
<p>{{ i18nErrorMessage }}</p>
22-
</div>
23-
</div>
24-
</template>
25-
261
<script>
272
import $ from 'jquery';
283
import {SvgIcon} from '../svg.js';
@@ -115,3 +90,27 @@ export default {
11590
}
11691
};
11792
</script>
93+
<template>
94+
<div ref="root">
95+
<div v-if="loading" class="ui active centered inline loader"/>
96+
<div v-if="!loading && issue !== null">
97+
<p><small>{{ issue.repository.full_name }} on {{ createdAt }}</small></p>
98+
<p><svg-icon :name="icon" :class="['text', color]"/> <strong>{{ issue.title }}</strong> #{{ issue.number }}</p>
99+
<p>{{ body }}</p>
100+
<div>
101+
<div
102+
v-for="label in labels"
103+
:key="label.name"
104+
class="ui label"
105+
:style="{ color: label.textColor, backgroundColor: label.color }"
106+
>
107+
{{ label.name }}
108+
</div>
109+
</div>
110+
</div>
111+
<div v-if="!loading && issue === null">
112+
<p><small>{{ i18nErrorOccurred }}</small></p>
113+
<p>{{ i18nErrorMessage }}</p>
114+
</div>
115+
</div>
116+
</template>

0 commit comments

Comments
 (0)