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

[Download Page] Can we get system based anchors? #78

Open
Confectrician opened this issue Jun 17, 2018 · 11 comments
Open

[Download Page] Can we get system based anchors? #78

Confectrician opened this issue Jun 17, 2018 · 11 comments

Comments

@Confectrician
Copy link
Contributor

Hi,

Is it possible to add anchors and hashed urls that open the downlad page with a specific tab?

Something like https://www.openhab.org/download/#linux or https://www.openhab.org/download/#windows_snapshot or
https://www.openhab.org/download/#windows_stable.

Which could be set on the corresponding buttons of the download page.

We could then replace links on the docs installation pages with simple and easy maintanable direct links.

Wdyt?

@ghys
Copy link
Member

ghys commented Jun 18, 2018

Yep, good idea! Just needs a few lines of code in the component and access this.$route.hash.

@Confectrician
Copy link
Contributor Author

If you point me to the right direction for the start i would love to start contributing here too. 🙂

@ghys
Copy link
Member

ghys commented Jun 19, 2018

Sure!

First try to run the site on your local machine by following the (very succint) instructions in https://github.com/openhab/website/blob/master/CONTRIBUTING.md#running-in-development-mode:

  1. Install NodeJS and Ruby
  2. Install the dependencies with npm install
  3. Install VuePress globally with npm install -g vuepress
  4. Run ruby prepare-docs.rb in the website's folder
  5. Run vuepress dev and wait a minute or two to get the development server listening in port 8080.

Then you can try making changes. actually for this one you can use as an example:

if (this.$route.hash && this.$route.hash.indexOf('token') > 0) {
window.location = 'https://www.openhab.org/admin/' + this.$route.hash
}

but you'll want to add a mounted () method in https://github.com/openhab/website/blob/master/.vuepress/components/InstallInstructions.vue instead, and not change window.location but set properties set in data () with what you find in this.$route.hash - something like:

mounted () {
  if (this.$route.hash) {
    if (this.$route.hash.system) {
      this.currentSystem = this.$route.hash.system
    }
    if (this.$route.hash.distro) {
      this.currentDistro = this.$route.hash.distro
    }
    if (this.$route.hash.version) {
      this.currentVersion = this.$route.hash.version
    }
  }
},

(this is completely untested, just a general idea! 😉 )
Then you can try navigating to /download/#distro=rpm&version=unstable, /download/#system=raspberry-pi and so on. If it works do the pull request so we can get a preview deploy!

Good luck ;)

@Confectrician
Copy link
Contributor Author

Thanks for the overview.
Perfect issue for digging into this. :)

I will update you are as if anything isn't working.

@Confectrician
Copy link
Contributor Author

Confectrician commented Jun 19, 2018

https://stackoverflow.com/questions/50774321/vuepress-unexpected-token

Same problem here.
(I cant even run vuepress -v. Also throws this error.)
Any ideas?

Edit:
Forget this, seems that i had a really old node js version installed^^

@ghys
Copy link
Member

ghys commented Jun 19, 2018

Hmm, no clue, but I'm still on 0.10.0.
Check your node version (mine is 8.9.4) and also try node_modules/.bin/vuepress dev to use the local binary (which will normally be 0.10.0), or downgrade to 0.10.0.

@Confectrician
Copy link
Contributor Author

See edit. 😄 i was on 5.X.X

But have another error now:

 WAIT  Extracting site metadata...
Error: Cannot find module './addons-actions.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\openHAB\openhab-website\.vuepress\config.js:1:85)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

This seems related to openhab docs?!
ruby script has run already.

@ghys
Copy link
Member

ghys commented Jun 19, 2018

If the file doesn't exist, the script hasn't run properly :)
Relaunch it and check the output (or paste it here!).

@Confectrician
Copy link
Contributor Author

Confectrician commented Jun 19, 2018

>D:\openHAB\openhab-website>ruby prepare-docs.rb
>>> Deleting .vuepress/openhab-docs if existing...
>>> Cloning openhab-docs
Cloning into '.vuepress/openhab-docs'...
remote: Counting objects: 4662, done.
remote: Compressing objects: 100% (1888/1888), done.
remote: Total 4662 (delta 1671), reused 4133 (delta 1619), pack-reused 0
Receiving objects: 100% (4662/4662), 26.04 MiB | 3.54 MiB/s, done.
Resolving deltas: 100% (1671/1671), done.
Checking out files: 100% (5779/5779), done.
>>> Download ESH addons feature file
C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
        from C:/Ruby22/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `connect'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:852:in `start'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:583:in `start'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:478:in `get_response'
        from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:455:in `get'
        from prepare-docs.rb:36:in `<main>'

maybe i should check my ruby version too.
(Is windows a problem maybe?)

@ghys
Copy link
Member

ghys commented Jun 19, 2018 via email

@Confectrician
Copy link
Contributor Author

Still some warnings and errors in the output but basically there was a build and i can view it on localhost.
Thanks for the fast help.

Updated tools, can save lots of time...

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

No branches or pull requests

2 participants