default language from machine configuration
This commit is contained in:
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+3
-3
File diff suppressed because one or more lines are too long
@@ -19,15 +19,6 @@
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
|
||||
<!--
|
||||
:class="{'turn-up':state.isMainViewLiftedUp}"
|
||||
-->
|
||||
|
||||
<!-- Modali sempre disponibili -->
|
||||
<!-- <login></login> -->
|
||||
<!-- <user-info></user-info>
|
||||
<machine-info></machine-info> -->
|
||||
|
||||
</div>
|
||||
<modal-container name="modal" ></modal-container>
|
||||
</div>
|
||||
@@ -87,16 +78,6 @@ export default {
|
||||
}
|
||||
);
|
||||
|
||||
// SHOW Toasts notifications
|
||||
// iziToast.show({
|
||||
// theme:"dark",
|
||||
// message: "test",
|
||||
// icon: "fa fa-refresh fa-spin fa-2x fa-fw",
|
||||
// position: "bottomLeft", animateInside: false, timeout: false,
|
||||
// transitionIn: 'fadeInRight',
|
||||
// transitionOut: 'fadeOut',
|
||||
// })
|
||||
|
||||
this.hub = new Hub();
|
||||
},
|
||||
computed: {
|
||||
@@ -136,7 +117,7 @@ export default {
|
||||
this.loadingOperations = 0;
|
||||
iziToast.hide(
|
||||
document.querySelector(".t-loading"),
|
||||
{transitionOut: "fadeOut"}
|
||||
{transitionOut: "fadeOut"}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ import { MessageService, Factory } from "./_base";
|
||||
import { ModalHelper } from "./modules/base-components";
|
||||
import { machineService } from "src/services/machineService";
|
||||
|
||||
import { store, AppModel, MachineStatusModel, machineStatusActions } from "src/store";
|
||||
import { store, AppModel, MachineStatusModel, machineStatusActions, localizationModelActions } from "src/store";
|
||||
|
||||
import { UserInfoDialog, MachineInfoDialog, AxesCalibration } from "./app.modules";
|
||||
import { AreaModel } from "src/store/machineStatus.store";
|
||||
import { machineInfoActions } from "src/store/machineInfo.store";
|
||||
|
||||
declare let cmsClient: any;
|
||||
|
||||
@@ -20,11 +21,26 @@ messageService.subscribeToChannel("show-axes-calibration", () => { ModalHelper.S
|
||||
//
|
||||
async function loadMachineConfig() {
|
||||
try {
|
||||
let result = await new machineService().getAreasConfiguration();
|
||||
let machine = new machineService();
|
||||
|
||||
let result = await machine.getAreasConfiguration();
|
||||
machineStatusActions.setAreasConfg(store, result);
|
||||
|
||||
let mcresult = await machine.getMachineConfiguration();
|
||||
|
||||
// set vendor type
|
||||
switch (mcresult.ncVendor.toLowerCase()) {
|
||||
case "siemens": machineInfoActions.updateMachineInfo(store, { isSiemens: true, isFanuc: false, isOsai: false, defaultLanguage: mcresult.defaultLanguage }); break;
|
||||
case "fanuc": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: true, isOsai: false, defaultLanguage: mcresult.defaultLanguage }); break;
|
||||
case "osai": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: false, isOsai: true, defaultLanguage: mcresult.defaultLanguage }); break;
|
||||
default: machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: false, isOsai: false, defaultLanguage: mcresult.defaultLanguage }); break;
|
||||
}
|
||||
|
||||
// load default language
|
||||
localizationModelActions.changeCurrentLanguage(store, mcresult.defaultLanguage);
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
console.error("Loading initial configuration error: ", error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
import { baseRestService } from "src/_base/baseRestService";
|
||||
import { AreaModel } from "src/store/machineStatus.store";
|
||||
|
||||
export class machineService extends baseRestService{
|
||||
export class machineService extends baseRestService {
|
||||
|
||||
async getAreasConfiguration():Promise<AreaModel[]>{
|
||||
async getAreasConfiguration(): Promise<AreaModel[]> {
|
||||
return await this.Get<AreaModel[]>("/api/configuration/areas");
|
||||
}
|
||||
|
||||
async getMachineConfiguration(): Promise<ClientConfigurationModel> {
|
||||
return await this.Get<ClientConfigurationModel>("/api/configuration/client")
|
||||
}
|
||||
}
|
||||
|
||||
export interface ClientConfigurationModel {
|
||||
ncVendor: string,
|
||||
showHMI: boolean,
|
||||
defaultLanguage: string
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ const _store = {
|
||||
if (userinfo)
|
||||
localizationModelActions.changeCurrentLanguage(context, userinfo.language);
|
||||
else
|
||||
localizationModelActions.changeCurrentLanguage(context, "en");
|
||||
localizationModelActions.changeCurrentLanguage(context, (context.state as AppModel).machineInfo.defaultLanguage);
|
||||
},
|
||||
async SetCurrentUserLanguage(context, newlanguage) {
|
||||
if (context.state.currentUser && context.state.currentUser.language != newlanguage) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Factory } from "src/_base";
|
||||
import { LocalizationService } from "src/services/localizationService";
|
||||
|
||||
import { appModelActions } from "src/store/app.store";
|
||||
import { appModelActions, AppModel } from "src/store/app.store";
|
||||
import { MessageService } from "src/_base";
|
||||
|
||||
export class languageModel {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export interface MachineInfoModel {
|
||||
machineSerialNumber: string;
|
||||
machineName: string;
|
||||
machineSerialNumber?: string;
|
||||
machineName?: string;
|
||||
|
||||
installationDate?: Date;
|
||||
ncBrand?: string;
|
||||
@@ -11,6 +11,12 @@ export interface MachineInfoModel {
|
||||
cmsServerVersion?: string;
|
||||
cmsCoreVersion?: string;
|
||||
cmsClientVersion?: String;
|
||||
|
||||
isSiemens?: boolean,
|
||||
isFanuc?: boolean,
|
||||
isOsai?: boolean,
|
||||
|
||||
defaultLanguage?: string
|
||||
}
|
||||
|
||||
export interface MachineInfoActions {
|
||||
@@ -34,7 +40,8 @@ export const machineInfoStore = {
|
||||
|
||||
isSiemens: false,
|
||||
isFanuc: false,
|
||||
isOsai: true
|
||||
isOsai: true,
|
||||
defaultLanguage: "en"
|
||||
|
||||
} as MachineInfoModel,
|
||||
mutations: {
|
||||
|
||||
Reference in New Issue
Block a user