Aggiungi DefinePlugin per la gestione dell'ambiente e aggiorna gli URL API per la produzione
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const { ProvidePlugin } = require('webpack');
|
const { ProvidePlugin, DefinePlugin } = require('webpack');
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
@@ -12,6 +12,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
|
||||||
|
}),
|
||||||
new ProvidePlugin({
|
new ProvidePlugin({
|
||||||
$: 'jquery', // Rende $ disponibile globalmente
|
$: 'jquery', // Rende $ disponibile globalmente
|
||||||
jQuery: 'jquery',
|
jQuery: 'jquery',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const commonConfiguration = require('./webpack.common.js');
|
const commonConfiguration = require('./webpack.common.js');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const { ProvidePlugin } = require('webpack');
|
const { ProvidePlugin, DefinePlugin } = require('webpack');
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -16,6 +16,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin(),
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': JSON.stringify('production')
|
||||||
|
}),
|
||||||
new ProvidePlugin({
|
new ProvidePlugin({
|
||||||
$: 'jquery', // Rende $ disponibile globalmente
|
$: 'jquery', // Rende $ disponibile globalmente
|
||||||
jQuery: 'jquery',
|
jQuery: 'jquery',
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ let prescrizione;
|
|||||||
let def_config;
|
let def_config;
|
||||||
let lang = navigator.language.split('-')[0] != 'it' ? 'en' : 'it';
|
let lang = navigator.language.split('-')[0] != 'it' ? 'en' : 'it';
|
||||||
const hidden_fields = {};
|
const hidden_fields = {};
|
||||||
let API = 'http://localhost/api/';
|
let API = 'https://lto.test/api/';
|
||||||
let CRM_URL = 'http://localhost/prescrizioni/';
|
let CRM_URL = 'https://lto.test/prescrizioni/';
|
||||||
let CFG_URL = 'http://localhost/config-predefinite/';
|
let CFG_URL = 'https://lto.test/config-predefinite-tads/';
|
||||||
|
|
||||||
//if(process.env.NODE_ENV === 'production'){
|
if(process.env.NODE_ENV === 'production'){
|
||||||
API = 'https://setup.allineatoriinvisibili.it/api/';
|
API = 'https://setup.allineatoriinvisibili.it/api/';
|
||||||
CRM_URL = 'https://setup.allineatoriinvisibili.it/prescrizioni/';
|
CRM_URL = 'https://setup.allineatoriinvisibili.it/prescrizioni/';
|
||||||
CFG_URL = 'https://setup.allineatoriinvisibili.it/config-predefinite/';
|
CFG_URL = 'https://setup.allineatoriinvisibili.it/config-predefinite-tads/';
|
||||||
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
const assetDir = './assets/'
|
const assetDir = './assets/'
|
||||||
const anteprimaDir = assetDir+'images/anteprima_finiture/';
|
const anteprimaDir = assetDir+'images/anteprima_finiture/';
|
||||||
@@ -108,7 +108,7 @@ export const init = async (_scene, _cameraControls) => {
|
|||||||
let edit = url.searchParams.get("edit");
|
let edit = url.searchParams.get("edit");
|
||||||
|
|
||||||
|
|
||||||
let force_lang = url.searchParams.get("lang");
|
let force_lang = url.searchParams.get("lang") || localStorage.getItem('lang');
|
||||||
if(force_lang != null){
|
if(force_lang != null){
|
||||||
lang = force_lang;
|
lang = force_lang;
|
||||||
}else{
|
}else{
|
||||||
@@ -118,18 +118,20 @@ export const init = async (_scene, _cameraControls) => {
|
|||||||
|
|
||||||
if(id != null){
|
if(id != null){
|
||||||
if(type != null && type == 'default'){
|
if(type != null && type == 'default'){
|
||||||
def_config = await (await fetch(API+'frontend/def-config/'+id)).json();
|
fetch(API+'frontend/def-config-tads/'+id).then(res => res.json()).then(data => {
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
|
||||||
|
def_config = await (await fetch(API+'frontend/def-config-tads/'+id)).json();
|
||||||
|
|
||||||
$(".btn-torna-prescrizione").addClass('d-none');
|
$(".btn-torna-prescrizione").addClass('d-none');
|
||||||
$(".btn-torna-prescrizione-modal").addClass('d-none');
|
$(".btn-torna-prescrizione-modal").addClass('d-none');
|
||||||
|
|
||||||
if(demo_mode != null){
|
if(demo_mode != null){
|
||||||
|
|
||||||
$(".btn-salva").addClass('d-none');
|
$(".btn-salva").addClass('d-none');
|
||||||
$(".btn-torna-prescrizione").addClass('d-none');
|
$(".btn-torna-prescrizione").addClass('d-none');
|
||||||
}else{
|
}else{
|
||||||
$(".btn-torna-config-modal,.btn-torna-indietro").removeClass('d-none').on('click', ()=>{ location.href = CFG_URL })
|
$(".btn-torna-config-modal,.btn-torna-indietro").removeClass('d-none').on('click', ()=>{ location.href = CFG_URL })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -139,7 +141,7 @@ export const init = async (_scene, _cameraControls) => {
|
|||||||
let cfg = configurazione[k];
|
let cfg = configurazione[k];
|
||||||
$("#"+cfg.field.id).val(cfg.value);
|
$("#"+cfg.field.id).val(cfg.value);
|
||||||
$("#"+cfg.field.id).trigger('change');
|
$("#"+cfg.field.id).trigger('change');
|
||||||
//updateConfig(cfg.field, cfg.value, cfg.label)
|
updateConfig(cfg.field, cfg.value, cfg.label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -150,7 +152,7 @@ export const init = async (_scene, _cameraControls) => {
|
|||||||
let ed_config = null;
|
let ed_config = null;
|
||||||
|
|
||||||
if(id_config != null){
|
if(id_config != null){
|
||||||
ed_config = await (await fetch(API+'frontend/def-config/'+id_config)).json();
|
ed_config = await (await fetch(API+'frontend/def-config-tads/'+id_config)).json();
|
||||||
}
|
}
|
||||||
|
|
||||||
prescrizione = await (await fetch(API+'frontend/config/'+id)).json();
|
prescrizione = await (await fetch(API+'frontend/config/'+id)).json();
|
||||||
@@ -174,7 +176,7 @@ export const init = async (_scene, _cameraControls) => {
|
|||||||
|
|
||||||
$("#"+cfg.field.id).val(cfg.value);
|
$("#"+cfg.field.id).val(cfg.value);
|
||||||
$("#"+cfg.field.id).trigger('change');
|
$("#"+cfg.field.id).trigger('change');
|
||||||
//updateConfig(cfg.field, cfg.value, cfg.label)
|
updateConfig(cfg.field, cfg.value, cfg.label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,7 +447,7 @@ const salvaConfigurazione = async () => {
|
|||||||
let toSend = {configurazione: config, configurazione_html: config_html.innerHTML}
|
let toSend = {configurazione: config, configurazione_html: config_html.innerHTML}
|
||||||
|
|
||||||
if(def_config != null){
|
if(def_config != null){
|
||||||
url = API+'frontend/save-def-config';
|
url = API+'frontend/save-def-config-tads';
|
||||||
toSend.id = def_config.id;
|
toSend.id = def_config.id;
|
||||||
}else{
|
}else{
|
||||||
toSend.prescrizione_id = prescrizione.id;
|
toSend.prescrizione_id = prescrizione.id;
|
||||||
@@ -498,4 +500,6 @@ window.appendLang = (lang) => {
|
|||||||
window.location.href += '?lang='+lang;
|
window.location.href += '?lang='+lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
localStorage.setItem('lang', lang);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ export const loadModels = async (config) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Active objs:", activeObjs);
|
//console.log("Active objs:", activeObjs);
|
||||||
|
|
||||||
mainGroup.traverse((el) => {
|
mainGroup.traverse((el) => {
|
||||||
if(el.isMesh && el.userData.type != 'arcata') el.visible = false;
|
if(el.isMesh && el.userData.type != 'arcata') el.visible = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user