gcp-material-ui 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/charts/SKILL.MD +103 -0
- package/.agents/skills/creating-common-components/SKILL.MD +121 -0
- package/.agents/skills/creating-pages/SKILL.MD +205 -0
- package/.agents/skills/sidebar/SKILL.MD +63 -0
- package/.agents/skills/workflow-graph/SKILL.MD +160 -0
- package/.dockerignore +4 -0
- package/.editorconfig +17 -0
- package/.prettierrc +12 -0
- package/Dockerfile +14 -0
- package/PUBLISH_GUIDE.md +33 -0
- package/README.md +48 -0
- package/angular.json +79 -0
- package/deploy.sh +47 -0
- package/nginx.conf +15 -0
- package/package.json +48 -0
- package/public/favicon.ico +0 -0
- package/public/google-cloud-combined.svg +1 -0
- package/publish.sh +14 -0
- package/src/_variables.scss +183 -0
- package/src/app/app.config.ts +19 -0
- package/src/app/app.html +1 -0
- package/src/app/app.routes.ts +65 -0
- package/src/app/app.scss +0 -0
- package/src/app/app.spec.ts +23 -0
- package/src/app/app.ts +12 -0
- package/src/app/auth/auth.guard.ts +7 -0
- package/src/app/auth/auth.service.ts +50 -0
- package/src/app/components/page/page.html +20 -0
- package/src/app/components/page/page.scss +41 -0
- package/src/app/components/page/page.ts +15 -0
- package/src/app/dashboard/dashboard.html +287 -0
- package/src/app/dashboard/dashboard.scss +196 -0
- package/src/app/dashboard/dashboard.ts +24 -0
- package/src/app/demo-components/buttons/buttons-demo.html +92 -0
- package/src/app/demo-components/buttons/buttons-demo.scss +38 -0
- package/src/app/demo-components/buttons/buttons-demo.ts +23 -0
- package/src/app/demo-components/card/card-demo.html +52 -0
- package/src/app/demo-components/card/card-demo.scss +47 -0
- package/src/app/demo-components/card/card-demo.ts +21 -0
- package/src/app/demo-components/charts/charts-demo.html +88 -0
- package/src/app/demo-components/charts/charts-demo.scss +50 -0
- package/src/app/demo-components/charts/charts-demo.ts +201 -0
- package/src/app/demo-components/chips/chips-demo.html +87 -0
- package/src/app/demo-components/chips/chips-demo.scss +6 -0
- package/src/app/demo-components/chips/chips-demo.ts +57 -0
- package/src/app/demo-components/code-snippet/code-snippet-demo.html +52 -0
- package/src/app/demo-components/code-snippet/code-snippet-demo.scss +20 -0
- package/src/app/demo-components/code-snippet/code-snippet-demo.ts +31 -0
- package/src/app/demo-components/dialog/dialog-demo.html +47 -0
- package/src/app/demo-components/dialog/dialog-demo.ts +90 -0
- package/src/app/demo-components/dialog/dialog-examples.ts +126 -0
- package/src/app/demo-components/expand-button/expand-button-demo.html +28 -0
- package/src/app/demo-components/expand-button/expand-button-demo.scss +45 -0
- package/src/app/demo-components/expand-button/expand-button-demo.ts +28 -0
- package/src/app/demo-components/expansion/expansion-demo.html +105 -0
- package/src/app/demo-components/expansion/expansion-demo.scss +11 -0
- package/src/app/demo-components/expansion/expansion-demo.ts +49 -0
- package/src/app/demo-components/forms/forms-demo.html +114 -0
- package/src/app/demo-components/forms/forms-demo.scss +43 -0
- package/src/app/demo-components/forms/forms-demo.ts +57 -0
- package/src/app/demo-components/message/message-demo.html +47 -0
- package/src/app/demo-components/message/message-demo.ts +33 -0
- package/src/app/demo-components/message/message.html +15 -0
- package/src/app/demo-components/message/message.scss +115 -0
- package/src/app/demo-components/message/message.ts +39 -0
- package/src/app/demo-components/sidebar/sidebar-demo.html +46 -0
- package/src/app/demo-components/sidebar/sidebar-demo.scss +47 -0
- package/src/app/demo-components/sidebar/sidebar-demo.ts +27 -0
- package/src/app/demo-components/sidebar/sidebar.html +15 -0
- package/src/app/demo-components/sidebar/sidebar.scss +25 -0
- package/src/app/demo-components/sidebar/sidebar.ts +87 -0
- package/src/app/demo-components/slide-toggle/slide-toggle-demo.html +110 -0
- package/src/app/demo-components/slide-toggle/slide-toggle-demo.scss +45 -0
- package/src/app/demo-components/slide-toggle/slide-toggle-demo.ts +39 -0
- package/src/app/demo-components/stepper/stepper-demo.html +99 -0
- package/src/app/demo-components/stepper/stepper-demo.ts +84 -0
- package/src/app/demo-components/tables/clean_tables_scss.py +16 -0
- package/src/app/demo-components/tables/tables-demo.html +64 -0
- package/src/app/demo-components/tables/tables-demo.scss +18 -0
- package/src/app/demo-components/tables/tables-demo.ts +89 -0
- package/src/app/demo-components/tabs/tabs-demo.html +168 -0
- package/src/app/demo-components/tabs/tabs-demo.scss +22 -0
- package/src/app/demo-components/tabs/tabs-demo.ts +76 -0
- package/src/app/demo-components/toolbars/toolbars-demo.html +50 -0
- package/src/app/demo-components/toolbars/toolbars-demo.scss +29 -0
- package/src/app/demo-components/toolbars/toolbars-demo.ts +25 -0
- package/src/app/demo-components/tooltip/tooltip-demo.html +80 -0
- package/src/app/demo-components/tooltip/tooltip-demo.scss +30 -0
- package/src/app/demo-components/tooltip/tooltip-demo.ts +27 -0
- package/src/app/demo-components/typography/typography-demo.html +23 -0
- package/src/app/demo-components/typography/typography-demo.scss +49 -0
- package/src/app/demo-components/typography/typography-demo.ts +72 -0
- package/src/app/demo-components/workflow-graph/workflow-graph-demo.html +25 -0
- package/src/app/demo-components/workflow-graph/workflow-graph-demo.scss +48 -0
- package/src/app/demo-components/workflow-graph/workflow-graph-demo.ts +133 -0
- package/src/app/layout/layout.html +12 -0
- package/src/app/layout/layout.scss +21 -0
- package/src/app/layout/layout.ts +19 -0
- package/src/app/layout/side-menu/side-menu.html +32 -0
- package/src/app/layout/side-menu/side-menu.scss +52 -0
- package/src/app/layout/side-menu/side-menu.ts +70 -0
- package/src/app/layout/top-action-bar/top-action-bar.html +41 -0
- package/src/app/layout/top-action-bar/top-action-bar.scss +98 -0
- package/src/app/layout/top-action-bar/top-action-bar.ts +68 -0
- package/src/app/page-templates/complex-form/complex-form.html +103 -0
- package/src/app/page-templates/complex-form/complex-form.scss +110 -0
- package/src/app/page-templates/complex-form/complex-form.ts +66 -0
- package/src/app/page-templates/firewall-add/firewall-add.html +78 -0
- package/src/app/page-templates/firewall-add/firewall-add.scss +1 -0
- package/src/app/page-templates/firewall-add/firewall-add.ts +94 -0
- package/src/app/page-templates/firewall-details/firewall-details.html +115 -0
- package/src/app/page-templates/firewall-details/firewall-details.scss +21 -0
- package/src/app/page-templates/firewall-details/firewall-details.ts +91 -0
- package/src/app/page-templates/firewall-list/firewall-list.html +99 -0
- package/src/app/page-templates/firewall-list/firewall-list.scss +21 -0
- package/src/app/page-templates/firewall-list/firewall-list.ts +85 -0
- package/src/app/page-templates/firewall.service.ts +84 -0
- package/src/app/services/project.service.ts +24 -0
- package/src/index.html +17 -0
- package/src/main.ts +6 -0
- package/src/styles.scss +739 -0
- package/start_server.sh +4 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +33 -0
- package/tsconfig.spec.json +15 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Using Charts
|
|
3
|
+
description: Guidelines and best practices for integrating and rendering Chart.js using ng2-charts in Standalone Angular components. Use when you need to render metrics and graphs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Charts with Chart.js & ng2-charts
|
|
7
|
+
|
|
8
|
+
This skill provides configuration and implementation standards for rendered graphs and analytics dashboards.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Use this when you need to create analytics dashboards or render visual metrics (Line, Bar charts).
|
|
13
|
+
- This is helpful for visualizing traffic, logs, or metrics over time.
|
|
14
|
+
|
|
15
|
+
## How to use it
|
|
16
|
+
|
|
17
|
+
### 1. Setup & Configuration
|
|
18
|
+
|
|
19
|
+
#### A. Global Setup (`app.config.ts`)
|
|
20
|
+
|
|
21
|
+
To support dynamic graph datasets globally, include `provideCharts(withDefaultRegisterables())`:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';
|
|
25
|
+
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideRouter(routes),
|
|
29
|
+
provideCharts(withDefaultRegisterables()) // <- Required
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. Component Implementation
|
|
35
|
+
|
|
36
|
+
All components rendering charts **MUST** be Standalone and import core directives:
|
|
37
|
+
|
|
38
|
+
#### Type Definition Configs:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { BaseChartDirective } from 'ng2-charts';
|
|
42
|
+
import { ChartConfiguration, ChartData, ChartType, ChartOptions } from 'chart.js';
|
|
43
|
+
|
|
44
|
+
@Component({
|
|
45
|
+
standalone: true,
|
|
46
|
+
imports: [BaseChartDirective, MatCardModule],
|
|
47
|
+
...
|
|
48
|
+
})
|
|
49
|
+
export class MyChartComponent {
|
|
50
|
+
|
|
51
|
+
// 1. EXACT Literal typing fixes template compilation errors
|
|
52
|
+
public myChartType: 'line' = 'line'; // DO NOT use ChartType union
|
|
53
|
+
|
|
54
|
+
// 2. Specific ChartOptions<'type'> enables type-safe config (e.g., cutout)
|
|
55
|
+
public myChartOptions: ChartOptions<'doughnut'> = {
|
|
56
|
+
responsive: true,
|
|
57
|
+
maintainAspectRatio: false,
|
|
58
|
+
cutout: '70%', // specific to doughnut
|
|
59
|
+
plugins: {
|
|
60
|
+
legend: { display: true, position: 'bottom' } // best for responsive scaling
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 3. Template Layout Standards
|
|
67
|
+
|
|
68
|
+
Wrap all `<canvas>` wrappers strictly with sizing bounds inside parent modules:
|
|
69
|
+
|
|
70
|
+
#### Layout Sizing Checklist:
|
|
71
|
+
|
|
72
|
+
1. **Wrapper size Constraint**: Always put `<canvas baseChart>` inside a `<div>` with explicit dimensions (like `.chart-wrapper` height set).
|
|
73
|
+
2. **Overflow confinement**: Apply `overflow: hidden;` to correct resizing scale-bound overlaps.
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<mat-card>
|
|
77
|
+
<mat-card-header>
|
|
78
|
+
<mat-card-title>Network Dashboard</mat-card-title>
|
|
79
|
+
</mat-card-header>
|
|
80
|
+
<mat-card-content>
|
|
81
|
+
<div class="chart-wrapper">
|
|
82
|
+
<canvas baseChart
|
|
83
|
+
[data]="chartData"
|
|
84
|
+
[options]="myChartOptions"
|
|
85
|
+
[type]="myChartType">
|
|
86
|
+
</canvas>
|
|
87
|
+
</div>
|
|
88
|
+
</mat-card-content>
|
|
89
|
+
</mat-card>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Corresponding SCSS sizes:
|
|
93
|
+
|
|
94
|
+
```scss
|
|
95
|
+
@use '../../../_custom-theme' as theme;
|
|
96
|
+
|
|
97
|
+
.chart-wrapper {
|
|
98
|
+
position: relative;
|
|
99
|
+
height: theme.px-to-rem(300); // Set fixed/relative height rules
|
|
100
|
+
width: 100%;
|
|
101
|
+
overflow: hidden; // Contain resize overlaps
|
|
102
|
+
}
|
|
103
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Creating Common Components
|
|
3
|
+
description: Guidelines for building or sourcing reusable components in Angular with Material UI. Use when you need to select, build, or import reusable UI components.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Common Components
|
|
7
|
+
|
|
8
|
+
This skill provides instructions for selecting, building, or importing reusable components in this application while maintaining design system consistency.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Use this when you need a new UI element, card, or layout component.
|
|
13
|
+
- This is helpful for choosing between standard Material components vs. custom builds.
|
|
14
|
+
|
|
15
|
+
## How to use it
|
|
16
|
+
|
|
17
|
+
### 1. Component Selection Strategy
|
|
18
|
+
|
|
19
|
+
When a new UI element is needed, follow this priority order:
|
|
20
|
+
|
|
21
|
+
#### A. Angular Material (Priority 1)
|
|
22
|
+
Always try to use [Official Angular Material Components](https://material.angular.dev/components/categories) first.
|
|
23
|
+
- These are already integrated and themed in the application.
|
|
24
|
+
- Example: `<mat-card>`, `<mat-button>`, `<mat-form-field>`.
|
|
25
|
+
|
|
26
|
+
#### B. NPM Packages (Priority 2)
|
|
27
|
+
If no Angular Material component supports the requirement, you may fetch a new component from npm.
|
|
28
|
+
- **Rule**: Ensure the package is compatible with the current Angular version.
|
|
29
|
+
- **Rule**: Prefer packages that allow visual customization to match the application theme.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 2. Styling & Theming Strategy
|
|
34
|
+
|
|
35
|
+
All components MUST align with the application's design system. **DO NOT** use hardcoded static colors (e.g., `#0c67df`).
|
|
36
|
+
|
|
37
|
+
#### A. Angular Material Theming
|
|
38
|
+
Refer to:
|
|
39
|
+
- [Theming Guide](https://material.angular.dev/guide/theming)
|
|
40
|
+
- [Theming Your Own Components](https://material.angular.dev/guide/theming-your-components)
|
|
41
|
+
|
|
42
|
+
#### B. Using Global Variables
|
|
43
|
+
Take layout variables and colors strictly from `components/src/_custom-theme.scss`.
|
|
44
|
+
|
|
45
|
+
Inside your component `.scss`:
|
|
46
|
+
|
|
47
|
+
```scss
|
|
48
|
+
@use '@angular/material' as mat;
|
|
49
|
+
@use '../../../_custom-theme' as theme;
|
|
50
|
+
|
|
51
|
+
.custom-widget {
|
|
52
|
+
background-color: theme.$white;
|
|
53
|
+
border: 1px solid theme.$grey300;
|
|
54
|
+
color: theme.$blue600;
|
|
55
|
+
padding: theme.px-to-rem(16);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Available Variables:
|
|
60
|
+
- **Colors**: `$greyXX`, `$blueXX`, `$redXX`.
|
|
61
|
+
- **Functions**: `px-to-rem($px)`.
|
|
62
|
+
|
|
63
|
+
#### C. Typography Utility Classes (Recommended)
|
|
64
|
+
Use global `.cm-t-*` classes defined in `styles.scss` for text styling consistency.
|
|
65
|
+
- **Rules**:
|
|
66
|
+
- Prefer using utility classes (e.g., `.cm-t-display-large`, `.cm-t-body-medium`) over ad-hoc font styles.
|
|
67
|
+
- **Check first**: Look in `styles.scss` for the full list of `.cm-t-*` classes.
|
|
68
|
+
- Example:
|
|
69
|
+
```html
|
|
70
|
+
<span class="cm-t-title-medium">Panel Title</span>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### 3. Implementation Checklist
|
|
76
|
+
|
|
77
|
+
1. **Check existing**: Look in `components/src/app/components/`.
|
|
78
|
+
2. **Material First**: Mimic layout using Material's service/element.
|
|
79
|
+
3. **Standalone**: Always build components as Standalone (`standalone: true`).
|
|
80
|
+
4. **Page Wrapper**: Every page/Showcase demo **MUST** use `<app-page>` as its root wrapper.
|
|
81
|
+
5. **No local color definitions**: Reference SASS variables.
|
|
82
|
+
6. **Tabs**: Configure default attributes: `mat-stretch-tabs="false"` and `mat-align-tabs="start"`.
|
|
83
|
+
7. **Tables**: Wrap standard tables inside `<div class="table-container">`.
|
|
84
|
+
8. **Chips**: Use `<mat-chip-grid>` bound to an input field.
|
|
85
|
+
9. **Dialogs**: ALWAYS create a separate component for dialog content.
|
|
86
|
+
10. **Stepper**: Bind each step to a distinct `FormGroup`.
|
|
87
|
+
11. **Buttons**: DO NOT use `<button mat-raised-button>`. Use `<button mat-flat-button>`.
|
|
88
|
+
12. **Message (Alerts)**: Use the `<app-message>` component.
|
|
89
|
+
13. **Expand Button (Collapsible Pattern)**: Use text buttons with icons for lightweight expand/collapse sections (e.g., "Advanced Settings").
|
|
90
|
+
- **Rule**: Toggle a boolean flag with `*ngIf` to toggle content.
|
|
91
|
+
- Example:
|
|
92
|
+
```html
|
|
93
|
+
<button mat-button color="primary" (click)="isExpanded = !isExpanded">
|
|
94
|
+
<mat-icon>{{ isExpanded ? 'expand_less' : 'expand_more' }}</mat-icon>
|
|
95
|
+
<span>{{ isExpanded ? 'Hide' : 'Show' }} advanced settings</span>
|
|
96
|
+
</button>
|
|
97
|
+
<div *ngIf="isExpanded">Content</div>
|
|
98
|
+
```
|
|
99
|
+
14. **Slide Toggle**: Use `<mat-slide-toggle>` for boolean state switches.
|
|
100
|
+
- **Rule**: Support standard Material colors (`color="primary"`, `accent`, `warn`).
|
|
101
|
+
- **Rule**: Support binding via `[(ngModel)]` or `formControlName`.
|
|
102
|
+
- Example:
|
|
103
|
+
```html
|
|
104
|
+
<mat-slide-toggle [(ngModel)]="isChecked">Enable Feature</mat-slide-toggle>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
15. **Tooltip**: Use `matTooltip` directive to provide supplemental information on hover or long-press.
|
|
108
|
+
- **Rule**: Use standard positioning inputs (`matTooltipPosition="above|below|left|right"`).
|
|
109
|
+
- **Rule**: Prefer RTL-friendly positions (`before`, `after`) if localizing.
|
|
110
|
+
- Example:
|
|
111
|
+
```html
|
|
112
|
+
<button mat-flat-button matTooltip="Supplemental info">Hover me</button>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
16. **Code Snippet**: Use standard `<pre class="code-block">` for read-only displays, or `@ngstack/code-editor` for interactive editing.
|
|
116
|
+
- **Rule**: For `code-editor`, initialize `CodeEditorModule.forRoot()` at the app level config.
|
|
117
|
+
- **Rule**: Bind to a `CodeModel` object defining language and value.
|
|
118
|
+
- Example:
|
|
119
|
+
```html
|
|
120
|
+
<ngs-code-editor [codeModel]="codeModel" style="height: 300px;"></ngs-code-editor>
|
|
121
|
+
```
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Creating Pages
|
|
3
|
+
description: Instructions for building pages using Angular and Material UI with custom components. Use when you need to build List, Details, or Create forms views.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Pages with Angular & Material UI
|
|
7
|
+
|
|
8
|
+
This skill provides guidelines and best practices for building consistent, themed pages in this application based on the golden templates (List, Details, Create).
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Use this when building new pages in Angular with Material UI.
|
|
13
|
+
- This is helpful for structuring List views, Details views, and Form Create views using the design system.
|
|
14
|
+
|
|
15
|
+
## How to use it
|
|
16
|
+
|
|
17
|
+
### 1. Page Wrapper (`app-page`)
|
|
18
|
+
|
|
19
|
+
Every page **MUST** use the `<app-page>` component as its root wrapper. This ensures a uniform header with title and consistent content spacing layout.
|
|
20
|
+
|
|
21
|
+
#### Selector
|
|
22
|
+
`<app-page>`
|
|
23
|
+
|
|
24
|
+
#### Slots (Projection)
|
|
25
|
+
- **`actions`**: Elements on the right side of the toolbar.
|
|
26
|
+
- **`left-actions`**: Elements on the left side, next to the title (e.g., "Add Rule" button).
|
|
27
|
+
- **`back-button`**: Icon-only button (e.g., `<button back-button mat-icon-button>`).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### 2. List Pages (Collections)
|
|
32
|
+
|
|
33
|
+
Follow these norms for List pages depicting collections (e.g., Firewall Rules, Routes).
|
|
34
|
+
|
|
35
|
+
#### Layout
|
|
36
|
+
- **No Page Padding Container**: **DO NOT** wrap the list in `<div class="default-container-padding">`. Lists should be full-width.
|
|
37
|
+
- **Top Actions**: Action buttons placed in `left-actions` slot. Must be primary text links (`button mat-button color="primary"`) with plus icons (`<mat-icon>add</mat-icon>`).
|
|
38
|
+
|
|
39
|
+
#### Table & Filter Standards
|
|
40
|
+
- Rely on global styles for tables. **DO NOT** add local `.scss` styles or overrides for standard Material tables.
|
|
41
|
+
- Use `<div class="table-container">` to wrap standard tables and let global styles apply.
|
|
42
|
+
- Use standard Material `<mat-table>` with `mat-elevation` classes for standard styling.
|
|
43
|
+
- **Checkboxes ARE REQUIRED**: All list views **MUST** include checkboxes for multi-selection using standard Material checkboxes.
|
|
44
|
+
- Interactive triggers (like "View Details") should appear strictly inside explicit resource identifier columns (like Name) using standard `<a>` tags. **DO NOT** make the entire row clickable.
|
|
45
|
+
|
|
46
|
+
#### Selection logic setup
|
|
47
|
+
Include `SelectionModel` from `@angular/cdk/collections` in your `.ts` file:
|
|
48
|
+
```typescript
|
|
49
|
+
selection = new SelectionModel<T>(true, []);
|
|
50
|
+
|
|
51
|
+
@ViewChild(MatPaginator) paginator!: MatPaginator;
|
|
52
|
+
|
|
53
|
+
isAllSelected() {
|
|
54
|
+
const numSelected = this.selection.selected.length;
|
|
55
|
+
const numRows = this.dataSource.data.length;
|
|
56
|
+
return numSelected === numRows;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
toggleAllRows() {
|
|
60
|
+
if (this.isAllSelected()) {
|
|
61
|
+
this.selection.clear();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.selection.select(...this.dataSource.data);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ngAfterViewInit() {
|
|
68
|
+
this.dataSource.paginator = this.paginator;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Schema Setup
|
|
73
|
+
```html
|
|
74
|
+
<app-page title="Resource List View">
|
|
75
|
+
<button left-actions mat-button color="primary" (click)="navigateToAdd()">
|
|
76
|
+
<mat-icon>add</mat-icon> Add Rule
|
|
77
|
+
</button>
|
|
78
|
+
|
|
79
|
+
<div class="filter-container">
|
|
80
|
+
<mat-icon>filter_list</mat-icon>
|
|
81
|
+
<span class="filter-title">Filter</span>
|
|
82
|
+
<input class="filter-input" (keyup)="applyFilter($event)" placeholder="Filter items" />
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="table-container">
|
|
86
|
+
<table mat-table [dataSource]="dataSource" matSort class="mat-elevation">
|
|
87
|
+
<!-- Standard Material Table usage -->
|
|
88
|
+
</table>
|
|
89
|
+
|
|
90
|
+
<mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
|
|
91
|
+
</div>
|
|
92
|
+
</app-page>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### 3. Details Pages (Single Resource Views)
|
|
98
|
+
|
|
99
|
+
Follow these norms for Details pages depicting single resource properties.
|
|
100
|
+
|
|
101
|
+
#### Layout
|
|
102
|
+
- **Page Padding Container**: Use `<div class="default-container-padding">` around the main page content.
|
|
103
|
+
- **Flat Property Table**: Use `.details-table` defined globally to show Property/Value lists in a grid.
|
|
104
|
+
- **Tabs and Charts**: Place a `<mat-tab-group>` section at the bottom to house metrics and logs. Standardize on Line/Bar charts for traffic visualization using `ng2-charts`.
|
|
105
|
+
|
|
106
|
+
#### HTML Schema Setup
|
|
107
|
+
```html
|
|
108
|
+
<app-page title="Resource details">
|
|
109
|
+
<button back-button mat-icon-button (click)="goBack()">
|
|
110
|
+
<mat-icon>arrow_back</mat-icon>
|
|
111
|
+
</button>
|
|
112
|
+
|
|
113
|
+
<div class="default-container-padding">
|
|
114
|
+
<h2>Resource Name (Primary Title)</h2>
|
|
115
|
+
|
|
116
|
+
<div class="details-table" *ngIf="rule">
|
|
117
|
+
<div class="table-row">
|
|
118
|
+
<div class="table-label">ID</div>
|
|
119
|
+
<div class="table-value">{{ rule.id }}</div>
|
|
120
|
+
</div>
|
|
121
|
+
<!-- Repeat property rows -->
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="start" style="width: 100%; margin-top: 30px;">
|
|
125
|
+
<mat-tab label="Traffic Metrics">
|
|
126
|
+
<div style="padding: 16px; height: 300px;">
|
|
127
|
+
<canvas baseChart [data]="chartData" [options]="chartOptions" [type]="'line'"></canvas>
|
|
128
|
+
</div>
|
|
129
|
+
</mat-tab>
|
|
130
|
+
<mat-tab label="Logs List">
|
|
131
|
+
<div style="padding: 16px;">
|
|
132
|
+
<!-- Sample Nested Material Table -->
|
|
133
|
+
</div>
|
|
134
|
+
</mat-tab>
|
|
135
|
+
</mat-tab-group>
|
|
136
|
+
</div>
|
|
137
|
+
</app-page>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### 4. Create Pages (Forms View)
|
|
143
|
+
|
|
144
|
+
To maintain clean layout architecture:
|
|
145
|
+
|
|
146
|
+
#### Layout Alignment
|
|
147
|
+
- **Page Padding Container**: Use `<div class="default-container-padding">` around the main form content.
|
|
148
|
+
- **Form Caps Size**: Align to the **Left** and cap maximum width at **600px**. No centered forms.
|
|
149
|
+
- **Row Columns layout**: Wrap fields grouped horizontally via row elements collapsing responsively.
|
|
150
|
+
- **Action Buttons placement**: Save and Cancel buttons **MUST** be placed at the bottom on the **Left** side.
|
|
151
|
+
|
|
152
|
+
#### Create View Setup
|
|
153
|
+
```html
|
|
154
|
+
<app-page title="Create Resource">
|
|
155
|
+
<div class="default-container-padding">
|
|
156
|
+
<form [formGroup]="form" class="form-container">
|
|
157
|
+
<div class="row">
|
|
158
|
+
<mat-form-field appearance="outline">
|
|
159
|
+
<mat-label>Name</mat-label>
|
|
160
|
+
<input matInput formControlName="name">
|
|
161
|
+
</mat-form-field>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div class="actions">
|
|
165
|
+
<button mat-flat-button color="primary" type="submit">Create</button>
|
|
166
|
+
<button mat-button type="button" (click)="cancel()">Cancel</button>
|
|
167
|
+
</div>
|
|
168
|
+
</form>
|
|
169
|
+
</div>
|
|
170
|
+
</app-page>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 5. Styling Strategy & Variables Usage
|
|
176
|
+
|
|
177
|
+
#### Use Shared Variables from components package
|
|
178
|
+
- **DO NOT** hardcode colors.
|
|
179
|
+
- Use SCSS variables from the shared `components` package:
|
|
180
|
+
```scss
|
|
181
|
+
@use 'components/variables' as theme;
|
|
182
|
+
// Use theme.$blue50, theme.$grey100, etc.
|
|
183
|
+
```
|
|
184
|
+
- Import global shared styles for standard layouts:
|
|
185
|
+
```scss
|
|
186
|
+
@use 'components/styles';
|
|
187
|
+
```
|
|
188
|
+
- Rely on global stylesheets for standard components (tables, headers) instead of duplicating them in local component `.scss`.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### 6. Standard Component & Style Reuse
|
|
193
|
+
|
|
194
|
+
Always reuse standard UI elements and components to maintain visual consistency.
|
|
195
|
+
|
|
196
|
+
#### Common Components
|
|
197
|
+
- Use `<app-page>` as the root wrapper for all pages. Import it from your project's local `layout/page` folder (e.g., `import { PageComponent } from '../layout/page/page'`).
|
|
198
|
+
- Use `<app-message>` for alerts and status notifications if available.
|
|
199
|
+
- Use `<button mat-flat-button>` for primary actions (DO NOT use `mat-raised-button`).
|
|
200
|
+
- Use `.chip-badge` (standard `.scss` utility) for status badges in tables.
|
|
201
|
+
|
|
202
|
+
#### Design System Workspace (Reference)
|
|
203
|
+
The `components` workspace acts as a **Reference System**. When designing new pages or components, reference its demos and templates to learn from its layout, but DO NOT import files directly from it into your app workspace.
|
|
204
|
+
- **Learn from demos**: `components/src/app/components`
|
|
205
|
+
- **Learn from styles**: Check global styles defined in `components/styles` package to replicate them locally if needed.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Using Sidebar Drawer
|
|
3
|
+
description: Guidelines and best practices for utilizing the `<app-sidebar>` overlay panel component for details or summaries over layouts. Use when you need a contextual side drawer opening from the right.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Sidebar Drawer Overlay
|
|
7
|
+
|
|
8
|
+
This skill provides configuration and implementation standards for contextual side drawers opening from the right utilizing `@angular/cdk/overlay`.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Use this when you need a contextual side drawer to show details or summaries without leaving the page.
|
|
13
|
+
- This is helpful for quick edits, viewing resource details, or showing logs side-by-side.
|
|
14
|
+
|
|
15
|
+
## How to use it
|
|
16
|
+
|
|
17
|
+
### 1. Setup & Component Definition
|
|
18
|
+
|
|
19
|
+
The sidebar component triggers programmatically using coordinate strategies.
|
|
20
|
+
|
|
21
|
+
#### Selector
|
|
22
|
+
`<app-sidebar>`
|
|
23
|
+
|
|
24
|
+
#### Inputs
|
|
25
|
+
| Input | Type | Description |
|
|
26
|
+
| :--- | :--- | :--- |
|
|
27
|
+
| `isOpen` | `boolean` | State toggle to initiate slide translation and Backdrop masks. |
|
|
28
|
+
| `title` | `string` | Text payload rendered inside the top `<mat-toolbar>` header bar. |
|
|
29
|
+
|
|
30
|
+
#### Outputs
|
|
31
|
+
| Output | Type | Description |
|
|
32
|
+
| :--- | :--- | :--- |
|
|
33
|
+
| `close` | `EventEmitter<void>` | Notification event triggered when the user clicks the external overlay mask or close button toolbar item. |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### 2. Usage Examples
|
|
38
|
+
|
|
39
|
+
Place the sidebar anywhere inside the page template view scope and bind the outputs to toggle flags.
|
|
40
|
+
|
|
41
|
+
#### Standard Template Integration:
|
|
42
|
+
```html
|
|
43
|
+
<app-page title="Resource Dashboard">
|
|
44
|
+
<button mat-flat-button color="primary" (click)="isSidebarOpen = true">
|
|
45
|
+
View Summary Detail
|
|
46
|
+
</button>
|
|
47
|
+
|
|
48
|
+
<app-sidebar [isOpen]="isSidebarOpen" title="Element Status" (close)="isSidebarOpen = false">
|
|
49
|
+
<!-- Projected Content -->
|
|
50
|
+
<div class="summary">
|
|
51
|
+
<p>Content rendered overlaying viewport securely scaling dimension guides bounds reliably.</p>
|
|
52
|
+
</div>
|
|
53
|
+
</app-sidebar>
|
|
54
|
+
</app-page>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 3. Best Practices Guidelines
|
|
60
|
+
|
|
61
|
+
1. **Close Binding strictly Required**: Make sure to always wire `(close)="isOpen = false"` so clicking backdrops executes dismissal triggers gracefully.
|
|
62
|
+
2. **Sizing Boundaries**: The sidebar is fixed at height `100vh` and width `576px` with smart responsive limits (`max-width: 100vw`). Ensure items projecting fit within safe scroll regions without breaking overflows.
|
|
63
|
+
3. **MatToolbar configuration**: Sidebars bundle native container toolbars setup mapping title bars. Spacer classes `.spacer { flex: 1 1 auto; }` are provided default scaling to push close actions items comfortably right-aligned.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Workflow Graph
|
|
3
|
+
description: Guidelines on using @google/workflow-graph inside standalone Angular apps. Use when you need to integrate directed acyclic graphs for visualization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Workflow Graph
|
|
7
|
+
|
|
8
|
+
This skill provides instructions for adding and configuring details regarding nodes layouts inside components canvases.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Use this when you need to render complex workflows, DAGs (Directed Acyclic Graphs), or step-by-step state representations.
|
|
13
|
+
- This is helpful for showing deployment pipelines, resource dependencies, or traffic flow maps.
|
|
14
|
+
|
|
15
|
+
## How to use it
|
|
16
|
+
|
|
17
|
+
### 1. Registration setup
|
|
18
|
+
|
|
19
|
+
Always import the side-effect module inside your standard typescript class or layout main file initialization routine:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import '@google/workflow-graph/web-component/registerWorkflowGraphWebComponent.js';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Adding `<workflow-graph>` directly onto html structures. To enable typescript compilers to accept this wrapper add `CUSTOM_ELEMENTS_SCHEMA` schema layer sets rules inside corresponding components.
|
|
26
|
+
|
|
27
|
+
### 2. Setting Schema Config
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
...
|
|
34
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
35
|
+
})
|
|
36
|
+
export class MyGraphComponent { ... }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Data Structure Specification (`dagSpec`)
|
|
40
|
+
|
|
41
|
+
The `<workflow-graph>` relies heavily on structural specifications.
|
|
42
|
+
|
|
43
|
+
#### A. Graph Skeleton (`skeleton`)
|
|
44
|
+
An array setting up hierarchy and connections:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const skeleton = [
|
|
48
|
+
{
|
|
49
|
+
id: 'step-a',
|
|
50
|
+
type: 'execution',
|
|
51
|
+
next: [
|
|
52
|
+
{ id: 'step-b', type: 'execution' }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Field | Type | Description |
|
|
59
|
+
| :--- | :--- | :--- |
|
|
60
|
+
| `id` | `string` | Unique identifier |
|
|
61
|
+
| `type` | `string` | Node variant: `execution`, `group` |
|
|
62
|
+
| `next` | `Array` | Array of child node declarations |
|
|
63
|
+
|
|
64
|
+
#### B. Grouping Nodes
|
|
65
|
+
To group items together map `type: 'group'`:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
{
|
|
69
|
+
id: 'my-group',
|
|
70
|
+
type: 'group',
|
|
71
|
+
definition: [
|
|
72
|
+
{ id: 'child-a', type: 'execution' },
|
|
73
|
+
{ id: 'child-b', type: 'execution' }
|
|
74
|
+
],
|
|
75
|
+
next: [ { id: 'next-node', type: 'execution' } ]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### C. State Mapping Configs
|
|
80
|
+
Array lookup mapping layout specification diagrams:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const state = {
|
|
84
|
+
'step-a': {
|
|
85
|
+
displayName: 'A Node Title',
|
|
86
|
+
state: 'SUCCEEDED', // Valid states: SUCCEEDED, RUNNING, PENDING, FAILED, TIMEOUT, SKIPPED, NOT_TRIGGERED, CANCELLED
|
|
87
|
+
description: 'Subtitle explanation',
|
|
88
|
+
subType: 'Type Label',
|
|
89
|
+
icon: {
|
|
90
|
+
name: 'web',
|
|
91
|
+
iconset: 'shell',
|
|
92
|
+
size: 'small'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You can also use Text-based icons:
|
|
99
|
+
```typescript
|
|
100
|
+
const state = {
|
|
101
|
+
'node-id': {
|
|
102
|
+
displayName: 'My Node',
|
|
103
|
+
icon: {
|
|
104
|
+
text: 'BQ',
|
|
105
|
+
iconColors: 'inverted'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### 4. Setting Attributes Trigger
|
|
114
|
+
|
|
115
|
+
To propagate details forward trigger direct specs binding through mapped viewport triggers:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
@ViewChild('graph') graph!: ElementRef;
|
|
119
|
+
|
|
120
|
+
updateGraph() {
|
|
121
|
+
const dagSpec = { skeleton, meta: state };
|
|
122
|
+
this.graph.nativeElement.dagSpec = dagSpec;
|
|
123
|
+
this.graph.nativeElement.enableMinimap = true;
|
|
124
|
+
this.graph.nativeElement.layout = {
|
|
125
|
+
rankDirection: "LR", // TB (Top-Bottom) / LR (Left-Right)
|
|
126
|
+
ranker: "network-simplex"
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### 5. Troubleshooting & Best Practices
|
|
134
|
+
|
|
135
|
+
#### A. Strict Config Validation Crash (Unexpected Keys)
|
|
136
|
+
Setting `dagSpec` may fail with errors listing `Unexpected Keys: expanded` if you supply properties the wrapper is not designed to consume.
|
|
137
|
+
|
|
138
|
+
To fix it, safely sanitize the metadata:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
function sanitizeMeta(obj: any): any {
|
|
142
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
143
|
+
|
|
144
|
+
if (Array.isArray(obj)) {
|
|
145
|
+
return obj.map(item => sanitizeMeta(item));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const filtered = { ...obj };
|
|
149
|
+
delete filtered.expanded;
|
|
150
|
+
for (const key in filtered) {
|
|
151
|
+
if (filtered[key] && typeof filtered[key] === 'object') {
|
|
152
|
+
filtered[key] = sanitizeMeta(filtered[key]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return filtered;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Assignment
|
|
159
|
+
this.graph.nativeElement.dagSpec = { skeleton, meta: sanitizeMeta(state) };
|
|
160
|
+
```
|
package/.dockerignore
ADDED
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Editor configuration, see https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.ts]
|
|
12
|
+
quote_type = single
|
|
13
|
+
ij_typescript_use_double_quotes = false
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
max_line_length = off
|
|
17
|
+
trim_trailing_whitespace = false
|