Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules/
public/
bundles/
PIG/bundles/
Parse-Dashboard/bundles/
Parse-Dashboard/parse-dashboard-config.json
10 changes: 3 additions & 7 deletions PIG.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Import the main configuration file
var configuration = require('./webpack.config.js');
var configuration = require('./base.config.js');

// Remove the dashboard configuration, we're only building the PIG
delete configuration.entry.dashboard;

// Remove SVG plugin
configuration.plugins = [];
configuration.entry = {PIG: './parse-interface-guide/index.js'};
configuration.output.path = './PIG/bundles';

module.exports = configuration;
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# parse-dashboard
An open source dashboard for managing your Parse apps that aren't hosted on Parse.com
# Parse Dashboard

Currently this is just a separate repo containing all the dashboard code, with a few modifications to make it actually build.
An open source dashboard for managing your Parse apps.

To run it:

```
git clone git@github.com:ParsePlatform/parse-dashboard.git
cd parse-dashboard
npm install
npm run-script dashboard
```

Next add your app into parse-dashboard/Parse-Dashboard/parse-dashboard-config.json. Ask Drew how to do this. It is currently difficult, but it will get better.

Then visit http://localhost:4040 and you will be able to manage your parse apps.
40 changes: 40 additions & 0 deletions base.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//This file should be imported by another config file, like dashboard.config.js

var path = require('path');
var SvgPrepPlugin = require('./plugins/svg-prep');

module.exports = {
output: {
filename: '[name].bundle.js'
},
resolve: {
root: [__dirname, path.join(__dirname, 'node_modules')]
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
optional: ['runtime', 'es7.decorators']
}
}, {
test: /\.scss$/,
loader: "style-loader!css-loader?modules&localIdentName=[local]__[hash:base64:5]!sass-loader?includePaths[]=" +
encodeURIComponent(path.resolve(__dirname, "../../app/webpack"))
}, {
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
},
plugins: [
new SvgPrepPlugin({
source: path.join(__dirname, 'icons')
})
]
};
17 changes: 0 additions & 17 deletions components/PlatformCard/PlatformCard.test.js

This file was deleted.

14 changes: 3 additions & 11 deletions dashboard.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
var path = require('path');
var configuration = require('./base.config.js');

// Import the main configuration file
var configuration = require('./webpack.config.js');

// Remove the dashboard configuration, we're only building the PIG
delete configuration.entry.PIG;

configuration.output.path = path.join(__dirname, 'Parse-Dashboard', 'bundles');

// Remove SVG plugin
configuration.plugins = [];
configuration.entry = {dashboard: './dashboard/index.js'};
configuration.output.path = './Parse-Dashboard/bundles';

module.exports = configuration;
10 changes: 6 additions & 4 deletions dashboard/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import AppsManager from 'lib/AppsManager';
import Immutable from 'immutable';
import installDevTools from 'immutable-devtools';
import Parse from 'parse';
import ReactDOM from 'react-dom';
import Routes from './routes';
import Immutable from 'immutable';
import installDevTools from 'immutable-devtools';

require('stylesheets/fonts.scss');
installDevTools(Immutable);
Expand All @@ -16,5 +17,6 @@ if (window.DEVELOPMENT) {
Parse.CoreManager.set('VERSION', 'browser');

// App entry point

ReactDOM.render(Routes, document.getElementById('browser_mount'));
AppsManager.seed().then(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this just temporary?

Ah nvm seeing the change you made below.

ReactDOM.render(Routes, document.getElementById('browser_mount'));
});
Empty file added let
Empty file.
20 changes: 12 additions & 8 deletions lib/AppsManager.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import ParseApp from 'lib/ParseApp';
import ParseApp from 'lib/ParseApp';
import { get, post, del } from 'lib/AJAX';
import { unescape } from 'lib/StringEscaping';
import { unescape } from 'lib/StringEscaping';

let appsStore = null;

