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

feat(site-status): add <rh-site-status> #1507

Merged
merged 58 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
13089d1
feat(site-status): add site-status
zeroedin Mar 28, 2024
6164e39
fix(site-status): add missing export
zeroedin Mar 28, 2024
0f9c293
chore(site-stutus): fix comment
zeroedin Mar 28, 2024
eaaeb48
fix(site-status): lint
zeroedin Mar 28, 2024
c11d438
fix(site-status): add color-context
zeroedin Mar 28, 2024
af69a63
test(site-staus): fix missing semi colon
zeroedin Mar 28, 2024
0c8fcd0
fix(site-status): remove errant import
zeroedin Mar 28, 2024
58ddfd5
fix(site-status): allow endpoint to be overridden
zeroedin Mar 29, 2024
9aa6c81
docs(site-status): add incorrect endpoint demo
zeroedin Mar 29, 2024
5f27e23
docs(site-status): correct auto generated template for demo
zeroedin Mar 29, 2024
ec1433c
test(site-status): improve tests
zeroedin Mar 29, 2024
f1cc5a3
fix(site-status): lint
zeroedin Mar 29, 2024
25401d8
fix(site-status): lint
zeroedin Mar 29, 2024
f281942
fix(site-status): ugh lint...
zeroedin Mar 29, 2024
d4c7625
fix(site-status): revert customizable endpoint, add href to status pa…
zeroedin Apr 1, 2024
dc580dd
test(site-status): improve tests
zeroedin Apr 1, 2024
0301f8b
docs(site-status): add status demos
zeroedin Apr 1, 2024
a691888
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 1, 2024
3ec44e8
docs(site-status): stub docs
zeroedin Apr 1, 2024
33fe32b
docs(site-status): add jsdoc
zeroedin Apr 2, 2024
339629f
docs: add site-status to related items
zeroedin Apr 2, 2024
f62b047
fix(site-status): add type guard for api response
zeroedin Apr 4, 2024
1916723
docs(site-status): update readme
zeroedin Apr 10, 2024
5bed744
docs(site-status): imporove jsdoc
zeroedin Apr 11, 2024
3f5d67b
docs(site-status): add docs pages and images
zeroedin Apr 11, 2024
646dd8e
chore(site-status): add changeset
zeroedin Apr 11, 2024
e7761e1
chore(site-status): update changeset to include example
zeroedin Apr 11, 2024
1ec93f1
chore(site-status): remove unused demo files
zeroedin Apr 11, 2024
53d3db9
fix(site-status): remove unused part
zeroedin Apr 12, 2024
5b1412e
style(site-status): reorder type
zeroedin Apr 12, 2024
c7b264a
fix(site-status): make #isApiStatus static
zeroedin Apr 12, 2024
2a78dcc
fix(site-status): class decorators cant be use with static private id…
zeroedin Apr 12, 2024
db54625
fix(site-status): move getStatus to firstUpdated, remove extraneous t…
zeroedin Apr 12, 2024
80b08db
fix(site-status): handle capitalization in css
zeroedin Apr 12, 2024
082bfd5
fix(site-status): correct first letter uppercase style
zeroedin Apr 12, 2024
88ff1ff
fix(site-status): revert response error removal
zeroedin Apr 12, 2024
3903bfb
fix(site-status): remove status as statusText includes the 404 text.
zeroedin Apr 12, 2024
3dc5356
fix(site-status): correct viewbox attr
zeroedin Apr 12, 2024
339a018
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 13, 2024
eef39fd
docs(site-status): add repoStatus
zeroedin Apr 13, 2024
3130696
test(site-status): use sinon for fetch stub
zeroedin Apr 15, 2024
8787c54
test(site-status): remove unused aTimeout
zeroedin Apr 15, 2024
2adc35b
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 15, 2024
29694e1
fix(site-status): switch api call to a try catch
zeroedin Apr 16, 2024
f8106f4
fix(site-status): remove contextProvider not used in design spec
zeroedin Apr 16, 2024
24e29ea
fix(site-status): use block instead of display contents on host
zeroedin Apr 16, 2024
ad684b8
fix(site-status): move restore of fetch to top describes
zeroedin Apr 16, 2024
302d2b0
fix(site-status): implement loading-text slot for translations and ac…
zeroedin Apr 16, 2024
c6631ee
docs(site-status): improve demos with loading state demo
zeroedin Apr 16, 2024
57ca112
fix(site-status): add focus and hover states
zeroedin Apr 16, 2024
0c28434
docs(site-status): add if status is still loading to accessibility
zeroedin Apr 16, 2024
cb23515
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 16, 2024
fd85451
fix(site-status): readding color context provider
zeroedin Apr 16, 2024
1ec825c
chore(site-status): lint
zeroedin Apr 16, 2024
3c312f4
fix(site-status): remove context provider add dark styles
zeroedin Apr 17, 2024
581e712
docs(site-status): readding arg check to fetch override
zeroedin Apr 17, 2024
0ff93cf
chore(site-status): lint
zeroedin Apr 17, 2024
e73ac83
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions elements/rh-site-status/demo/fetch-override.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

const { fetch: originalFetch } = window;

export function overrideFetch(ok, status, statusText, json) {
window.fetch = new Proxy(window.fetch, {
apply: (target, thisArg, args) => {
if (args[0] === 'https://status.redhat.com/index.json') {
return Promise.resolve({
ok,
status,
statusText,
json
});
}
return target.apply(thisArg, args);
}
});
window.fetch = async () => {
return Promise.resolve({
ok,
status,
statusText,
json
});
};
}
32 changes: 32 additions & 0 deletions elements/rh-site-status/demo/loading.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(
true,
200,
'OK',
() => new Promise((resolve) => {
setTimeout(() => resolve({ status: { indicator: 'none', description: 'All Systems Operational' } }), 100000);
})
);
</script>

<rh-site-status></rh-site-status>

Example of translated loading text:
<rh-context-demo lang="fr">
<rh-site-status>
<span slot="loading-text">Chargement</span>
</rh-site-status>
</rh-context-demo>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
import '@rhds/elements/lib/elements/rh-context-demo/rh-context-demo.js';
</script>

<style>
rh-context-demo {
height: unset;
margin: unset;
}
</style>
8 changes: 5 additions & 3 deletions elements/rh-site-status/rh-site-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const statusMap: Record<string, string> = {
* Website status communicates the operational status of a website or domain using a status icon and link. It is usually located in the Footer component.
*
* @summary Communicates operational status of a website or domain
*
* @slot loading-text - Text to display while loading the status defaults to "Loading"
*/
@customElement('rh-site-status')
export class RhSiteStatus extends LitElement {
Expand All @@ -66,7 +68,7 @@ export class RhSiteStatus extends LitElement {

#logger = new Logger(this);

#text = 'Loading';
#text = '';

#icon: TemplateResult = html``;

Expand All @@ -79,8 +81,8 @@ export class RhSiteStatus extends LitElement {

render() {
return html`
<a href="https://status.redhat.com/">
${this.#isLoading ? html`<rh-spinner size="sm"></rh-spinner>` : html`
<a href="https://status.redhat.com/" aria-busy="${this.#isLoading ? 'true' : 'false'}" aria-live="polite">
${this.#isLoading ? html`<rh-spinner size="sm" color-palette="dark"></rh-spinner><span><slot name="loading-text">Loading</slot></span>` : html`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewbox="0 0 16 17" fill="none">
${this.#icon}
</svg>
Expand Down
Loading