restore License to details expander

closes #535
This commit is contained in:
Collin M. Barrett 2018-09-29 12:11:37 -05:00
parent 2ba103414f
commit 2f86110087
5 changed files with 23 additions and 10 deletions

View file

@ -1,4 +1,4 @@
import { ILanguage, IMaintainer, ISyntax, ITag } from "../../interfaces";
import { ILanguage, ILicense, IMaintainer, ISyntax, ITag } from "../../interfaces";
export interface IListDetails {
id: number;
@ -12,6 +12,7 @@ export interface IListDetails {
homeUrl: string;
issuesUrl: string;
languages: ILanguage[];
license: ILicense;
maintainers: IMaintainer[];
name: string;
policyUrl: string;

View file

@ -1,9 +1,10 @@
import * as React from "react";
import { IColumnVisibility } from "../../../interfaces";
import { ILanguage, ISoftware, ISyntax, ITag } from "../../../interfaces";
import { ILanguage, ILicense, ISoftware, ISyntax, ITag } from "../../../interfaces";
import { Description } from "./Description";
import { DiscontinuedDate } from "./DiscontinuedDate";
import { Languages } from "./Languages";
import { License } from "./License";
import { PublishedDate } from "./PublishedDate";
import { RuleCount } from "./RuleCount";
import { SoftwareIcon } from "../../softwareIcon";
@ -17,6 +18,7 @@ interface IProps {
descriptionSourceUrl: string;
discontinuedDate: string;
languages: ILanguage[];
license: ILicense;
name: string;
publishedDate: string;
ruleCount: number;
@ -50,7 +52,9 @@ export const InfoCard = (props: IProps) =>
? null
: <UpdatedDate {...props}/>}
<PublishedDate date={props.publishedDate}/>
<Syntax {...props}/>
{ /*<License {...props.license}/>*/ }
<Syntax {...props} />
{props.columnVisibility.filter((c: IColumnVisibility) => c.column === "License")[0].visible
? null
: <License {...props} />}
</ul>
</div>;

View file

@ -1,12 +1,17 @@
import * as React from "react";
import { ILicense } from "../../../interfaces";
export const License = (props: any) =>
props.name
? (props.descriptionUrl
interface IProps {
license: ILicense;
};
export const License = (props: IProps) =>
props.license.name
? (props.license.descriptionUrl
? <li className="list-group-item">
<p>License: <a href={props.descriptionUrl}>{props.name}</a></p>
<p>License: <a href={props.license.descriptionUrl}>{props.license.name}</a></p>
</li>
: <li className="list-group-item">
<p>License: {props.name}</p>
<p>License: {props.license.name}</p>
</li>)
: null;

View file

@ -44,6 +44,7 @@ export const ListsTable = (props: IProps) =>
list={mapListDetails(({
list: r.original,
languages: props.languages,
licenses: props.licenses,
maintainers: props.maintainers,
syntaxes: props.syntaxes,
tags: props.tags
@ -55,6 +56,7 @@ export const ListsTable = (props: IProps) =>
interface ICreateListDtoProps {
list: IList;
languages: ILanguage[];
licenses: ILicense[];
maintainers: IMaintainer[];
syntaxes: ISyntax[];
tags: ITag[];
@ -75,6 +77,7 @@ const mapListDetails = (props: ICreateListDtoProps): IListDetails =>
languages: props.list.languageIds
? props.languages.filter((l: ILanguage) => props.list.languageIds.indexOf(l.id) > -1)
: undefined,
license: props.licenses.filter((l: ILicense) => props.list.licenseId === l.id)[0],
maintainers: props.list.maintainerIds
? props.maintainers.filter((m: IMaintainer) => props.list.maintainerIds.indexOf(m.id) > -1)
: undefined,

View file

@ -10,7 +10,7 @@
homeUrl: string;
issuesUrl: string;
languageIds: number[];
licenseId: string;
licenseId: number;
maintainerIds: number[];
name: string;
policyUrl: string;