Skip to content

Commit

Permalink
feat: work on files attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
albanm committed Oct 2, 2018
1 parent 132fc7b commit af3b018
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM koumoul/webapp-base:1.6.0
MAINTAINER "contact@koumoul.com"

RUN apk add --no-cache --update python make g++
RUN apk add --no-cache --update python make g++ unzip

# Install the prepair command line tool
RUN mkdir /prepair
Expand Down
186 changes: 3 additions & 183 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.1.3",
"http-proxy-middleware": "^0.19.0",
"lodash": "^4.17.10",
"nock": "^9.1.5",
"nodemon": "^1.18.3",
"nyc": "^13.0.1",
"pump": "^3.0.0",
"push-dir": "^0.4.1"
},
"dependencies": {
Expand Down Expand Up @@ -68,7 +70,6 @@
"csv-sniffer": "^0.1.1",
"csv-stringify": "^2.0.2",
"debug": "^3.1.0",
"decompress": "^4.2.0",
"elasticsearch": "^15.1.1",
"event-to-promise": "^0.8.0",
"express": "^4.16.2",
Expand Down
22 changes: 12 additions & 10 deletions public/components/SearchFiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p>Vous pouvez consulter <nuxt-link :to="`/dataset/${dataset.id}/journal`">le journal</nuxt-link> pour en savoir plus.</p>
</div>
<v-card>
<v-card-title>
<v-card-title style="padding-bottom: 0;">
<v-layout column>
<h3 v-if="data.total <= 10000">Consultez {{ data.total.toLocaleString() }} {{ plural ? 'enregistrements' : 'enregistrement' }}</h3>
<h3 v-if="data.total > 10000">Consultez {{ plural ? 'les' : 'le' }} {{ (10000).toLocaleString() }} {{ plural ? 'premiers enregistrements' : 'premier enregistrement' }} ({{ data.total.toLocaleString() }} au total)</h3>
Expand All @@ -19,7 +19,7 @@
@keyup.enter.native="refresh"
@click:append="refresh"/>
<v-spacer/>
<v-flex v-if="data.total > pagination.rowsPerPage" sm4 md2 lg1 xl1>
<v-flex v-if="!hideRowsPerPage && data.total > pagination.rowsPerPage" sm4 md2 lg1 xl1>
<v-select
:items="[10,20,50]"
v-model="pagination.rowsPerPage"
Expand All @@ -30,14 +30,14 @@
</v-layout>
</v-layout>
</v-card-title>
<v-list three-line style="padding-top: 0;" class="search-results">
<v-list-tile v-for="(item, i) in data.results" :key="i">
<v-list-tile-content>
<v-list-tile-title><a :href="resourceUrl + '/files/' + item.file">{{ item.file }}</a></v-list-tile-title>
<v-list-tile-sub-title v-html="item._highlight['_file.content'].join(' ')"/>
</v-list-tile-content>
</v-list-tile>
</v-list>
<v-container fluid class="search-results">
<v-layout v-for="(item, i) in data.results" :key="i" row wrap>
<v-flex xs12>
<h4><a :href="resourceUrl + '/files/' + item.file">{{ item.file }}</a></h4>
<p class="body-1" v-html="item._highlight['_file.content'].join('... ')" />
</v-flex>
</v-layout>
</v-container>
</v-card>
</div>
</template>
Expand All @@ -47,6 +47,7 @@ import { mapState, mapGetters } from 'vuex'
import eventBus from '../event-bus'
export default {
props: ['initRowsPerPage', 'hideRowsPerPage'],
data: () => ({
data: {},
query: null,
Expand Down Expand Up @@ -76,6 +77,7 @@ export default {
}
},
mounted() {
if (this.initRowsPerPage) this.pagination.rowsPerPage = this.initRowsPerPage
this.refresh()
},
methods: {
Expand Down
13 changes: 13 additions & 0 deletions public/pages/embed/dataset/_id/search-files.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template lang="html">
<search-files :init-rows-per-page="4" :hide-rows-per-page="true" />
</template>

<script>
import SearchFiles from '../../../../components/SearchFiles.vue'
export default {
components: { SearchFiles }
}
</script>

<style lang="css">
</style>
4 changes: 3 additions & 1 deletion server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ const session = require('@koumoul/sd-express')({ directoryUrl: config.directoryU

const app = express()

// Create a mono-domain environment with other services in dev
if (process.env.NODE_ENV === 'development') {
app.set('json spaces', 2)

// Create a mono-domain environment with other services in dev
const proxy = require('http-proxy-middleware')
app.use('/openapi-viewer', proxy({ target: 'http://localhost:5680', pathRewrite: { '^/openapi-viewer': '' } }))
}
Expand Down

0 comments on commit af3b018

Please sign in to comment.