-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Features/interface fixes #157
Conversation
And build warning fixes
…work-weathermap into features/interface-fixes
…eatures/interface-fixes
…eatures/interface-fixes
Wow, this is a big one! Thanks! It'll take a little while to go through, but a couple of immediate comments:
This looks great though, I'll be reading some more later tonight! |
Rutger - one other thing that I thought I'd already done, but it turns out I haven't yet. I'm planning to change the license for Weathermap from GPL to MIT. Since this PR is the first major code contribution, I thought I should let you know before anything gets merged, in case that is a problem for you. |
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.
Some changes are needed, but this can be done later
@@ -59,13 +59,13 @@ public function handleManagementMainScreen($request, $appObject) | |||
$locale = $this->manager->application->getLocale(); | |||
print "<h3>This is the React UI below here</h3>"; | |||
print "<h1>INCOMPLETE</h1>"; | |||
print '<style>@import "cacti-resources/mgmt/main.css";</style>'; | |||
print '<style>@import "/cacti/plugins/weathermap/cacti-resources/mgmt/main.css";</style>'; |
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.
It is more correct to do this:
above add global $config;
and replace the string with:
print '<style>@import "' . $config['url_path'] . 'plugins/weathermap/cacti-resources/mgmt/main.css";</style>';
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.
This is the other one I was going to comment on last night, but didn't have the Cacti source handy to check the config item name. Thanks @pautiina.
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 really should start testing this for you... but @pautiina is doing a great job and I've too many things to try out too little time.
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.
Should be done now.
print "<h3>Testing API</h3>"; | ||
print '<a href="?action=listmaps">Map List</a> - '; | ||
print '<a href="?action=app_settings">Settings</a> - '; | ||
print '<a href="?action=listmapfiles">Map Files</a>'; | ||
print "<div id='weathermap-mgmt-root' data-locale='" . $locale . "' data-url='" . $this->makeURL(array("action" => "app_settings")) . "'></div>"; | ||
print '<script type="text/javascript" src="cacti-resources/mgmt/main.js"></script>'; | ||
print '<script type="text/javascript" src="/cacti/plugins/weathermap/cacti-resources/mgmt/main.js"></script>'; |
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.
applying the above global $config
print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/cacti-resources/mgmt/main.js"></script>';
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.
Should be done now.
@@ -626,6 +658,23 @@ function handleMapListAdd( | |||
} | |||
} | |||
|
|||
|
|||
protected | |||
function handleMapsListAdd( |
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.
It may be better to stick to the spelling standard to write all in one line:
protected function handleMapsListAdd(
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 think that was a mistake. Howie doesn't normally have lines like that. Good spot!
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.
Should be done now.
print "<h1>INCOMPLETE</h1>"; | ||
print '<style src="cacti-resources/user/main.css"></style>'; | ||
print '<style>@import "cacti-resources/user/main.css"</style>'; |
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.
also need add global $config
and change this line for this:
print '<style>@import "' . $config['url_path'] . 'plugins/weathermap/cacti-resources/user/main.css";</style>';
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.
Should be done now.
print "<h1>INCOMPLETE</h1>"; | ||
print '<style src="cacti-resources/user/main.css"></style>'; | ||
print '<style>@import "cacti-resources/user/main.css"</style>'; | ||
print '<script type="text/javascript" src="overlib.js"></script>'; |
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.
print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/overlib.js"></script>';
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.
Should be done now.
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.
In the cacti world we normally prefix with the $config['url_path'] but if you are using a relative path instead, the first <style>
is better for efficiency. Otherwise, the browser has to do multiple steps of retrieving the CSS, importing it into a new style block, parsing that.
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.
The first style might be more efficient. However, there is a (timing?) issue when loading the css.
If we do a 'src="..."' then the CSS does not load (on time), or is not applied.
When we do a '@import ...' then the CSS is applied.
Seems strange, however this fixes some styling issues.
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've run into these kinds of issues too, where a reload fixed styling or Javascript loading. I had assumed it was to do with the way Cacti loads partial pages, so relative URLs aren't always reliable. I haven't looked into it deeply to confirm though.
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.
That was what we experienced too.
The '@import' fixed (works around?) this issue. At least the CSS is now always loaded.
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.
Interesting to know. It should use the current location of the first script as the relative base unless something changes it. So, the import shouldn’t make a difference. Guess if it works, go with it as I doubt any of us have that much free time to waste when there’s a workaround 👍
print '<style src="cacti-resources/user/main.css"></style>'; | ||
print '<style>@import "cacti-resources/user/main.css"</style>'; | ||
print '<script type="text/javascript" src="overlib.js"></script>'; | ||
|
||
print "<div id='weathermap-user-root' data-locale='" . $locale . "' data-url='" . $this->makeURL(array("action" => "settings")) . "'></div>"; | ||
print '<script type="text/javascript" src="cacti-resources/user/main.js"></script>'; |
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.
Forgot to change this line:
print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/cacti-resources/user/main.js"></script>';
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.
Should be done now.
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.
Again, I would revert to the direct method rather than using @imports
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.
The first style might be more efficient. However, there is a (timing?) issue when loading the css.
If we do a 'src="..."' then the CSS does not load (on time), or is not applied.
When we do a '@import ...' then the CSS is applied.
Seems strange, however this fixes some styling issues.
lib/Weathermap/UI/UIBase.php
Outdated
@@ -98,7 +100,7 @@ public function validateArgument($type, $value) | |||
} | |||
|
|||
if ($type != "") { | |||
throw new WeathermapInternalFail("ValidateArgs saw unknown type"); | |||
throw new WeathermapInternalFail("ValidateArgs saw unknown type '$type'"); |
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 about this line, namely the addition of single quotes
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.
With the single quotes you can see the difference between an empty value, a value with spaces and typos in the message.
However, I'll remove it. :-)
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 would have left it as is. As you said, it makes things clear that its an actually value not just a string part of the message.
Howard, we're fine with the licence change. Rutger |
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.
This is looking good to me. My only change requests are:
- yarn.lock is supposed to be there for the two react apps
- Please don't make random files executable (configs/*.conf for some reason)
I think it can be merge and then change by you requests |
@RutgerLubbers can you change? |
I merged and then fixed the permissions. |
Thith it right |
Although it doesn't actually pass the tests. You ran the tests, right, Rutger? |
@howardjones that's still the |
Fixed - the default group ID for a new map should be 1 not 0. |
No, this was a unit test failing that previously didn’t. Travis is building
cleanly now.
https://travis-ci.org/howardjones/network-weathermap/jobs/437817023
…On Fri, 5 Oct 2018 at 22:24, Mark Brugnoli-Vinten ***@***.***> wrote:
@howardjones <https://github.com/howardjones> that's still the ext-snmp
error we haven't managed to resolve.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#157 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3sJRhDhEwbcDrhRUsE171zN5EB2ft_ks5uh830gaJpZM4Wry5n>
.
|
I didn't see that one 👍 |
Anyway - UI is moving forwards... thanks, Rutger & co! :-) |
Hi Howard,
as per previous pull request, this PR with some functionality fixes. We've bundled them together.
The changes are:
Management:
Weathermap:
General:
These changes may not be as you would like to see the final release, but it is working now (a bit more :-) ).
Kind regards,
Rutger Lubbers