re-add Software to details expander

closes #530
This commit is contained in:
Collin M. Barrett 2018-09-29 11:49:34 -05:00
parent ad69073f1b
commit a495fbd6bc
7 changed files with 23 additions and 45 deletions

View file

@ -8,7 +8,6 @@ const columnVisibilityDefaults: IColumnVisibility[] = [
{ column: "Tags", visible: true },
{ column: "Updated", visible: false },
{ column: "Rules", visible: false },
//{ column: "Syntax", visible: false },
{ column: "License", visible: false },
{ column: "Maintainers", visible: false }
];

View file

@ -1,5 +1,5 @@
import * as React from "react";
import { IColumnVisibility } from "../../interfaces";
import { IColumnVisibility, ISoftware } from "../../interfaces";
import { IListDetails } from "./IListDetails";
import { InfoCard } from "./infoCard";
import { LinkButtonGroup } from "./LinkButtonGroup";
@ -8,6 +8,7 @@ import { MaintainersInfoCard } from "./maintainersInfoCard";
interface IProps {
columnVisibility: IColumnVisibility[];
list: IListDetails;
software: ISoftware[];
};
export const DetailsExpander = (props: IProps) =>
@ -15,7 +16,7 @@ export const DetailsExpander = (props: IProps) =>
<div className="card-body p-2">
<div className="container m-0">
<div className="row">
<InfoCard columnVisibility={props.columnVisibility} {...props.list}/>
<InfoCard columnVisibility={props.columnVisibility} software={props.software} {...props.list}/>
<LinkButtonGroup {...props.list}/>
</div>
<div className="row">

View file

@ -1,4 +1,4 @@
import { ILanguage, IMaintainer, ITag } from "../../interfaces";
import { ILanguage, IMaintainer, ISyntax, ITag } from "../../interfaces";
export interface IListDetails {
id: number;
@ -12,33 +12,15 @@ export interface IListDetails {
homeUrl: string;
issuesUrl: string;
languages: ILanguage[];
license: IListLicense;
maintainers: IMaintainer[];
name: string;
policyUrl: string;
publishedDate: string;
ruleCount: number;
submissionUrl: string;
syntax: IListSyntax;
syntax: ISyntax;
tags: ITag[];
updatedDate: string;
viewUrl: string;
viewUrlMirrors: string[];
};
export interface IListLicense {
descriptionUrl: string;
name: string;
};
export interface IListSyntax {
definitionUrl: string;
name: string;
supportedSoftware: ISyntaxSupportedSoftware[];
};
export interface ISyntaxSupportedSoftware {
homeUrl: string;
id: number;
name: string;
};

View file

@ -1,11 +1,9 @@
import * as React from "react";
import { IColumnVisibility } from "../../../interfaces";
import { IListLicense, IListSyntax, ISyntaxSupportedSoftware } from "../IListDetails";
import { ILanguage, ITag } from "../../../interfaces";
import { ILanguage, 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";
@ -19,11 +17,11 @@ interface IProps {
descriptionSourceUrl: string;
discontinuedDate: string;
languages: ILanguage[];
license: IListLicense;
name: string;
publishedDate: string;
ruleCount: number;
syntax: IListSyntax;
software: ISoftware[];
syntax: ISyntax;
tags: ITag[];
updatedDate: string;
};
@ -34,13 +32,12 @@ export const InfoCard = (props: IProps) =>
? null
: <TagGroup tags={props.tags}/>}
<div>
{props.syntax
? props.syntax.supportedSoftware.map(
(s: ISyntaxSupportedSoftware, i: number) =>
<a href={s.homeUrl} key={i}>
<SoftwareIcon id={s.id} key={i}/>
</a>)
: null}
{props.columnVisibility.filter((c: IColumnVisibility) => c.column === "Software")[0].visible
? null
: props.syntax
? props.software.filter((s: ISoftware) => s.syntaxIds.indexOf(props.syntax.id) > -1)
.map((s: ISoftware, i: number) => <SoftwareIcon id={s.id} key={i}/>)
: null}
</div>
<Description {...props} url={props.descriptionSourceUrl}/>
<ul className="list-group list-group-flush">
@ -54,6 +51,6 @@ export const InfoCard = (props: IProps) =>
: <UpdatedDate {...props}/>}
<PublishedDate date={props.publishedDate}/>
<Syntax {...props.syntax}/>
<License {...props.license}/>
{ /*<License {...props.license}/>*/ }
</ul>
</div>;

View file

@ -1,7 +1,6 @@
import * as React from "react";
import { IListLicense as IListLicenseDto } from "../IListDetails";
export const License = (props: IListLicenseDto) =>
export const License = (props: any) =>
props.name
? (props.descriptionUrl
? <li className="list-group-item">

View file

@ -1,7 +1,6 @@
import * as React from "react";
import { IListSyntax as IListSyntaxDto } from "../IListDetails";
export const Syntax = (props: IListSyntaxDto) =>
export const Syntax = (props: any) =>
props.name
? (props.definitionUrl
? <li className="list-group-item">

View file

@ -4,7 +4,7 @@ import "../../../../utils/loader.css";
import ReactTable from "react-table";
import "react-table/react-table.css";
import "./listsTable.css";
import { DetailsButton, Languages, License, Maintainers, Name, RuleCount, Software, Syntax, Tags, UpdatedDate } from
import { DetailsButton, Languages, License, Maintainers, Name, RuleCount, Software, Tags, UpdatedDate } from
"./columns";
import { IListDetails } from "../../components/detailsExpander";
import { DetailsExpander } from "../../components";
@ -34,7 +34,6 @@ export const ListsTable = (props: IProps) =>
Tags(props.columnVisibility, props.tags),
UpdatedDate(props.columnVisibility),
RuleCount(props.columnVisibility),
//Syntax(props.columnVisibility, props.syntaxes),
License(props.columnVisibility, props.licenses),
Maintainers(props.columnVisibility, props.maintainers),
DetailsButton
@ -46,8 +45,10 @@ export const ListsTable = (props: IProps) =>
list: r.original,
languages: props.languages,
maintainers: props.maintainers,
syntaxes: props.syntaxes,
tags: props.tags
} as ICreateListDtoProps))}/>}
} as ICreateListDtoProps))}
software={props.software}/>}
className="-striped -highlight"/>
: <div className="loader">Loading...</div>;
@ -55,6 +56,7 @@ interface ICreateListDtoProps {
list: IList;
languages: ILanguage[];
maintainers: IMaintainer[];
syntaxes: ISyntax[];
tags: ITag[];
};
@ -73,7 +75,6 @@ const mapListDetails = (props: ICreateListDtoProps): IListDetails =>
languages: props.list.languageIds
? props.languages.filter((l: ILanguage) => props.list.languageIds.indexOf(l.id) > -1)
: undefined,
//license:,
maintainers: props.list.maintainerIds
? props.maintainers.filter((m: IMaintainer) => props.list.maintainerIds.indexOf(m.id) > -1)
: undefined,
@ -82,7 +83,7 @@ const mapListDetails = (props: ICreateListDtoProps): IListDetails =>
publishedDate: props.list.publishedDate,
ruleCount: props.list.ruleCount,
submissionUrl: props.list.submissionUrl,
//syntax:,
syntax: props.syntaxes.filter((s: ISyntax) => props.list.syntaxId === s.id)[0],
tags: props.list.tagIds ? props.tags.filter((t: ITag) => props.list.tagIds.indexOf(t.id) > -1) : undefined,
updatedDate: props.list.updatedDate,
viewUrl: props.list.viewUrl,