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({
|
ActiveFires.schema = new SimpleSchema({
|
||||||
lat: SimpleSchema.Integer,
|
lat: Number,
|
||||||
lon: SimpleSchema.Integer,
|
lon: Number,
|
||||||
scan: Number,
|
scan: Number,
|
||||||
type: String,
|
type: String,
|
||||||
acq_date: String,
|
acq_date: String,
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ FireAlerts.deny({
|
||||||
|
|
||||||
FireAlerts.schema = new SimpleSchema({
|
FireAlerts.schema = new SimpleSchema({
|
||||||
location: Object,
|
location: Object,
|
||||||
'location.lat': SimpleSchema.Integer,
|
'location.lat': Number,
|
||||||
'location.lon': SimpleSchema.Integer,
|
'location.lon': Number,
|
||||||
aviso: Date
|
aviso: Date
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,12 @@ Subscriptions.deny({
|
||||||
|
|
||||||
Subscriptions.schema = new SimpleSchema({
|
Subscriptions.schema = new SimpleSchema({
|
||||||
location: Object,
|
location: Object,
|
||||||
'location.lat': SimpleSchema.Integer,
|
'location.lat': Number,
|
||||||
'location.lon': SimpleSchema.Integer,
|
'location.lon': Number,
|
||||||
distance: Number,
|
distance: Number,
|
||||||
owner: String
|
owner: String
|
||||||
});
|
});
|
||||||
|
|
||||||
// Subscriptions.attachSchema(Subscriptions.schema);
|
Subscriptions.attachSchema(Subscriptions.schema);
|
||||||
|
|
||||||
export default Subscriptions;
|
export default Subscriptions;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ Meteor.methods({
|
||||||
},
|
},
|
||||||
'subscriptions.update': function subscriptionsUpdate(doc) {
|
'subscriptions.update': function subscriptionsUpdate(doc) {
|
||||||
check(doc, {
|
check(doc, {
|
||||||
_id: String,
|
_id: Meteor.Collection.ObjectID,
|
||||||
location: Match.ObjectIncluding({ lat: Number, lon: Number }),
|
location: Match.ObjectIncluding({ lat: Number, lon: Number }),
|
||||||
distance: Number
|
distance: Number
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* eslint-disable prefer-arrow-callback */
|
/* eslint-disable prefer-arrow-callback */
|
||||||
|
|
||||||
import { Meteor } from 'meteor/meteor';
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { Mongo } from 'meteor/mongo';
|
||||||
|
import { check } from 'meteor/check';
|
||||||
import Perlin from 'loms.perlin';
|
import Perlin from 'loms.perlin';
|
||||||
import Subscriptions from '../Subscriptions';
|
import Subscriptions from '../Subscriptions';
|
||||||
|
|
||||||
|
|
@ -42,5 +44,7 @@ Meteor.publish('subscriptions', function subscriptions() {
|
||||||
// Note: subscriptions.view is also used when editing an existing subscription.
|
// Note: subscriptions.view is also used when editing an existing subscription.
|
||||||
Meteor.publish('subscriptions.view', function subscriptionsView(subscriptionId) {
|
Meteor.publish('subscriptions.view', function subscriptionsView(subscriptionId) {
|
||||||
check(subscriptionId, String);
|
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 => ({
|
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
|
distance: props.distance
|
||||||
}))(SelectionMap));
|
}))(SelectionMap));
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,11 @@
|
||||||
width: 85vw;
|
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 Privacy from '../../pages/Privacy/Privacy';
|
||||||
import License from '../../pages/License/License';
|
import License from '../../pages/License/License';
|
||||||
import Credits from '../../pages/Credits/Credits';
|
import Credits from '../../pages/Credits/Credits';
|
||||||
import FireSubscription from '../../pages/FireSubscription/FireSubscription';
|
|
||||||
import ReSendEmail from '../../components/ReSendEmail/ReSendEmail';
|
import ReSendEmail from '../../components/ReSendEmail/ReSendEmail';
|
||||||
import FiresMap from '../../pages/FiresMap/FiresMap';
|
import FiresMap from '../../pages/FiresMap/FiresMap';
|
||||||
import Sandbox from '../../pages/Sandbox/Sandbox';
|
import Sandbox from '../../pages/Sandbox/Sandbox';
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,6 @@ export default createContainer(({ match }) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: !subscription.ready(),
|
loading: !subscription.ready(),
|
||||||
doc: Subscriptions.findOne(subscriptionId)
|
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||||
};
|
};
|
||||||
}, EditSubscription);
|
}, EditSubscription);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class FireSubscription extends React.Component {
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={12} sm={12} md={6} lg={6} >
|
<Col xs={12} sm={12} md={6} lg={6} >
|
||||||
<DistanceSlider onChange={value => this.onSliderChange(value)} />
|
<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)} />
|
<CenterInMyPosition onClick={viewport => this.centerOnUserLocation(viewport)} />
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,6 @@ export default createContainer(({ match }) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: !subscription.ready(),
|
loading: !subscription.ready(),
|
||||||
doc: Subscriptions.findOne(subscriptionId)
|
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||||
};
|
};
|
||||||
}, ViewSubscription);
|
}, ViewSubscription);
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,7 @@ body {
|
||||||
/* for fixed header */
|
/* for fixed header */
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navbar-nav .nav-link {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue