From 5dd294a695ffa5b692dd39e564c9639f29b62333 Mon Sep 17 00:00:00 2001 From: nonodev96 Date: Sat, 2 Jul 2022 21:27:03 +0200 Subject: [PATCH] Update readme, wiki and fix code request test --- README.md | 105 +++++++------- package.json | 2 +- src/app/Types.ts | 15 +- src/app/__core/machine/machine.service.ts | 2 +- .../pixi-pipeline/pixi-pipeline.component.ts | 6 +- src/app/views/_index/index.view.html | 132 +++++++----------- src/app/views/debug/debug-view.html | 22 ++- src/app/views/debug/debug-view.ts | 29 ++-- wiki | 2 +- 9 files changed, 150 insertions(+), 165 deletions(-) diff --git a/README.md b/README.md index ce14437..6b058f9 100644 --- a/README.md +++ b/README.md @@ -21,81 +21,72 @@ THUMDER
- THUMDER page + Página del proyecto en producción THUMDER
-## Installation +
+ Repositorio del servidor del proyecto THUMDER server +
+ +## Instalación de las dependencias ```bash -sudo npm install -g @angular/cli@12.2.10 -npm install -# npm install --only=prod +sudo npm install -g @angular/cli@12.5.0 # Instala la herramienta de desarrollo +npm install # Instala las dependencias ``` -## Included Commands +Tu necesitas aumenta la memoria de node, para ello se debe modificar la variable de entorno de node (`NODE_OPTIONS`), +para ello debemos asignar al menos 4Gb de memoria `--max_old_space_size=`. -### Develop +## Desarrollo -| Command | Description | -|:-------------------------------|:-------------------------------| -| `npm run ng:serve-angular:dev` | Develop the app in the browser | -### Deploy +| **Commandos** | **Descripción** | +|:-------------------------------|:--------------------------------------------------------| +| `npm run ng:serve-angular:dev` | Enciende el servidor de angular en modo de desarrollo | +| `npm run ws:server` | Enciende el servidor websocket, requiere THUMDER Server | -| Command | Description | -|:--------------------------------------|:-------------------------------------------------------------------------------------| -| `npm run ng:build-angular:production` | Deploy Angular app for browser version | -| `npm run electron:build` | Builds your application and creates an app consumable based on your operating system | +## Despliegue -### Others command -| Command | Description | -|:----------------------------------------|:--------------| -| `npm run ng:build:dev` | | -| `npm run ng:build:web` | | -| `npm run ng:build:production` | | -| `npm run ng:build-angular:dev` | | -| `npm run ng:build-angular:web` | | -| `npm run ng:build-angular:production` | | -| `npm run ng:serve:dev` | | -| `npm run ng:serve:web` | | -| `npm run ng:serve:production` | | -| `npm run ng:serve-angular:dev` | | -| `npm run ng:serve-angular:web` | | -| `npm run ng:serve-angular:production` | | +| **Commandos** | **Descripción** | +|:--------------------------------------|:--------------------------------------------------------------------------------------------------| +| `npm run ng:build-angular:production` | Construye la aplicación angular de navegador con las variables de producción | +| `npm run electron:build` | Construye la aplicación angular y encapsula la aplicación dentro electron generando un ejecutable | -You need to change de space of node with `NODE_OPTIONS` `--max_old_space_size=` +El despliegue genera las carpetas `/dist`, `/dist-angular` y `/release`. -**Your application is optimised. Only /dist folder and node dependencies are included in the executable.** +La carpeta `/dist-angular` es la indicada para el despliegue en servidores. -## You want to use a specific lib (like rxjs) in electron main thread ? +La carpeta `/release` contiene los ficheros ejecutables con la aplicación. -YES! You can do it! Just by importing your library in npm dependencies section (not **devDependencies**) -with `npm install --save`. It will be loaded by electron during build phase and added to your final package. Then use -your library by importing it in `main.ts` file. Quite simple, isn't it ? +## Otros comandos -## Unit Tests -| Command | Description | -|:---------|:-------------------------------------------------------------| -| ng test | Run unit tests with karma, for components, views and modules | - -## E2E Testing - -E2E Test scripts can be found in `e2e` and `cypress` folder. +| **Commandos** | **Descripción** | +|:--------------------------------------|:----------------| +| `npm run ng:build:dev` | | +| `npm run ng:build:web` | | +| `npm run ng:build:production` | | +| `npm run ng:build-angular:dev` | | +| `npm run ng:build-angular:web` | | +| `npm run ng:build-angular:production` | | +| `npm run ng:serve:dev` | | +| `npm run ng:serve:web` | | +| `npm run ng:serve:production` | | +| `npm run ng:serve-angular:dev` | | +| `npm run ng:serve-angular:web` | | +| `npm run ng:serve-angular:production` | | ## Server e2e -| Command | Description | -|:------------------------|:--------------------------------------------| -| `npm run ng:server` | Start the server | -| `npm run cypress:open` | Open cypress app and configure the commands | -| `npm run cypress:run` | Run tests of cypress (BUG) | -Note: To make it work behind a proxy, you can add this proxy exception in your terminal -`export {no_proxy,NO_PROXY}="127.0.0.1,localhost"` +| **Commandos** | **Descripción** | +|:-----------------------|:--------------------------------------------------------------------------------| +| `npm run cypress:open` | Abre la aplicación con cypress app y configura los comandos y pruebas | +| `npm run cypress:run` | Ejecuta las pruebas sobre el servidor (solo son visibles por linea de comandos) | -### Coverage +### Cobertura de navegadores ```bash npx browserslist @@ -104,10 +95,8 @@ npx browserslist --coverage These browsers account for 86.79% of all users globally -## Currently, runs with: - -- Angular v12.2.10 -- Electron v12.2.2 -- Electron Builder v22.10.5 +## Versión actual de las dependencias -[//]: # +- Angular v12.5.0 +- Electron v16.2.6 +- Electron Builder v23.0.3 diff --git a/package.json b/package.json index a354ae5..58a6074 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "thumder", - "version": "1.6.2", + "version": "1.6.3", "private": true, "description": "TFG - THUMDER (THe UltiMate Dlx EmulatoR): emulador multiplataforma DLX con fines didácticos", "keywords": [ diff --git a/src/app/Types.ts b/src/app/Types.ts index 07e3357..da3ce05 100644 --- a/src/app/Types.ts +++ b/src/app/Types.ts @@ -551,17 +551,22 @@ export type TypeStage = | "faddEX_7" | "fmultEX_7" | "fdivEX_7"; export type TypeDirectiveData = { - address: TypeAddress; // 0x00000000 - directive: TypeDirective; + address: TypeAddress; // 0x00000000 + hexValue: string; // 0x00000000 text: string; - hexValue: string; // 0x00000000 + directive: TypeDirective; }; export type TypeInstructionsData = { - address: TypeAddress; // 0x00000000 + address: TypeAddress; // 0x00000000 + code: string; // 0x00000000 text: string; instruction: string; - code: string; // 0x00000000 +}; + +export type TypeCodeResponse = { + machineDirectives: TypeDirectiveData[], + machineInstructions: TypeInstructionsData[], }; export type TypeInstructionsData_Table = TypeInstructionsData & { diff --git a/src/app/__core/machine/machine.service.ts b/src/app/__core/machine/machine.service.ts index 362b743..6825f77 100644 --- a/src/app/__core/machine/machine.service.ts +++ b/src/app/__core/machine/machine.service.ts @@ -230,7 +230,7 @@ export class MachineService { } }; this.socketProviderConnect.emitMessage("UpdateConfigurationMachineRequest", JSON.stringify(payload), (response) => { - console.log(response); + // console.log(response); this.writeToLog(JSON.stringify(response)) }); diff --git a/src/app/components/pixi-pipeline/pixi-pipeline.component.ts b/src/app/components/pixi-pipeline/pixi-pipeline.component.ts index 0fba4ca..3b27fcf 100644 --- a/src/app/components/pixi-pipeline/pixi-pipeline.component.ts +++ b/src/app/components/pixi-pipeline/pixi-pipeline.component.ts @@ -15,7 +15,7 @@ import { PixiTHUMDER_Pipeline } from "../../__core/machine/PixiTHUMDER_Pipeline" @Component({ selector: "THUMDER-pixi-pipeline", templateUrl: "./pixi-pipeline.component.html", - styleUrls: ["./pixi-pipeline.component.scss"] + styleUrls: [ "./pixi-pipeline.component.scss" ] }) export class PixiPipelineComponent implements OnInit, AfterViewInit, OnDestroy { @@ -72,7 +72,7 @@ export class PixiPipelineComponent implements OnInit, AfterViewInit, OnDestroy { this.stepSimulationSubscription.unsubscribe(); } - @HostListener("window:resize", ["$event"]) + @HostListener("window:resize", [ "$event" ]) public onResize(event): void { event.preventDefault(); event.stopPropagation(); @@ -87,6 +87,7 @@ export class PixiPipelineComponent implements OnInit, AfterViewInit, OnDestroy { } private getInstructionDataPipelineItem(item: TypeCycleCell): TypeInstructionPipelineRepresentation { + if (item.address === undefined || item.address === "") return { text: "", draw: item.draw }; const machineInstruction = this.machine.getCode(item.address); return { text: machineInstruction.instruction, @@ -96,6 +97,7 @@ export class PixiPipelineComponent implements OnInit, AfterViewInit, OnDestroy { private getInstructionDataPipeline(items: TypeCycleCellUnit[]): TypeInstructionPipelineFloatingRepresentation[] { return items.map((item) => { + if (item.address === undefined || item.address === "") return { unit: item.unit, text: "", draw: item.draw }; const machineInstruction = this.machine.getCode(item.address); return { unit: item.unit, diff --git a/src/app/views/_index/index.view.html b/src/app/views/_index/index.view.html index fbef570..405abfe 100644 --- a/src/app/views/_index/index.view.html +++ b/src/app/views/_index/index.view.html @@ -1,19 +1,3 @@ -
@@ -31,83 +15,63 @@

