Moonshine-IDE / Moonshine-IDE

Moonshine is a free and open source middleweight IDE built with ActionScript 3 for ActionScript 3, Apache Flex®, Apache Royale™, and Feathers development, with Cloud and Desktop support.
http://moonshine-ide.com/
Other
122 stars 16 forks source link

In-memory CRUD Operations for Generated Royale Interface #1040

Closed JoelProminic closed 2 years ago

JoelProminic commented 2 years ago

This is a sub-task of #675. We discussed this in the meeting today, but this is complex enough that I wanted to pull it into a separate issue.

We would like to have an in-memory object model and CRUD interface as part of the generated Royale application. The main goals are:

@rat-moonshine implemented something similar to this for Form Builder in #704.

The ValueObject properties can be built from the fields (DominoInputText) found in the Domino Visual Editor intermediate XML. You should mainly need the Name, Type, and Multivalue properties for this.

One feature that is missing currently in Domino Visual Editor is view configuration. For an initial implementation, just include the first X fields from the form in the View.

Similarly, we don't define keys, which will be needed for the CRUD agents. You can ignore this for now in the view.

piotrzarzycki21 commented 2 years ago

First part of this issue has been completed. Royale project generated out of Domino Visual Editor project now contains VOs based on views which contains either DominoTextInput or DominoParagraph with Field.

piotrzarzycki21 commented 2 years ago

Next step would be generate usage of this VO in each view.

piotrzarzycki21 commented 2 years ago

@JoelProminic I have started to take care a little bit of data type of fields in VO, cause it seems to me it is started to be important. I have following code:

<par def="1013" paragraph="true" dominotype="paragraph" class="flexHorizontalLayout flexHorizontalLayoutLeft flexHorizontalLayoutTop">
              <field useappletinbrowser="false" allowtabout="false" defaultfocus="false" protected="false" sign="false" storelocally="false" value="Disable" type="keyword" kind="editable" computeaftervalidation="false" allowmultivalues="true" width="100pt" height="30pt" bgcolor="#ffffff" name="Disable" borderstyle="inset" listdisplayseparator="comma" listinputseparators="comma" lookupaddressonrefresh="false" lookupeachchar="false" showdelimiters="true">
                <keywords ui="checkbox" recalconchange="false" recalcchoices="false" columns="1">
                  <textlist>
                    <text>True | true</text>
                  </textlist>
                </keywords>
              </field>
            </par>

In the result I will have following field in VO: public var Disable:Boolean = "Disable";

Value is incorrect it should be true/false - Should I take that value from some different property above or should I leave default false ?

piotrzarzycki21 commented 2 years ago

I have pushed for now default value "false" for Boolean type - Let me know how it should be.

JoelProminic commented 2 years ago

Hi Piotr,

In Domino, "checkbox" fields are actually multi-value text fields. This is because all checkboxes support multiple options.

I normally use these like binaries, with an option list like this:

True | true

In this case, "True" is the display value, and the actually value will be "true" if the option is checked, or "" otherwise. However, this is my convention for single checkboxes, so we can't reliably convert this to a binary.

The Prominic databases also have some fields like this (HostAdminMethod in Jedi Partition Form):

SSH | ssh
RDP | winrdp
FTP | ftp
VMRC | vmrc

In this case, the value could have any, all, or none of these values: 'ssh', 'winrdp', 'ftp', 'vmrc'

JoelProminic commented 2 years ago

Also to clarify, Domino Visual Editor is not using the value attribute currently. I think this was originally used as the default by PrimeFaces Visual Editor, but Domino has a more complicated "Default Value" logic. For example, see the "defaultvalue" here:

          <field listdisplayseparator="newline" listinputseparators="comma semicolon newline" useappletinbrowser="false" allowtabout="false" defaultfocus="false" storelocally="false" alignPardef="left" value="TestLeft" type="text" kind="editable" computeaftervalidation="false" allowmultivalues="false" width="100pt" height="30pt" bgcolor="#ffffff" name="TestLeft">
            <code event="defaultvalue">
              <formula>"Lorem ipsum ..."</formula>
            </code>
          </field>

You can see the default value in <formula>, but could also be a Domino Formula. I expect the formulas to be added to the code in a comment for manual implementation, but we could try to convert default literals

