From ce02fd7a6b15d8685351d822636f18092e54b02c Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Tue, 7 Apr 2020 01:08:20 +0200 Subject: [PATCH] Improve the 'noJob' view immediately after setup --- .../hudson/model/AllView/noJob.groovy | 44 ++++++++++++++++ .../hudson/model/AllView/noJob.jelly | 52 ------------------- .../hudson/model/AllView/noJob.properties | 12 +++-- war/src/main/less/base/style.less | 3 +- 4 files changed, 55 insertions(+), 56 deletions(-) create mode 100644 core/src/main/resources/hudson/model/AllView/noJob.groovy delete mode 100644 core/src/main/resources/hudson/model/AllView/noJob.jelly diff --git a/core/src/main/resources/hudson/model/AllView/noJob.groovy b/core/src/main/resources/hudson/model/AllView/noJob.groovy new file mode 100644 index 0000000000..c7f66be608 --- /dev/null +++ b/core/src/main/resources/hudson/model/AllView/noJob.groovy @@ -0,0 +1,44 @@ +package hudson.model.AllView + +import hudson.model.Computer +import hudson.model.Item +import jenkins.model.Jenkins + +div { + h1(_("Welcome to Jenkins!")) + + if (my.owner == Jenkins.get()) { + // we're a top-level 'All' view + if (Jenkins.get().hasPermission(Computer.CREATE) && Jenkins.get().clouds.isEmpty() && Jenkins.get().getNodes().isEmpty()) { + div(class: 'call-to-action') { + if (Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { + raw(_("distributedBuildsWithCloud")) + } else { + raw(_("distributedBuilds")) + } + } + } + if (my.owner.hasPermission(Item.CREATE)) { + div(class: 'call-to-action') { + raw(_("newJob")) + } + } + } else { + // we're in a folder + if (my.owner.hasPermission(Item.CREATE)) { + div(class: 'call-to-action') { + raw(_("newJob")) + } + } + } + + if (h.isAnonymous() && !my.owner.hasPermission(Item.CREATE)) { + div(class:'call-to-action') { + raw(_("login", rootURL, app.securityRealm.loginUrl, request.requestURI)) + if (app.securityRealm.allowsSignup()) { + text(" ") // TODO make this nicer + raw(_("signup")) + } + } + } +} diff --git a/core/src/main/resources/hudson/model/AllView/noJob.jelly b/core/src/main/resources/hudson/model/AllView/noJob.jelly deleted file mode 100644 index 0c9e0c26a9..0000000000 --- a/core/src/main/resources/hudson/model/AllView/noJob.jelly +++ /dev/null @@ -1,52 +0,0 @@ - - - -
- -

${%Welcome to Jenkins!}

- - - - - -
${%newJob}
-
- - - -
- ${%login(rootURL, app.securityRealm.loginUrl, request.requestURI)} - - - ${%signup} - -
-
-
-
- -
\ No newline at end of file diff --git a/core/src/main/resources/hudson/model/AllView/noJob.properties b/core/src/main/resources/hudson/model/AllView/noJob.properties index a314eec51f..a56ca9a8a6 100644 --- a/core/src/main/resources/hudson/model/AllView/noJob.properties +++ b/core/src/main/resources/hudson/model/AllView/noJob.properties @@ -20,8 +20,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -newJob=Please create new jobs to get started. +newJob=Create a job to start building your software project. -login=Log in to create new jobs. +distributedBuildsWithCloud=Create an agent or configure a cloud to set up distributed builds. \ + Learn more. -signup=If you don\u2019t already have an account, you can sign-up now. +distributedBuilds=Create an agent to set up distributed builds. \ + Learn more. + +login=You are not logged in. Log in now to view or create jobs. + +signup=If you don\u2019t already have an account, you can sign up now. diff --git a/war/src/main/less/base/style.less b/war/src/main/less/base/style.less index 177ac40881..e81298e081 100644 --- a/war/src/main/less/base/style.less +++ b/war/src/main/less/base/style.less @@ -196,7 +196,8 @@ a.tip:hover span { } .call-to-action { - display: inline-block; + display: table; + margin-bottom: 5px; padding: 10px; background-color: #cdf0f2; border-left: 4px solid #577baa; -- GitLab