Frontend: Code & test clean-up

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2019-12-05 03:58:54 +01:00
parent 2541b95c68
commit 9f8bad1ffa
7 changed files with 17 additions and 15 deletions

View file

@ -18,7 +18,8 @@ dep: dep-tensorflow dep-js dep-go
build: build-js build-go build: build-js build-go
install: install-bin install-assets install: install-bin install-assets
test: test-js test-go test: test-js test-go
acceptance: start test-chromium test-firefox stop acceptance-all: start acceptance acceptance-firefox stop
test-all: test acceptance-all
fmt: fmt-js fmt-go fmt: fmt-js fmt-go
upgrade: upgrade-js upgrade-go upgrade: upgrade-js upgrade-go
start: start:
@ -63,12 +64,12 @@ watch-js:
test-js: test-js:
$(info Running JS unit tests...) $(info Running JS unit tests...)
(cd frontend && env NODE_ENV=development BABEL_ENV=test npm run test) (cd frontend && env NODE_ENV=development BABEL_ENV=test npm run test)
test-chromium: acceptance:
$(info Running JS acceptance tests in Chrome...) $(info Running JS acceptance tests in Chrome...)
(cd frontend && npm run test-chromium) (cd frontend && npm run acceptance)
test-firefox: acceptance-firefox:
$(info Running JS acceptance tests in Firefox...) $(info Running JS acceptance tests in Firefox...)
(cd frontend && npm run test-firefox) (cd frontend && npm run acceptance-firefox)
test-go: test-go:
$(info Running all Go unit tests...) $(info Running all Go unit tests...)
$(GOTEST) -count=1 -tags=slow -timeout 20m ./internal/... $(GOTEST) -count=1 -tags=slow -timeout 20m ./internal/...

View file

@ -5,7 +5,7 @@ process.env.CHROME_BIN = findChrome();
module.exports = (config) => { module.exports = (config) => {
config.set({ config.set({
logLevel: config.LOG_INFO, logLevel: config.LOG_ERROR,
webpackMiddleware: { webpackMiddleware: {
stats: "errors-only", stats: "errors-only",
@ -24,6 +24,7 @@ module.exports = (config) => {
files: [ files: [
{pattern: "tests/unit/**/*_test.js", watched: false}, {pattern: "tests/unit/**/*_test.js", watched: false},
'node_modules/@babel/polyfill/dist/polyfill.js',
], ],
// Preprocess through webpack // Preprocess through webpack

View file

@ -10,8 +10,8 @@
"lint": "eslint --cache src/ *.js", "lint": "eslint --cache src/ *.js",
"fmt": "eslint --cache --fix src/ *.js", "fmt": "eslint --cache --fix src/ *.js",
"test": "karma start", "test": "karma start",
"test-chromium": "testcafe \"chromium:headless --disable-dev-shm-usage\" --selector-timeout 5000 -S -s tests/screenshots tests/acceptance", "acceptance": "testcafe \"chromium:headless --disable-dev-shm-usage\" --selector-timeout 5000 -S -s tests/screenshots tests/acceptance",
"test-firefox": "testcafe firefox:headless --selector-timeout 5000 -S -s tests/screenshots tests/acceptance", "acceptance-firefox": "testcafe firefox:headless --selector-timeout 5000 -S -s tests/screenshots tests/acceptance",
"gettext-extract": "gettext-extract --attribute v-translate --output src/resources/translations.pot $(find src/ -type f -name '*.vue')", "gettext-extract": "gettext-extract --attribute v-translate --output src/resources/translations.pot $(find src/ -type f -name '*.vue')",
"gettext-compile": "gettext-compile --output src/resources/translations.json src/resources/*.po" "gettext-compile": "gettext-compile --output src/resources/translations.json src/resources/*.po"
}, },

View file

@ -90,7 +90,7 @@
</v-list-tile> </v-list-tile>
<v-list-tile v-for="(album, index) in config.albums" <v-list-tile v-for="(album, index) in config.albums"
:key="index" :to="{ name: 'albums_view', params: { uuid: album.AlbumUUID, slug: album.AlbumSlug } }"> :key="index" :to="{ name: 'album', params: { uuid: album.AlbumUUID, slug: album.AlbumSlug } }">
<v-list-tile-content> <v-list-tile-content>
<v-list-tile-title v-if="album.AlbumName">{{ album.AlbumName }}</v-list-tile-title> <v-list-tile-title v-if="album.AlbumName">{{ album.AlbumName }}</v-list-tile-title>
<v-list-tile-title v-else>Untitled</v-list-tile-title> <v-list-tile-title v-else>Untitled</v-list-tile-title>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="p-page p-page-albums-view" v-infinite-scroll="loadMore" :infinite-scroll-disabled="scrollDisabled" <div class="p-page p-page-album-photos" v-infinite-scroll="loadMore" :infinite-scroll-disabled="scrollDisabled"
:infinite-scroll-distance="10" :infinite-scroll-listen-for-event="'scrollRefresh'"> :infinite-scroll-distance="10" :infinite-scroll-listen-for-event="'scrollRefresh'">
<p-album-photo-search :settings="settings" :filter="filter" :filter-change="updateQuery" <p-album-photo-search :settings="settings" :filter="filter" :filter-change="updateQuery"
@ -25,7 +25,7 @@
import Photo from "model/photo"; import Photo from "model/photo";
export default { export default {
name: 'p-page-albums-view', name: 'p-page-album-photos',
props: { props: {
staticFilter: Object staticFilter: Object
}, },

View file

@ -157,7 +157,7 @@
}, },
openAlbum(index) { openAlbum(index) {
const album = this.results[index]; const album = this.results[index];
this.$router.push({name: "albums_view", params: { uuid: album.AlbumUUID, slug: album.AlbumSlug }}); this.$router.push({name: "album", params: { uuid: album.AlbumUUID, slug: album.AlbumSlug }});
}, },
loadMore() { loadMore() {
if (this.scrollDisabled) return; if (this.scrollDisabled) return;

View file

@ -1,6 +1,6 @@
import Photos from "pages/photos.vue"; import Photos from "pages/photos.vue";
import Albums from "pages/albums.vue"; import Albums from "pages/albums.vue";
import AlbumsView from "pages/albums/view.vue"; import AlbumPhotos from "pages/album/photos.vue";
import Places from "pages/places.vue"; import Places from "pages/places.vue";
import Labels from "pages/labels.vue"; import Labels from "pages/labels.vue";
import Events from "pages/events.vue"; import Events from "pages/events.vue";
@ -36,9 +36,9 @@ export default [
meta: {area: "Albums"}, meta: {area: "Albums"},
}, },
{ {
name: "albums_view", name: "album",
path: "/albums/:uuid/:slug", path: "/albums/:uuid/:slug",
component: AlbumsView, component: AlbumPhotos,
meta: {area: "View Album"}, meta: {area: "View Album"},
}, },
{ {