-
Notifications
You must be signed in to change notification settings - Fork 0
81 feature frontend for engine configuration group5 #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tr0ub1eM4k3r
wants to merge
113
commits into
main
Choose a base branch
from
81-feature-frontend-for-engine-configuration-group5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
44026ce
class and fields defined
DenFlyvendeGed 6aa3d5a
Made general Dialog component
tr0ub1eM4k3r e2236b9
created EngineStore
DenFlyvendeGed 5d34b62
Made EngineSeperate component
SolarEarth37 9b02fbd
Engine store functions implemented
DenFlyvendeGed 5417b3b
added function comments
DenFlyvendeGed 49c641c
Updated syntax
DenFlyvendeGed ca19632
Merge branch '80-Create-class-for-engines-group5' of https://github.c…
tr0ub1eM4k3r 4e1536a
updated getEngine
DenFlyvendeGed 1973926
fixed overflow
DenFlyvendeGed 0265823
added tests
DenFlyvendeGed 3178c69
created more test cases
DenFlyvendeGed 4380085
Merge branch 'main' of https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-W…
DenFlyvendeGed 24a2647
Formated
DenFlyvendeGed 9db7a9a
Cleanup
DenFlyvendeGed 31ae3b4
Added adding and deleting engines from the view
tr0ub1eM4k3r 19fa937
Merge branch '80-Create-class-for-engines-group5' of https://github.c…
tr0ub1eM4k3r 478e504
Made DTO for engines
tr0ub1eM4k3r 31c5647
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
tr0ub1eM4k3r b8fb464
Made engineDTO work
tr0ub1eM4k3r d2389a3
Added functionality for saving engines in the ui
tr0ub1eM4k3r 5245406
Made general css for the Engine UI
SolarEarth37 d72a5ca
Made CSS for engine delete button and UI
SolarEarth37 999e3ff
Added Google icons to deletion UI
SolarEarth37 4c6bc54
lint fixes
tr0ub1eM4k3r afd67e8
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
tr0ub1eM4k3r 14dc709
lint changes
tr0ub1eM4k3r 168e77c
Fixed delete UI buttons
SolarEarth37 1f29530
Merge branches '81-feature-frontend-for-engine-configuration-group5' …
SolarEarth37 d211c16
Fixed issue where deleted engine will get added
tr0ub1eM4k3r f9f7395
Made you unable to delete the last engine
tr0ub1eM4k3r 168c025
made dialog backdrop
tr0ub1eM4k3r cce7526
Merge branch 'main' of
tr0ub1eM4k3r 6b99890
Made engineUI openable from the topbar
tr0ub1eM4k3r 389bb2f
Incorporated global CSS in Engine UI
SolarEarth37 061216e
typo
DenFlyvendeGed be42942
Merge branch '80-Create-class-for-engines-group5' of https://github.c…
tr0ub1eM4k3r e100fa0
Fixed lint issues
tr0ub1eM4k3r 3e3766f
Merge branch 'main' of https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-W…
tr0ub1eM4k3r 8c8f31d
Removed unnecessary code
tr0ub1eM4k3r 9874b23
Changed file names to be more style guide fitting
tr0ub1eM4k3r 962b49e
Made ports min and max
tr0ub1eM4k3r ae08857
Added comments for functions
tr0ub1eM4k3r f61833c
Changed naming of interface
tr0ub1eM4k3r 3bbd132
Changed spelling
tr0ub1eM4k3r d7113a5
Added increased usability when deleing engnies
tr0ub1eM4k3r f8d8311
Added issue with deleting the last engine
tr0ub1eM4k3r b591e72
Merge branch 'main' of https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-Web
tr0ub1eM4k3r ad14aeb
lint
tr0ub1eM4k3r 4f2feb0
Rename iEngineStorageObject.ts to IEngineStorageObject.ts
tr0ub1eM4k3r 8d5e4b2
Rename iEngineUIComponent.ts to IEngineUIComponent.ts
tr0ub1eM4k3r daaa6c6
Rename iModalComponent.ts to IModalComponent.ts
tr0ub1eM4k3r e2501ad
Fixed no prompt when closing with unsaved data
tr0ub1eM4k3r b544cfa
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
tr0ub1eM4k3r afa9281
Added highlighting of misinformation
tr0ub1eM4k3r 6fc9979
Added interface for the IEngineSeperateComponent
tr0ub1eM4k3r b000929
Merge branch 'main' of https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-W…
tr0ub1eM4k3r d27fd6d
Changed static implementation of the EngineStorage
tr0ub1eM4k3r 438ebef
lint
tr0ub1eM4k3r 08e50aa
Added functionality for closing Modal
tr0ub1eM4k3r 8e39a30
Set ModalCloseOnBackdrop to false if not defined
tr0ub1eM4k3r 58ab0d9
Changed Button component to be more flexible
tr0ub1eM4k3r 9b8b4ee
Merged main
tr0ub1eM4k3r 3c42222
Moved tabindex
tr0ub1eM4k3r 0c022e6
Moved validation helper functions to own file
tr0ub1eM4k3r 8532817
Merge branch 'main' into 81-feature-frontend-for-engine-configuration…
DenFlyvendeGed fa02996
Merge branch 'main' of https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-W…
tr0ub1eM4k3r 8626b21
Delete yarn-error.log
tr0ub1eM4k3r 88ca945
Fixed issues with useBundle implementation
tr0ub1eM4k3r b5b738f
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
tr0ub1eM4k3r ee1aa88
Merge branch 'main' into 81-feature-frontend-for-engine-configuration…
tr0ub1eM4k3r 964abd8
Changed color to css variable
tr0ub1eM4k3r 6b9b213
Box size changes due to font change
SolarEarth37 642ebaa
Fixed issue with error screen on engineUI
tr0ub1eM4k3r fe5a12c
Changed deletion of engines
tr0ub1eM4k3r 75ac2b3
Made playwright tests
tr0ub1eM4k3r 83a225f
Made playwright tests
tr0ub1eM4k3r fe0cabd
lint
tr0ub1eM4k3r 5468dcd
Changed modal css to own variable
tr0ub1eM4k3r d97da3d
Removed nested forms
tr0ub1eM4k3r f2e9aba
fixed tests
DenFlyvendeGed 5a96d7c
Fixed multiple issues, related to comments
SolarEarth37 eeccc93
engineArray uses id as index
DenFlyvendeGed 68f6910
Removed undefined elements from getEngineArray
DenFlyvendeGed d417a52
Fixed problem with hard coded EngineUI
SolarEarth37 20e88b8
lint and changes from button to SvgButton
SolarEarth37 c804b9d
fixed port input accepting decimals
DenFlyvendeGed 4233339
Fixed Bundle problem, along with closeModal not working as expected
SolarEarth37 5ce9222
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
SolarEarth37 ca8dfec
should have fixed 9 -13. tests incoming
DenFlyvendeGed f8d54c5
fixed ip input not centering custom value
DenFlyvendeGed 9354871
Use bundle label trigger checkbox. test are wip
DenFlyvendeGed c78d08d
added test
DenFlyvendeGed 98f02d4
format
DenFlyvendeGed c6672ca
Fixed most lint, only one left is label control which might be irelav…
DenFlyvendeGed af7a512
Added engine store to global state, and removed tempengine store from…
DenFlyvendeGed e926bf1
fixed a11y-label-has-associated-control
KamyaPA 5e89113
Merge branch '81-feature-frontend-for-engine-configuration-group5' of…
KamyaPA d676f15
cleanup
DenFlyvendeGed 414a065
lint
DenFlyvendeGed fcfb0f1
Fixed being able to delete all engines
DenFlyvendeGed 9fc1b68
Removed old functionality for not deleting last element
DenFlyvendeGed 09fa393
fixed tests
DenFlyvendeGed 85e0647
Added URL.canParse
KamyaPA 4692d6d
readded ip support
DenFlyvendeGed d998c42
Merge branch 'main' into 81-feature-frontend-for-engine-configuration…
KamyaPA 0530e0d
Refactored to new modal
KamyaPA 403d6ce
Main merge fixed
DenFlyvendeGed 0386eab
Minor deletions
KamyaPA 939fd1f
fixed engine store not being utilized + escape press bug
DenFlyvendeGed b2902e1
Merge remote-tracking branch 'origin/main' into 81-feature-frontend-f…
DenFlyvendeGed 126fd77
Fixed input placeholder color
SolarEarth37 4368a69
Fixed scrollbar CSS issues, and light mode being a random combination…
SolarEarth37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| import { | ||
| comparePortRange, | ||
| validateEndPort, | ||
| validateIP, | ||
| validateName, | ||
| validateStartPort, | ||
| } from "./Validation"; | ||
|
|
||
| /** | ||
| * A Reveaal, JEcdar andd API engine definition | ||
| * It stores the IP and port of an engine | ||
| * */ | ||
| export class Engine { | ||
| /** | ||
| * The #name of the Engine | ||
| * */ | ||
| #name: string = ""; | ||
| get name(): string { | ||
| return this.#name; | ||
| } | ||
| set name(setName: string) { | ||
| if (validateName(setName)) this.#name = setName; | ||
| else throw new Error("Engine must have a name"); | ||
| } | ||
| /** | ||
| * The IP #address of the engine | ||
| * */ | ||
| #address: string = ""; | ||
| get address(): string { | ||
| return this.#address; | ||
| } | ||
| set address(ipAdress: string) { | ||
| if (validateIP(ipAdress)) this.#address = ipAdress; | ||
| else throw new Error(ipAdress + " Is an invalid IP address"); | ||
| } | ||
| /** | ||
| * The starting number of the portrange | ||
| * */ | ||
| #portRangeStart: number = 0; | ||
| get portRangeStart(): number { | ||
| return this.#portRangeStart; | ||
| } | ||
| set portRangeStart(portStart: number) { | ||
| if (validateStartPort(portStart)) this.#portRangeStart = portStart; | ||
| else throw new Error("Invalid start port"); | ||
| } | ||
|
|
||
| /** | ||
| * The last number of the portrange | ||
| * */ | ||
| #portRangeEnd: number = 0; | ||
| get portRangeEnd(): number { | ||
| return this.#portRangeEnd; | ||
| } | ||
| set portRangeEnd(portEnd: number) { | ||
| if ( | ||
| comparePortRange(this.#portRangeStart, portEnd) && | ||
| validateEndPort(portEnd) | ||
| ) | ||
| this.#portRangeEnd = portEnd; | ||
| else throw new Error("Invalid end port"); | ||
| } | ||
|
|
||
| /** | ||
| * Unique identifier | ||
| * */ | ||
| #id: number = 0; | ||
| get id(): number { | ||
| return this.#id; | ||
| } | ||
| set id(inputId: number) { | ||
| if (inputId >= 0) this.#id = inputId; | ||
| else throw new Error("Invalid id"); | ||
| } | ||
|
|
||
| hasBeenChanged: boolean = false; | ||
|
|
||
| #useBundle: boolean = false; | ||
| get useBundle(): boolean { | ||
| return this.#useBundle; | ||
| } | ||
| set useBundle(useBundle: boolean) { | ||
| this.#useBundle = useBundle; | ||
| if (useBundle) this.address = "127.0.0.1"; | ||
| } | ||
|
|
||
| constructor( | ||
| name: string, | ||
| address: string, | ||
| portRangeStart: number, | ||
| portRangeEnd: number, | ||
| id: number, | ||
| useBundle: boolean, | ||
| ) { | ||
| this.name = name; | ||
| if (!useBundle) this.address = address; | ||
| this.portRangeStart = portRangeStart; | ||
| this.portRangeEnd = portRangeEnd; | ||
| this.id = id; | ||
| this.#useBundle = useBundle; | ||
| } | ||
|
|
||
| toJSON() { | ||
| return { | ||
| name: this.#name, | ||
| address: this.#address, | ||
| portRangeStart: this.#portRangeStart, | ||
| portRangeEnd: this.#portRangeEnd, | ||
| id: this.#id, | ||
| useBundle: this.#useBundle, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| import type IEngineStorageObject from "$lib/interfaces/IEngineStorageObject"; | ||
| import { Engine } from "./Engine"; | ||
| /** | ||
| * Engine storage definition. | ||
| * Stores an array of Engine instances, and can create, delete or search the array | ||
| * */ | ||
| class EngineStorage { | ||
| /** | ||
| * Array of engines defined | ||
| * */ | ||
| engineArray: Array<Engine | undefined> = []; | ||
|
|
||
| /** | ||
| * variable used to give unique id to engines | ||
| * */ | ||
| #engineId: number = 0; | ||
|
|
||
| get engineId(): number { | ||
| this.engineId = ++this.#engineId; //auto inc | ||
| return this.#engineId; | ||
| } | ||
| set engineId(id: number) { | ||
| if (id >= 0) this.#engineId = id; | ||
| else throw new Error("Invalid engineId"); | ||
| } | ||
|
|
||
| /** | ||
| * Array of engines defined | ||
| * */ | ||
| #defaultEngine: Engine | undefined; | ||
| get defaultEngine(): Engine | undefined { | ||
| return this.#defaultEngine; | ||
| } | ||
| set defaultEngine(engine: Engine | undefined) { | ||
| let index = -1; | ||
|
|
||
| index = this.engineArray.findIndex( | ||
| (arrayEngine: Engine | undefined) => { | ||
| return arrayEngine?.id === engine?.id; | ||
| }, | ||
| ); | ||
| if (engine === undefined || index > -1) this.#defaultEngine = engine; | ||
| else throw new Error("Failed to set default engine"); | ||
| } | ||
|
|
||
| constructor() { | ||
| this.engineArray = new Array<Engine>(); | ||
| this.engineId = 0; | ||
| this.defaultEngine = undefined; | ||
| } | ||
|
|
||
| /** | ||
| * Create an Engine and pushes it to engineArray | ||
| */ | ||
| createEngine( | ||
| name: string, | ||
| address: string, | ||
| portRangeStart: number, | ||
| portRangeEnd: number, | ||
| useBundle: boolean, | ||
| ) { | ||
| const newEngine = new Engine( | ||
| name, | ||
| address, | ||
| portRangeStart, | ||
| portRangeEnd, | ||
| this.engineId, | ||
| useBundle, | ||
| ); | ||
| this.engineArray[this.engineId - 1] = newEngine; | ||
|
|
||
| return newEngine; | ||
| } | ||
|
|
||
| /** | ||
| * Deletes the engine with the given id | ||
| */ | ||
| deleteEngine(id: number) { | ||
| //check for results | ||
| if (this.engineArray[id]) { | ||
| //Check if the default engine is being removed | ||
| if (this.defaultEngine?.id === id) this.defaultEngine = undefined; | ||
|
|
||
| this.engineArray[id] = undefined; | ||
| } else { | ||
| throw new Error("Engine Id does not exist"); | ||
| } | ||
| } | ||
KamyaPA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * Get engines based on id or name | ||
| */ | ||
| getEngine(identifier: number | string): Engine { | ||
| let returnEngine: undefined | Engine; | ||
|
|
||
| //Find engine based on id | ||
| if (typeof identifier === "number") { | ||
| returnEngine = this.engineArray[identifier]; | ||
| } | ||
| //Find engine based on name | ||
| else { | ||
| returnEngine = this.engineArray.find( | ||
| (engine: Engine | undefined) => { | ||
| return engine?.name === identifier; | ||
| }, | ||
| ); | ||
| } | ||
| if (returnEngine !== undefined) return returnEngine; | ||
| else throw new Error("Could not find engine"); | ||
| } | ||
|
|
||
| /** | ||
| * Returns all engines in the store in the form of an array | ||
| */ | ||
| getEngineArray(): Array<Engine> { | ||
| const filtered: Engine[] = this.engineArray.filter( | ||
| (element) => element !== undefined, | ||
| ) as Engine[]; | ||
| return filtered; | ||
| } | ||
|
|
||
| /** | ||
| * Coonvert the EngineStorage to a JSON string | ||
| */ | ||
| serialize(): string { | ||
| return JSON.stringify(this); | ||
| } | ||
|
|
||
| toJSON() { | ||
| return { | ||
| engineArray: this.engineArray, | ||
| engineId: this.#engineId, | ||
| defaultEngine: this.defaultEngine, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Reads fields and engines from JSON string, and applies them in the store | ||
| */ | ||
| deSerialize(json: string) { | ||
| const parsedJSON: IEngineStorageObject = JSON.parse( | ||
| json, | ||
| ) as IEngineStorageObject; | ||
| this.engineArray = []; | ||
| this.engineId = parsedJSON.engineId; | ||
| this.defaultEngine = parsedJSON.defaultEngine; | ||
|
|
||
| //run Engine constructer to validate input. | ||
| parsedJSON.engineArray.forEach((engine) => { | ||
| this.engineArray.push( | ||
| new Engine( | ||
| engine.name, | ||
| engine.address, | ||
| engine.portRangeStart, | ||
| engine.portRangeEnd, | ||
| engine.id, | ||
| engine.useBundle, | ||
| ), | ||
| ); | ||
| }); | ||
| } | ||
| } | ||
| const engineStorage = new EngineStorage(); | ||
| export default engineStorage; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.