Skip to content

Commit

Permalink
Merge pull request #10 from RocketCommunicationsInc/mj.9.5.1
Browse files Browse the repository at this point in the history
Mj.9.5.1
  • Loading branch information
micahjones13 authored Dec 16, 2024
2 parents ed304d6 + 947e025 commit e94f193
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ e2e-results/

# Editors
.idea
.vscode

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## About This Plugin

This panel plugin is primarly a theme plugin. It provides CSS style overrides for the Grafana dashboard in order to theme the dashboard with [Astro UXDS](https://www.astrouxds.com) colors and typography. It also provides options for a classification banner, clock, light/dark theme switching, and setting a default theme. Due to Grafana limitations, the Astro plugin _must be visible_ in order to take effect. Navigation inside of the Grafana dashboard will retain the plugin's overrides, but moving away from the dashboard will cause the styles to revert back to Grafana defaults.
This panel plugin is primarly a theme plugin. It provides CSS style overrides for the Grafana dashboard in order to theme the dashboard with the [Astro UXDS](https://www.astrouxds.com) design system. It also provides options for a classification banner, clock, light/dark theme switching, and setting a default theme. The Astro Panel _must_ be added to a dashboard in order for styles to take effect. Navigation inside of the Grafana dashboard will retain the plugin's overrides, but moving away from the dashboard will cause the styles to revert back to Grafana defaults.

## Panel Options

Expand All @@ -14,7 +14,13 @@ This panel plugin is primarly a theme plugin. It provides CSS style overrides fo
- Shows or hides the clock.
- Format
- Allows user to choose left, center, or right alignment for the panel content.
- Hide Astro Panel
- Hides the Astro Panel from the dashboard, but retains the style overrides the panel provdies.

## MIL-STD 1472 Compliance

The Astro plugin for Grafana implements the AstroUX Design System and implements requirements for Section 5.17 of MIL-STD 1472 compliance as documented at https://www.astrouxds.com/compliance/mil-std-1472/ the Astro plugin does not impact or account for core Grafana functionality. No review of Grafana’s core functionality is implied or warranted by this statement. Any user generated content is not implied or warranted. It is the responsibility of implementors and 3rd party tools to evaluate and implement any 1472 compliance. For questions or comments please contact [email protected].

## Support

For any issues or ideas, please see [the github page](https://github.com/RocketCommunicationsInc/grafana-theme).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rocket-communications-astro",
"version": "1.0.6",
"version": "1.1.0",
"description": "An Astro UXDS theme for Grafana dashboards.",
"scripts": {
"build": "grafana-toolkit plugin:build",
Expand Down
977 changes: 928 additions & 49 deletions src/AstroPanel.tsx

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/Clock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Mode, useAstroTokens } from 'use-astro-tokens';
import React, { useEffect, useState } from 'react';

import { DefaultTheme } from 'types';
import { Global } from '@emotion/react';
import { useAstroTokens, Mode } from 'use-astro-tokens';
import { getDayOfYear } from 'date-fns';

interface Props {
Expand Down Expand Up @@ -46,7 +47,7 @@ export const Clock: React.FC<Props> = (props) => {
<div className="date-label">Date</div>
</div>
<div className="time-container">
<div className="time">{clockTime} UTC</div>
<div className="time">{clockTime}UTC</div>
<div className="time-label">Time</div>
</div>
<Global
Expand All @@ -59,7 +60,7 @@ export const Clock: React.FC<Props> = (props) => {
alignItems: 'center',
width: 'fit-content',
margin: astro.spacing(2),
fontFamily: astro.typography.monospace.fontFamily,
...astro.typography.monospace,
'.date-container': {
display: 'flex',
flexDirection: 'column',
Expand Down Expand Up @@ -116,6 +117,8 @@ export const Clock: React.FC<Props> = (props) => {
height: astro.spacing(10),
padding: astro.spacing(0, 3),
border: `1px solid ${astro.color.background.surface.default}`,
...astro.typography.monospace,
fontVariantNumeric: 'tabular-nums',
},
},
},
Expand Down
9 changes: 8 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PanelPlugin } from '@grafana/data';
import { AstroOptions } from './types';
import { AstroPanel } from './AstroPanel';
import { PanelPlugin } from '@grafana/data';

export const plugin = new PanelPlugin<AstroOptions>(AstroPanel).setPanelOptions((builder) => {
builder.addRadio({
Expand All @@ -25,6 +25,13 @@ export const plugin = new PanelPlugin<AstroOptions>(AstroPanel).setPanelOptions(
path: 'hideTheme',
defaultValue: false,
});
builder.addBooleanSwitch({
name: 'Hide Astro Panel',
path: 'hidePanel',
defaultValue: false,
description:
'Hides the Astro panel entirely, allowing for extra dashboard space but retaining the styling the panel provides. If enabled, you may need to edit the JSON model to see the panel options again.',
});
builder.addSelect({
path: 'classification',
name: 'Classification',
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface AstroOptions {
classification: Classification;
clock: boolean;
format: Format;
hidePanel: boolean;
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./node_modules/@grafana/toolkit/src/config/tsconfig.plugin.json",
"include": ["src", "types"],
"compilerOptions": {
"jsx": "react",
"rootDir": "./src",
"baseUrl": "./src",
"typeRoots": ["./node_modules/@types"]
Expand Down

0 comments on commit e94f193

Please sign in to comment.