-
Notifications
You must be signed in to change notification settings - Fork 165
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
added option to add additional items to the view-overview #183
Open
trombastic
wants to merge
1
commit into
pyscada:main
Choose a base branch
from
trombastic:AddViewLink
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
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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I understood, for a dummy view defined in the
settings.py
:link_title
is set, it redirect to a view (why let this option if this is the classic way to add a view from the admin ?)link_title
is not set, it redirect to a local link on the server but you define an URL to catch it (and redirect to the index view function), so it will not redirect to your other plugin or django app if the thoseurls.py
is loaded after thehmi/urls.py
settings.py
needs to restartgunicorn
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean with this, at least in my case (and I admit, that I didn't think to much about other cases were one would like to add links to the view-overview) this is not a problem, but i see that there is a chance that the user may set a custom link with this new way which overrides a internal url of pyscada itself or a pyscada-plugin
this is True, to have this option more changes to the view-overview template will be necessary, for my case where I use nginx as reverse proxy for the other apps, this is not a problem, but i see your point.
In my opinion the need to restart
gunicorn
is not a problem, my intention was to use it not dynamically, but if we decide later to have it as dedicated model then it would be possible to keep more or less the same logic.When I implemented this I was not sure what others may have build on top of the view-overview template and therefore tried to keep the changes to that minimal. I agree with you, that if we want to add the ability to add links more freely (e.g. external links) or allow dynamic changes, this would be not the right way. But for links in the same Namespace as Pyscada (same Top Level URL) hijacking the index Funktion in views is the only good option I see. There would be the other option to have a special URL for that (e.g. https://TOP_LEVEL_URL/external/NEW_NAMESPACE) that I don't like so much because this would make those urls harder to memories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this config add a view that redirect to
https://127.0.0.1/test/
.As this url is not defined in nginx as a location and no plugin is catching this path before the
hmi.urls.py
, the path you defined inhmi.urls.py
redirect this link toview-overview
with the linkhttps://127.0.0.1/test/
(theindex
view).########
This should do the trick :
########
I think it should be easy from the admin to:
What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a first step I will try your code Suggestion for the view-overview template