{{ ("NAVIGATION." + item.lang) | translate }}

- - -

{{ 'PAGES.INDEX.MACHINE' | translate }}

-
- - - - - - -
-
- -

{{ 'PAGES.INDEX.IDE' | translate }}

-
- - - -
-
- -

{{ 'PAGES.INDEX.UTILS' | translate }}

-
- - -
+
+

{{ 'PAGES.INDEX.MACHINE' | translate }}

+
+ + + + + + +
+
-

{{ 'PAGES.INDEX.CONFIG' | translate }}

-
- -
+

{{ 'PAGES.INDEX.IDE' | translate }}

+
+ + + +
+
- -

{{ 'PAGES.INDEX.DEBUG' | translate }}

+

{{ 'PAGES.INDEX.UTILS' | translate }}

+ [ngTemplateOutletContext]="{item:PRIVATE_AUTH_ROUTES.CALCULATOR}"> + [ngTemplateOutletContext]="{item:PRIVATE_AUTH_ROUTES.DOCUMENTATION}"> +
+
+ + +

{{ 'PAGES.INDEX.CONFIG' | translate }}

+
+ [ngTemplateOutletContext]="{item:PRIVATE_AUTH_ROUTES.CONFIG}">
-
+
- - - diff --git a/src/app/views/debug/debug-view.html b/src/app/views/debug/debug-view.html index d12bed9..80faa8a 100644 --- a/src/app/views/debug/debug-view.html +++ b/src/app/views/debug/debug-view.html @@ -196,16 +196,32 @@

