Skip to content

Commit

Permalink
Reset to upstream (#1)
Browse files Browse the repository at this point in the history
* Do not merge the same story.

* Actually handle replacing, not merging, records.

* Try to replace tapes, when possible.

* Search UI will handle dates for queries.

* Pasing the correct parameters to the service for search.

* Search client service, not exporting unnecessary things.

* Chore: removing extra whitespace.

* Fix database not being read at startup

* Some layout improvements, breaking start and end dates into explicit fields that can be manually set by the user.

* Add some basic logging on error

* Some layout improvements, breaking start and end dates into explicit fields that can be manually set by the user.

* Expand first/last dates.

* Current record will collapse on background click.

* Adding a new record will set it as current for editing.

* Fixing collapse when middle record is selected.

* Add icon indicators on right side.

* Tests for archive.collapse

* Remove extension importing mock logger.

* Gulpfile makes builds *much* faster.

* Gulp for build; run mocha and karma directly.

* Save on close, and show toast when done.

* Made webpack less verbose in it's output, took out webpack stream.

* Updated mocks.

* Add multimedia to detail view layout

- Adds videos, images, and notes to layout.
- Adds videos and images to the data model.

* Don't let stubs span columns

* Fix some nits.

* Add file upload UI and API route

* Reused TabletTop uploader.

* Uploads save in data/ directory, and load in sidebar.

* Updates after call w/ Stan

* Ensure persisted database when no db present.

* Only show image loader with valid label.

* Miscellaneous.

* Cleaned up date entry.

* Reload data when loading records.

* Added missing static mock.

* When renaming a record, move the images as well.

* Sort by label when find()ing all records.

* Test regression and correctly filter duplicate stories.

* Add static Bootstrap, and augment some elements with bootstrap styles.

* Bump karma version, see karma-runner/karma#1782

* Records now grouped by family

* Futzed with styles for archive record list.

* Use same markup in pre and post.

* no-sticky the subheaders.

* Add toggle between view and edit for record top content.

* Responsive record view

* Initial markup for video association.

* This tweaks a bug with firefox's rendering of md-card. Basically, there is a css prop that sets max height to 100%. Firefox interprets this as the height of the visible viewport rather than 'what is needed', or whatever chrome actually is. By setting this value to inherit, the height is automatically inherited. This works in chrome and firefox.

* Added videos api, and /api/videos/incoming route.

* Tweak class implementation.

* Patch the other card.

* worked in video player to responsive design and moved buttons

* put back real video code

* Changes to labels. Dates crunch and family as a super.

* Hey tests actually run now.

* So, apparently <super> isn't a tag. Changed to <sup> and added md-subheader class to family on record view.

* displays error when server not running

* Tigthen list view and fix icons

* Changed icon for notes

* Fix tests that had bad form, and add Associate route for adding vidoes.

* Displaying incoming videos.

* Associate incoming videos.

* When creating a new record, start in edit state.

* Added documentation on how to set up ./incoming

* Do not try to focus a record when it does not have an input.

* Added image delete button.

* Search bar works and even works right!

* Allow force set of a Record id

* Correct test to use ID convention forced in Record

* Set baseId when id is force set; Update test to check for force set id

* Remove tslint option

* Fix a bunch of breaking things.

* Add a form-level action for searching.

* Unify data/ and incoming/

* Update docs.

* Try ARCHIVE_DATA_ROOT first for image paths.

* And do the same for the list of incoming vidoes.

* finish refactoring basePath and dataPath.

* Moving in a hurry...

* Added debugging for video display.

* Use more correct images url for video.

* Remove console.log

* Changes to adding video

* Don't attempt to save when a current request is in flight.

* Make Notes part of the Editable toggle.

* Add videos safely, and show them immediately.

* This makes the style bar look not as totally horendous.

* Create missing record folders when associating videos.

* When users attempt to move a record into an existing label, don't damage data and tell them why it failed.

* Ensure newly added & saved records have correct baseId.

* URL encodes search and selected record.

BIG BUG: Dates are all mucked up.

* Fix date handling.

* Handle all path permutations.

* Records have a more permissive check for when two stories are equivalent.

* Clarified and simplified story adding and editing.

* Save record when finished editing stories.

* Do not dupe when saving renamed stories.

* Only allow single story to be edited at a time.

* Clearing a story's slug will change save to delete.

* Sets focus on slug when editing story.

* Merge with a real record.

* Search within stories.

* Wait for previous record to close before opening new record.

* Delete button on images confirms, then deletes.

* Sort by family, then first: date.

* Punt on performance, and just hide the FAB when a tape is selected.

* Use mdButton for virtual click on Add Image.

* Delete dialog and button.

* Update media links when renaming records.

* Always anchorscroll when selecting records.

* Apparently we were not merging dates, because we thought they should be computed at one point.

* Consistently enters edit mode when creating a new record.

* Assume that returned media data is canonical.

* Update location when saving and when collapsing.

* Return record data after renaming files, and update in memory record.

* Turns out, failing to remove an image you want removed is not an exceptional case.

* Delete records, as per discussion.

* Actually remove the tape after deleting it.

* Remove the empty directory on delete.

* Make viewing state for notes

* add padding to video player

* put record medium selector in line

* Disable [Delete] when the form is not pristine.

* Do not fail save when data/id dir is not present.

* addressed Davids notes

* a space

* another space
  • Loading branch information
JonathanPorta authored Jun 22, 2016
1 parent 86075e7 commit 7d76c0a
Show file tree
Hide file tree
Showing 61 changed files with 4,129 additions and 597 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*]
indent_style = space
indent_size = 2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
dist/
npm-debug.log
.db.json
data
incoming/
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@

