feat: ajout possibilite vidanger le localstorage via une global gamuza_version_demandee
This commit is contained in:
parent
144aff6164
commit
17d9560748
8 changed files with 97 additions and 53 deletions
2
dist/.vite/manifest.json
vendored
2
dist/.vite/manifest.json
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"gamutable.js": {
|
||||
"file": "assets/gamutable-Cq_WjPEr.js",
|
||||
"file": "assets/gamutable-DbZfumel.js",
|
||||
"name": "gamutable",
|
||||
"src": "gamutable.js",
|
||||
"isEntry": true
|
||||
|
|
51
dist/assets/gamutable-Cq_WjPEr.js
vendored
51
dist/assets/gamutable-Cq_WjPEr.js
vendored
File diff suppressed because one or more lines are too long
52
dist/assets/gamutable-DbZfumel.js
vendored
Normal file
52
dist/assets/gamutable-DbZfumel.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -118,3 +118,20 @@ function gamutable_recharger_tableau($id_objet = 9999999999, $num = null):string
|
|||
EOJS;
|
||||
return $html;
|
||||
}
|
||||
|
||||
function gamutable_vider_localstorage():int {
|
||||
$version_prod = (int) lire_config('gamutable/version_stockage', 1);
|
||||
$version_demandee = (int) ($GLOBALS['gamutable_version_stockage'] ?? 1);
|
||||
if ($version_demandee > $version_prod) {
|
||||
ecrire_config('gamutable/version_stockage', $version_demandee);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function gamutableGetGlobals(string $name, string $defaut = ''):string {
|
||||
if (empty($name)) {
|
||||
return '';
|
||||
}
|
||||
return $GLOBALS[$name] ?? $defaut;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
if (!defined('_ECRIRE_INC_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Global pour indiquer le numero de version de gamutable
|
||||
*/
|
||||
// $GLOBALS['gamutable_version_demandee'] = 1;
|
||||
|
||||
if (_request('var_mode') == 'gamutable') {
|
||||
include_spip('inc/invalideur');
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
[(#ENV{fichierVueBloc}|oui)
|
||||
[(#SET{htmlvuebloc,#INCLURE{fond=#ENV{fichierVueBloc}}|replace{'"',"'"}})]
|
||||
]
|
||||
|
||||
[(#SET{gamutable_version_demandee,#VAL{gamutable_version_demandee}|gamutableGetGlobals{1}})]
|
||||
|
||||
<div id="vueGamutable">
|
||||
<BOUCLE_un(CONDITION){si #ENV{apiuri}|oui}>
|
||||
<div class="container_un">
|
||||
|
@ -53,6 +56,7 @@
|
|||
trier="[(#ENV{trier})]"
|
||||
langpdf="[(#ENV{langpdf})]"
|
||||
:id_auteur="[(#SESSION{id_auteur}|intval)]"
|
||||
:gamutable_version_demandee="#GET{gamutable_version_demandee,1}"
|
||||
></gamu-table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -90,6 +94,7 @@
|
|||
trier="[(#ENV{trier_deux})]"
|
||||
langpdf="[(#ENV{langpdf})]"
|
||||
:id_auteur="[(#SESSION{id_auteur}|intval)]"
|
||||
:gamutable_version_demandee="#GET{gamutable_version_demandee,1}"
|
||||
></gamu-table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,6 +107,7 @@
|
|||
|
||||
<script src="[(#CHEMIN{js/localforage.min.js}|timestamp)]" type="text/javascript"></script>
|
||||
|
||||
|
||||
[(#CONFIG{gamutable/charger_modalbox}|=={oui}|oui)
|
||||
<script src="[(#CHEMIN{js/gamubox.js}|timestamp)]" type="text/javascript"></script>
|
||||
]
|
||||
|
|
|
@ -188,6 +188,7 @@
|
|||
<script setup>
|
||||
import { watch, ref, onMounted, computed, nextTick, inject } from "vue";
|
||||
import VueSelect from "vue-next-select";
|
||||
import { VueCookieNext as $c } from 'vue-cookie-next'
|
||||
import {
|
||||
orderBy,
|
||||
ordonnerSelect,
|
||||
|
@ -195,6 +196,9 @@ import {
|
|||
recupJson,
|
||||
trouver_index,
|
||||
} from "./helpers";
|
||||
|
||||
$c.config({ expire: '360d' })
|
||||
|
||||
const $papa = inject("$papa");
|
||||
const props = defineProps({
|
||||
tparpage: {
|
||||
|
@ -268,6 +272,9 @@ const props = defineProps({
|
|||
filtreselect: {
|
||||
type: String,
|
||||
},
|
||||
gamutable_version_demandee: {
|
||||
type: Number
|
||||
}
|
||||
});
|
||||
let table = ref([]);
|
||||
let header_top = ref({});
|
||||
|
@ -318,6 +325,15 @@ let filtreColValeurs = [];
|
|||
|
||||
onMounted(() => {
|
||||
localforage.setDriver(localforage[props.stockage.toUpperCase()]);
|
||||
const gamutable_version_production = $c.getCookie('gamutable_version_production') ?? 1;
|
||||
console.log('gamutable_version_production ', gamutable_version_production);
|
||||
|
||||
if (+props.gamutable_version_demandee > gamutable_version_production) {
|
||||
console.log("⚠ Vidange du localstorage ⚠");
|
||||
$c.setCookie('gamutable_version_production', +props.gamutable_version_demandee )
|
||||
localStorage.clear(); // suppression des configs (entetes) + suppression des donnes si stockage localstorage
|
||||
localforage.clear(); // suppression de indexeddbb
|
||||
}
|
||||
chargerJson("maj");
|
||||
});
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ export default defineConfig(({ mode }) => {
|
|||
host: true,
|
||||
port: port,
|
||||
strictPort: true,
|
||||
cors: true,
|
||||
},
|
||||
|
||||
// required for in-browser template compilation
|
||||
|
|
Loading…
Add table
Reference in a new issue