Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Fixes Issue #23 and #33#47

Merged
mosoriob merged 7 commits intomintproject:masterfrom
dhruvp-8:master
Apr 16, 2020
Merged

Fixes Issue #23 and #33#47
mosoriob merged 7 commits intomintproject:masterfrom
dhruvp-8:master

Conversation

@dhruvp-8
Copy link
Copy Markdown
Contributor

No description provided.

@mosoriob mosoriob self-requested a review April 14, 2020 17:06
src/mic/_menu.py Outdated
click.clear()
first_line_new(resource_object.name)
property_chosen = menu_select_property(request, mapping)
if resource_object.name=='Model'or resource_object.name=='Model Configuration':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nope. This is a bad idea, you must verify it in a generic way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What could be a more generic way? Verify if it's a top resource?
I think this is problematic because if you are defining a model and define versions and then configurations, you don't want to allow inserting them from there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, what should be the generic way. I thought only model and configurations are allowed to have send.
Should I have array similar to ACTIONS declared on top to denote which can have send option?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See my comment. If ModelConfigurations can send, then you can encounter an error when defining a model configuration on a model version of a model. I think that if what you are editing is a top resource, then you can send.

Copy link
Copy Markdown
Contributor

@maurya-rohit maurya-rohit Apr 14, 2020

Choose a reason for hiding this comment

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

So, only model can have send option, is that correct as for now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No. If you start with a modelConfiguration, then modelConfig is your top resource and you should be able to send. If you start with model, then you should not be able to send in the sub-resources

src/mic/_menu.py Outdated
first_line_new(resource_object.name)
if resource_object.name=='Model'or resource_object.name=='Model Configuration':
property_chosen = menu_select_property(request, mapping,False)
if parent is None and full_request is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please check if this is the correct way.

@mosoriob
Copy link
Copy Markdown
Contributor

mosoriob commented Apr 14, 2020

Using: 398e2c1
Fix #33, added more generic way for checking

I can't see the send in the top resource view

mic model add
======= Model ======
Select the property to edit [1-17] or ['show', 'save', 'exit'] [1]:

I can type send in a subresource view

Definition: Name of the person
Person - Name : asdfa
======= Person ======
The actual values are:
+-------+------------+-----------+
|   no. | Property   | Value     |
+=======+============+===========+
|     1 | Name       | ['asdfa'] |
+-------+------------+-----------+
|     2 | email      |           |
+-------+------------+-----------+
|     3 | website    |           |
+-------+------------+-----------+
Select the property to edit [1-3] or ['show', 'save', 'exit'] [1]: send
Traceback (most recent call last):
  File "/Users/mosorio/.pyenv/versions/mic/bin/mic", line 11, in <module>
    load_entry_point('mic', 'console_scripts', 'mic')()
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/mosorio/.pyenv/versions/3.7.6/envs/mic/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/mosorio/repos/mic-dev/src/mic/__main__.py", line 48, in add
    create_model()
  File "/Users/mosorio/repos/mic-dev/src/mic/_model.py", line 18, in create
    call_menu_select_property(mapping_model, ModelCli(), request)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 304, in call_menu_select_property
    resource_object=resource_object, mapping=mapping)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 220, in call_ask_value
    menu_call_actions_complex(request, variable_selected, resource_name, mapping, resource_object, request_property)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 96, in menu_call_actions_complex
    mapping_create_value_complex(request, resource_object, request_property)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 362, in mapping_create_value_complex
    value = mapping_resource_complex(resource_object, request_property)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 349, in mapping_resource_complex
    return call_menu_select_property(sub_resource_mapping, sub_resource, full_request)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 299, in call_menu_select_property
    if handle_actions(request, property_chosen, mapping, resource_object, full_request=full_request, parent=parent):
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 409, in handle_actions
    menu_push(full_request, resource_object, parent=parent)
  File "/Users/mosorio/repos/mic-dev/src/mic/_menu.py", line 152, in menu_push
    response_sub_resource = resource_object.post(request)
AttributeError: type object 'PersonCli' has no attribute 'post'

Please, take your time to do it.

@mosoriob
Copy link
Copy Markdown
Contributor

mosoriob commented Apr 14, 2020

The action must be enable in the top resource.
For example:

$ mint model add 
The top resource is model
$ mint cat add
The top resource is cat
$ mint modelconfiguration add
The top resource is modelconfiguration

@maurya-rohit
Copy link
Copy Markdown
Contributor

Thanks for the feedback. Please check the updated changes.

@mosoriob mosoriob merged commit 12c4e1e into mintproject:master Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants