Skip to content

Commit

Permalink
Merge branch 'main' into staging/charmander
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroedin committed May 16, 2024
2 parents 194eba3 + 51606cd commit f1314e8
Show file tree
Hide file tree
Showing 15 changed files with 3,185 additions and 1,882 deletions.
4 changes: 4 additions & 0 deletions .changeset/eager-dolls-wear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@rhds/elements": patch
---
`<rh-site-status>`: automatically fetch status for the current domain
5 changes: 0 additions & 5 deletions .changeset/metal-birds-share.md

This file was deleted.

33 changes: 33 additions & 0 deletions elements/rh-site-status/demo/domains.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<form id="demo-form">
<rh-site-status id="status"></rh-site-status>
<label for="domain"></label>
<pf-select id="domain">
<pf-option>redhat.com</pf-option>
<pf-option>access.redhat.com</pf-option>
<pf-option>bugzilla.redhat.com</pf-option>
<pf-option>cloud.redhat.com</pf-option>
<pf-option>connect.redhat.com</pf-option>
<pf-option>console.redhat.com</pf-option>
<pf-option>developers.redhat.com</pf-option>
<pf-option>docs.redhat.com</pf-option>
<pf-option>intelligence.redhat.com</pf-option>
</pf-select>
</form>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
import '@patternfly/elements/pf-select/pf-select.js';
document.getElementById('domain').addEventListener('change', function(event) {
document.getElementById('status').__TESTING_ONLY_DONT_USE_OR_WELL_TELL_YOUR_BOSS__domain__ = event.target.value;
})
</script>

<style>
#demo-form {
display: flex;
gap: var(--rh-space-md, 8px);
& #domain {
flex: 1;
}
}
</style>
15 changes: 0 additions & 15 deletions elements/rh-site-status/demo/fetch-override.js

This file was deleted.

26 changes: 24 additions & 2 deletions elements/rh-site-status/demo/loading.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
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);
},
});
}

overrideFetch(
true,
200,
'OK',
() => new Promise(resolve => {
setTimeout(() => resolve({ status: { indicator: 'none', description: 'All Systems Operational' } }), 100000);
setTimeout(() => resolve(
{
page: 'fake data',
components: ['fake data'],
incidents: 'fake data',
status: { indicator: 'none', description: 'All Systems Operational' }
}
), 100000);
})
);
</script>
Expand Down
18 changes: 17 additions & 1 deletion elements/rh-site-status/demo/status-404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@

<script type="module">
import { overrideFetch } from '../fetch-override.js';
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);
},
});
}

overrideFetch(false, 404, 'Error: 404 Not Found');
</script>

Expand Down
26 changes: 24 additions & 2 deletions elements/rh-site-status/demo/status-critical.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
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);
},
});
}

overrideFetch(
true,
200,
'Critical Outage',
() => Promise.resolve({ status: { indicator: 'critical', description: 'Critical Outage' } })
() => Promise.resolve(
{
page: 'fake data',
components: ['fake data'],
incidents: 'fake data',
status: { indicator: 'critical', description: 'Critical Outage' }
}
)
);
</script>

Expand Down
15 changes: 0 additions & 15 deletions elements/rh-site-status/demo/status-maintenance.html

This file was deleted.

26 changes: 24 additions & 2 deletions elements/rh-site-status/demo/status-major.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
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);
},
});
}

overrideFetch(
true,
200,
'Major Outage',
() => Promise.resolve({ status: { indicator: 'major', description: 'Major Outage' } })
() => Promise.resolve(
{
page: 'fake data',
components: ['fake data'],
incidents: 'fake data',
status: { indicator: 'major', description: 'Major Outage' }
}
)
);
</script>

Expand Down
26 changes: 24 additions & 2 deletions elements/rh-site-status/demo/status-minor.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
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);
},
});
}

overrideFetch(
true,
200,
'Partially Degraded Service',
() => Promise.resolve({ status: { indicator: 'minor', description: 'Partially Degraded Service' } })
() => Promise.resolve(
{
page: 'fake data',
components: ['fake data'],
incidents: 'fake data',
status: { indicator: 'minor', description: 'Partially Degraded Service' }
}
)
);
</script>

Expand Down
20 changes: 6 additions & 14 deletions elements/rh-site-status/docs/30-code.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
{% renderOverview %}
<rh-site-status></rh-site-status>
{% endrenderOverview %}
{% renderInstall %}{% endrenderInstall %}

{% band header="Usage" %}{% endband %}
## Usage

{% renderSlots %}{% endrenderSlots %}
```html
<rh-site-status></rh-site-status>
```

{% renderAttributes %}{% endrenderAttributes %}

{% renderMethods %}{% endrenderMethods %}

{% renderEvents %}{% endrenderEvents %}

{% renderCssCustomProperties %}{% endrenderCssCustomProperties %}

{% renderCssParts %}{% endrenderCssParts %}
{% renderCodeDocs hideDescription=true %}{% endrenderCodeDocs %}
Loading

0 comments on commit f1314e8

Please sign in to comment.