adminfaces / admin-starter-springboot

https://adminfaces.github.io/admin-starter
37 stars 33 forks source link

Layout options freezes most functions #4

Closed chrisfperes closed 5 years ago

chrisfperes commented 5 years ago

When some of the options in lateral layout options menu are toggle, both lateral menus stop working, this only fixes when I clean the browser caches. I tested it on Chrome.

rmpestano commented 5 years ago

Yes, also ajax call are not triggered anymore, no javascript errors thou.

I need to investigate further as it doesn't happen on other starters (tomcat/javaee/javaee-security).

Thanks for reporting.

rmpestano commented 5 years ago

Hi @chrisfperes, can you try the fix below?

https://github.com/adminfaces/admin-starter-springboot/commit/84f10c5f9fd01ced9e72a06b431f494df93737b7#diff-6937490b8ef42332c03bbfbc492073a8R60

rmpestano commented 5 years ago

Forget it, it only fixes the control sidebar opening issue but the ajax calls and left hamburger menu still not working.

rmpestano commented 5 years ago

Alright, now I think I got it working. Had to update OmniFaces (and weld) to v3.0, take a look at this branch: https://github.com/adminfaces/admin-starter-springboot/blob/omnifaces3/pom.xml and compare with your pom.xml to configure omnifaces 3.

If you want to test locally just clone omnifaces3 branch:

git clone -b omnifaces3 https://github.com/adminfaces/admin-starter-springboot

if you already have cloned the starter just do a git checkout -f omnifaces3

I hope it helps.

chrisfperes commented 5 years ago

It's working fine now, thanks for helping!

persapiens commented 5 years ago

hi @chrisfperes and @rmpestano

Which application server do you use to run omnifaces3 branch successfully? I tried with java -jar target/admin-starter.war but login failed.

I look forward your answer.

rmpestano commented 5 years ago

Hi @persapiens, I'm just using mvn spring-boot:run and it is just working.

If it still doesn't work for you, try attached zip:

admin-starter-springboot-omni3.zip

rmpestano commented 5 years ago

From the logs it is using embedded tomcat:

2018-11-23 16:10:08.909  INFO 14789 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-11-23 16:10:08.935  INFO 14789 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-11-23 16:10:08.936  INFO 14789 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.34
rmpestano commented 5 years ago

Hi guys,

Thanks to @persapiens PR this issue is almost fixed.

We're still facing the very same issue when a skin is changed via the controlsidebar.

As before it doesn't happen on omnifaces3 branch, JavaEE admin-starter or admin-starter-tomcat.

@persapiens, can you have a look? the skin changing was moved to admin-base, (for details see adminfaces/admin-template#140).

PS: I'm watting to release vRC20 so this fix gets included.

persapiens commented 5 years ago

hi @rmpestano , omnifaces3 branch is not perfect. It works ok with skin change but it skips login if you run it with mvn spring-boot:run. More, omnifaces3 branch login does not work if you run it with java -jar target/admin-starter.war.

master branch breaks skin change indeed. I've played a bit with broken implementation

<p:commandLink id="btn-skin-purple" styleClass="skin-link clearfix #{skinMB.skin eq 'skin-purple' ? '':'full-opacity-hover'}"
  oncomplete="replaceSkinWith('skin-purple');updateSkinPurple()"
  process="@none" update="@none" global="false" partialSubmit="true">
  <div>
    <span style="display:block; width: 20%; float: left; height: 7px;" class="bg-purple-active"></span>
    <span class="bg-purple" style="display:block; width: 80%; float: left; height: 7px;"></span>
  </div>
  <div>
    <span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span>
    <span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span>
  </div>
</p:commandLink>
<p:remoteCommand name="updateSkinPurple" action="#{skinMB.changeSkin('skin-purple')}" process="@this" update="@none" global="false"/>

It is strange that if I remove oncomplete="replaceSkinWith('skin-purple');updateSkinPurple()", controlsidebar breaks!

rmpestano commented 5 years ago

Hi @persapiens,

...It works ok with skin change but it skips login...

Yes, it is probably not recognizing AdminSession specialization on LoginMB because the AdminFilter is active but is considering user is always logged in which is the default behaviour. LoginMB is responsible for telling AdminFaces that user is not logged in.

More, omnifaces3 branch login does not work if you run it with java -jar target/admin-starter.war.

For some reason when using java -jar SpringBoot uses omnifaces1 and that's probably why it's not working with java -jar:

2018-11-27 09:45:48.121  INFO 4148 --- [ost-startStop-1] o.omnifaces.VersionLoggerEventListener   : Using OmniFaces version 1.14.1

It is strange that if I remove oncomplete="replaceSkinWith('skin-purple');updateSkinPurple()", controlsidebar breaks!

The controlsidebar is a bit complex component because it uses LocalStorage for persisting user preferences (see here, the get('layout.skin'); loads from browser storage - loadSkin is called on documentReady) but at the same time AdminFaces binds the current skin in skinMB so we can reset defaults by loading skin from admin-config.properties.

persapiens commented 5 years ago

When I run omnifaces branch using java -jar admin-starter.war, I see OmniFaces 3.2

2018-11-27 15:50:17.566  INFO 21653 --- [ost-startStop-1] org.omnifaces.ApplicationInitializer     : Using OmniFaces version 3.2
rmpestano commented 5 years ago

When I run omnifaces branch using java -jar admin-starter.war, I see OmniFaces 3.2

You're right, I was running against an old war file on target. Same thing for me here, the login is not working with java -jar on the other hand using mvn spring-boot:run the login page is skipped and looks like LoginMB is not being used on this case.

rmpestano commented 5 years ago

Guys, I think I got it working with OmniFaces1, can you try on the master branch of this repo?

persapiens commented 5 years ago

Guys, I think I got it working with OmniFaces1, can you try on the master branch of this repo?

It works. Great work.

rmpestano commented 5 years ago

RC20 was released, I'll close the issue. Thank you very much guys for your help here!