const AppsManager = {
seed() {
let promise = get('/parse-dashboard-config.json');
promise.then(({ apps }) => {
appsStore = appsStore.concat(apps.map(app => new ParseApp(app)));
});
let appsData = document.getElementById('appsData');
if (!appsData) {
return;
if (appsData) {
let rawApps = JSON.parse(unescape(appsData.innerHTML || '[]'));
appsStore = rawApps.map(raw => new ParseApp(raw));
} else {
appsStore = [];
}
let rawApps = JSON.parse(unescape(appsData.innerHTML));
appsStore = rawApps.map((raw) => {
return new ParseApp(raw);
});
return promise;
},

apps() {
Expand Down
4 changes: 2 additions & 2 deletions components/Button/Button.test.js → lib/tests/Button.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
jest.dontMock('./Button.react');
jest.dontMock('../../components/Button/Button.react');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const Button = require('./Button.react');
const Button = require('../../components/Button/Button.react');

describe('Button', () => {
it('has a default state', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
jest.dontMock('./Markdown.react');
jest.dontMock('../../components/Markdown/Markdown.react');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const Markdown = require('./Markdown.react');
const Markdown = require('../../components/Markdown/Markdown.react');

describe('Markdown', () => {
it('can render examples', () => {
jest.dontMock('./Markdown.example');
const example = require('./Markdown.example');
jest.dontMock('../../components/Markdown/Markdown.example');
const example = require('../../components/Markdown/Markdown.example');
example.demos.forEach((example, i) => {
example.render();
});
Expand Down
17 changes: 17 additions & 0 deletions lib/tests/PlatformCard.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
jest.dontMock('../../components/PlatformCard/PlatformCard.react');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const PlatformCard = require('../../components/PlatformCard/PlatformCard.react');

describe('PlatformCard', () => {
it('can render examples', () => {
jest.dontMock('../../components/PlatformCard/PlatformCard.example');
const example = require('../../components/PlatformCard/PlatformCard.example');
example.demos.forEach((example, i) => {
example.render();
});
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
jest.dontMock('./Tooltip.react');
jest.dontMock('../../components/Tooltip/Tooltip.react');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not jest.dontMock('../Tooltip.react');?


import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const Tooltip = require('./Tooltip.react');
const Tooltip = require('../../components/Tooltip/Tooltip.react');

describe('Tooltip', () => {
// test suite goes here
Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,11 @@
"generate": "node scripts/generate.js"
},
"jest": {
"rootDir": "../../app/webpack",
"testPathDirs": [
"components",
"lib"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"scriptPreprocessor": "<rootDir>/../../script/webpack/testing/preprocessor.js",
"testDirectoryName": "webpack",
"scriptPreprocessor": "<rootDir>/testing/preprocessor.js",
"testDirectoryName": "tests",
"testFileExtensions": [
"test.js"
],
Expand Down
2 changes: 1 addition & 1 deletion parse-interface-guide/ComponentsMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ export let SliderWrap = require('components/SliderWrap/SliderWrap
export let StatusIndicator = require('components/StatusIndicator/StatusIndicator.example');
export let TextInput = require('components/TextInput/TextInput.example');
export let Toggle = require('components/Toggle/Toggle.example');
export let Tooltip = require('components/Tooltip/Tooltip.example');
export let Tooltip = require('components/Tooltip/Tooltip.example');
17 changes: 10 additions & 7 deletions production.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Production build configuration for dashboard.parse.com
var configuration = require('./base.config.js');

var webpack = require('webpack');

// Import the main configuration file
var configuration = require('./webpack.config.js');
configuration.entry = {
dashboard: './dashboard/index.js',
login: './login/index.js',
signup: './signup/index.js',
PIG: './parse-interface-guide/index.js',
quickstart: './quickstart/index.js',
};
configuration.output.path = './production/bundles';

// Remove the PIG configuration, we're only building the dashboard
delete configuration.entry.PIG;
var webpack = require('webpack');

// Add propType removal to Babel
var loaders = configuration.module.loaders;
Expand Down
37 changes: 19 additions & 18 deletions scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
const fs = require('fs');
const path = require('path');

const rootDir = path.join(__dirname, '..', '..', '..', 'app', 'webpack', 'components');
const pigDir = path.join(__dirname, '..', '..', '..', 'app', 'webpack', 'PIG');
const rootDir = path.join(__dirname, '..', 'components');
const pigDir = path.join(__dirname, '..', 'parse-interface-guide');
const testDir = path.join(__dirname, '..', 'lib', 'tests');

function padding(length) {
let space = [];
Expand All @@ -18,25 +19,24 @@ function padding(length) {

function generateReact(name) {
return (
`import React from 'react';
import styles from 'components/${name}/${name}.scss';

export default class ${name} extends React.Component {
constructor() {
super();
}
`import PropTypes from 'lib/PropTypes';
import React from 'react';
import styles from 'components/${name}/${name}.scss';

render() {
let ${name} = ({prop1}) => {
return <div />;
}

}
${name}.propTypes = {
prop1: PropTypes.string.isRequired.describe('Replace me with the actual props'),
}
`);
}

function generateExample(name) {
return (
`import React${padding(name.length - 5)} from 'react';
import ${name}${padding(5 - name.length)} from 'components/${name}/${name}.react';
import ${name}${padding(5 - name.length)} f`+ 'rom' +` 'components/${name}/${name}.react';

export const component = ${name};

Expand All @@ -53,18 +53,18 @@ export const demos = [

function generateTest(name) {
return (
`jest.dontMock('./${name}.react');
`jest.dontMock('../../components/${name}/${name}.react');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const ${name} = require('./${name}.react');
const ${name} = require('../../components/${name}/${name}.react');

describe('${name}', () => {
it('can render examples', () => {
jest.dontMock('./${name}.example');
const example = require('./${name}.example');
jest.dontMock('../../components/${name}/${name}.example');
const example = require('../../components/${name}/${name}.example');
example.demos.forEach((example, i) => {
example.render();
});
Expand All @@ -74,6 +74,7 @@ describe('${name}', () => {
`);
}


function updateComponentMap(name) {
let numSpace = 1;
if (name.length < 26) {
Expand All @@ -86,7 +87,7 @@ function updateComponentMap(name) {
}

return (
`export let ${name}${spaces}= require('components/${name}/${name}.example');`
`export let ${name}${spaces}= require('components/${name}/${name}.example');\n`
);
}

Expand Down Expand Up @@ -122,7 +123,7 @@ try {
fs.writeFileSync(path.join(rootDir, name, `${name}.react.js`), generateReact(name));
fs.writeFileSync(path.join(rootDir, name, `${name}.scss`), '');
fs.writeFileSync(path.join(rootDir, name, `${name}.example.js`), generateExample(name));
fs.writeFileSync(path.join(rootDir, name, `${name}.test.js`), generateTest(name));
fs.writeFileSync(path.join(testDir, `${name}.test.js`), generateTest(name));
fs.appendFileSync(path.join(pigDir, 'ComponentsMap.js'), updateComponentMap(name));

console.log(`Component ${name} created at ${path.join(rootDir, name)}.`);
Expand Down
Loading