diff options
author | Mantas <11616378+mistermantas@users.noreply.github.com> | 2019-01-24 19:23:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 19:23:35 +0200 |
commit | 4a968698e45ece04b25f41783298b9b397a191a1 (patch) | |
tree | 57ae06a3d7344f234ba71a12b7962144b8eb5472 /static | |
parent | 8a1aaf4737e90406119bdf5770937eea924729aa (diff) |
cState is now stable on v3.0 - 2019-01-24 (info: #41)
Diffstat (limited to 'static')
-rw-r--r-- | static/admin/config.yml | 171 | ||||
-rw-r--r-- | static/admin/index.html | 78 |
2 files changed, 244 insertions, 5 deletions
diff --git a/static/admin/config.yml b/static/admin/config.yml index f9ba412..7ac1f5a 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -17,13 +17,13 @@ display_url: / # Do not change this! collections: - - name: "issue" + - name: "issues" label: "Incidents" label_singular: "Incident" - description: "Welcome to the cState admin panel! Here you can create new incidents or manage existing ones. Go ahead and give it a shot." + description: "📚 Welcome to the cState admin panel! Here you can create new incidents or manage existing ones. Go ahead and give it a shot." folder: "content/issues" create: true - slug: "{{slug}}" + slug: "{{year}}-{{month}}-{{day}}-{{slug}}" fields: - {label: "Mark as incident", name: "section", widget: "hidden", default: "issue"} - {label: "Title", name: "title", widget: "string"} @@ -31,7 +31,7 @@ collections: - {label: "Mark as resolved", name: "resolved", widget: "boolean", required: false} - {label: "End date & time (your time)", name: "resolvedWhen", widget: "datetime", required: false} - label: "Affected systems (use exact name, separated by commas)" - name: "Affected" + name: "affected" widget: "list" required: false - label: "Severity" @@ -45,3 +45,166 @@ collections: name: "body" widget: "markdown" default: "*Investigating* - We are investigating a potential issue that might affect the uptime of one our of services. We are sorry for any inconvenience this may cause you. This incident post will be updated once we have more information." + - name: "settings" + label: "Settings" + description: "⚠Please be warned that by editing settings from Netlify CMS you are _OVERWRITING_ what you have in the original Git repository, meaning any CURRENT SETTINGS OR COMMENTS left will be deleted." + delete: false # Prevent users from deleting documents in this collection + editor: + preview: false + files: + - name: "general" + label: "⚙ Configuration File" + file: "config.yml" + fields: + # MAIN + - label: 'Site title' + hint: 'What is your status page called? Shows up in the browser bar and meta.' + name: 'title' + widget: 'string' + - label: 'Build future posts' + name: 'buildFuture' + widget: 'boolean' + hint: 'Should posts, which have a publish date from the future, be built? Useful for sharing upcoming maintenance, etc.' + required: false + default: true + - label: 'Site display language' + hint: 'Docs: https://github.com/cstate/cstate/wiki/Translations#available-translations' + name: 'defaultContentLanguage' + widget: 'select' + default: 'en' + options: + - { label: "🇺🇸 English (default)", value: "en" } + - { label: "🇱🇹 Lithuanian (official)", value: "lt" } + - label: 'Site language in code for html[lang]' + hint: 'Use the ISO 639-1 defined abbreviations. Examples: en, lt, de. Fully explained here: https://github.com/mistermantas/cstate/wiki/Customization#changing-site-language' + name: 'languageCode' + widget: 'string' + default: 'en' + - label: 'Base URL / Hostname' + name: 'baseURL' + widget: 'string' + hint: 'Where is the site hosted? What is the hostname or path to the root? Slash forces relative links but may not work in all setups.' + default: '/' + # PARAMS + - label: "Params" + name: "params" + widget: "object" + fields: + # Components + - label: "System components" + name: "systems" + widget: "list" + allow_add: true + fields: + - {label: "Name", name: "name", widget: string} + - {label: "Description", name: "description", widget: string, required: false} + - {label: "Partial", hint: "Custom HTML feature: https://github.com/cstate/cstate/wiki/Customization#custom-html", name: "partial", widget: string, required: false} + # Components + - label: "Tabs" + hint: 'You can add extra tabs below the main homepage summary, for example, to external sites, monitoring services, as shown in the example below. Try Uptime Robot!' + name: "customTabs" + widget: "list" + allow_add: true + fields: + - {label: "Name", name: "name", widget: string} + - {label: "Link", name: "link", widget: string} + # Dates + - label: 'Long date format' + name: 'dateFormat' + widget: 'string' + hint: 'Default: January 2, 2006 at 3:04 PM. Hugo formatting docs: https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference' + default: 'January 2, 2006 at 3:04 PM' + - label: 'Short date format' + name: 'shortDateFormat' + widget: 'string' + hint: 'Default: 15:04 — Jan 2. Hugo formatting docs: https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference' + default: '15:04 — Jan 2' + # Design toggles + - label: 'Use large header design' + name: 'useLargeHeaderDesign' + widget: 'boolean' + hint: 'What header design should we use? https://github.com/cstate/cstate/wiki/Customization#changing-header' + required: false + default: false + - label: 'Show logo' + name: 'useLogo' + widget: 'boolean' + required: false + default: true + - label: 'Logo image' + hint: 'Upload your logo here. If the logo option is switched off, this will not show.' + name: 'logo' + widget: 'image' + # Description + - label: 'Site description' + hint: 'This is the description that is shown on the footer and meta tags.' + name: 'description' + widget: 'text' + default: 'We continuously monitor the status of our services and if there are any interruptions, a note will be posted here.' + # Refresh + - label: 'Auto refresh status' + name: 'autoRefresh' + widget: 'boolean' + hint: 'This does nothing but refresh the page around every 5 minutes; it does not send alerts! May also have issues on some browsers.' + required: false + default: true + # Incidents per page + - label: 'Incident posts shown in one page' + name: 'incidentPostsPerPage' + widget: 'number' + valueType: 'int' + min: 1 + max: 100 + default: 10 + # Brand color + - label: 'Header: always keep brand color the same' + name: 'alwaysKeepBrandColor' + hint: 'You may choose whether the brand color should stay unchanged once there are disruptions or outages on the header.' + widget: 'boolean' + default: true + # Colors + - label: 'Site HEX color: Brand' + hint: 'Should not have # mark. Default: 181818' + name: 'brand' + widget: 'string' + default: '181818' + - label: 'Site HEX color: Operational / OK' + hint: 'Should not have # mark. Default: 228B22' + name: 'ok' + widget: 'string' + default: '228B22' + - label: 'Site HEX color: Disrupted' + hint: 'Should not have # mark. Default: FF8C00' + name: 'disrupted' + widget: 'string' + default: 'FF8C00' + - label: 'Site HEX color: Down / Offline / Major' + hint: 'Should not have # mark. Default: DC143C' + name: 'down' + widget: 'string' + default: 'DC143C' + - label: 'Site HEX color: Notice' + hint: 'Should not have # mark. Default: 708090' + name: 'notice' + widget: 'string' + default: '708090' + # Google Analytics + - label: 'Google Analytics tracking code' + hint: 'By default, cState does not use Google Analytics. If you choose to use it, you may change the placeholder code below to your own and thereby enable the tracking service. If you set the value back to UA-00000000-1, the code will once again be removed.' + name: 'googleAnalytics' + widget: 'string' + default: 'UA-00000000-1' + # REQUIRED BUT HIDDEN + - label: 'theme' + name: 'theme' + widget: 'hidden' + default: 'cstate' + - label: 'preserveTaxonomyNames' + name: 'preserveTaxonomyNames' + widget: 'hidden' + default: 'true' + - label: "taxonomies" + name: taxonomies + widget: "hidden" + fields: + - {label: "affected", name: "affected", widget: "hidden", default: "affected"} diff --git a/static/admin/index.html b/static/admin/index.html index f650db5..03fce04 100644 --- a/static/admin/index.html +++ b/static/admin/index.html @@ -14,8 +14,84 @@ /admin/ directory. --> - <script>console.log('You are using cState v2.0: https://github.com/cstate/cstate')</script> + <script>console.log('You are using cState. The version can be looked at from the console on the homepage or incidents view.+ https://github.com/cstate')</script> <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script> + <script> + var IssuePreview = createClass({ + render: function() { + var entry = this.props.entry; + + var layoutPostDate = entry.getIn(['data', 'date']); + var layoutPostDateEnd = entry.getIn(['data', 'resolvedWhen']); + const layoutDaysInEnglish = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + + var resultOfStateProps = {"class": "warning"}; + var resultOfState = 'This incident has not yet been resolved.'; + + if (entry.getIn(['data', 'resolved']) === true) { + var resultOfStateProps = {"class": "green"}; + var resultOfState = 'This incident has been resolved.'; + } + + if (layoutPostDateEnd.getYear() === layoutPostDate.getYear()) { + if (layoutPostDateEnd.getHours() === layoutPostDate.getHours()) { + if (layoutPostDateEnd.getMinutes() === layoutPostDate.getMinutes()) { + var resultOfStateProps = {"class": "red"}; + var resultOfState = 'It looks like you haven\'t defined when this incident was resolved. Please double-check.'; + } + } + } + + return h('div', {}, + h('h1', {}, entry.getIn(['data', 'title'])), + h('div', {}, + h('small', {}, layoutDaysInEnglish[layoutPostDate.getMonth()] + ' ' + layoutPostDate.getDate() + ', ' + layoutPostDate.getFullYear() + ' at ' + layoutPostDate.toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true }) ) + ), + h('p', {}, + h('strong', resultOfStateProps, resultOfState) + ), + h('div', {"className": "text"}, this.props.widgetFor('body')) + ); + } + }); + CMS.registerPreviewTemplate("issues", IssuePreview, { raw: true }); + + const previewStyles = ` + html, + body { + padding: 16px; + color: #444; + background: #fff; + font: 100%/1.5 BlinkMacSystemFont, -apple-system, "San Francisco Text", "Roboto", "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + } + + h1 { + line-height: 1; + margin: 0; + color: #000; + font-weight: normal; + font-size: 40px; + font-family: "Segoe UI", BlinkMacSystemFont, -apple-system, "San Francisco Text", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + } + + small { + margin-top: 12px; + color: #666; + font-variant: small-caps; + display: block; + } + + .text { + padding-top: 12px; + border-top: 1px solid #ccc; + } + + .green { color: #228B22; } + .red { color: #DC143C; } + .warning { color: #EE7600; } + `; + CMS.registerPreviewStyle(previewStyles, { raw: true }); + </script> </body> </html> |