238 lines
7.7 KiB
JavaScript
238 lines
7.7 KiB
JavaScript
/* Xeslint-disable */
|
|
import "typeface-roboto/index.css";
|
|
import "github-markdown-css";
|
|
import Vue from "vue";
|
|
import Vuetify from "./plugins/vuetify";
|
|
import App from "./App.vue";
|
|
import router from "./router";
|
|
import store from "./store";
|
|
import "./registerServiceWorker";
|
|
import errorHandler from "./api/errorhandler";
|
|
import NProgress from "nprogress";
|
|
import "nprogress/nprogress.css";
|
|
import { DateTime } from "luxon";
|
|
import VueCurrencyInput from "vue-currency-input";
|
|
|
|
//my libs
|
|
import errorhandler from "./api/errorhandler";
|
|
import ayaNovaVersion from "./api/ayanova-version";
|
|
import gzeventbus from "./api/eventbus";
|
|
import gzmenu from "./api/gzmenu";
|
|
import gzdialog from "./api/gzdialog";
|
|
import gzutil from "./api/gzutil";
|
|
import translation from "./api/translation";
|
|
import locale from "./api/locale";
|
|
import gzapi from "./api/gzapi";
|
|
|
|
import gzform from "./api/gzform";
|
|
import gzformcustomtemplate from "./api/form-custom-template";
|
|
import authorizationroles from "./api/authorizationroles";
|
|
import gztype from "./api/ayatype";
|
|
import gzenums from "./api/enums";
|
|
import "@/assets/css/main.css";
|
|
|
|
//controls
|
|
import dateTimeControl from "./components/date-time-control.vue";
|
|
//import dateTimeControl2 from "./components/date-time-non-native-control.vue";//keeping around in case need it for some reason
|
|
import dateControl from "./components/date-control.vue";
|
|
import timeControl from "./components/time-control.vue";
|
|
import tagPicker from "./components/tag-picker.vue";
|
|
import pickList from "./components/pick-list.vue";
|
|
import dataTable from "./components/gz-data-table.vue";
|
|
import customFieldsControl from "./components/custom-fields-control.vue";
|
|
import currencyControl from "./components/currency-control.vue";
|
|
import decimalControl from "./components/decimal-control.vue";
|
|
import roleControl from "./components/role-control.vue";
|
|
import durationControl from "./components/duration-control.vue";
|
|
import errorControl from "./components/error-control.vue";
|
|
import extensionsControl from "./components/extensions-control.vue";
|
|
import reportSelectorControl from "./components/report-selector-control.vue";
|
|
import wikiControl from "./components/wiki-control.vue";
|
|
import attachmentControl from "./components/attachment-control.vue";
|
|
import chartLineControl from "./components/chart-line-control.vue";
|
|
import chartPieControl from "./components/chart-pie-control.vue";
|
|
import chartBarControl from "./components/chart-bar-control.vue";
|
|
import chartBarHorizontalControl from "./components/chart-bar-horizontal-control.vue";
|
|
|
|
//**************************************************************
|
|
//**************************************************************
|
|
//**************************************************************
|
|
//DEVELOPMENT MODE
|
|
//THIS SHOULD BE FALSE IN RELEASE
|
|
//************************************************************
|
|
const DEV_MODE = true;
|
|
//************************************************************
|
|
//**************************************************************
|
|
//**************************************************************
|
|
//**************************************************************
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// LIBS AND GLOBAL ITEMS
|
|
//
|
|
//
|
|
|
|
window.$gz = {
|
|
translation: translation,
|
|
locale: locale,
|
|
formCustomTemplate: gzformcustomtemplate,
|
|
type: gztype,
|
|
role: authorizationroles,
|
|
enums: gzenums,
|
|
eventBus: gzeventbus,
|
|
menu: gzmenu,
|
|
dialog: gzdialog,
|
|
util: gzutil,
|
|
DateTime: DateTime,
|
|
api: gzapi,
|
|
form: gzform,
|
|
errorHandler: errorhandler,
|
|
store: store,
|
|
clientInfo: ayaNovaVersion,
|
|
dev: DEV_MODE
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// ERROR HANDLING
|
|
//
|
|
|
|
Vue.config.errorHandler = errorHandler.handleVueError;
|
|
window.onerror = errorHandler.handleGeneralError;
|
|
|
|
// //unhandled rejection handler
|
|
//shouldn't need this
|
|
// window.addEventListener("unhandledrejection", function(event) {
|
|
// // the event object has two special properties:
|
|
// alert(event.promise); // [object Promise] - the promise that generated the error
|
|
// alert(event.reason); // Error: Whoops! - the unhandled error object
|
|
// });
|
|
|
|
//warnings, only occur by default in debug mode not production
|
|
Vue.config.warnHandler = errorHandler.handleVueWarning;
|
|
|
|
//added for vuetify 2.x to disable annoying prodution mode tip warning
|
|
//but commented out for now just to see what it looks like
|
|
Vue.config.productionTip = false;
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// AJAX LOADER INDICATOR
|
|
//
|
|
//
|
|
|
|
// Store a copy of the fetch function
|
|
let _oldFetch = fetch;
|
|
|
|
// Create our new version of the fetch function
|
|
window.fetch = function() {
|
|
// Create hooks
|
|
let fetchStart = new Event("fetchStart", {
|
|
view: document,
|
|
bubbles: true,
|
|
cancelable: false
|
|
});
|
|
let fetchEnd = new Event("fetchEnd", {
|
|
view: document,
|
|
bubbles: true,
|
|
cancelable: false
|
|
});
|
|
|
|
// Pass the supplied arguments to the real fetch function
|
|
let fetchCall = _oldFetch.apply(this, arguments);
|
|
|
|
// Trigger the fetchStart event
|
|
document.dispatchEvent(fetchStart);
|
|
|
|
fetchCall
|
|
.then(function() {
|
|
// Trigger the fetchEnd event
|
|
document.dispatchEvent(fetchEnd);
|
|
})
|
|
.catch(function() {
|
|
// Trigger the fetchEnd event
|
|
document.dispatchEvent(fetchEnd);
|
|
});
|
|
|
|
return fetchCall;
|
|
};
|
|
|
|
document.addEventListener("fetchStart", function() {
|
|
NProgress.start();
|
|
});
|
|
|
|
document.addEventListener("fetchEnd", function() {
|
|
NProgress.done();
|
|
});
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// FILTERS
|
|
//
|
|
|
|
//example filter kept for just in case
|
|
// Vue.filter("capitalize", function vueFilterCapitalize(value) {
|
|
// if (!value) return "";
|
|
// value = value.toString();
|
|
// return value.charAt(0).toUpperCase() + value.slice(1);
|
|
// });
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
//GZ COMPONENTS
|
|
//
|
|
Vue.component("gz-date-time-picker", dateTimeControl);
|
|
//Vue.component("gz-date-time-non-native-picker", dateTimeNonNativeControl);//keeping in case decide to support alternative (at this time mostly for mac ios it seems)
|
|
Vue.component("gz-date-picker", dateControl);
|
|
Vue.component("gz-time-picker", timeControl);
|
|
Vue.component("gz-tag-picker", tagPicker);
|
|
Vue.component("gz-pick-list", pickList);
|
|
Vue.component("gz-data-table", dataTable);
|
|
Vue.component("gz-custom-fields", customFieldsControl);
|
|
Vue.component("gz-currency", currencyControl);
|
|
Vue.component("gz-decimal", decimalControl);
|
|
Vue.component("gz-role-picker", roleControl);
|
|
Vue.component("gz-duration-picker", durationControl);
|
|
Vue.component("gz-error", errorControl);
|
|
Vue.component("gz-report-selector", reportSelectorControl);
|
|
Vue.component("gz-extensions", extensionsControl);
|
|
Vue.component("gz-wiki", wikiControl);
|
|
Vue.component("gz-attachments", attachmentControl);
|
|
Vue.component("gz-chart-line", chartLineControl);
|
|
Vue.component("gz-chart-pie", chartPieControl);
|
|
Vue.component("gz-chart-bar", chartBarControl);
|
|
Vue.component("gz-chart-bar-horizontal", chartBarHorizontalControl);
|
|
|
|
//3rd party components
|
|
Vue.use(VueCurrencyInput);
|
|
/////////////////////////////////////////////////////////////
|
|
//DIRECTIVES
|
|
//
|
|
//Auto focus on forms
|
|
Vue.directive("focus", {
|
|
// When the bound element is inserted into the DOM...
|
|
inserted: function(el) {
|
|
// Focus the element
|
|
el.focus();
|
|
}
|
|
});
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// INSTANTIATE
|
|
//
|
|
Vue.prototype.$ay = {
|
|
//development mode, development level error messages etc
|
|
dev: DEV_MODE,
|
|
t: function(tKey) {
|
|
return translation.get(tKey);
|
|
},
|
|
dt: function(timestamp) {
|
|
return locale.utcDateToShortDateAndTimeLocalized(timestamp);
|
|
},
|
|
sd: function(timestamp) {
|
|
return locale.utcDateToShortDateLocalized(timestamp);
|
|
}
|
|
};
|
|
new Vue({
|
|
vuetify: Vuetify,
|
|
router,
|
|
store,
|
|
// eslint-disable-next-line
|
|
render: (h) => h(App)
|
|
}).$mount("#app");
|