Skip to content

Commit

Permalink
Meteor 1.9 upgrade
Browse files Browse the repository at this point in the history
🔥 removing aldeed:tabular dependency and all associated workarounds
⬆️ upgrading to Meteor 1.9
⬆️ updated package dependencies
🐳 updating docker base image to reflect changes in Meteor 1.9
🐛 bug fixes for the new weekly time input mode
💄 further UI and dark mode improvements 🌑
✨ added global keyboard shortcuts (CTRL + SHIFT + S to save)
  • Loading branch information
faburem committed Jan 17, 2020
1 parent 8446647 commit b074323
Show file tree
Hide file tree
Showing 43 changed files with 1,153 additions and 1,078 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.yml
Expand Up @@ -37,12 +37,8 @@ rules:
import/no-unresolved: [2, { ignore: ['^meteor'] }]
no-console: [2, { allow: ['warn', 'error'] }]
no-restricted-syntax: [2, 'DebuggerStatement', 'LabeledStatement', 'WithStatement']
i18next/no-literal-string: 1
# eslint-plugin-meteor
# meteor/no-session: [1] # allow Session
# meteor/prefer-session-equals: [2] # prefer Session.equals instead
i18next/no-literal-string: [1, { "ignoreCallee": ["$","get","set","add","added","changed","children","html","prop","call","on","is","tab","addClass","removeClass","toggle","querySelector","querySelectorAll","go","remove","getParam","getQueryParam","moment","format","subscribe","publish","setParams","setQueryParams","startOf","endOf","Collection","subtract","find","data"] }]
import/extensions: 0

globals:
adsbygoogle: true
# collections
11 changes: 5 additions & 6 deletions .meteor/packages
Expand Up @@ -6,23 +6,22 @@

meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.0.5 # Packages for a great mobile UX
mongo@1.7.0 # The database Meteor supports right now
mongo@1.8.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.2.0 # Meteor's client-side reactive programming library

standard-minifier-css@1.5.4 # CSS minifier run for production mode
standard-minifier-js@2.5.2 # JS minifier run for production mode
standard-minifier-css@1.6.0 # CSS minifier run for production mode
standard-minifier-js@2.6.0 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.13.2 # Enable ECMAScript2015+ syntax in app code
ecmascript@0.14.0 # Enable ECMAScript2015+ syntax in app code
shell-server@0.4.0 # Server-side component of the `meteor shell` command

fourseven:scss@4.5.0
accounts-password@1.5.2
check@1.3.1
fortawesome:fontawesome
random@1.1.0
aldeed:tabular
dynamic-import@0.5.1
ostrio:loggerconsole
faburem:client-server-logger
Expand All @@ -32,4 +31,4 @@ brettle:accounts-anonymous
brettle:accounts-add-service
tunguska:reactive-aggregate
ostrio:flow-router-extra
jquery
jquery@3.0.0
2 changes: 1 addition & 1 deletion .meteor/release
@@ -1 +1 @@
METEOR@1.8.3
METEOR@1.9
40 changes: 19 additions & 21 deletions .meteor/versions
@@ -1,10 +1,9 @@
accounts-base@1.4.5
accounts-password@1.5.2
aldeed:tabular@2.1.1
accounts-base@1.5.0
accounts-password@1.5.3
allow-deny@1.1.0
autoupdate@1.6.0
babel-compiler@7.4.2
babel-runtime@1.4.0
babel-compiler@7.5.1
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
blaze@2.3.4
Expand All @@ -19,7 +18,7 @@ brettle:workaround-issue-4862@0.0.3
brettle:workaround-issue-4970@0.0.4
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.2.0
callback-hook@1.3.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
Expand All @@ -29,10 +28,10 @@ ddp-server@2.3.0
deps@1.0.12
diff-sequence@1.1.1
dynamic-import@0.5.1
ecmascript@0.13.2
ecmascript@0.14.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.9.0
ecmascript-runtime-server@0.8.0
ecmascript-runtime-client@0.10.0
ecmascript-runtime-server@0.9.0
ejson@1.1.1
email@1.2.3
es5-shim@4.8.0
Expand All @@ -47,27 +46,27 @@ htmljs@1.0.11
http@1.4.2
id-map@1.1.0
inter-process-messaging@0.1.0
jquery@1.11.11
jquery@3.0.0
launch-screen@1.1.1
livedata@1.0.18
localstorage@1.2.0
logging@1.1.20
meteor@1.9.3
meteor-base@1.4.0
minifier-css@1.4.3
minifier-js@2.5.1
minifier-css@1.5.0
minifier-js@2.6.0
minimongo@1.4.5
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modern-browsers@0.1.4
modules@0.14.0
modules-runtime@0.11.0
mongo@1.7.0
modern-browsers@0.1.5
modules@0.15.0
modules-runtime@0.12.0
mongo@1.8.0
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-bcrypt@0.9.3
npm-mongo@3.2.0
npm-mongo@3.3.0
observe-sequence@1.0.16
ordered-dict@1.1.0
ostrio:flow-router-extra@3.7.3
Expand All @@ -82,15 +81,14 @@ reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
service-configuration@1.0.11
session@1.2.0
sha@1.0.9
shell-server@0.4.0
socket-stream-client@0.2.2
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.12
standard-minifier-css@1.5.4
standard-minifier-js@2.5.2
standard-minifier-css@1.6.0
standard-minifier-js@2.6.0
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
Expand All @@ -100,5 +98,5 @@ tunguska:reactive-aggregate@1.2.5
ui@1.0.13
underscore@1.0.10
url@1.2.0
webapp@1.7.5
webapp@1.8.2
webapp-hashing@1.0.9
4 changes: 2 additions & 2 deletions Dockerfile
@@ -1,4 +1,4 @@
FROM node:8.16.2
FROM node:12.14
ENV METEOR_ALLOW_SUPERUSER true
RUN curl https://install.meteor.com/ | sh
RUN meteor --version
Expand All @@ -12,7 +12,7 @@ COPY imports/ ./imports/
COPY .meteor/ ./.meteor/
RUN meteor build /build/ --server-only --architecture os.linux.x86_64

