Refactor and add doc level comments
This commit is contained in:
parent
0d915eccc4
commit
daa759a066
4 changed files with 35 additions and 17 deletions
|
@ -1,24 +1,32 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
interface IMain {
|
interface IBody {
|
||||||
description: string
|
description: string
|
||||||
}
|
}
|
||||||
|
|
||||||
class body extends React.Component<IMain, {}> {
|
/**
|
||||||
|
* The Component for the main body of the repo page
|
||||||
|
* @param {string} description - The description of the repository
|
||||||
|
*/
|
||||||
|
class body extends React.Component<IBody, {}> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
description: React.PropTypes.string.isRequired,
|
description: React.PropTypes.string.isRequired,
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
|
let description: string = this.props.description;
|
||||||
|
if (description === "") {
|
||||||
|
description = "No Description";
|
||||||
|
}
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<ul className="nav nav-tabs rp-tabs">
|
<ul className="nav nav-tabs rp-tabs">
|
||||||
<li className="active"><a href="#tab1" data-toggle="tab">Description</a></li>
|
<li className="active"><a href="#tab1" data-toggle="tab">Description</a></li>
|
||||||
<li><a href="#tab2" data-toggle="tab">Automated Builds</a></li>
|
<li><a href="#tab2" data-toggle="tab">Automated Builds</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div className="panel-body rp-panelBody">
|
<div className="panel-body rp-panelBody">
|
||||||
<div className="tab-content">
|
<div className="tab-content">
|
||||||
<div className="tab-pane in active" id="tab1">
|
<div className="tab-pane in active" id="tab1">
|
||||||
<div className="rp-description">{this.props.description}</div>
|
<div className="rp-description">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="tab-pane" id="tab2">
|
<div className="tab-pane" id="tab2">
|
||||||
TODO (IAN): Convert the build directives to angular components
|
TODO (IAN): Convert the build directives to angular components
|
||||||
|
|
|
@ -5,6 +5,11 @@ interface IHeader {
|
||||||
namespace: string
|
namespace: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Component for the header of the repo page
|
||||||
|
* @param {string} name - The name of the repository
|
||||||
|
* @param {string} namespace - The namespace of the repository
|
||||||
|
*/
|
||||||
class repoHeader extends React.Component<IHeader, {}> {
|
class repoHeader extends React.Component<IHeader, {}> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
name: React.PropTypes.string.isRequired,
|
name: React.PropTypes.string.isRequired,
|
||||||
|
|
|
@ -14,6 +14,12 @@ interface ISidebar {
|
||||||
repository: Object
|
repository: Object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Component for the sidebar of the repo page
|
||||||
|
* @param {string} isPublic - A string that states whether the repository is private or public
|
||||||
|
* @param {tag} tags - The list of tags for the repository
|
||||||
|
* @param {object} repository - The list of properties for the repository
|
||||||
|
*/
|
||||||
class repoSidebar extends React.Component<ISidebar, {}> {
|
class repoSidebar extends React.Component<ISidebar, {}> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
isPublic: React.PropTypes.string.isRequired,
|
isPublic: React.PropTypes.string.isRequired,
|
||||||
|
@ -27,16 +33,18 @@ class repoSidebar extends React.Component<ISidebar, {}> {
|
||||||
let badgeIcon: string = (this.props.isPublic) ? "rp-badge__icon--public" : "rp-badge__icon--private";
|
let badgeIcon: string = (this.props.isPublic) ? "rp-badge__icon--public" : "rp-badge__icon--private";
|
||||||
let repository: any = this.props.repository;
|
let repository: any = this.props.repository;
|
||||||
let sharing: string = repository.company || repository.namespace;
|
let sharing: string = repository.company || repository.namespace;
|
||||||
for (let t in this.props.tags){
|
|
||||||
sortedTags.push(
|
for (let tagObject in this.props.tags) {
|
||||||
{
|
sortedTags.push({
|
||||||
name: this.props.tags[t].name,
|
name: this.props.tags[tagObject].name,
|
||||||
lastModified: Date.parse(this.props.tags[t].last_modified)
|
lastModified: Date.parse(this.props.tags[tagObject].last_modified)
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sortedTags = sortedTags.sort(function(a,b){return a.lastModified - b.lastModified});
|
sortedTags = sortedTags.sort(function(a, b) {
|
||||||
|
return a.lastModified - b.lastModified;
|
||||||
|
});
|
||||||
|
|
||||||
sortedTags.forEach(function(el, i){
|
sortedTags.forEach(function(el, i){
|
||||||
tagRows.push(
|
tagRows.push(
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -61,13 +61,10 @@
|
||||||
$scope.repository = repo;
|
$scope.repository = repo;
|
||||||
$scope.viewScope.repository = repo;
|
$scope.viewScope.repository = repo;
|
||||||
$scope.publicRepoExperiment = CookieService.get('quay.public-repo-exp') == 'true';
|
$scope.publicRepoExperiment = CookieService.get('quay.public-repo-exp') == 'true';
|
||||||
if (!$scope.repository.description){
|
|
||||||
$scope.repository.description = "No Description";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flag for new repo page experiment
|
// Flag for new repo page experiment
|
||||||
$scope.newRepoExperiment = $scope.repository.is_public && $scope.user.username != $scope.repository.namespace && $scope.publicRepoExperiment;
|
$scope.newRepoExperiment = $scope.repository.is_public && $scope.user.username != $scope.repository.namespace && $scope.publicRepoExperiment;
|
||||||
|
|
||||||
// Load the remainder of the data async, so we don't block the initial view from
|
// Load the remainder of the data async, so we don't block the initial view from
|
||||||
// showing.
|
// showing.
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
Reference in a new issue