Skip to content
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

Fix mscolab flighttrack template handling #2652

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

annapurna-gupta
Copy link
Contributor

Fixes #2474

@ReimarBauer
Copy link
Member

@annapurna-gupta all major tests are failing.

@@ -39,6 +39,7 @@
from mslib.utils.verify_waypoint_data import verify_waypoint_data
from mslib.mscolab.models import db, Operation, Permission, User, Change, Message
from mslib.mscolab.conf import mscolab_settings
from mslib.utils.config import MSUIDefaultConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server on a remote place does not know MSUIDefaultConfig

@@ -103,7 +104,11 @@ def create_operation(self, path, description, user, last_used=None, content=None
if content is not None:
operation_file.write(content)
else:
operation_file.write(mscolab_settings.STUB_CODE)
content = MSUIDefaultConfig.new_flighttrack_template or mscolab_settings.STUB_CODE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to implement this on the client side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i got you.

@@ -32,6 +32,7 @@
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.models import User, db, Permission, Operation
from mslib.mscolab.server import APP as app
from mslib.utils.config import MSUIDefaultConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also seed belongs to the server. It does not know about MSUIDefaultConfig, or not on that what the user has

@ReimarBauer
Copy link
Member

You need to use something like this:

def handle_import_msc(self, file_path, extension, function, pickertype):

But it is not all, you need a way to create the operation on the client site without the need of an initial server revision. This all needs to become covered by tests.

@annapurna-gupta
Copy link
Contributor Author

You need to use something like this:

def handle_import_msc(self, file_path, extension, function, pickertype):

But it is not all, you need a way to create the operation on the client site without the need of an initial server revision. This all needs to become covered by tests.

so you mean that it needs to create an operation on the client side without connection MSCOLAB server, and in the operation, i need to use MSUIDefaultConfig.new_flighttrack_template as template and then write a test function for it. so that MSUI can can create operation without connecting the server, am i right? or something is missing?

@ReimarBauer
Copy link
Member

You need to use something like this:

def handle_import_msc(self, file_path, extension, function, pickertype):

But it is not all, you need a way to create the operation on the client site without the need of an initial server revision. This all needs to become covered by tests.

so you mean that it needs to create an operation on the client side without connection MSCOLAB server, and in the operation, i need to use MSUIDefaultConfig.new_flighttrack_template as template and then write a test function for it. so that MSUI can can create operation without connecting the server, am i right? or something is missing?

Of course you need to be connected to the MSColab Service. When you create a new operation you have to feed in the data from the users local configuration for the initial operation.
This feature is currently only implemented for the Flighpath (left window of the msui view).

@annapurna-gupta
Copy link
Contributor Author

You need to use something like this:

def handle_import_msc(self, file_path, extension, function, pickertype):

But it is not all, you need a way to create the operation on the client site without the need of an initial server revision. This all needs to become covered by tests.

so you mean that it needs to create an operation on the client side without connection MSCOLAB server, and in the operation, i need to use MSUIDefaultConfig.new_flighttrack_template as template and then write a test function for it. so that MSUI can can create operation without connecting the server, am i right? or something is missing?

Of course you need to be connected to the MSColab Service. When you create a new operation you have to feed in the data from the users local configuration for the initial operation. This feature is currently only implemented for the Flighpath (left window of the msui view).

so this will include change in ui of MSUI, it should have a button or a way for operation.

@annapurna-gupta
Copy link
Contributor Author

@ReimarBauer could you please give me little more description of this issue.

@ReimarBauer
Copy link
Member

@ReimarBauer could you please give me little more description of this issue.

Please ask specific questions, once I have planned a solution, this task is done and I would set the PR myself.
This task requires a reengenering of the server and client code to be able to create an operation on the server and then transmit data individually via client for initialization.

@ReimarBauer
Copy link
Member

You need to use something like this:

def handle_import_msc(self, file_path, extension, function, pickertype):

But it is not all, you need a way to create the operation on the client site without the need of an initial server revision. This all needs to become covered by tests.

so you mean that it needs to create an operation on the client side without connection MSCOLAB server, and in the operation, i need to use MSUIDefaultConfig.new_flighttrack_template as template and then write a test function for it. so that MSUI can can create operation without connecting the server, am i right? or something is missing?

Of course you need to be connected to the MSColab Service. When you create a new operation you have to feed in the data from the users local configuration for the initial operation. This feature is currently only implemented for the Flighpath (left window of the msui view).

so this will include change in ui of MSUI, it should have a button or a way for operation.

On the client everything in the UI is defined, no extra button needed. The handling needs changes.

@ReimarBauer
Copy link
Member

ReimarBauer commented Mar 2, 2025

of the msui view).\n\nso this will include change in ui of MSUI, it should have a button or a way for operation.

