Skip to content

Commit

Permalink
fix npm & vue bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
datenangebot committed Feb 24, 2021
1 parent a95c9b7 commit fde1655
Show file tree
Hide file tree
Showing 37 changed files with 212 additions and 246 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: [
'nextcloud'
]
'@nextcloud'
],
};
18 changes: 0 additions & 18 deletions composer.lock

This file was deleted.

2 changes: 1 addition & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct($appName, IRequest $request) {
public function index() {
// $this->cesService->transformDatasets();
// Util::addScript($this->appName, 'vue-chartjs.min');
// Util::addScript($this->appName, 'Chart');
Util::addScript($this->appName, 'health-main');
Util::addScript($this->appName, 'health');
Util::addStyle($this->appName, 'icons');
//Util::addStyle($this->appName, 'bulma.min');
Expand Down
2 changes: 0 additions & 2 deletions lib/Db/Measurementdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public function __construct() {
$this->addType('bloodSugar','float');
$this->addType('oxygenSat','float');
$this->addType('defecation','integer');
$this->addType('appetite','integer');
$this->addType('allergies','integer');
$this->addType('cigarettes','integer');
$this->addType('alcohol','integer');
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Db/MeasurementdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace OCA\Health\Db;

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\AppFramework\Db\QBMapper;
Expand All @@ -34,7 +35,7 @@ public function __construct(IDbConnection $db) {
parent::__construct($db, 'health_measurementdata', Measurementdata::class);
}

public function find(int $id): ?\OCP\AppFramework\Db\Entity
public function find(int $id): ?Entity
{
$qb = $this->db->getQueryBuilder();

Expand Down
38 changes: 17 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,25 @@
"license": "agpl",
"private": true,
"scripts": {
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.dev.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"stylelint": "stylelint src",
"stylelint:fix": "stylelint src --fix"
},
"dependencies": {
"@bundle-analyzer/webpack-plugin": "^0.2.1",
"@nextcloud/axios": "^1.5.0",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/axios": "^1.6.0",
"@nextcloud/dialogs": "^3.1.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^2.9.0",
"@nextcloud/vue": "^3.5.4",
"chart.js": "^2.9.4",
"dayjs": "^1.10.4",
"moment": "^2.29.1",
"nextcloud-l10n": "^0.1.1",
"vue": "^2.6.12",
"vue-chartjs": "^3.5.1",
"vue-json-csv": "^1.2.12",
"vue-table-dynamic": "^0.2.8",
"vue2-datepicker": "^3.9.0",
"vuex": "^3.6.2"
},
"browserslist": [
Expand All @@ -54,36 +50,36 @@
"node": ">=10.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.13",
"@babel/core": "^7.12.17",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.12.13",
"@babel/preset-env": "^7.12.17",
"@nextcloud/browserslist-config": "^1.0.0",
"@nextcloud/eslint-config": "^2.2.0",
"@nextcloud/eslint-plugin": "^1.5.0",
"@nextcloud/webpack-vue-config": "^1.1.0",
"@vue/test-utils": "^1.1.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"css-loader": "^3.6.0",
"eslint": "^5.16.0",
"eslint-config-nextcloud": "0.1.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-import-resolver-webpack": "^0.12.2",
"eslint-import-resolver-webpack": "^0.13.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-nextcloud": "^0.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",
"stylelint": "^13.9.0",
"stylelint-config-recommended-scss": "^3.3.0",
"stylelint": "^13.11.0",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.19.0",
"stylelint-webpack-plugin": "^1.2.3",
"stylelint-webpack-plugin": "^2.1.1",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2",
"webpack-node-externals": "^1.7.2"
"webpack-merge": "^5.7.3"
}
}
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ import SleepContent from './modules/sleep/SleepContent'
import MeasurementContent from './modules/measurement/MeasurementContent'
import MeasurementSidebar from './modules/measurement/MeasurementSidebar'
import SleepSidebar from './modules/sleep/SleepSidebar'
import moment from '@nextcloud/moment'
import moment from 'moment'
import SmokingSidebar from './modules/smoking/SmokingSidebar'
import SmokingContent from './modules/smoking/SmokingContent'

Expand All @@ -143,7 +143,7 @@ export default {
SmokingSidebar,
SmokingContent,
},
data: function() {
data() {
return {
loading: true,
}
Expand All @@ -158,7 +158,7 @@ export default {
this.loading = false
},
methods: {
formatMyDate: function(v) {
formatMyDate(v) {
return moment(v).format('DD.MM.YYYY')
},
},
Expand Down
17 changes: 9 additions & 8 deletions src/general/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<script>
import LineChart from './charts/LineChart'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import moment from '@nextcloud/moment'
import moment from 'moment'

export default {
name: 'Chart',
Expand Down Expand Up @@ -119,13 +119,13 @@ export default {
default: null,
},
},
data: function() {
data() {
return {
range: this.rangeDefinition,
}
},
computed: {
getOptions: function() {
getOptions() {
if (!this.options) {
return []
}
Expand All @@ -141,12 +141,13 @@ export default {
// console.debug('axesIds', axesIds)
AllYAxes.forEach((axes, i) => {
if (axes.id in axesIds && axesIds[axes.id]) {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.options.scales.yAxes.push(AllYAxes[i])
}
})
return this.options
},
getChartData: function() {
getChartData() {
if (!this.definition || !this.data) {
return []
}
Expand Down Expand Up @@ -201,10 +202,10 @@ export default {
// console.debug('chartData', result)
return result
},
isDetailRange: function() {
isDetailRange() {
return !(this.rangeDefinition === 'week' || this.rangeDefinition === 'month' || this.rangeDefinition === 'year')
},
rangeDays: function() {
rangeDays() {
if (this.range === 'week') {
return 7
} else if (this.range === 'month') {
Expand All @@ -215,7 +216,7 @@ export default {
return -1
}
},
rangeHours: function() {
rangeHours() {
if (this.range === '1hour') {
return 1
} else if (this.range === '4hours') {
Expand All @@ -232,7 +233,7 @@ export default {
},
},
methods: {
isInTimeRange: function(date) {
isInTimeRange(date) {
if (this.rangeDays !== -1 && !this.isDetailRange) {
return Math.abs(moment(date).diff(moment(), 'days')) <= this.rangeDays
} else if (this.rangeHours !== -1 && this.isDetailRange) {
Expand Down
25 changes: 13 additions & 12 deletions src/general/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
{{ n('health', '%n item is hidden, because it is out of the chosen time range.', '%n items are hidden, because they are out of the chosen time range.', data.length - datasets.length, {}) }}
</div>
<JsonCSV
v-if="getExportData.length > 0"
:data="getExportData"
:name="entityName + '.csv'">
<button class="export">
Expand All @@ -161,18 +162,18 @@
<script>
import ModalItem from './ModalItem'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import moment from '@nextcloud/moment'
import moment from 'moment'
import JsonCSV from 'vue-json-csv'

export default {
name: 'DataTable',
filters: {
formatMyDate: function(v) {
formatMyDate(v) {
// return new Date(v).toLocaleDateString() === new Date().toLocaleDateString() ? t('health', 'today') : new Date(v).toLocaleDateString()
// console.debug('is valid date', { date: moment(v), valid: moment(v).isValid() })
return moment(v) === moment() ? t('health', 'today') : moment(v).format('lll')
},
formatMyDatetime: function(v) {
formatMyDatetime(v) {
return moment(v).format('L') === moment().format('L') ? t('health', 'today') + ' ' + moment(v).format('LT') : moment(v).format('lll')
// const date = new Date(v).toLocaleDateString() === new Date().toLocaleDateString() ? t('health', 'today') : new Date(v).toLocaleDateString()
// return date + ' ' + new Date(v).toLocaleTimeString().slice(0, 5)
Expand Down Expand Up @@ -201,13 +202,13 @@ export default {
default: false,
},
},
data: function() {
data() {
return {
range: 'week',
}
},
computed: {
datasets: function() {
datasets() {
const d = []
// console.debug('try to return', this.data)
this.data.forEach(item => {
Expand All @@ -224,7 +225,7 @@ export default {
})
return d
},
rangeDays: function() {
rangeDays() {
if (this.range === 'week') {
return 7
} else if (this.range === 'month') {
Expand All @@ -235,7 +236,7 @@ export default {
return -1
}
},
getExportData: function() {
getExportData() {
if (!this.datasets && this.datasets.length > 0 && !this.header) {
console.debug('error datasets', this.datasets)
return []
Expand All @@ -254,18 +255,18 @@ export default {
},
},
methods: {
isInTimeRange: function(date) {
isInTimeRange(date) {
if (this.rangeDays !== -1) {
// console.debug('diff', Math.abs(moment(date).diff(moment(), 'days')))
return Math.abs(moment(date).diff(moment(), 'days')) <= this.rangeDays
} else {
return true
}
},
calcCount: function(items) {
calcCount(items) {
return items.length
},
deleteItem: function(id) {
deleteItem(id) {
this.$emit('deleteItem', this.datasets[id])
},
handleDataIncome(item) {
Expand All @@ -277,10 +278,10 @@ export default {
this.addItem(item)
}
},
addItem: function(item) {
addItem(item) {
this.$emit('addItem', item)
},
updateItem: function(item) {
updateItem(item) {
this.$emit('updateItem', item)
},
},
Expand Down
Loading

0 comments on commit fde1655

Please sign in to comment.