-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
234 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
.DS_Store | ||
*.iml | ||
.idea/* | ||
*.sw[o|p] | ||
~* | ||
|
||
# npm | ||
node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import React from "react/addons"; | ||
|
||
import QueryParamsMixin from "../mixins/QueryParamsMixin"; | ||
import {Link} from "react-router"; | ||
import SidebarComponent from "../components/SidebarComponent"; | ||
import AppListComponent from "../components/AppListComponent"; | ||
import BreadcrumbComponent from "../components/BreadcrumbComponent"; | ||
import FilterTypes from "../constants/FilterTypes"; | ||
import Util from "../helpers/Util"; | ||
|
||
var AppsAndGroupsListComponent = React.createClass({ | ||
displayName: "AppsAndGroupsListComponent", | ||
|
||
mixins: [QueryParamsMixin], | ||
|
||
getInitialState: function () { | ||
return { | ||
currentGroup: "/" | ||
}; | ||
}, | ||
|
||
componentWillReceiveProps: function () { | ||
this.updateCurrentGroup(); | ||
}, | ||
|
||
componentWillMount: function () { | ||
this.updateCurrentGroup(); | ||
}, | ||
|
||
updateCurrentGroup: function () { | ||
var {groupId} = this.context.router.getCurrentParams(); | ||
if (groupId == null) { | ||
groupId = "/"; | ||
} | ||
groupId = decodeURIComponent(groupId); | ||
if (!groupId.endsWith("/")) { | ||
groupId += "/"; | ||
} | ||
|
||
this.setState({ | ||
currentGroup: groupId | ||
}); | ||
}, | ||
|
||
getContextualBar: function () { | ||
var groupId = "/"; | ||
var filters = this.getQueryParamObject(); | ||
|
||
if (filters[FilterTypes.TEXT] == null || | ||
Util.isStringAndEmpty(filters[FilterTypes.TEXT])) { | ||
return <BreadcrumbComponent groupId={groupId} />; | ||
} | ||
|
||
return ( | ||
<p className="breadcrumb"> | ||
<span> | ||
{`Search results for "${filters[FilterTypes.TEXT]}"`} | ||
</span> | ||
{this.getClearLinkForFilter(FilterTypes.TEXT, | ||
"Clear search", | ||
"clear")} | ||
</p> | ||
); | ||
}, | ||
|
||
render: function () { | ||
var path = this.getCurrentPathname(); | ||
var groupId = this.state.currentGroup; | ||
|
||
var newAppModalQuery = { | ||
modal: "new-app" | ||
}; | ||
|
||
var newGroupModalQuery = { | ||
modal: "new-group" | ||
}; | ||
|
||
if (groupId != null && groupId !== "/") { | ||
newAppModalQuery.groupId = groupId; | ||
newGroupModalQuery.groupId = groupId; | ||
} | ||
return ( | ||
<div className="app-list-wrapper"> | ||
<SidebarComponent groupId={groupId} /> | ||
<main> | ||
<div className="contextual-bar"> | ||
{this.getContextualBar()} | ||
<ul className="list-unstyled list-inline"> | ||
<li> | ||
<Link to={path} | ||
query={newGroupModalQuery} | ||
className="btn btn-default create-group" | ||
activeClassName="create-group-active"> | ||
Create Group | ||
</Link> | ||
</li> | ||
<li> | ||
<Link to={path} | ||
query={newAppModalQuery} | ||
className="btn btn-success create-app" | ||
activeClassName="create-app-active"> | ||
Create Application | ||
</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
<AppListComponent currentGroup={groupId} /> | ||
</main> | ||
</div> | ||
); | ||
} | ||
|
||
}); | ||
|
||
export default AppsAndGroupsListComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const NavTabEvents = { | ||
CHANGE: "NAV_TAB_EVENTS_CHANGE", | ||
APPEND_NAVTAB: "NAV_TAB_EVENTS_APPEND_NAVTAB" | ||
}; | ||
|
||
export default Object.freeze(NavTabEvents); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {EventEmitter} from "events"; | ||
import React from "react/addons"; | ||
import PluginDispatcher from "../plugin/shared/PluginDispatcher"; | ||
import Util from "../helpers/Util"; | ||
import NavTabEvents from "../events/NavTabEvents"; | ||
|
||
import DeploymentsListComponent | ||
from "../components/DeploymentsListComponent"; | ||
import AppsAndGroupsListComponent | ||
from "../components/AppsAndGroupsListComponent"; | ||
|
||
var tabs = [ | ||
{ | ||
id: "/apps", | ||
text: "Applications", | ||
component: AppsAndGroupsListComponent | ||
}, | ||
{ | ||
id: "/deployments", | ||
text: "Deployments", | ||
component: DeploymentsListComponent | ||
} | ||
]; | ||
|
||
function appendTab(tab) { | ||
tabs.push(tab); | ||
} | ||
|
||
var NavTabStore = Util.extendObject(EventEmitter.prototype, { | ||
getTabs: function () { | ||
return tabs; | ||
} | ||
}); | ||
|
||
PluginDispatcher.register(event => { | ||
if (event.eventType === NavTabEvents.APPEND_NAVTAB) { | ||
event.data.map(appendTab); | ||
NavTabStore.emit(NavTabEvents.CHANGE); | ||
} | ||
}); | ||
|
||
export default NavTabStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.