type allowmultivalues` Example Literal Notes
text false "Hello, world!" A single double-quoted string
text true "ssh":"winrdp" Multiple text literals (see above), separated by ':' (ignore any separating whitespace
number false 123 A single number, including floating points
number true 123:456 Multiple text literals (see above), separated by ':' (ignore any separating whitespace
datetime - N/A I think we can only set this with formulas
richtext false "Hello, world!" A single double-quoted string. This represents unformatted text
piotrzarzycki21 commented 2 years ago

I have made another step to get this working. Generate VO now is being used in MXML - I believe next step would be connect with server sight.

JoelProminic commented 2 years ago

@piotrzarzycki21, I mentioned the CRUD interface in the description, but from our meeting today it seems that this was not clear. I'm envisioning an interface similar to what we generated for FormBuilder in #704. The components are:

What configuration information is missing to generate this full interface. The only thing I'm seeing is the view configuration, including:

A placeholder solution would be to make this a single-column datagrid or list with a generic label (i.e. "Object1", "Object2"). This wouldn't be desirable for a real application, but it would let us continue with the CRUD interface until we have a better solution.

You may be able to reuse the view and action logic from the templates in #704. Talk to @rat-moonshine if you need clarification for this.

We also want to be able to generate the Royale application to read from generated Domino agents instead.

JoelProminic commented 2 years ago

As discussed in the meeting, I recommend you use a placeholder datagrid for now that will just serve as a list of available objects.

For example, the interface might look like this: image

Then when the user clicks edits an (double-click), it opens the form you generated, bound to the selected object. New/Create would open a new object. image

The values in the Authors datagrid doesn't matter for now. This can be a constant string (like what I did), an object reference, or just the first property from the form/value object. This will allow you to continue working on the CRUD actions until we have a more permanent solution for defining the view (datagrid) from #1057.

piotrzarzycki21 commented 2 years ago

@JoelProminic I have finished adding to generated Royale application "Edit" option. It should be functional and ready for review. I will try to handle option "Add" today as well.

piotrzarzycki21 commented 2 years ago

@JoelProminic I have fixed problems with editing in more sophisticated views and displaying more columns in DataGrid.

piotrzarzycki21 commented 2 years ago

@JoelProminic I have pushed ability to remove items from list - it's ready for tests. What should be done next actually ?

JoelProminic commented 2 years ago

When I did a fresh test for the PerformanceStats_BingTest database, I got this error on compilation:

: /Users/joelanderson/Documents/Flex/temp_workspace/PerformanceStats_BingTest_Royale/src/PerformanceStats_BingTest_Royale.mxml(72): col: 5 Error: This tag is unexpected. It will be ignored. : : ^

I figured out that this was because of the space in the class name. You should strip out spaces and other invalid special characters when generating the class names. I also found references in the class that were broken. For example:

    [Bindable] private var config valueVO:Config ValueVO;
    [Bindable] private var config valueVOItems:Array = [new Config ValueVO()];

I tried to rename this from the class, but I found that the case-sensitive checkbox in the Moonshine Find/Replace did not work - I may report this separately.

I renamed nsfs/nsf-moonshine/odp/Forms/Config Value.form and visualeditor-src/main/webapp/Config Value.xml in my test converted database to remove the space for this test. There is a minor bug with this rename that we can fix separately (it is doing a replaceAll on ".form" as a regular expression):

: Unable to access file:/Users/-user-/Documents/Flex/temp_workspace/Pe.xmlanceStats_BingTest/visualeditor-src/main/webapp/Config Value.form
: Unable to access file:/Users/-user-/Documents/Flex/temp_workspace/Pe.xmlanceStats_BingTest/visualeditor-src/main/webapp/Config Value.xml

With this change, I was able to build and run the project. I confirmed that the CRUD operations were working for the ConfigValue form.

Some issues:

image

But they are displayed on the same line in Royale:

image

Are you still waiting on me for a fresh export of the PerformanceStats_BingTest with these newline fixes? I tested on a fresh conversion on my side.

JoelProminic commented 2 years ago

Some bigger changes that are still pending before we can start on integration with the agents:

image

piotrzarzycki21 commented 2 years ago

I renamed nsfs/nsf-moonshine/odp/Forms/Config Value.form and visualeditor-src/main/webapp/Config Value.xml in my test converted database to remove the space for this test. There is a minor bug with this rename that we can fix separately (it is doing a replaceAll on ".form" as a regular expression):

I'm not sure who should fix that issue? Shouldn't I get from converter project which doesn't contains such things ? I believe that should be the case. We do not allow create files with spaces in Moonshine, so that's the rule where converter should adjust itself in my opinion.

piotrzarzycki21 commented 2 years ago

Are you still waiting on me for a fresh export of the PerformanceStats_BingTest with these newline fixes? I tested on a fresh conversion on my side.

I think I do. I haven't have fresh copy of that project for a long time.

piotrzarzycki21 commented 2 years ago
  • Updates to "richtext" fields are not saved during Add or Update. For an example, see Differences on the first tab of HostConfigSnapshot.

That one has been fixed - should be available with next build.

piotrzarzycki21 commented 2 years ago
  • Default Value. Currently this is populated from the "Value" property, but this is not correct for Domino Visual Editor. The actual default value is based on a Domino formula (Field Info > Client Objects > defaultvalue > Formula). Don't worry about parsing this formula for now - it will be difficult to handle cases beyond no value and a string or number literal. The text default value will cause problems for at least the type=number fields as we move to the agents.

@JoelProminic please raise separate issue for this - I would like to discuss it widely.

piotrzarzycki21 commented 2 years ago

I think we should close this issue and continue in new one.

piotrzarzycki21 commented 2 years ago

When I did a fresh test for the PerformanceStats_BingTest database, I got this error on compilation:

: /Users/joelanderson/Documents/Flex/temp_workspace/PerformanceStats_BingTest_Royale/src/PerformanceStats_BingTest_Royale.mxml(72): col: 5 Error: This tag is unexpected. It will be ignored. : : ^

I figured out that this was because of the space in the class name. You should strip out spaces and other invalid special characters when generating the class names. I also found references in the class that were broken. For example:

  [Bindable] private var config valueVO:Config ValueVO;
  [Bindable] private var config valueVOItems:Array = [new Config ValueVO()];

I tried to rename this from the class, but I found that the case-sensitive checkbox in the Moonshine Find/Replace did not work - I may report this separately.

I renamed nsfs/nsf-moonshine/odp/Forms/Config Value.form and visualeditor-src/main/webapp/Config Value.xml in my test converted database to remove the space for this test. There is a minor bug with this rename that we can fix separately (it is doing a replaceAll on ".form" as a regular expression):

: Unable to access file:/Users/-user-/Documents/Flex/temp_workspace/Pe.xmlanceStats_BingTest/visualeditor-src/main/webapp/Config Value.form
: Unable to access file:/Users/-user-/Documents/Flex/temp_workspace/Pe.xmlanceStats_BingTest/visualeditor-src/main/webapp/Config Value.xml

With this change, I was able to build and run the project. I confirmed that the CRUD operations were working for the ConfigValue form.

Some issues:

  • Updates to "richtext" fields are not saved during Add or Update. For an example, see Differences on the first tab of HostConfigSnapshot.
  • I'm still seeing issues with the line breaks (Inconsistent Newline Behavior in Converted Domino Database #1033) in the HostConfigSnapshot form. I see that my generated form has "$hostname" and the HostnameOutput in separate Paragraphs here:

image

But they are displayed on the same line in Royale:

image

Are you still waiting on me for a fresh export of the PerformanceStats_BingTest with these newline fixes? I tested on a fresh conversion on my side.

I took a deeper look into Paragraph and why they are not in new line. Mentioned by you hostname code looks like that:

<Column>
                <Div class="flexHorizontalLayout flexHorizontalLayoutLeft flexHorizontalLayoutTop" height="300px" percentWidth="100">
                  <Paragraph alignPardef="" class="flexHorizontalLayout flexHorizontalLayoutLeft flexHorizontalLayoutTop" defid="11" isNewLine="true" wrap="false">
                    <run hide="">
                      <font name="monospace"/>
                      <Label color="system" fontName="monospace" hide="" isBreak="false" isNewLine="false" isUrlLink="false" style="normal">$ hostname</Label>
                    </run>
                  </Paragraph>
                  <Paragraph isNewLine="true">
                    <run hide="">
                      <font name="monospace"/>
                      <Field fontName="monospace" height="30" hidewhen="" htmlClass="" htmlId="" htmlOther="" htmlStyle="" htmlTitle="" id="" kind="editable" listdisplayseparator="" listinputseparators="" maxlength="" name="HostnameOutput" required="false" type="text" value="HostnameOutput" width="106"/>
                    </run>
                    <run hide="">
                      <font name="monospace"/>
                    </run>
                  </Paragraph>
                </Div>
</Column>

These paragraphs are part of DominoTable which contains Column and each column has internal container Div - which has horizontal layout. I think we should change that and we will have good behavior. We could agreed on having DominoTable with vertical layout inside rows/columns.

piotrzarzycki21 commented 2 years ago

I have moved discussion about new line behaviour to #1033 . I will close this issue. @JoelProminic please take a look into my above comments. I will raise also issue for default value.