Skip to content

Commit

Permalink
Fixed code styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MuazOthman committed May 3, 2022
1 parent 846f9b6 commit 4566bee
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
54 changes: 29 additions & 25 deletions packages/app/src/specs/RunStatusDots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<script setup lang="ts">
import type { CloudRun } from '@packages/graphql/src/gen/cloud-source-types.gen'
import { computed} from 'vue'
import type { CloudRun } from '../packages/graphql/src/gen/cloud-source-types.gen'
import { computed } from 'vue'
import CancelledIcon from '~icons/cy/cancelled-solid_x16.svg'
import ErroredIcon from '~icons/cy/errored-solid_x16.svg'
import FailedIcon from '~icons/cy/failed-solid_x16.svg'
Expand All @@ -43,20 +43,22 @@ const props = withDefaults(defineProps<{
runs: Maybe<CloudRun>[]
}>(), { runs: () => [] })
const dotClasses = computed(()=>{
const statuses = ['placeholder','placeholder','placeholder']
if(props.runs && props.runs.length>0){
for (let i = 1; i < Math.min(props.runs.length,4); i++) {
statuses[i-1] = props.runs[i]?.status??"";
const dotClasses = computed(() => {
const statuses = ['placeholder', 'placeholder', 'placeholder']
if (props.runs && props.runs.length > 0) {
for (let i = 1; i < Math.min(props.runs.length, 4); i++) {
statuses[i - 1] = props.runs[i]?.status ?? ''
}
}
return statuses.reverse().map(s=> {
switch(s){
case 'PASSED':
return statuses.reverse().map((s) => {
switch (s) {
case 'PASSED':
return 'icon-light-jade-400'
case 'RUNNING':
return 'icon-light-indigo-400'
case 'FAILED':
case 'FAILED':
return 'icon-light-red-400'
case 'ERRORED':
case 'OVERLIMIT':
Expand All @@ -65,31 +67,33 @@ const dotClasses = computed(()=>{
case 'NOTESTS':
return 'icon-light-gray-400'
case 'CANCELLED':
default:
default:
return 'icon-light-gray-300'
}
})
})
const latestStatus = computed(()=>{
if(props.runs == null || props.runs.length===0 || props.runs[0] === null)
return {icon: PlaceholderIcon, spin: false}
switch(props.runs[0]?.status){
case 'PASSED':
return {icon: PassedIcon, spin: false}
const latestStatus = computed(() => {
if (props.runs == null || props.runs.length === 0 || props.runs[0] === null) {
return { icon: PlaceholderIcon, spin: false }
}
switch (props.runs[0]?.status) {
case 'PASSED':
return { icon: PassedIcon, spin: false }
case 'RUNNING':
return {icon: RunningIcon, spin: true}
case 'FAILED':
return {icon: FailedIcon, spin: false}
return { icon: RunningIcon, spin: true }
case 'FAILED':
return { icon: FailedIcon, spin: false }
case 'ERRORED':
case 'OVERLIMIT':
case 'TIMEDOUT':
return {icon: ErroredIcon, spin: false}
return { icon: ErroredIcon, spin: false }
case 'NOTESTS':
case 'CANCELLED':
return {icon: CancelledIcon, spin: false}
default:
return {icon: PlaceholderIcon, spin: false}
return { icon: CancelledIcon, spin: false }
default:
return { icon: PlaceholderIcon, spin: false }
}
})
Expand Down
14 changes: 7 additions & 7 deletions packages/app/src/specs/SpecsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
:gql="row.data.data.gitInfo"
/>
</template>
<template #latest-runs>
<RunStatusDots
v-if="row.data.isLeaf"
Expand Down Expand Up @@ -150,7 +150,7 @@ import Alert from '../../../frontend-shared/src/components/Alert.vue'
import InlineCodeFragment from '../../../frontend-shared/src/components/InlineCodeFragment.vue'
import WarningIcon from '~icons/cy/warning_x16.svg'
import { useRoute } from 'vue-router'
import type { CloudProjectSpecs, CloudRun } from '@packages/graphql/src/gen/cloud-source-types.gen'
import type { CloudProjectSpecs, CloudRun } from '../packages/graphql/src/gen/cloud-source-types.gen'
const route = useRoute()
const { t } = useI18n()
Expand Down Expand Up @@ -184,7 +184,6 @@ fragment SpecsList on Spec {
}
`
// gql`
// fragment CloudSpecData on CloudProject {
// # temporarily use hardcoded paths, pending an update to the GQL layer
Expand Down Expand Up @@ -225,10 +224,10 @@ const props = defineProps<{
}>()
const testingRuns: CloudRun[] = [
{ id: "4", status: "RUNNING"},
{ id: "3", status: "PASSED"},
{ id: "2", status: "FAILED"},
];
{ id: '4', status: 'RUNNING' },
{ id: '3', status: 'PASSED' },
{ id: '2', status: 'FAILED' },
]
const emit = defineEmits<{
(e: 'showCreateSpecModal'): void
Expand Down Expand Up @@ -267,6 +266,7 @@ function handleClear () {
const specs = computed(() => {
const specs2 = cachedSpecs.value.map((x) => {
const s = makeFuzzyFoundSpec(x)
// if(props.gql.currentProject?.cloudProject?.__typename === 'CloudProject'){
// const runInfo = props.gql.currentProject?.cloudProject?.specs?.find(ss=>ss?.specPath === s.name)
// return {
Expand Down

0 comments on commit 4566bee

Please sign in to comment.