Skip to content

Commit 7595a3f

Browse files
committed
Usability: Dark/Light mode switch added, Fixes: DB not available - log human error instead of an exception, Technical: Upgrade to Vuetify 1.5.7
1 parent b9c0ae9 commit 7595a3f

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

client/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"vue-axios": "^2.1.4",
1717
"vue-markdown": "^2.2.4",
1818
"vue-router": "^3.0.2",
19-
"vuetify": "^1.5.6",
19+
"vuetify": "^1.5.7",
2020
"vuetify-stylus-fixed-table-header": "^1.1.0",
2121
"vuetify-upload-button": "^1.2.2",
2222
"vuex": "^3.1.0"

client/src/App.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Copyright © 2018-2019 Stanislav Valasek <valasek@gmail.com> -->
22

33
<template>
4-
<v-app>
4+
<v-app :dark="goDark">
55
<v-snackbar v-model="notification" :color="notificationType" :left="true" :timeout="5000">
66
{{ notificationText }}
77
</v-snackbar>
@@ -21,7 +21,10 @@
2121
<v-divider class="menuSettings" />
2222

2323
<v-list-tile class="menuSettings">
24-
<v-switch v-model="weekUnlocked" :disabled="isCurrentWeek===true" label="Enable editing of this week" color="error" hide-details class="body-1" />
24+
<v-switch v-model="weekUnlocked" :disabled="isCurrentWeek===true" label="Enable editing of this week" color="info" hide-details class="body-1" />
25+
</v-list-tile>
26+
<v-list-tile class="menuSettings">
27+
<v-switch v-model="goDark" label="Enable dark mode" color="info" hide-details class="body-1" />
2528
</v-list-tile>
2629
</v-list>
2730
</v-navigation-drawer>
@@ -69,6 +72,7 @@
6972

7073
data () {
7174
return {
75+
goDark: false,
7276
drawer: true,
7377
items: [
7478
{ title: 'Report my work', icon: 'work_outline', route: 'report' },

screenshots/screencast.gif

-2.84 MB
Loading

server/models/db.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
package models
44

55
import (
6+
"os"
67
"time"
78

9+
"github.com/valasek/timesheet/server/logger"
10+
811
"github.com/jinzhu/gorm"
912
_ "github.com/jinzhu/gorm/dialects/mysql" // needed because of gorm design
1013
_ "github.com/jinzhu/gorm/dialects/postgres" // needed because of gorm design
@@ -59,11 +62,13 @@ func NewPostgresDB(dataSourceName string) *DB {
5962

6063
db, err := gorm.Open("postgres", dataSourceName)
6164
if err != nil {
62-
panic(err)
65+
logger.Log.Error("cannot open postgres connection, error: ", err)
66+
os.Exit(1)
6367
}
6468

6569
if err = db.DB().Ping(); err != nil {
66-
panic(err)
70+
logger.Log.Error("cannot ping postgres, error: ", err)
71+
os.Exit(1)
6772
}
6873

6974
// db.LogMode(true)
@@ -76,11 +81,14 @@ func NewMySQLDB(dataSourceName string) *DB {
7681

7782
db, err := gorm.Open("mysql", dataSourceName)
7883
if err != nil {
79-
panic(err)
84+
logger.Log.Error("cannot open mysql connection, error: ", err)
85+
os.Exit(1)
8086
}
8187

8288
if err = db.DB().Ping(); err != nil {
83-
panic(err)
89+
// panic("ping", err)
90+
logger.Log.Error("cannot ping mysql, error: ", err)
91+
os.Exit(1)
8492
}
8593

8694
// db.LogMode(true)

server/timesheet.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ url: "" # URL on which application is running
3030
PORT: "3000" # port on which application is running
3131

3232
# DB type
33-
dbType: "mysql" # allowed types postgresql or mysql
33+
dbType: "postgresql" # allowed types postgresql or mysql
3434

3535
# Production URL - will be read from production environment config variable
3636
# If set, Database settings section variables will be ignored

0 commit comments

Comments
 (0)