Skip to content

Commit

Permalink
PackageDetail: show alert info box for version != latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dmstern committed Nov 26, 2018
1 parent 7005e7b commit 60ad75d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/views/PackageDetail.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<template>
<div>
<v-container v-if="!data.packageDetail">
<v-container v-if="!data.packageDetail || !data.currentPackage">
<LoadingSpinner msg="Loading package details..."/>
</v-container>
<v-container v-else fluid grid-list-lg :class="isOld() ? 'isOld' : ''">
<v-layout row wrap>
<v-flex xs12 md7 xl8 class="packageDetail__heading">
<v-alert
v-if="isOld()"
v-model="showAlert"
:value="isOld() || data.currentPackage.version !== data.packageDetail.distTags.latest"
dismissible
type="info"
>You are displaying an old version of this package. To see the newest version, click on "latest" under "versions".</v-alert>
>You are not watching the latest version of this package. To see the latest version, click on "latest" under "versions".</v-alert>
<h1>{{ data.packageDetail.name }}</h1>
<div class="subheading last-published-version-line">
<span>{{data.currentPackage.version}}</span>
Expand Down Expand Up @@ -438,7 +437,6 @@ export default class PackageDetail extends Vue {
};
private activeTab: number;
private isLoadingCode: boolean;
private showAlert: boolean = false;
constructor() {
super();
Expand Down Expand Up @@ -769,7 +767,6 @@ export default class PackageDetail extends Vue {
typeof this.data.packageDetail.distTags.latest === 'string' &&
this.data.currentPackage.version !== undefined &&
this.data.currentPackage.version < this.data.packageDetail.distTags.latest;
this.showAlert = isOld;
return isOld;
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/package-meta-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ITimes {
}

export interface IDistTags {
[key: string]: number;
[key: string]: string;
}

export interface IVersions {
Expand Down

0 comments on commit 60ad75d

Please sign in to comment.