{{'DEBUG' | translate}} Code

+ - - + + - + +
{{ 'ADDRESS' | translate }}{{ 'CODE' | translate }} {{ 'TEXT' | translate }} {{ 'INSTRUCTION' | translate }}{{ 'CODE' | translate }}
{{item.address}}{{item.code}} {{item.text}} {{item.instruction}}{{item.code}}
+ + + + + + + + + + + + + +
{{ 'ADDRESS' | translate }}{{ 'HEX VALUE' | translate }}{{ 'TEXT' | translate }}{{ 'DIRECTIVE' | translate }}
{{item.address}}{{item.hexValue}}{{item.text}}{{item.directive}}
diff --git a/src/app/views/debug/debug-view.ts b/src/app/views/debug/debug-view.ts index 00d9d55..c9e47b6 100644 --- a/src/app/views/debug/debug-view.ts +++ b/src/app/views/debug/debug-view.ts @@ -11,14 +11,14 @@ import { TypeMemoryToUpdate, TypeRegister, TypeRegisterToUpdate, - TypeSimulationInitRequest, TypeAddress + TypeSimulationInitRequest, TypeAddress, TypeCodeResponse, TypeDirectiveData } from "../../Types"; import { ElectronService } from "../../__core/services"; @Component({ selector: "app-debug", templateUrl: "./debug-view.html", - styleUrls: ["./debug-view.scss"] + styleUrls: [ "./debug-view.scss" ] }) export class DebugView implements OnInit, AfterViewInit { @@ -56,7 +56,8 @@ export class DebugView implements OnInit, AfterViewInit { "TRAP #0" ].join("\n"); - public testCodeResponse: TypeInstructionsData[] = []; + public testCodeResponse_instructions: TypeInstructionsData[] = []; + public testCodeResponse_directives: TypeDirectiveData[] = []; i = 0; constructor(private toast: ToastrService, @@ -67,8 +68,8 @@ export class DebugView implements OnInit, AfterViewInit { ngOnInit(): void { this.socketProviderConnect.socketIO.on("CodeResponse", (response) => { - const code = JSON.parse(response) as TypeInstructionsData[]; - this.testCodeResponse = code.map((v) => { + const code = JSON.parse(response) as TypeCodeResponse; + this.testCodeResponse_instructions = code.machineInstructions.map((v) => { return { address: v.address, code: v.code, @@ -76,6 +77,14 @@ export class DebugView implements OnInit, AfterViewInit { instruction: v.instruction, }; }); + this.testCodeResponse_directives = code.machineDirectives.map((v) => { + return { + address: v.address, + hexValue: v.hexValue, + text: v.text, + directive: v.directive, + }; + }); }); /* @@ -142,7 +151,7 @@ export class DebugView implements OnInit, AfterViewInit { pepe.key = Utils.uuidv4(); const value = JSON.stringify({ - items: [documents, pepe] + items: [ documents, pepe ] }); localStorage.setItem("FileSystem", value); } @@ -160,11 +169,11 @@ export class DebugView implements OnInit, AfterViewInit { async updateRegisterServer(typeRegister: TypeRegister, register: string, value: string): Promise { try { - const payload = JSON.stringify([{ + const payload = JSON.stringify([ { typeRegister: typeRegister, register: register, hexadecimalValue: value - }] as TypeRegisterToUpdate[]); + } ] as TypeRegisterToUpdate[]); this.socketProviderConnect.emitMessage("UpdateRegisterRequest", payload); } catch (error) { console.error(error); @@ -175,11 +184,11 @@ export class DebugView implements OnInit, AfterViewInit { async updateMemoryServer(memoryTypeData: TypeData, memoryAddress: TypeAddress, memoryValue: string): Promise { try { - const payload = JSON.stringify([{ + const payload = JSON.stringify([ { typeData: memoryTypeData, address: memoryAddress, value: memoryValue - }] as TypeMemoryToUpdate[]); + } ] as TypeMemoryToUpdate[]); this.socketProviderConnect.emitMessage("UpdateMemoryRequest", payload); } catch (error) { console.error(error); diff --git a/wiki b/wiki index 2ee4c9c..90b3dbb 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 2ee4c9caafcd71980f6c66a41f13f3c6c5dc8695 +Subproject commit 90b3dbbea47ead49407c9de7287150b6bfef25ab