2021-11-10 10:41:40 -08:00
|
|
|
<template>
|
2022-12-14 01:04:10 -08:00
|
|
|
<!-- eslint-disable vue/no-mutating-props -->
|
|
|
|
<a
|
|
|
|
v-if="version"
|
|
|
|
:set="(version = version)"
|
|
|
|
:href="version.documentationUrl"
|
|
|
|
target="_blank"
|
|
|
|
:class="$style.card"
|
|
|
|
>
|
2021-07-22 01:22:17 -07:00
|
|
|
<div :class="$style.header">
|
|
|
|
<div>
|
|
|
|
<div :class="$style.name">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ `${$locale.baseText('versionCard.version')} ${version.name}` }}
|
2021-07-22 01:22:17 -07:00
|
|
|
</div>
|
|
|
|
<WarningTooltip v-if="version.hasSecurityIssue">
|
|
|
|
<template>
|
2022-03-05 11:11:34 -08:00
|
|
|
<span v-html="$locale.baseText('versionCard.thisVersionHasASecurityIssue')"></span>
|
2021-07-22 01:22:17 -07:00
|
|
|
</template>
|
|
|
|
</WarningTooltip>
|
|
|
|
<Badge
|
|
|
|
v-if="version.hasSecurityFix"
|
2021-12-15 04:16:53 -08:00
|
|
|
:text="$locale.baseText('versionCard.securityUpdate')"
|
2021-07-22 01:22:17 -07:00
|
|
|
type="danger"
|
|
|
|
/>
|
|
|
|
<Badge
|
|
|
|
v-if="version.hasBreakingChange"
|
2021-12-15 04:16:53 -08:00
|
|
|
:text="$locale.baseText('versionCard.breakingChanges')"
|
2021-07-22 01:22:17 -07:00
|
|
|
type="warning"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div :class="$style['release-date']">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('versionCard.released') }} <TimeAgo :date="version.createdAt" />
|
2021-07-22 01:22:17 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-14 01:04:10 -08:00
|
|
|
<div
|
|
|
|
:class="$style.divider"
|
|
|
|
v-if="version.description || (version.nodes && version.nodes.length)"
|
|
|
|
></div>
|
2021-07-22 01:22:17 -07:00
|
|
|
<div>
|
2022-12-14 01:04:10 -08:00
|
|
|
<div
|
|
|
|
v-if="version.description"
|
|
|
|
v-html="version.description"
|
|
|
|
:class="$style.description"
|
|
|
|
></div>
|
2021-07-22 01:22:17 -07:00
|
|
|
<div v-if="version.nodes && version.nodes.length > 0" :class="$style.nodes">
|
|
|
|
<NodeIcon
|
|
|
|
v-for="node in version.nodes"
|
|
|
|
:key="node.name"
|
|
|
|
:nodeType="node"
|
|
|
|
:title="$options.nodeName(node)"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import NodeIcon from './NodeIcon.vue';
|
|
|
|
import TimeAgo from './TimeAgo.vue';
|
|
|
|
import Badge from './Badge.vue';
|
|
|
|
import WarningTooltip from './WarningTooltip.vue';
|
|
|
|
import { IVersionNode } from '@/Interface';
|
|
|
|
|
|
|
|
Vue.component('NodeIcon', NodeIcon);
|
|
|
|
Vue.component('TimeAgo', TimeAgo);
|
|
|
|
Vue.component('Badge', Badge);
|
|
|
|
Vue.component('WarningTooltip', WarningTooltip);
|
|
|
|
|
2021-12-07 07:14:40 -08:00
|
|
|
export default Vue.extend({
|
2021-07-22 01:22:17 -07:00
|
|
|
components: { NodeIcon, TimeAgo, Badge, WarningTooltip },
|
2021-11-10 10:41:40 -08:00
|
|
|
name: 'VersionCard',
|
2021-07-22 01:22:17 -07:00
|
|
|
props: ['version'],
|
|
|
|
// @ts-ignore
|
2022-12-14 01:04:10 -08:00
|
|
|
nodeName(node: IVersionNode): string {
|
2021-12-15 04:16:53 -08:00
|
|
|
return node !== null ? node.displayName : this.$locale.baseText('versionCard.unknown');
|
2021-07-22 01:22:17 -07:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style module lang="scss">
|
2022-12-14 01:04:10 -08:00
|
|
|
.card {
|
|
|
|
background-color: $version-card-background-color;
|
|
|
|
border: $version-card-border;
|
|
|
|
border-radius: 8px;
|
|
|
|
display: block;
|
|
|
|
padding: 16px;
|
|
|
|
text-decoration: none;
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
&:hover {
|
|
|
|
box-shadow: 0px 2px 10px $version-card-box-shadow-color;
|
2021-07-22 01:22:17 -07:00
|
|
|
}
|
2022-12-14 01:04:10 -08:00
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.header {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
> * {
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
> div:first-child {
|
|
|
|
flex-grow: 1;
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
> * {
|
|
|
|
margin-right: 5px;
|
2021-07-22 01:22:17 -07:00
|
|
|
}
|
|
|
|
}
|
2022-12-14 01:04:10 -08:00
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.name {
|
|
|
|
font-weight: 600;
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 18px;
|
|
|
|
color: $version-card-name-text-color;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.divider {
|
|
|
|
border-bottom: $version-card-border;
|
|
|
|
width: 100%;
|
|
|
|
margin: 10px 0 15px 0;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.description {
|
|
|
|
font-size: 14px;
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 19px;
|
|
|
|
color: $version-card-description-text-color;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.release-date {
|
|
|
|
font-size: 12px;
|
|
|
|
line-height: 18px;
|
|
|
|
font-weight: 400;
|
|
|
|
color: $version-card-release-date-text-color;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.nodes {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(10, 1fr);
|
|
|
|
grid-row-gap: 12px;
|
|
|
|
margin-block-start: 24px;
|
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
</style>
|