FROM node:8.16.2-slim
FROM node:12.14-slim
RUN apt-get update && apt-get install -y python make g++ && rm -rf /var/lib/apt/lists/*
COPY --from=0 /build/*.tar.gz /app/bundle.tar.gz
WORKDIR /app/
Expand Down
8 changes: 4 additions & 4 deletions imports/api/projects/methods.js
Expand Up @@ -5,15 +5,15 @@ import Projects from './projects.js'
import { checkAuthentication } from '../../utils/server_method_helpers.js'
import { addNotification } from '../notifications/notifications.js'

const replacer = match => emoji.emojify(match)
const replacer = (match) => emoji.emojify(match)

Meteor.methods({
getAllProjectStats() {
checkAuthentication(this)
const projectList = Projects.find(
{ $or: [{ userId: this.userId }, { public: true }, { team: this.userId }] },
{ _id: 1 },
).fetch().map(value => value._id)
).fetch().map((value) => value._id)
let totalHours = 0
let currentMonthHours = 0
let previousMonthHours = 0
Expand Down Expand Up @@ -112,7 +112,7 @@ Meteor.methods({
const projectList = Projects.find(
{ $or: [{ userId: this.userId }, { public: true }, { team: this.userId }] },
{ _id: 1 },
).fetch().map(value => value._id)
).fetch().map((value) => value._id)
const rawCollection = Timecards.rawCollection()
// const aggregate = Meteor.wrapAsync(rawCollection.aggregate, rawCollection)
if (projectId === 'all') {
Expand All @@ -129,7 +129,7 @@ Meteor.methods({
}
const targetProject = Projects.findOne({ _id: projectId })
if (!targetProject || targetProject.userId !== this.userId) {
throw new Meteor.Error(getMessageInUserLangauge(this.userId, 'notifications.only_owner_can_add_team_members'))
throw new Meteor.Error('notifications.only_owner_can_add_team_members')
}
const targetUser = Meteor.users.findOne({ 'emails.0.address': eMail })
if (targetUser) {
Expand Down
144 changes: 142 additions & 2 deletions imports/api/timecards/server/publications.js
Expand Up @@ -2,7 +2,7 @@ import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate'
import Timecards from '../timecards.js'
import Projects from '../../projects/projects.js'
import { periodToDates } from '../../../utils/periodHelpers.js'
import { checkAuthentication, getProjectListById } from '../../../utils/server_method_helpers.js'
import { checkAuthentication, getProjectListById, buildDetailedTimeEntriesForPeriodSelector } from '../../../utils/server_method_helpers.js'

Meteor.publish('projectTimecards', function projectTimecards({ projectId, period, userId }) {
check(projectId, String)
Expand Down Expand Up @@ -68,12 +68,87 @@ Meteor.publish('userTimeCardsForPeriodByProjectByTask', function periodTimecards
},
{
$group: {
_id: '$task',
_id: { $concat: ['$projectId', '|', '$task'] },
entries: { $push: '$$ROOT' },
},
},
], { clientCollection: 'clientTimecards' })
})
// Meteor.publish('dailyTimeCardsForUserByPeriod', function getDailyTimecards({
// projectId,
// userId,
// period,
// customer,
// limit,
// page,
// }) {
// check(projectId, String)
// check(period, String)
// check(userId, String)
// check(customer, String)
// check(limit, Number)
// check(page, Match.Maybe(Number))
// checkAuthentication(this)
// const aggregationSelector = buildDailyHoursSelector(projectId, period, userId, customer, limit, page)
// // const dailyHours = Promise.await(Timecards.rawCollection().aggregate(aggregationSelector))
// const totalEntries = Promise.await(Timecards.rawCollection()
// .aggregate(buildDailyHoursSelector(projectId, period, userId, customer, 0))
// .toArray()).length
// aggregationSelector.push({ $addFields: { totalEntries } })
// aggregationSelector.splice(1, 1)
// return ReactiveAggregate(this, Timecards, aggregationSelector, { clientCollection: 'clientTimecards' })
// })
// getTotalHoursForPeriod({
// projectId,
// userId,
// period,
// customer,
// limit,
// page,
// }) {
// check(projectId, String)
// check(period, String)
// check(userId, String)
// check(customer, String)
// check(limit, Number)
// check(page, Match.Maybe(Number))
// checkAuthentication(this)
// const aggregationSelector = buildTotalHoursForPeriodSelector(projectId, period, userId, customer, limit, page)
// const totalHoursObject = {}
// const totalEntries = Promise.await(Timecards.rawCollection()
// .aggregate(buildTotalHoursForPeriodSelector(projectId, period, userId, customer, 0))
// .toArray()).length
// const totalHours = Promise.await(Timecards.rawCollection().aggregate(aggregationSelector)
// .toArray()).map(totalHoursForPeriodMapper)
// totalHoursObject.totalHours = totalHours
// totalHoursObject.totalEntries = totalEntries
// return totalHoursObject
// },
// getWorkingHoursForPeriod({
// projectId,
// userId,
// period,
// limit,
// page,
// }) {
// check(projectId, String)
// check(period, String)
// check(userId, String)
// check(limit, Number)
// check(page, Match.Maybe(Number))
// const aggregationSelector = buildworkingTimeSelector(projectId, period, userId, limit, page)
// const totalEntries = Promise.await(
// Timecards.rawCollection()
// .aggregate(buildworkingTimeSelector(projectId, period, userId, 0)).toArray(),
// ).length
// const workingHoursObject = {}
// workingHoursObject.totalEntries = totalEntries
// const workingHours = Promise.await(Timecards.rawCollection().aggregate(aggregationSelector)
// .toArray()).map(workingTimeEntriesMapper)
// workingHoursObject.workingHours = workingHours
// return workingHoursObject
// },
// })
Meteor.publish('myTimecardsForDate', function myTimecardsForDate({ date }) {
check(date, String)
checkAuthentication(this)
Expand All @@ -82,7 +157,72 @@ Meteor.publish('myTimecardsForDate', function myTimecardsForDate({ date }) {
date: new Date(date),
})
})
Meteor.publish('getDetailedTimeEntriesForPeriodCount', function getDetailedTimeEntriesForPeriodCount({
projectId,
userId,
customer,
period,
search,
}) {
check(projectId, String)
check(userId, String)
check(customer, String)
check(period, String)
check(search, Match.Maybe(String))
let count = 0
let initializing = true
const selector = buildDetailedTimeEntriesForPeriodSelector({
projectId, search, customer, period, userId,
})
const handle = Timecards.find(selector[0], selector[1]).observeChanges({
added: () => {
count += 1

if (!initializing) {
this.changed('counts', projectId, { count })
}
},
removed: () => {
count -= 1
this.changed('counts', projectId, { count })
},
})

initializing = false
this.added('counts', projectId, { count })
this.ready()

this.onStop(() => handle.stop())
})

Meteor.publish('getDetailedTimeEntriesForPeriod', function getDetailedTimeEntriesForPeriod({
projectId,
userId,
customer,
period,
search,
sort,
limit,
page,
}) {
check(projectId, String)
check(userId, String)
check(customer, String)
check(period, String)
check(search, Match.Maybe(String))
check(sort, Match.Maybe(Object))
if (sort) {
check(sort.column, Number)
check(sort.order, String)
}
check(limit, Number)
check(page, Match.Maybe(Number))
checkAuthentication(this)
const selector = buildDetailedTimeEntriesForPeriodSelector({
projectId, search, customer, period, userId, limit, page, sort,
})
return Timecards.find(selector[0], selector[1])
})
Meteor.publish('singleTimecard', function singleTimecard(_id) {
check(_id, String)
checkAuthentication(this)
Expand Down

0 comments on commit b074323

Please sign in to comment.