No.
FILE

  • NEW OPERATION

is there already. You need to send data to the server. Change the API of the server. Use the received information.

there is a tutorial which describes how mscolab can be used
https://mss.readthedocs.io/en/stable/tutorials/tutorial_mscolab.html

The task is about removing STUB_CODE

and use the submitted data by the user.
The data is defined in the users configuration.

@annapurna-gupta
Copy link
Contributor Author

of the msui view).\n\nso this will include change in ui of MSUI, it should have a button or a way for operation.

No. FILE

  • NEW OPERATION

is there already. You need to send data to the server. Change the API of the server. Use the received information.

there is a tutorial which describes how mscolab can be used https://mss.readthedocs.io/en/stable/tutorials/tutorial_mscolab.html

The task is about removing STUB_CODE and use the submitted data by the user. The data is defined in the users configuration.

okk

@@ -146,6 +151,35 @@ def list_operations(self, user, skip_archived=False):
})
return operations

@app.route('/create_operation', methods=['POST'])
def create_operation_route():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all routes should be in the server code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okk

@@ -146,6 +151,35 @@ def list_operations(self, user, skip_archived=False):
})
return operations

@app.route('/create_operation', methods=['POST'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs in the server code, a @verify_user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okk

@@ -151,7 +151,8 @@ def add_operation(operation_name, description):
with fs.open_fs(mscolab_settings.OPERATIONS_DATA) as file_dir:
if not file_dir.exists(operation_name):
file_dir.makedir(operation_name)
file_dir.writetext(f'{operation_name}/main.ftml', mscolab_settings.STUB_CODE)
content = mscolab_settings.STUB_CODE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a duplication of the var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry this is a mistake.

@@ -982,7 +982,7 @@ def browse():
self.add_proj_dialog = add_operation_ui.Ui_addOperationDialog()
self.add_proj_dialog.setupUi(self.proj_diag)
self.add_proj_dialog.f_content = None
self.add_proj_dialog.buttonBox.accepted.connect(self.add_operation)
self.add_proj_dialog.buttonBox.accepted.connect(self.create_local_operation)
Copy link
Member

@ReimarBauer ReimarBauer Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the existing method and modify it so that it does the new aspect.

Copy link
Contributor Author

@annapurna-gupta annapurna-gupta Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To pass MSUIDefaultConfig.new_flighttrack_template to the server, I’ve created this function that initially triggers when the user clicks on the MSColab operation button. This function will check for initial data, include the template, and then pass it to the add_operation function, which will handle the operation as expected...this is what i am trying to do

Copy link
Member

@ReimarBauer ReimarBauer Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks way to complicated
the server has

@APP.route('/create_operation', methods=["POST"])
@verify_user
def create_operation()

And to that you can send content

content = request.form.get('content', None)

That means when the user is not using a ftml file to upload a local file the default content sended is the content based on the user local settings, of course when you send it. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you add content always with the users new_flight_template to the data in
https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/mscolab.py#L1031

You have only to convert the data from new_flight_template to a ftml str syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there for flightracks the template is used to create a waypoint table. When you have a waypoint table you can format it to different types.

https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/msui_mainwindow.py#L750

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@@ -103,7 +104,11 @@ def create_operation(self, path, description, user, last_used=None, content=None
if content is not None:
operation_file.write(content)
else:
operation_file.write(mscolab_settings.STUB_CODE)
content = mscolab_settings.STUB_CODE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to remove the constant STUB_CODE and use only the new_flighttrack_template which the user provides in her msui_settings.json

@ReimarBauer
Copy link
Member

you need to rebase to develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unify mscolab_settings.STUB_CODE with MSUIDefaultConfig.new_flighttrack_template
2 participants