Skip to content

Commit

Permalink
Merge branch 'feature/update-front' into 'develop'
Browse files Browse the repository at this point in the history
Met à jour les dépendances + Refactoring
  • Loading branch information
polosson authored May 4, 2021
2 parents 192e58c + 88aaea6 commit 0930466
Show file tree
Hide file tree
Showing 130 changed files with 4,869 additions and 3,437 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name : CI
on : [push, pull_request]
on : [pull_request]
jobs :
client-linting:
name : "Client: Linting"
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs :
runs-on : ubuntu-latest
strategy :
matrix:
php: [7.4, 7.3, 7.2, 7.1]
php: [7.4, 7.3]
defaults : { run: { working-directory: ./server }}
services :
mysql:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Ce projet adhère au principe du [Semantic Versioning](https://semver.org/spec/v

- Corrige un problème avec le nom de la base de données de test (#128 et #129).
- Ajoute la création / suppression de devis pour les événements (#5).
- __[CHANGEMENT CRITIQUE]__ Robert requiert maintenant au minimum PHP 7.3 pour fonctionner (#78).

## 0.12.0 (2021-03-29)

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Cette commande vous permet de lancer un serveur de développement front-end, ave
qui servira les sources JS, CSS et les assets, à l'adresse `http://localhost:8081/`.

Pour travailler, créez un fichier `.env` dans le dossier `server/` qui contient la variable `APP_ENV=development`,
puis ouvrez l'application sur son serveur back-end (par ex. `http://robert.local`).
puis ouvrez l'application sur son serveur back-end (par ex. `http://robert2.local`).

#### `yarn build`

Expand All @@ -90,7 +90,7 @@ _(Pensez à exécuter cette commande et à commiter le résultat dans votre PR l

## URL de l'API en développement

En développement, l'hôte par défaut utilisé par la partie client pour communiquer avec l'API est `http://robert.local`.
En développement, l'hôte par défaut utilisé par la partie client pour communiquer avec l'API est `http://robert2.local`.

Si vous souhaitez modifier ceci, vous pouvez créer un fichier `.env.development.local` à la racine du dossier
client et surcharger la variable d'environnement `VUE_APP_API_URL` avec votre propre URL d'API (par
Expand Down
2 changes: 1 addition & 1 deletion client/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VUE_APP_API_URL='http://robert.local'
VUE_APP_API_URL='http://robert2.local'
69 changes: 33 additions & 36 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,41 @@
"test": "vue-cli-service test:unit"
},
"dependencies": {
"@fortawesome/fontawesome-free": "~5.15.3",
"axios": "~0.21.1",
"core-js": "~3.10.1",
"debounce": "~1.2.1",
"deep-freeze-strict": "~1.1.1",
"js-cookie": "~2.2.1",
"moment": "~2.29.1",
"sweetalert2": "~10.15.5",
"v-tooltip": "~2.1.3",
"vue": "~2.6.12",
"vue-click-outside": "~1.1.0",
"vue-js-modal": "~2.0.0-rc.6",
"vue-router": "~3.5.1",
"vue-select": "~3.11.2",
"vue-slim-tabs": "~0.4.0",
"vue-tables-2": "~2.2.1",
"vue-visjs": "~0.4.2",
"vuejs-datepicker": "~1.6.2",
"vuex": "~3.6.2",
"vuex-i18n": "~1.13.1"
"@fortawesome/fontawesome-free": "5.15.3",
"@robert2/vis-timeline": "file:./vendors/vis-timeline",
"axios": "0.21.1",
"debounce": "1.2.1",
"deep-freeze-strict": "1.1.1",
"js-cookie": "2.2.1",
"moment": "2.29.1",
"sweetalert2": "10.16.7",
"v-tooltip": "2.1.3",
"vue": "2.6.12",
"vue-click-outside": "1.1.0",
"vue-js-modal": "2.0.0-rc.6",
"vue-router": "3.5.1",
"vue-select": "3.11.2",
"vue-slim-tabs": "0.4.0",
"vue-tables-2": "2.2.2",
"vuejs-datepicker": "1.6.2",
"vuex": "3.6.2",
"vuex-i18n": "1.13.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.12",
"@vue/cli-plugin-eslint": "^4.5.12",
"@vue/cli-plugin-unit-jest": "^4.5.12",
"@vue/cli-service": "^4.5.12",
"@vue/eslint-config-airbnb": "^5.3.0",
"@vue/test-utils": "1.1.4",
"@babel/core": "7.14.0",
"@vue/cli-plugin-babel": "4.5.12",
"@vue/cli-plugin-eslint": "4.5.12",
"@vue/cli-plugin-unit-jest": "4.5.12",
"@vue/cli-service": "4.5.12",
"@vue/eslint-config-airbnb": "5.3.0",
"@vue/test-utils": "1.2.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.3",
"eslint": "^7.24.0",
"eslint-plugin-vue": "^7.9.0",
"node-sass": "^5.0.0",
"sass-loader": "^10.1.1",
"vue-template-compiler": "^2.6.12"
},
"resolutions": {
"vis-timeline": "7.3.9"
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
"eslint": "7.25.0",
"eslint-plugin-vue": "7.9.0",
"node-sass": "5.0.0",
"sass-loader": "10.1.1",
"vue-template-compiler": "2.6.12"
}
}
17 changes: 11 additions & 6 deletions client/src/components/ErrorDetails/ErrorDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
{{ $t('errors.details-intro3') }}
<a href="https://github.com/Robert-2/Robert2/issues" target="_blank">Github</a>.
</p>
<p v-if="!data.requested" class="ErrorDetails__no-details-info">
<p v-if="!data.debug" class="ErrorDetails__no-details-info">
<i class="fas fa-info-circle" />
{{ $t('errors.details-intro-not-detailed') }}
</p>
<hr />
<div class="ErrorDetails__content" ref="errorContent">
<div v-if="data.requested">
<div v-if="requested">
<h3 class="ErrorDetails__subtitle">
#### {{ $t('errors.details-request') }}
</h3>
<p class="ErrorDetails__request">
`{{ data.requested }}`
`{{ requested }}`
</p>
</div>
<h3 class="ErrorDetails__subtitle">
Expand Down Expand Up @@ -111,16 +111,21 @@ export default {
};
},
computed: {
requested() {
return this.data.debug?.requested;
},
file() {
return cleanFilePath(this.data.file);
return cleanFilePath(this.data.debug?.file);
},
trace() {
if (!this.data.stackTrace) {
const stackTrace = this.data.debug?.stackTrace;
if (!stackTrace) {
return [];
}
return this.data.stackTrace.map((traceItem) => {
return stackTrace.map((traceItem) => {
const { file } = traceItem;
return { ...traceItem, file: cleanFilePath(file) };
});
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Help/Help.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ export default {
}
const defaultError = {
requested: '',
code: 500,
message: 'Unknown error',
file: '',
stackTrace: [],
debug: {
file: '',
stackTrace: [],
},
};
return response.data?.error || defaultError;
Expand Down
28 changes: 28 additions & 0 deletions client/src/components/Timeline/_utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2019 Steve Mallon
// @see https://github.com/sjmallon/vue-visjs/blob/v0.4.2/src/utils.js
/* eslint-disable import/prefer-default-export */

import { DataSet, DataView } from '@robert2/vis-timeline';

const arrayDiff = (arr1, arr2) => arr1.filter((x) => arr2.indexOf(x) === -1);

export const mountVisData = (vm) => {
if (vm.items instanceof DataSet || vm.items instanceof DataView) {
return vm.items;
}

// We attach deep watcher on the prop to propagate changes in the DataSet
const callback = (value) => {
if (!Array.isArray(value)) {
return;
}

const newIds = new DataSet(value).getIds();
const diff = arrayDiff(vm.data.getIds(), newIds);
vm.data.update(value);
vm.data.remove(diff);
};
vm.$watch('items', callback, { deep: true });

return new DataSet(vm.items);
};
102 changes: 102 additions & 0 deletions client/src/components/Timeline/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import '@robert2/vis-timeline/index.scss';
import moment from 'moment';
import { Timeline as TimelineCore, DataSet, DataView } from '@robert2/vis-timeline';
import { mountVisData } from './_utils';

const Timeline = {
props: {
items: {
type: [Array, DataSet, DataView],
default: () => [],
},
options: {
type: Object,
},
},
data: () => ({
data: null,
}),
created() {
// @see https://github.com/almende/vis/issues/2524
this.timeline = null;
},
mounted() {
this.data = mountVisData(this);
this.timeline = new TimelineCore(
this.$refs.visualization,
this.data,
this.fullOptions,
);

// - Binding des événements globaux.
const globalsEvents = {
itemover: 'item-over',
itemout: 'item-out',
rangechanged: 'range-changed',
doubleClick: 'double-click',
};
Object.entries(globalsEvents).forEach(([originalName, name]) => {
this.timeline.on(originalName, (props) => { this.$emit(name, props); });
});

// - Binding des événements liés aux données.
const dataEvents = {
add: 'item-added',
update: 'item-updated',
remove: 'item-removed',
};
Object.entries(dataEvents).forEach(([originalName, name]) => {
this.data.on(originalName, (event, properties, senderId) => {
this.$emit(name, { event, properties, senderId });
});
});
},
computed: {
fullOptions() {
return {
xss: {
filterOptions: {
whiteList: {
i: 'class',
strong: 'class',
em: 'class',
},
},
},
tooltip: {
followMouse: true,
overflowMethod: 'flip',
},
moment: (date) => moment(date),
...(this.options || {}),
onMove: (item, callback) => {
this.$emit('item-moved', item, callback);
},
onRemove: (item, callback) => {
this.$emit('item-remove', item, callback);
},
};
},
},
watch: {
fullOptions: {
deep: true,
handler() {
this.timeline.setOptions(this.fullOptions);
},
},
},
beforeDestroy() {
this.timeline.destroy();
},
methods: {
moveTo(time, options) {
this.timeline.moveTo(time, options);
},
},
render() {
return <div ref="visualization"></div>;
},
};

export default Timeline;
16 changes: 7 additions & 9 deletions client/src/pages/Calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@
class="Calendar__timeline"
:items="events"
:options="timelineOptions"
:events="['itemover', 'itemout', 'doubleClick', 'items-remove', 'rangechanged']"
@itemover="onItemOver"
@itemout="onItemOut"
@item-over="onItemOver"
@item-out="onItemOut"
@item-moved="onItemMoved"
@item-remove="onItemRemove"
@item-removed="onItemRemoved"
@double-click="onDoubleClick"
@items-remove="onRemoved"
@rangechanged="onRangeChanged"
/>
<Help
:message="help"
:error="error"
@range-changed="onRangeChanged"
/>
<Help :message="help" :error="error" />
</div>
</div>
</template>
Expand Down
Loading

0 comments on commit 0930466

Please sign in to comment.