mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-11 09:49:17 +00:00
new components structure, navigation in header
This commit is contained in:
parent
db63537a26
commit
f66f3b97d6
@ -32,6 +32,10 @@
|
|||||||
|
|
||||||
&_item {
|
&_item {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
|
&_link {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
&_run {
|
&_run {
|
||||||
color: rgba(255, 255, 255, 0.5);
|
color: rgba(255, 255, 255, 0.5);
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -17,8 +17,8 @@ define([
|
|||||||
DefaultRoute = React.createFactory(Router.DefaultRoute);
|
DefaultRoute = React.createFactory(Router.DefaultRoute);
|
||||||
|
|
||||||
var routes = (
|
var routes = (
|
||||||
Route({name: 'index', path: '/'},
|
Route({handler: Components.App},
|
||||||
Route({name: 'dashboard', path: '/', handler: Components.App}),
|
Route({name: 'dashboard', path: '/', handler: Components.Dashboard}),
|
||||||
Route({
|
Route({
|
||||||
name: 'projects',
|
name: 'projects',
|
||||||
path: 'projects/:name',
|
path: 'projects/:name',
|
||||||
@ -30,7 +30,7 @@ define([
|
|||||||
|
|
||||||
Router.run(routes, Router.HistoryLocation, function(Handler) {
|
Router.run(routes, Router.HistoryLocation, function(Handler) {
|
||||||
React.render(
|
React.render(
|
||||||
template({Component: Handler, Header: Components.Header}),
|
React.createElement(Handler),
|
||||||
document.getElementById('content')
|
document.getElementById('content')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
6
static/js/app/components/app/index.jade
Normal file
6
static/js/app/components/app/index.jade
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
div
|
||||||
|
Header()
|
||||||
|
|
||||||
|
.container-fluid
|
||||||
|
.page-wrapper
|
||||||
|
RouteHandler()
|
24
static/js/app/components/app/index.js
Normal file
24
static/js/app/components/app/index.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
define([
|
||||||
|
'react',
|
||||||
|
'react-router',
|
||||||
|
'app/actions/project',
|
||||||
|
'app/components/header/index',
|
||||||
|
'templates/app/components/app/index'
|
||||||
|
], function(React, Router, ProjectActions, Header, template) {
|
||||||
|
template = template.locals({
|
||||||
|
Link: Router.Link,
|
||||||
|
Header: Header,
|
||||||
|
RouteHandler: Router.RouteHandler
|
||||||
|
});
|
||||||
|
|
||||||
|
var Component = React.createClass({
|
||||||
|
componentWillMount: function() {
|
||||||
|
ProjectActions.readAll();
|
||||||
|
},
|
||||||
|
render: template
|
||||||
|
});
|
||||||
|
|
||||||
|
return Component;
|
||||||
|
});
|
@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'react',
|
'react',
|
||||||
|
'react-router',
|
||||||
'app/actions/project',
|
'app/actions/project',
|
||||||
'app/actions/build',
|
'app/actions/build',
|
||||||
'app/components/projects/index',
|
'app/components/builds/list',
|
||||||
'app/components/builds/index',
|
'templates/app/components/dashboard/index'
|
||||||
'templates/app/components/app/template'
|
], function(React, Router, ProjectActions, BuildActions, BuildsList, template) {
|
||||||
], function(React, ProjectActions, BuildActions, Projects, Builds, template) {
|
|
||||||
template = template.locals({
|
template = template.locals({
|
||||||
BuildsList: Builds.List
|
Link: Router.Link,
|
||||||
|
BuildsList: BuildsList
|
||||||
});
|
});
|
||||||
|
|
||||||
var Component = React.createClass({
|
var Component = React.createClass({
|
@ -1,7 +1,7 @@
|
|||||||
.navbar.navbar-default.navbar-fixed-top
|
.navbar.navbar-default.navbar-fixed-top
|
||||||
.container-fluid
|
.container-fluid
|
||||||
.navbar-header
|
.navbar-header
|
||||||
a.navbar-brand(href="/")
|
Link.navbar-brand(to="dashboard")
|
||||||
span NCI
|
span NCI
|
||||||
.navbar-left.navbar-form(style={paddingTop: "11px"})
|
.navbar-left.navbar-form(style={paddingTop: "11px"})
|
||||||
ProjectsSelector()
|
ProjectsSelector()
|
@ -4,7 +4,7 @@ define([
|
|||||||
'react',
|
'react',
|
||||||
'react-router',
|
'react-router',
|
||||||
'app/components/projects/selector/index',
|
'app/components/projects/selector/index',
|
||||||
'templates/app/components/header/template'
|
'templates/app/components/header/index'
|
||||||
], function(React, Router, ProjectsSelector, template) {
|
], function(React, Router, ProjectsSelector, template) {
|
||||||
template = template.locals({
|
template = template.locals({
|
||||||
Link: Router.Link,
|
Link: Router.Link,
|
@ -3,13 +3,15 @@
|
|||||||
define([
|
define([
|
||||||
'app/components/projects/index',
|
'app/components/projects/index',
|
||||||
'app/components/builds/index',
|
'app/components/builds/index',
|
||||||
'app/components/app/component',
|
'app/components/app/index',
|
||||||
'app/components/header/component'
|
'app/components/header/index',
|
||||||
], function(ProjectsComponents, BuildsComponents, App, Header) {
|
'app/components/dashboard/index'
|
||||||
|
], function(ProjectsComponents, BuildsComponents, App, Header, Dashboard) {
|
||||||
return {
|
return {
|
||||||
App: App,
|
App: App,
|
||||||
Header: Header,
|
Header: Header,
|
||||||
Project: ProjectsComponents,
|
Project: ProjectsComponents,
|
||||||
Build: BuildsComponents
|
Build: BuildsComponents,
|
||||||
|
Dashboard: Dashboard
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
each project in this.state.projects
|
each project in this.state.projects
|
||||||
li.projects-selector_item.row(key=project.name)
|
li.projects-selector_item.row(key=project.name)
|
||||||
.col-md-8
|
.col-md-8
|
||||||
p= project.name
|
Link.projects-selector_item_link(to="projects", params={name: project.name}, onMouseDown=this.onSelectProject(project.name))
|
||||||
|
span= project.name
|
||||||
.col-md-4.text-small.text-right
|
.col-md-4.text-small.text-right
|
||||||
a.projects-selector_item_run(href="javascript:void(0);", onMouseDown=this.onRunProject(project.name))
|
a.projects-selector_item_run(href="javascript:void(0);", onMouseDown=this.onRunProject(project.name))
|
||||||
i.fa.fa-fw.fa-play
|
i.fa.fa-fw.fa-play
|
||||||
|
@ -10,7 +10,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
return React.createClass({
|
return React.createClass({
|
||||||
mixins: [Reflux.ListenerMixin],
|
mixins: [Reflux.ListenerMixin, Router.Navigation],
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.listenTo(projectsStore, this.updateItems);
|
this.listenTo(projectsStore, this.updateItems);
|
||||||
},
|
},
|
||||||
@ -23,6 +23,9 @@ define([
|
|||||||
ProjectActions.run(projectName)
|
ProjectActions.run(projectName)
|
||||||
this.setState({showSearch: false});
|
this.setState({showSearch: false});
|
||||||
},
|
},
|
||||||
|
onSelectProject: function(name) {
|
||||||
|
this.transitionTo('projects', {name: name});
|
||||||
|
},
|
||||||
updateItems: function(projects) {
|
updateItems: function(projects) {
|
||||||
this.setState({projects: projects});
|
this.setState({projects: projects});
|
||||||
},
|
},
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
h1= this.state.project.name
|
div
|
||||||
Builds()
|
h1= this.state.project.name
|
||||||
|
Builds()
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
Header()
|
|
||||||
|
|
||||||
.container-fluid
|
|
||||||
.page-wrapper
|
|
||||||
Component()
|
|
@ -8,8 +8,6 @@ define([
|
|||||||
listenables: BuildActions,
|
listenables: BuildActions,
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
console.log('init builds console output');
|
|
||||||
|
|
||||||
// the only purpose of this hash to reconnect all the time
|
// the only purpose of this hash to reconnect all the time
|
||||||
// except first, see notes at using
|
// except first, see notes at using
|
||||||
this.connectedResourcesHash = {};
|
this.connectedResourcesHash = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user