1. Install [NVM](https://github.com/creationix/nvm)
1. Install Node.js 4+
1. Create `./incoming` and `./data` for uploaded videos and psersistence, or
configure `ARCHIVE_DATA_ROOT`
1. Install NPM dependencies
1. Run test suite
1. Start a webserver

```
nvm install 4 ; nvm alias default 4 # One-time thing to get the right Node.
cd path/to/project
npm install # The tests should pass, and the command shouldn't fail.
mkdir incoming
# Alternatively, if you are uploading to a remote location, export this instead:
export ARCHIVE_INCOMING="/var/path/to/uploaded/vidoes"
npm install # The command shouldn't fail.
npm test # The tests should pass, and the command shouldn't fail.
npm start # The server will come up on localhost:8080, and print a banner.
```
116 changes: 116 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
'use strict';

let gulp = require('gulp');
let gutil = require('gulp-util');
let path = require('path');

const INDEX = 'src/client/index.jade';
const SOURCES = 'src/**/*.ts';
const TEST_SOURCES = 'src/**/*.{mock,spec}.ts';
const MOCKS = 'src/**/*mock.ts';
const TYPEDEPS = 'src/typings/**/*.d.ts';
const COMPILED_TEST_SOURCES = [
'dist/**/*.spec.js',
'!dist/client/**/*.spec.js'
];
const STATIC_FILES = 'src/static/**/*.css';
const CLIENT_ROOT = 'src/client';
const TEMPLATES = CLIENT_ROOT + '/**/*.jade';
const STYLES = CLIENT_ROOT + '/**/*.scss';
const STATIC = 'dist/_static';

const DEFAULT_TASKS = ['build', 'lint'];


/**
* Typescript gets compiled from src/ to dist/
*/
let gts = require('gulp-typescript');
let tsProject = gts.createProject('tsconfig.json');
let ts = gts(tsProject);
gulp.task('build:tsc', function() {
let destination = gulp.dest('dist');
return gulp.src([SOURCES]).pipe(ts).pipe(destination);
});

/**
* Copy static files
*/
gulp.task('build:copy:static', function() {
let destination = gulp.dest(STATIC);
return gulp.src([STATIC_FILES]).pipe(destination);
});

/**
* Bundle client app.
*/
let webpack = require('webpack');
gulp.task('bundle:client', ['build:tsc', 'build:copy:static'], function(done) {
const INDEX_ROOT = './dist/client/index.js';
const WPOPTS = require('./webpack.config.js');
WPOPTS.entry = INDEX_ROOT;
WPOPTS.output.path = path.resolve(STATIC);
webpack(WPOPTS, function(err, stats) {
if(err) {
throw new gutil.PluginError('webpack', err);
}
gutil.log('[webpack]', stats.toString({
colors: true,
chunks: false
}));
done();
});
});

/**
* Compile all templates
*/
let jade = require('gulp-jade');
let cache = require('gulp-angular-templatecache');
gulp.task('index', function() {
let STATIC_DEST = gulp.dest(STATIC);
return gulp.src([INDEX]).pipe(jade()).pipe(STATIC_DEST);
});
gulp.task('templates', function() {
const TEMPL_DEST = gulp.dest(STATIC);
const CACHE_OPTS = {
module: 'mtna.templates',
standalone: true,
transformUrl: _ => '/' + _
};
return gulp.src([TEMPLATES]).pipe(jade()).pipe(cache(CACHE_OPTS)).pipe(TEMPL_DEST);
});

/**
* Put together custom styles.
*/
let sass = require('gulp-sass');
let concatcss = require('gulp-concat-css');
gulp.task('styles', function() {
let STATIC_DEST = gulp.dest(STATIC);
return gulp.src([STYLES]).pipe(sass({outputStyle: 'compressed'})).pipe(concatcss('styles.css')).pipe(STATIC_DEST);
});

/**
* Lint checks all of our code.
*/
let tslintconfig = require('./tslint.json');
let tslint = require('gulp-tslint');
gulp.task('lint:tslint', function() {
return gulp.src([SOURCES, `!${TYPEDEPS}`, `!${MOCKS}`])
.pipe(tslint({configuration: tslintconfig}))
.pipe(tslint.report('prose'));
});

/**
* Some default tasks.
*/
const DEFAULT = ['default'];
gulp.task('default', DEFAULT_TASKS);
gulp.task('build', ['build:tsc', 'bundle:client', 'templates', 'styles', 'index']);
gulp.task('lint', ['lint:tslint']);
gulp.task('watch', DEFAULT, function() { gulp.watch([SOURCES], DEFAULT); });

if (require.main === module) {
gulp.runTask('default');
}
76 changes: 16 additions & 60 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,24 @@
// Karma configuration
// Generated on Sun Oct 11 2015 10:11:58 GMT-0400 (EDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],


// list of files / patterns to load in the browser
files: [
'./src/vendors/angular.js',
'./src/vendors/angular-*.js',
'./dist/templates.js',
'./dist/clientTest.js'
"frameworks" : [ "mocha", "sinon" ],
"files" : [
"./src/vendors/angular.js",
"./src/vendors/angular-*.js",
"./dist/_static/templates.js",
"./dist/client/**/*.spec.js"
],

"preprocessors" :
{"./dist/client/**/*.spec.js" : [ "webpack", "sourcemap" ]},

// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

"webpackMiddleware" : {"noInfo" : true},

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],
"reporters" : [ "progress" ],
"port" : 9876,

"colors" : true,
"browsers" : [ "Firefox" ],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
})
}
"singleRun" : false
});
};
71 changes: 28 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,45 @@
],
"license": "ISC",
"scripts": {
"watch": "watch 'npm run test --silent' src/ # run this for real-time build and test",
"start": "node dist/api/app.js",
"test": "npm run test:api --silent ; npm run test:browser --silent && echo 'All test suites pass!'",
"test:api": "mocha $(node ./src/scripts/glob './dist/{api,shared}/**/*.spec.js')",
"pretest": "gulp",
"test": "npm run test:mocha; npm run test:browser",
"test:browser": "karma start ./karma.config.js --single-run",
"pretest": "npm run build --silent",
"build": "mkdir -p dist/_static && npm run build:scripts && npm run build:styles && npm run build:markup && echo 'MTNA ready!'",
"build:scripts": "npm run build:tsc && npm run build:bundle && echo 'Scripts bundled!'",
"build:tsc": "echo 'Building Typscript... ' ; tsc --declaration --experimentalDecorators --module commonjs --noEmitOnError --noImplicitAny --outDir ./dist --preserveConstEnums --rootDir ./src --sourceMap --suppressImplicitAnyIndexErrors --target ES5 $(node ./src/scripts/glob './src/**/*.ts')",
"build:tsc:scripts": "tsc -p ./src/scripts",
"build:bundle": "npm run build:bundle:tests && npm run build:bundle:prod",
"build:bundle:prod": "echo 'Bundling prod... ' ; webpack -d dist/client/index.js ./dist/_static/bundle.js >/dev/null",
"build:bundle:tests": "echo 'Bundling tests... ' ; webpack -d $(node ./src/scripts/glob 'dist/client/**/*.spec.js') ./dist/clientTest.js >/dev/null",
"build:markup": "npm run build:jade:templates && npm run build:markup:cache && npm run build:jade:index && echo 'Markup emitted!'",
"build:jade:templates": "echo 'Jading HTML... ' ; jade --out dist/client --hierarchy src/client >/dev/null",
"build:jade:index": "cp ./dist/client/index.html ./dist/_static/index.html",
"build:markup:cache": "node ./src/scripts/templateCache.js -m mtna.templates -p ./dist/client $(node ./src/scripts/glob './dist/client/**/*.html') > ./dist/_static/templates.js",
"build:styles": "npm run build:styles:scss && npm run build:styles:join && echo 'Styles joined!'",
"build:styles:scss": "echo 'Compiling CSS... ' ; node-sass --quiet --recursive --output dist/client src/client",
"build:styles:join": "echo 'Joining CSS... ' ; cleancss --output dist/_static/styles.css $(node ./src/scripts/glob './dist/client/**/*.css')",
"prebuild": "[ -f ./src/scripts/glob.js ] || npm run build:tsc:scripts",
"postbuild": "npm run lint",
"lint": "npm run lint:tsc && npm run lint:sass && echo 'Local style guide enforced!'",
"lint:tsc": "echo 'Linting Typescript... ' ; tslint $(node ./src/scripts/glob './src/{api,client,scripts}/**/*.ts')",
"test:mocha": "mocha dist/{api,shared}/**/*.spec.js",
"lint:sass": "echo 'Linting Sass... ' ; sass-lint --verbose --no-exit $(node ./src/scripts/glob './src/**/*.scss')",
"lint:jade": "echo 'Linting Jade... ' ; ",
"clean": "rm -rf dist/ src/scripts/*.js",
"list": "echo $(node ./src/scripts/glob './src/**/*.scss')"
"clean": "rm -rf dist/"
},
"dependencies": {
"busboy": "^0.2.11",
"mkdirp": "^0.5.1",
"ts-rupert": "0.4.1-beta6"
},
"devDependencies": {
"chai": "3.2.0",
"clean-css": "3.4.5",
"commander": "2.8.1",
"glob": "5.0.15",
"chai": "^3.5.0",
"gulp": "^3.9.0",
"gulp-angular-templatecache": "^1.8.0",
"gulp-concat-css": "^2.2.0",
"gulp-jade": "^1.1.0",
"gulp-mocha": "^2.2.0",
"gulp-sass": "^2.1.0",
"gulp-tslint": "^4.3.2",
"gulp-typescript": "^2.9.2",
"gulp-util": "^3.0.7",
"jade": "1.11.0",
"karma": "0.13.10",
"karma-chrome-launcher": "0.2.1",
"karma-cli": "0.1.1",
"karma": "^0.13.21",
"karma-chrome-launcher": "^0.2.2",
"karma-cli": "^0.1.2",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "0.2.0",
"mocha": "2.2.5",
"node-sass": "3.3.3",
"sass-lint": "1.2.3",
"sinon": "1.17.1",
"karma-mocha": "^0.2.2",
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.4",
"mock-fs": "^3.6.0",
"sinon": "^1.17.3",
"sinon-chai": "2.8.0",
"source-map-loader": "^0.1.5",
"supertest": "1.1.0",
"ts-loader": "^0.6.0",
"tslint": "2.5.1",
"typescript": "1.6.2",
"watch": "0.16.0",
"webpack": "^1.12.2"
"supertest": "^1.2.0",
"webpack": "^1.12.8"
}
}
14 changes: 13 additions & 1 deletion src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,31 @@ import {
RecordHandler
} from './record/record';

import{
VideoHandler
} from './videos/video';

const defaults: any = {
log: {level: 'info'},
uploads: { size: '15Mb' },
static: {
routes: {
'/': normalize(join(__dirname, '../_static')),
'/images/': normalize(
// TODO If and when Rupert gets referential configs, set that here.
join(process.env['ARCHIVE_DATA_ROOT'] || process.cwd(), 'data'))
}
},
archive: {
data_root: normalize(process.cwd())
}
};

export const server = Rupert.createApp(defaults, [
Plugins.Healthz,
Plugins.Static,
RecordHandler
RecordHandler,
VideoHandler
]);

if (require.main === module) {
Expand Down
Loading

0 comments on commit 7d76c0a

Please sign in to comment.