Skip to content

Commit

Permalink
Merge pull request #2005 from zarvox/new-admin-breadcrumbs
Browse files Browse the repository at this point in the history
New admin reorganization
  • Loading branch information
kentonv committed May 20, 2016
2 parents 5c8ed62 + 8449fbd commit e4a1aa4
Show file tree
Hide file tree
Showing 28 changed files with 310 additions and 188 deletions.
40 changes: 9 additions & 31 deletions shell/client/admin-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,6 @@ Template.adminSettings.helpers({
return globalDb.getSamlPublicCert();
},

smtpUrl: function () {
return Iron.controller().state.get("smtpUrl");
},

smtpConfig() {
const config = Settings.findOne({ _id: "smtpConfig" });
return config && config.value;
Expand Down Expand Up @@ -1264,19 +1260,17 @@ const newAdminRoute = RouteController.extend({
Meteor.subscribe("adminServiceConfiguration", this.params._token),
Meteor.subscribe("featureKey", true, this.params._token),
];
if (this.params._token) {
subs.push(Meteor.subscribe("adminToken", this.params._token));
}

return subs;
},

data: function () {
const adminToken = AdminToken.findOne();
const wildcardHostSeemsBroken = (
Session.get("alreadyTestedWildcardHost") && !Session.get("wildcardHostWorks")
);
return {
settings: Settings.find(),
token: this.params._token,
isUserPermitted: isAdmin() || (adminToken && adminToken.tokenIsValid),
isUserPermitted: isAdmin(),
wildcardHostSeemsBroken,
};
},

Expand Down Expand Up @@ -1306,31 +1300,15 @@ const newAdminRoute = RouteController.extend({
});
});

const state = this.state;
Meteor.call("getSmtpUrl", this.params._token, function (error, result) {
state.set("smtpUrl", result);
});

const user = Meteor.user();
if (user && user.loginIdentities) {
if (this.params._token) {
if (!user.signupKey || !user.isAdmin) {
Meteor.call("signUpAsAdmin", this.params._token);
} else if (user.isAdmin) {
// We don't need the token. Redirect to the current route, minus the token parameter.
Router.go(this.route.getName(), {}, _.pick(this.params, "query", "hash"));
}
}
}

resetResult(state);
state.set("configurationServiceName", null);
state.set("token", this.params._token);
this.render();
},
});

Router.map(function () {
this.route("newAdminRoot", {
path: "/admin-new",
controller: newAdminRoute,
});
this.route("newAdminIdentity", {
path: "/admin-new/identity",
controller: newAdminRoute,
Expand Down
6 changes: 0 additions & 6 deletions shell/client/admin/admin-new-client.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
Template.adminNavPill.helpers({
currentRouteNameIs(name) {
return Router.current().route.getName() === name;
},
});

Template.newAdmin.helpers({
adminTab() {
return Router.current().route.getName();
Expand Down
103 changes: 80 additions & 23 deletions shell/client/admin/admin.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,109 @@
<template name="adminNavPill">
<template name="adminNavItem">
{{!--
Takes as arguments:

routeName: String
data: String
class: String
--}}
<li class="nav-pill {{#if currentRouteNameIs routeName}}active{{/if}}">
{{#linkTo route=routeName data=data}}{{> Template.contentBlock}}{{/linkTo}}
<li class="nav-item">
{{#linkTo route=routeName class=class data=data}}
{{> Template.contentBlock}}
{{/linkTo}}
</li>
</template>

<template name="newAdmin">
{{>title "(new) Admin Settings"}}
{{>title "Admin panel"}}

{{#if wildcardHostSeemsBroken}}
<div class="wildcard-host-warning">
<div class="flash-message warning-message">
WARNING: This server seems to have its WILDCARD_HOST misconfigured. Until you fix it, you will
not be able to use any apps.
<a target="_blank"
href="https://docs.sandstorm.io/en/latest/administering/faq/#why-do-i-see-an-error-when-i-try-to-launch-an-app-even-when-the-sandstorm-interface-works-fine">
Learn more.</a> You'll need to adjust DNS, SSL/TLS certificates, or edit the sandstorm.conf
file. Once you have addressed the issue, reload this page. If you're still having problems,
email us at support@sandstorm.io.
email us at <a href="mailto:support@sandstorm.io">support@sandstorm.io</a>.
</div>
{{/if}}

{{> _adminConfigureLoginServiceDialog}}
<div class="admin-settings">
{{#if isUserPermitted}}
<ul class="nav-pills">
{{#adminNavPill routeName="newAdminIdentity"}}Identity Providers{{/adminNavPill}}
{{#adminNavPill routeName="newAdminOrganization"}}Organization Settings{{/adminNavPill}}
{{#adminNavPill routeName="newAdminEmailConfig"}}Email Configuration{{/adminNavPill}}
{{#adminNavPill routeName="newAdminUsers"}}Users{{/adminNavPill}}
{{#adminNavPill routeName="newAdminAppSources"}}App Sources{{/adminNavPill}}
{{#adminNavPill routeName="newAdminMaintenance"}}Maintenance Message{{/adminNavPill}}
{{#adminNavPill routeName="newAdminStatus"}}System Status{{/adminNavPill}}
{{#adminNavPill routeName="newAdminPersonalization"}}Personalization{{/adminNavPill}}
{{#adminNavPill routeName="newAdminNetworkCapabilities"}}Network Capabilities{{/adminNavPill}}
{{#adminNavPill routeName="newAdminStats"}}Stats{{/adminNavPill}}
{{#adminNavPill routeName="newAdminFeatureKey"}}For Work{{/adminNavPill}}
</ul>
{{> Template.dynamic template=adminTab}}
{{else}}
<p>
You are not logged in as admin and there isn't a valid token specified. You should
either log in as an admin user or generate a token from the command line by doing
`sandstorm admin-token` in order to access the admin settings page.
You are not logged in as an admin. To access the admin panel, log in as an admin user or
generate a token from the command line by running `sandstorm admin-token`.
</p>
{{/if}}
</div>
</template>

<template name="newAdminRoot">
<h1>
<ul class="admin-breadcrumbs">
<li>Admin</li>
</ul>
</h1>

<nav>
<ul class="nav-sections">
<li>
<h2>Configuration</h2>
<ul class="nav-items">
{{#adminNavItem routeName="newAdminIdentity"}}
<div class="item-name">Identity providers</div>
<div class="item-subtext">How users log in.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminOrganization"}}
<div class="item-name">Organization settings</div>
<div class="item-subtext">Smoother onboarding and collaboration for larger teams.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminEmailConfig"}}
<div class="item-name">Email configuration</div>
<div class="item-subtext">How email gets sent to users.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminFeatureKey"}}
<div class="item-name">Sandstorm for Work</div>
<div class="item-subtext">Get a feature key and unlock advanced features.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminPersonalization"}}
<div class="item-name">Personalization</div>
<div class="item-subtext">Customize a splash page, terms of service, privacy policy,
etc.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminAppSources"}}
<div class="item-name">App sources</div>
<div class="item-subtext">Where to look for apps and app updates.</div>
{{/adminNavItem}}
</ul>
</li>
<li>
<h2>Management</h2>
<ul class="nav-items">
{{#adminNavItem routeName="newAdminUsers"}}
<div class="item-name">Users</div>
<div class="item-subtext">Manage all users on this Sandstorm installation.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminStatus"}}
<div class="item-name">System log</div>
<div class="item-subtext">View Sandstorm's debug log.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminStats"}}
<div class="item-name">Statistics</div>
<div class="item-subtext">View usage statistics for this server.</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminMaintenance"}}
<div class="item-name">Maintenance message</div>
<div class="item-subtext">Communicate potential downtime to users</div>
{{/adminNavItem}}
{{#adminNavItem routeName="newAdminNetworkCapabilities"}}
<div class="item-name">Network capabilities</div>
<div class="item-subtext">Manage direct network access for grains.</div>
{{/adminNavItem}}
</ul>
</li>
</ul>
</nav>
</template>
12 changes: 9 additions & 3 deletions shell/client/admin/app-sources.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template name="newAdminAppSources">
<h1>App Sources</h1>
<h1>
<ul class="admin-breadcrumbs">
<li>{{#linkTo route="newAdminRoot"}}Admin{{/linkTo}}</li>
<li>App sources</li>
</ul>
</h1>

{{#if hasSuccess}}
{{#focusingSuccessBox}}
{{message}}
Expand All @@ -13,7 +19,7 @@ <h1>App Sources</h1>
<form class="admin-app-sources">
<div class="form-group">
<label>
App Market URL
App market URL
<input type="text" name="appMarketUrl" value="{{appMarketUrl}}" />
</label>
<span class="form-subtext">
Expand All @@ -35,7 +41,7 @@ <h1>App Sources</h1>
{{#if enableAppUpdates}}
<div class="form-group">
<label>
App Index URL
App index URL
<input type="text" name="appIndexUrl" value="{{appIndexUrl}}" />
</label>
<span class="form-subtext">
Expand Down
7 changes: 6 additions & 1 deletion shell/client/admin/email-config.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template name="newAdminEmailConfig">
<h1>Email Configuration</h1>
<h1>
<ul class="admin-breadcrumbs">
<li>{{#linkTo route="newAdminRoot"}}Admin{{/linkTo}}</li>
<li>Email configuration</li>
</ul>
</h1>

<h2>Outbound email</h2>

Expand Down
7 changes: 6 additions & 1 deletion shell/client/admin/feature-key.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template name="newAdminFeatureKey">
<h1>Sandstorm for Work</h1>
<h1>
<ul class="admin-breadcrumbs">
<li>{{#linkTo route="newAdminRoot"}}Admin{{/linkTo}}</li>
<li>Sandstorm for Work</li>
</ul>
</h1>

{{#if currentFeatureKey}}
<h2>Current feature key</h2>
Expand Down
34 changes: 20 additions & 14 deletions shell/client/admin/identity-providers.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<template name="newAdminIdentity">
<h1>Identity Providers</h1>
<h1>
<ul class="admin-breadcrumbs">
<li>{{#linkTo route="newAdminRoot"}}Admin{{/linkTo}}</li>
<li>Identity providers</li>
</ul>
</h1>

<p>Choose which services users may use to identify themselves. Anyone can log in, but only users you invite will be able to install apps or create grains.</p>
{{>adminIdentityProviderTable idpData=idpData featureKeyRoute="newAdminFeatureKey"}}

{{#if hasFeatureKey}}
<p>
To configure organization membership and settings, see
{{#linkTo route="newAdminOrganization"}}Organization Settings{{/linkTo}}.
{{#linkTo route="newAdminOrganization"}}organization settings{{/linkTo}}.
</p>
{{/if}}
</template>

<template name="adminIdentityProviderConfigureEmail">
{{#modalDialogWithBackdrop onDismiss=onDismiss}}
<h2>Email Login Configuration</h2>
<h2>Email login configuration</h2>

{{#if errorMessage}}
{{#focusingErrorBox}}
Expand Down Expand Up @@ -62,7 +68,7 @@ <h2>Email Login Configuration</h2>

<template name="adminIdentityProviderConfigureGoogle">
{{#modalDialogWithBackdrop onDismiss=onDismiss}}
<h2>Google Login Configuration</h2>
<h2>Google login configuration</h2>

{{#if errorMessage}}
{{#focusingErrorBox}}
Expand All @@ -73,7 +79,7 @@ <h2>Google Login Configuration</h2>
<form class="setup-idp-form">
{{> googleLoginSetupInstructions }}

<p>Then, copy over your Client ID and Client Secret below:</p>
<p>Then, copy over your Client ID and Client secret below:</p>

<div class="form-group">
<label>
Expand All @@ -83,7 +89,7 @@ <h2>Google Login Configuration</h2>
</div>
<div class="form-group">
<label>
Client Secret:
Client secret:
<input type="text" name="clientSecret" value="{{clientSecret}}"/>
</label>
</div>
Expand Down Expand Up @@ -111,7 +117,7 @@ <h2>Google Login Configuration</h2>

<template name="githubLoginSetupInstructions">
<p>
First, you'll need to get a Github Client ID and Client Secret. Follow these steps:
First, you'll need to get a Github Client ID and Client secret. Follow these steps:
</p>
<ol>
<li>Visit <a href="https://github.com/settings/applications/new" target="blank">https://github.com/settings/applications/new</a></li>
Expand All @@ -122,12 +128,12 @@ <h2>Google Login Configuration</h2>

<template name="adminIdentityProviderConfigureGitHub">
{{#modalDialogWithBackdrop onDismiss=onDismiss}}
<h2>GitHub Configuration</h2>
<h2>GitHub login configuration</h2>

<form class="setup-idp-form">
{{> githubLoginSetupInstructions }}

<p>Then, copy over your Client ID and Client Secret below:</p>
<p>Then, copy over your Client ID and Client secret below:</p>
<div class="form-group">
<label>
Client ID:
Expand All @@ -136,7 +142,7 @@ <h2>GitHub Configuration</h2>
</div>
<div class="form-group">
<label>
Client Secret:
Client secret:
<input type="text" name="clientSecret" value="{{clientSecret}}"/>
</label>
</div>
Expand Down Expand Up @@ -164,7 +170,7 @@ <h2>GitHub Configuration</h2>

<template name="adminIdentityProviderConfigureLdap">
{{#modalDialogWithBackdrop onDismiss=onDismiss}}
<h2>LDAP Configuration</h2>
<h2>LDAP login configuration</h2>

{{#if errorMessage}}
{{#focusingErrorBox}}
Expand Down Expand Up @@ -274,7 +280,7 @@ <h2>LDAP Configuration</h2>

<template name="adminIdentityProviderConfigureSaml">
{{#modalDialogWithBackdrop onDismiss=onDismiss}}
<h2>SAML Login Configuration</h2>
<h2>SAML login configuration</h2>

<p>
Your SAML IDP should be configured to return a persistent nameID. In addition you <strong>must</strong>
Expand Down Expand Up @@ -333,7 +339,7 @@ <h2>SAML Login Configuration</h2>
<div class="identity-provider-table" role="grid">
<div class="idp-table-header" role="rowgroup">
<div class="idp-header-row" role="row">
<span class="idp" role="rowheader">Identity Provider</span>
<span class="idp" role="rowheader">Identity provider</span>
<span class="idp-status" role="rowheader">Status</span>
</div>
</div>
Expand All @@ -359,7 +365,7 @@ <h2>SAML Login Configuration</h2>
{{#if idp.enabled}}
<span class="idp-enabled">Enabled</span>
{{else}}
<span class="idp-disabled">Not Enabled</span>
<span class="idp-disabled">Not enabled</span>
{{/if}}

{{#if needsFeatureKey}}
Expand Down
Loading

0 comments on commit e4a1aa4

Please sign in to comment.