Conversation
Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
* Squashed Issue-469 * Issue 505/html output (#2) * HtmlPlugin object * HtmlFormat object * Angular view for html plugin * Add html format to object tree * Small fixes * Remove css class --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net> * Fixed tests --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
* Updated testing library to compatible version with angular19+ * Added safeJson object for handling json data * Paragraph collection object * Refactored notebook responsibilities * Refactored notebookCollection responsibilities * Refactored paragraph responsibilities * Added message object * Removed DTO objects and added message handlers * Refactored outputContainer responsibilities * Refactored outputPlugin and outputFormat responsibilities * OutputFormat implementations refactored * OutputPlugin implementations refactored * OutputSwitcher implementation refactored * AngularObjectCollection responsibilities refactored * Added more message handlers * Removed obsolete files and refactored after removing DTOs * Refactored angular components, separated angular logic from business logic * Refactored legacy websocket messages to comply with basic message format * Required changes to devserver after refactoring * Refactored OutputContainer to hold the responsibility for active plugin * Updated tests --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
|
One enhancement I've been thinking, would be refactor the directory structure for new code:
@kortemik @eemhu |
* Directive for rendering outputView programmatically * Refactored OutputView rendering from outputContainer * Modern input signals seem not to be entirely supported in a hybrid application, replaced input signal with traditional input decorator * Added fakePlugin for testing * Renamed input name * Fixed and refactored test * Added test file for pluginView * Add license --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
|
Started implementing #535 for this |
sounds like a decent idea, perhaps html could be named ui though |
Started working on this: |
* NotebookCollection integration test, and fixes for notebookCollection * WritableSignalArrayAsPushValue object for handling values with list type * Renamed unit tests with .unit prefix * ParagraphCollection object * Refactored paragraph rendering to ParagraphCollectionView * NotebookView integration spec * ParagraphCollectionView integration tests * ParagraphView integration tests * OutputContainerView integration spec * Renamed spec files --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
|
Problems detected during qa testing fixed in pr #555 |
* Fixed angular output format parsing * Render only current notebook in collection if id matches * ad hoc fix for broken output data format * Fixed Ajs template input name * Link paragraphCollection to angularObject collection so that on request paragraphCollection can decorate requests * Text plugin needs to add class value to html element * Pass responses to angularObjectCollection * Log error instead of warning * ParagraphCollection refactored as stubable, due notebook being partial initially * Updated notebook spec * Added tests for paragraphCollection * Re-use variable --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
* Refactored paragraphCollection as property of paragraph, because paragraph is responsible for filtering messages that paragraphCollection receives * Logic for handling paragraphId was missing from angular object, refactored object to encapsulate paragraphId --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
| * a licensee so wish it. | ||
| */ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the 'License'); |
| spyOn(scope, 'updateParagraphObjectWhenUpdated'); | ||
| spyOn(scope, 'updateAllScopeTexts'); | ||
| scope.updateParagraph(paragraphExampleMock.paragraph, paragraphClearMock.paragraph, emptyCallback); | ||
| scope.updateParagraph(paragraphExampleMock.paragraph, paragraphClearMock.paragraph); |
There was a problem hiding this comment.
wasn't the paragraph object removed? from paragraphExampleMock
* Refactored encapsulate properties of angularObject * Refactored angularObjectCollection initialization to paragraph object * Changed test description --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
| } | ||
|
|
||
| value(): unknown { | ||
| return this._angularObjectData['object']; |
There was a problem hiding this comment.
any reason to not use the SafeJson object? this way the non-validated object could be removed as a field variable and only have the SafeJson variant.
Perhaps SafeJson could be renamed as a ValidatedObject or such.
| export class AngularObjectCollectionImpl implements AngularObjectCollection { | ||
| private readonly _channel: Channel; | ||
| private readonly _angularObjects: AngularObject[]; | ||
| private readonly _pushValues: PushValue<AngularObject[]>[]; |
There was a problem hiding this comment.
I don't think I fully understand the purpose of the PushValue object, could you explain a bit?
| */ | ||
|
|
||
| export interface MessageWithAuthenticationInfo { | ||
| print(): { |
| ticket: '', | ||
| roles: '', | ||
| }; | ||
| if(!this._authentication.isStub()){ |
There was a problem hiding this comment.
I would leave authenticationInfo undefined and define it in else-block if authentication.isStub=false.
| expect(angularObjectCollection).toBeInstanceOf(AngularObjectCollectionImpl); | ||
| }); | ||
|
|
||
| it('Should have empty collection of angular objects', () => { |
| outputContainer.request(request); | ||
| expect(channelSpy).toHaveBeenCalledExactlyOnceWith(request); | ||
| }); | ||
| }); |
| }); | ||
|
|
||
| describe('Plugin formatting', () => { | ||
| const plugingData = { |
* Added missing webpackplugin for loading angular templates properly * Add AngularWebpackPlugin to production webpack config as well * This causes now type error * Now input signals work * Exclude unused files * POC solution for refactor * Fix recursion pattern from Render and RenderNode * poc version 2 * use signals for component inputs as well * Recursive component rendering * Stash * Poc works now * small fix * Refactored directories * ComponentView object * ParagraphCollectionRefactored * OutputContainer refactored * Output render works almost now, expect inputs are not updated since they are not wrapped to signals * Fixed signal read for RecursiveComponentDraw * Updated stub outputPlugin * webAppRoot needs to print signal and update it each response * Can use computed signal here instead of effect * Fix bug where adding paragraph caused disorientation of the paragraph mapping * This is not part of the objects responsibilities * Started refactoring OutputFormats * uPlot refactored * Renamed method * textOutput * AngularFormat * Deleted unused files * Removed WebAppComponentRegistry since it caused unnecessary complexity * Refactored outputPlugins, removed unused ones * Deleted unused file * Started refactoring outputSwitcher * Switcher refactored * Ad hoc fix for uPlotView change detection * Refactored outputFormat validation and conditional switching to separate object * Override inherited exclude rule for spec config * Fixed tests * Fixed tests * Fixed tests * Fixed tests * Fixed tests * Fixed tests * Fixed tests * Fixed tests * Subtyped OutputFormat objects * Fixed tests * Fixed tests * Added test * Fixed tests * Added test * Refactored NotebookCollection * Updated tests * ParagraphCollection is no longer stubable * Added test * Implemented generic filter object * Refactored paragraphOutputMessage as stubable * ParagraphDataAsOutputMessage object * Initialize decorator paragraph collection * Deleted push value objects * Patched tests * Core idea of the response refactor * Deleted obsolete objects * Decorator ResponseRegister objects * Refactor to use ResponseRegister * ParagraphMessage object * ParagraphAddedMessage * ParagraphRemovedMessage object * Refactored ParagraphCollection * Added RequestRegister object * Refactored paragraphCollection * Added unit test * fixed RequestRegister implementation * RequestRegisterWithPropertyDecorator object * Fixed implementations * Refactored interpreterErrorListener * Fixed tests * fixed test * removed signal * fixed tests * fixed tests * fixed tests * Refactored ParagraphOutputMessage * Refactored ParagraphOutputMessage * Fixed test * Refactored OutputFormat SwitcherButtons property * Fixed tests * Added test * Fixed test * Fixed tests * Added and fixed tests * Fixed test * Added test * Fixed implementation and test * Added test * Added test * Added testing library plugin for asserting changes for components who rely on css. Bootstrap5 modal for instance is such component. * Added test file * Added host class * Added test * Added tests * Added tests * Added tests * Added tests * Added test * Added test * Karma unit tests require additional webpack config that uses ts-loader --------- Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
…ion (#581) Co-authored-by: sryhanen <samuli.ryhanen@fail.safe.net>
|
|
||
| it('Should have notebookIndices', () => { | ||
| expect(notesInfoMessage.notebookIndices().size).toEqual(2); | ||
| expect(notesInfoMessage.notebookIndices().get('notebook1')).toBeDefined(); |
|
|
||
| private validateType():void{ | ||
| if(this._type !== this._message.operation()){ | ||
| throw new RangeError(`Message type is not "${this._type}".`); |
There was a problem hiding this comment.
would be worth to have the expected and actual message type in the error message
| const paragraphOutputMessage = new ParagraphOutputMessageImpl(message); | ||
| if(paragraphOutputMessage.type() !== OutputType.angular){ | ||
| this._componentView.set(this._componentViewStub); | ||
| return; |
| if(paragraphOutputMessage.type() !== OutputType.dataTables){ | ||
| this._componentView.set(this._componentViewStub); | ||
| this._plugin.set(this._pluginStub); | ||
| return; |
| const paragraphOutputMessage = new ParagraphOutputMessageImpl(message); | ||
| if(paragraphOutputMessage.type() !== OutputType.html) { | ||
| this._componentView.set(this._componentViewStub); | ||
| return; |
| import {RgbColor} from './rgbColor'; | ||
|
|
||
| export class RgbColorImpl implements RgbColor { | ||
| private readonly _red:number; |
There was a problem hiding this comment.
Could be improved with RgbaColor decorator. But perhaps leave that for another PR.
RgbColor(red, green, blue)
RgbaColor(RgbColor, opacity)
| const uPlotOutputOptions = { | ||
| labels:safeOutputOptions.getProperty<string[]>('labels', 'object'), | ||
| series:safeOutputOptions.getProperty<string[]>('series', 'object'), | ||
| xAxisLabel:safeOutputOptions.getProperty<string>('xAxisLabel', 'string'), | ||
| graphType: safeOutputOptions.getProperty<string>('graphType', 'string'), | ||
| }; | ||
| let uPlotOptions:uPlot.Options; | ||
| const basicOptions = new BasicOptionsImpl(uPlotOutputOptions); |
There was a problem hiding this comment.
I feel like this could be part of the BasicOptions object
| import {ComponentView} from '../../rendering/componentView/componentView'; | ||
| import {OutputFormatsWithValidatedOutputSwitch} from './outputFormatsWithValidatedOutputSwitch'; | ||
|
|
||
| export class OutputFormatsWithValidatedOutputSwitchImpl implements OutputFormatsWithValidatedOutputSwitch { |
There was a problem hiding this comment.
Not really clear on the purpose of this object. At least the name could use a fix
| import {ParagraphOutputMessageImpl} from '../../message/paragraphOutputMessage/paragraphOutputMessageImpl'; | ||
| import {MessageImpl} from '../../message/messageImpl'; | ||
|
|
||
| export class ParagraphDataAsOutputMessageImpl implements ParagraphDataAsOutputMessage { |
|
|
||
| const paragraphDataAsOutputMessage = new ParagraphDataAsOutputMessageImpl(paragraph); | ||
| const paragraphOutputMessage = paragraphDataAsOutputMessage.paragraphOutputMessage(); | ||
| if(!paragraphOutputMessage.isStub()){ |
Description
Checklists
Testing
General
Assertions
Testing Data
Statements
Java
Other
Code Quality