forked from hashicorp-forge/hermes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Draft of 404 * Update design * Fix transitionTo; Add test; MockDate resets * Revert out-of-scope changes * Fix merge error
- Loading branch information
Showing
9 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Controller from "@ember/controller"; | ||
import parseDate from "hermes/utils/parse-date"; | ||
|
||
export default class Error404Controller extends Controller { | ||
get currentDate() { | ||
return parseDate(new Date(), "long"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ Router.map(function () { | |
}); | ||
}); | ||
this.route("authenticate"); | ||
this.route('404', { path: '/*path' }) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Route from "@ember/routing/route"; | ||
|
||
export default class Error404Route extends Route {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.error-404 { | ||
@apply bg-color-page-faint; | ||
|
||
.title { | ||
@apply text-[3.5rem] mb-5 mr-20; | ||
} | ||
|
||
.doc-page { | ||
@apply mt-16 bg-white shadow-2xl border border-color-border-primary rounded-t-xl; | ||
} | ||
|
||
.meta-information { | ||
@apply grid grid-cols-2 gap-8; | ||
|
||
> div { | ||
@apply space-y-1; | ||
} | ||
} | ||
|
||
.divider { | ||
@apply h-[4px] bg-color-foreground-strong w-full; | ||
} | ||
|
||
p { | ||
@apply text-display-300 text-color-foreground-strong; | ||
} | ||
|
||
.summary { | ||
@apply mb-6 text-display-400 pr-20; | ||
} | ||
|
||
.gradient-overlay { | ||
@apply fixed w-full h-56 bottom-0 pointer-events-none bg-gradient-to-t from-color-surface-strong to-transparent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{page-title "Page not found"}} | ||
{{set-body-class "error-404"}} | ||
|
||
<div class="flex w-full min-h-screen px-16"> | ||
<div class="x-container doc-page"> | ||
<div class="p-16"> | ||
<header class="flex items-center justify-between mb-16"> | ||
<LinkTo @route="authenticated.dashboard" class="no-underline"> | ||
<HermesLogo /> | ||
</LinkTo> | ||
<Hds::Button | ||
@text="View dashboard" | ||
@icon="arrow-right" | ||
@iconPosition="trailing" | ||
@route="authenticated.dashboard" | ||
/> | ||
</header> | ||
<div class="divider mb-6"></div> | ||
<h1 class="title">[E-404] Page not found</h1> | ||
<p class="summary"> | ||
<strong class="mr-1">Summary:</strong>The address may be expired or the | ||
page may have moved. We apologize for any inconvenience. | ||
</p> | ||
<div class="meta-information"> | ||
<div> | ||
<p><strong>Status:</strong> | ||
Loading | Success | | ||
<strong>Error</strong></p> | ||
<p><strong>Type:</strong> Four hundred four</p> | ||
</div> | ||
<div> | ||
<p data-test-404-logged-time> | ||
<strong>Logged:</strong> | ||
{{this.currentDate}}</p> | ||
<p><strong>Assignee:</strong> Admin</p> | ||
</div> | ||
</div> | ||
<div class="divider mt-10 mb-14"></div> | ||
<p class="mb-40"> | ||
<strong class="uppercase">Note:</strong> | ||
If you think this is a mistake, | ||
<Hds::Link::Inline | ||
@isHrefExternal={{true}} | ||
@href="https://github.com/hashicorp-forge/hermes/issues" | ||
@icon="external-link" | ||
class="hover:no-underline" | ||
> | ||
please create an issue on GitHub | ||
</Hds::Link::Inline> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="gradient-overlay"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { visit } from "@ember/test-helpers"; | ||
import { setupApplicationTest } from "ember-qunit"; | ||
import { module, test } from "qunit"; | ||
import { getPageTitle } from "ember-page-title/test-support"; | ||
import MockDate from "mockdate"; | ||
|
||
module("Acceptance | 404", function (hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test("unknown URLs get the 404 treatment", async function (assert) { | ||
MockDate.set("2000-01-01T06:00:00.000-07:00"); | ||
|
||
await visit("/not_real_url"); | ||
|
||
assert.equal(getPageTitle(), "Page not found | Hermes"); | ||
|
||
assert.dom("h1").hasText("[E-404] Page not found"); | ||
assert.dom("[data-test-404-logged-time]").hasText("Logged: 1 January 2000"); | ||
|
||
MockDate.reset(); | ||
}); | ||
}); |