More work with subscriptions
This commit is contained in:
parent
316e14f0ea
commit
918103a17b
12 changed files with 29 additions and 14 deletions
|
|
@ -48,8 +48,8 @@ ActiveFires.deny({
|
|||
* */
|
||||
|
||||
ActiveFires.schema = new SimpleSchema({
|
||||
lat: SimpleSchema.Integer,
|
||||
lon: SimpleSchema.Integer,
|
||||
lat: Number,
|
||||
lon: Number,
|
||||
scan: Number,
|
||||
type: String,
|
||||
acq_date: String,
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ FireAlerts.deny({
|
|||
|
||||
FireAlerts.schema = new SimpleSchema({
|
||||
location: Object,
|
||||
'location.lat': SimpleSchema.Integer,
|
||||
'location.lon': SimpleSchema.Integer,
|
||||
'location.lat': Number,
|
||||
'location.lon': Number,
|
||||
aviso: Date
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ Subscriptions.deny({
|
|||
|
||||
Subscriptions.schema = new SimpleSchema({
|
||||
location: Object,
|
||||
'location.lat': SimpleSchema.Integer,
|
||||
'location.lon': SimpleSchema.Integer,
|
||||
'location.lat': Number,
|
||||
'location.lon': Number,
|
||||
distance: Number,
|
||||
owner: String
|
||||
});
|
||||
|
||||
// Subscriptions.attachSchema(Subscriptions.schema);
|
||||
Subscriptions.attachSchema(Subscriptions.schema);
|
||||
|
||||
export default Subscriptions;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Meteor.methods({
|
|||
},
|
||||
'subscriptions.update': function subscriptionsUpdate(doc) {
|
||||
check(doc, {
|
||||
_id: String,
|
||||
_id: Meteor.Collection.ObjectID,
|
||||
location: Match.ObjectIncluding({ lat: Number, lon: Number }),
|
||||
distance: Number
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
/* eslint-disable prefer-arrow-callback */
|
||||
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
import Perlin from 'loms.perlin';
|
||||
import Subscriptions from '../Subscriptions';
|
||||
|
||||
|
|
@ -42,5 +44,7 @@ Meteor.publish('subscriptions', function subscriptions() {
|
|||
// Note: subscriptions.view is also used when editing an existing subscription.
|
||||
Meteor.publish('subscriptions.view', function subscriptionsView(subscriptionId) {
|
||||
check(subscriptionId, String);
|
||||
return Subscriptions.find({ _id: subscriptionId, owner: this.userId });
|
||||
const id = new Mongo.ObjectID(subscriptionId);
|
||||
check(id, Meteor.Collection.ObjectID);
|
||||
return Subscriptions.find({ _id: id, owner: this.userId });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -174,6 +174,6 @@ SelectionMap.propTypes = {
|
|||
};
|
||||
|
||||
export default translate([], { wait: true })(withTracker(props => ({
|
||||
center: props.center[0] ? props.center : geolocation.get(),
|
||||
center: props.center[0] !== null ? props.center : geolocation.get(),
|
||||
distance: props.distance
|
||||
}))(SelectionMap));
|
||||
|
|
|
|||
|
|
@ -13,3 +13,11 @@
|
|||
width: 85vw;
|
||||
}
|
||||
}
|
||||
|
||||
.dist-slider {
|
||||
margin: 0px 10px 30px 10px;
|
||||
}
|
||||
|
||||
.center-in-my-pos {
|
||||
margin: 10px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import Terms from '../../pages/Terms/Terms';
|
|||
import Privacy from '../../pages/Privacy/Privacy';
|
||||
import License from '../../pages/License/License';
|
||||
import Credits from '../../pages/Credits/Credits';
|
||||
import FireSubscription from '../../pages/FireSubscription/FireSubscription';
|
||||
import ReSendEmail from '../../components/ReSendEmail/ReSendEmail';
|
||||
import FiresMap from '../../pages/FiresMap/FiresMap';
|
||||
import Sandbox from '../../pages/Sandbox/Sandbox';
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ export default createContainer(({ match }) => {
|
|||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Subscriptions.findOne(subscriptionId)
|
||||
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||
};
|
||||
}, EditSubscription);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class FireSubscription extends React.Component {
|
|||
</Col>
|
||||
<Col xs={12} sm={12} md={6} lg={6} >
|
||||
<DistanceSlider onChange={value => this.onSliderChange(value)} />
|
||||
<Row className="align-items-center justify-content-center">
|
||||
<Row className="center-in-my-pos">
|
||||
<CenterInMyPosition onClick={viewport => this.centerOnUserLocation(viewport)} />
|
||||
</Row>
|
||||
</Col>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@ export default createContainer(({ match }) => {
|
|||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Subscriptions.findOne(subscriptionId)
|
||||
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||
};
|
||||
}, ViewSubscription);
|
||||
|
|
|
|||
|
|
@ -15,3 +15,7 @@ body {
|
|||
/* for fixed header */
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue