@patternfly/quickstarts 2.2.1 → 2.2.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/README.md +20 -20
- package/dist/ConsoleShared/src/components/markdown-extensions/code-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +1 -0
- package/dist/HelpTopicDrawer.d.ts +8 -2
- package/dist/QuickStartDrawer.d.ts +21 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +127 -21
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +126 -19
- package/dist/index.js.map +1 -1
- package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +105 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements copy.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/catalog-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/check-your-work.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/introduction-screen.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/mixed-catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/prerequisites.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/qs-context.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-resized.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-no.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-yes.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/Basic.jsx +73 -0
- package/dist/patternfly-docs/quick-starts/examples/HelpTopic.jsx +53 -0
- package/dist/patternfly-docs/quick-starts/examples/about.md +77 -0
- package/dist/patternfly-docs/quick-starts/examples/basic.md +27 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-help-topics.js +173 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-quickstarts.js +215 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/index.js +15 -0
- package/dist/patternfly-docs/quick-starts/examples/help-topics.md +25 -0
- package/dist/patternfly-docs/quick-starts/examples/img/catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/help-topic.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/side-panel.png +0 -0
- package/dist/patternfly-nested.css +11 -1
- package/dist/quickstarts-base.css +49 -11
- package/dist/quickstarts-full.es.js +451 -305
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +5 -15
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +49 -11
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/asciidoc-procedure-parser.d.ts +12 -0
- package/dist/utils/help-topic-types.d.ts +7 -1
- package/package.json +11 -4
- package/src/ConsoleInternal/components/_icon-and-text.scss +14 -0
- package/src/ConsoleInternal/components/_markdown-view.scss +19 -0
- package/src/ConsoleInternal/components/catalog/_catalog.scss +390 -0
- package/src/ConsoleInternal/components/markdown-view.tsx +305 -0
- package/src/ConsoleInternal/components/utils/_status-box.scss +58 -0
- package/src/ConsoleInternal/components/utils/camel-case-wrap.tsx +33 -0
- package/src/ConsoleInternal/components/utils/index.tsx +3 -0
- package/src/ConsoleInternal/components/utils/router.ts +47 -0
- package/src/ConsoleInternal/components/utils/status-box.tsx +94 -0
- package/src/ConsoleInternal/module/k8s/types.ts +53 -0
- package/src/ConsoleShared/index.ts +1 -0
- package/src/ConsoleShared/src/components/index.ts +7 -0
- package/src/ConsoleShared/src/components/layout/PageLayout.scss +29 -0
- package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +93 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +25 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/test-data.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +66 -0
- package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +25 -0
- package/src/ConsoleShared/src/components/markdown-extensions/const.ts +3 -0
- package/src/ConsoleShared/src/components/markdown-extensions/index.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +45 -0
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +50 -0
- package/src/ConsoleShared/src/components/markdown-extensions/showdown-extension.scss +52 -0
- package/src/ConsoleShared/src/components/markdown-extensions/utils.ts +3 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.tsx +64 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/highlight-consts.ts +9 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/index.ts +1 -0
- package/src/ConsoleShared/src/components/modal/Modal.scss +3 -0
- package/src/ConsoleShared/src/components/modal/Modal.tsx +19 -0
- package/src/ConsoleShared/src/components/modal/index.ts +1 -0
- package/src/ConsoleShared/src/components/popper/Portal.tsx +23 -0
- package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +90 -0
- package/src/ConsoleShared/src/components/popper/index.ts +2 -0
- package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +58 -0
- package/src/ConsoleShared/src/components/spotlight/Spotlight.tsx +35 -0
- package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +32 -0
- package/src/ConsoleShared/src/components/spotlight/index.ts +1 -0
- package/src/ConsoleShared/src/components/spotlight/spotlight.scss +63 -0
- package/src/ConsoleShared/src/components/status/GenericStatus.tsx +33 -0
- package/src/ConsoleShared/src/components/status/NotStartedIcon.tsx +27 -0
- package/src/ConsoleShared/src/components/status/PopoverStatus.tsx +42 -0
- package/src/ConsoleShared/src/components/status/Status.tsx +38 -0
- package/src/ConsoleShared/src/components/status/StatusIconAndText.tsx +42 -0
- package/src/ConsoleShared/src/components/status/icons.tsx +77 -0
- package/src/ConsoleShared/src/components/status/index.tsx +1 -0
- package/src/ConsoleShared/src/components/status/statuses.tsx +36 -0
- package/src/ConsoleShared/src/components/status/types.ts +7 -0
- package/src/ConsoleShared/src/components/utils/FallbackImg.tsx +20 -0
- package/src/ConsoleShared/src/components/utils/index.ts +1 -0
- package/src/ConsoleShared/src/constants/index.ts +1 -0
- package/src/ConsoleShared/src/constants/ui.ts +1 -0
- package/src/ConsoleShared/src/hooks/index.ts +6 -0
- package/src/ConsoleShared/src/hooks/scroll.ts +52 -0
- package/src/ConsoleShared/src/hooks/useBoundingClientRect.ts +18 -0
- package/src/ConsoleShared/src/hooks/useEventListener.ts +14 -0
- package/src/ConsoleShared/src/hooks/useForceRender.ts +6 -0
- package/src/ConsoleShared/src/hooks/useResizeObserver.ts +20 -0
- package/src/ConsoleShared/src/hooks/useScrollShadows.ts +45 -0
- package/src/ConsoleShared/src/index.ts +4 -0
- package/src/ConsoleShared/src/utils/index.ts +1 -0
- package/src/ConsoleShared/src/utils/useCombineRefs.ts +17 -0
- package/src/HelpTopicDrawer.tsx +124 -0
- package/src/HelpTopicPanelContent.tsx +152 -0
- package/src/QuickStartCatalogPage.tsx +190 -0
- package/src/QuickStartCloseModal.tsx +47 -0
- package/src/QuickStartController.tsx +113 -0
- package/src/QuickStartDrawer.scss +11 -0
- package/src/QuickStartDrawer.tsx +265 -0
- package/src/QuickStartMarkdownView.tsx +75 -0
- package/src/QuickStartPanelContent.scss +46 -0
- package/src/QuickStartPanelContent.tsx +153 -0
- package/src/__tests__/quick-start-utils.spec.tsx +16 -0
- package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +18 -0
- package/src/catalog/Catalog/QuickStartCatalogSection.tsx +9 -0
- package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +12 -0
- package/src/catalog/Catalog/index.ts +3 -0
- package/src/catalog/QuickStartCatalog.scss +8 -0
- package/src/catalog/QuickStartCatalog.tsx +42 -0
- package/src/catalog/QuickStartTile.scss +11 -0
- package/src/catalog/QuickStartTile.tsx +105 -0
- package/src/catalog/QuickStartTileDescription.scss +29 -0
- package/src/catalog/QuickStartTileDescription.tsx +79 -0
- package/src/catalog/QuickStartTileFooter.tsx +101 -0
- package/src/catalog/QuickStartTileFooterExternal.tsx +40 -0
- package/src/catalog/QuickStartTileHeader.scss +12 -0
- package/src/catalog/QuickStartTileHeader.tsx +77 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.scss +25 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +34 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +199 -0
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +35 -0
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +38 -0
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +44 -0
- package/src/catalog/index.ts +9 -0
- package/src/controller/QuickStartConclusion.tsx +63 -0
- package/src/controller/QuickStartContent.scss +12 -0
- package/src/controller/QuickStartContent.tsx +72 -0
- package/src/controller/QuickStartFooter.scss +13 -0
- package/src/controller/QuickStartFooter.tsx +128 -0
- package/src/controller/QuickStartIntroduction.scss +35 -0
- package/src/controller/QuickStartIntroduction.tsx +66 -0
- package/src/controller/QuickStartTaskHeader.scss +58 -0
- package/src/controller/QuickStartTaskHeader.tsx +116 -0
- package/src/controller/QuickStartTaskHeaderList.scss +17 -0
- package/src/controller/QuickStartTaskHeaderList.tsx +35 -0
- package/src/controller/QuickStartTaskReview.scss +30 -0
- package/src/controller/QuickStartTaskReview.tsx +81 -0
- package/src/controller/QuickStartTasks.scss +89 -0
- package/src/controller/QuickStartTasks.tsx +75 -0
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +95 -0
- package/src/controller/__tests__/QuickStartContent.spec.tsx +52 -0
- package/src/controller/__tests__/QuickStartFooter.spec.tsx +148 -0
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +56 -0
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +45 -0
- package/src/controller/__tests__/QuickStartTasks.spec.tsx +81 -0
- package/src/data/mocks/json/explore-pipeline-quickstart.ts +66 -0
- package/src/data/mocks/json/explore-serverless-quickstart.ts +90 -0
- package/src/data/mocks/json/monitor-sampleapp-quickstart.ts +77 -0
- package/src/data/mocks/json/tour-icons.ts +3 -0
- package/src/data/mocks/yamls/add-healthchecks-quickstart.yaml +67 -0
- package/src/data/mocks/yamls/explore-pipeline-quickstart.yaml +57 -0
- package/src/data/mocks/yamls/explore-serverless-quickstart.yaml +83 -0
- package/src/data/mocks/yamls/install-associate-pipeline-quickstart.yaml +74 -0
- package/src/data/mocks/yamls/monitor-sampleapp-quickstart.yaml +66 -0
- package/src/data/mocks/yamls/sample-application-quickstart.yaml +97 -0
- package/src/data/mocks/yamls/serverless-application-quickstart.yaml +141 -0
- package/src/data/quick-start-test-data.ts +10 -0
- package/src/data/test-utils.ts +11 -0
- package/src/declaration.d.ts +2 -0
- package/src/index.ts +17 -0
- package/src/locales/en/quickstart.json +46 -0
- package/src/styles/_base.scss +54 -0
- package/src/styles/_dark-custom-override.scss +62 -0
- package/src/styles/legacy-bootstrap/README.md +21 -0
- package/src/styles/legacy-bootstrap/_code.scss +44 -0
- package/src/styles/legacy-bootstrap/_tables.scss +38 -0
- package/src/styles/legacy-bootstrap/_type.scss +90 -0
- package/src/styles/legacy-bootstrap/_variables.scss +48 -0
- package/src/styles/legacy-bootstrap.scss +5 -0
- package/src/styles/patternfly-global-entry.ts +1 -0
- package/src/styles/patternfly-global.scss +28 -0
- package/src/styles/patternfly-nested-entry.ts +1 -0
- package/src/styles/patternfly-nested.scss +18 -0
- package/src/styles/quickstarts-standalone-entry.ts +1 -0
- package/src/styles/quickstarts-standalone.scss +7 -0
- package/src/styles/style.scss +12 -0
- package/src/styles/vendor-entry.ts +1 -0
- package/src/styles/vendor.scss +7 -0
- package/src/utils/PluralResolver.ts +356 -0
- package/src/utils/asciidoc-procedure-parser.ts +132 -0
- package/src/utils/const.ts +10 -0
- package/src/utils/help-topic-context.tsx +74 -0
- package/src/utils/help-topic-types.ts +16 -0
- package/src/utils/quick-start-context.tsx +477 -0
- package/src/utils/quick-start-types.ts +72 -0
- package/src/utils/quick-start-utils.ts +92 -0
- package/src/utils/useLocalStorage.ts +38 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
// frontend/public/style/_vars.scss
|
|
2
|
+
$font-size-base: 14px;
|
|
3
|
+
$pfext-m-catalog-tile-height: 100%;
|
|
4
|
+
$pfext-m-catalog-tile-width: 260px;
|
|
5
|
+
|
|
6
|
+
$catalog-capability-level-icon-left: -20px;
|
|
7
|
+
$catalog-capability-level-icon-top: 4px;
|
|
8
|
+
$catalog-capability-level-inactive-color: var(--pf-global--Color--400);
|
|
9
|
+
$catalog-item-icon-size-lg: 40px;
|
|
10
|
+
$catalog-item-icon-size-sm: 24px;
|
|
11
|
+
$pfext-modal-ignore-warning-icon-width: 30px;
|
|
12
|
+
$catalog-tile-width: $pfext-m-catalog-tile-width;
|
|
13
|
+
|
|
14
|
+
// reset font size back to 13px since console h5 font size is 14px
|
|
15
|
+
.catalog-item-header-pf-subtitle {
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.catalog-tile-pf-body .catalog-tile-pf-subtitle {
|
|
20
|
+
font-size: ($font-size-base - 1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.pfext-catalog {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
min-height: 100%;
|
|
27
|
+
min-width: 515px; // in order to accommodate filters and tiles at mobile
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pfext-catalog-tile-view {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
--pf-l-gallery--GridTemplateColumns: repeat(auto-fill, 260px) !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pfext-catalog__body {
|
|
37
|
+
min-width: 575px; // Minimum shrinkable width of .pfext-catalog child elements => 15 + ((220 + 15) + (30 + 250 + 30)) + 15
|
|
38
|
+
@media (min-width: $screen-sm-min) {
|
|
39
|
+
min-width: 590px; // Left margin 30 instead of 15
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.pfext-catalog-item-details {
|
|
44
|
+
display: flex;
|
|
45
|
+
margin: 0 0 10px;
|
|
46
|
+
|
|
47
|
+
&__description {
|
|
48
|
+
white-space: pre-wrap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__kind-label {
|
|
52
|
+
font-weight: var(--pf-global--FontWeight--bold);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__name {
|
|
56
|
+
margin-bottom: 10px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&__provider,
|
|
60
|
+
&__tags {
|
|
61
|
+
margin-bottom: 5px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__tag {
|
|
65
|
+
color: $color-pf-black-600;
|
|
66
|
+
font-size: ($font-size-base - 1);
|
|
67
|
+
margin-right: 5px;
|
|
68
|
+
text-transform: uppercase;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.pfext-catalog-item-icon {
|
|
73
|
+
padding-right: 10px;
|
|
74
|
+
|
|
75
|
+
&__icon {
|
|
76
|
+
font-size: $catalog-item-icon-size-sm;
|
|
77
|
+
|
|
78
|
+
&--large {
|
|
79
|
+
font-size: $catalog-item-icon-size-lg;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&__img {
|
|
84
|
+
max-height: $catalog-item-icon-size-sm;
|
|
85
|
+
max-width: $catalog-item-icon-size-sm;
|
|
86
|
+
|
|
87
|
+
&[src$='.svg'] {
|
|
88
|
+
width: $catalog-item-icon-size-sm;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&--large {
|
|
92
|
+
max-height: $catalog-item-icon-size-lg;
|
|
93
|
+
max-width: $catalog-item-icon-size-lg;
|
|
94
|
+
|
|
95
|
+
&[src$='.svg'] {
|
|
96
|
+
width: $catalog-item-icon-size-lg;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.pfext-catalog-page {
|
|
103
|
+
background: $color-pf-white;
|
|
104
|
+
border: 1px solid var(--pf-global--BorderColor--300);
|
|
105
|
+
display: flex;
|
|
106
|
+
flex: 1;
|
|
107
|
+
padding-top: ($grid-gutter-width / 2);
|
|
108
|
+
|
|
109
|
+
&--with-sidebar {
|
|
110
|
+
margin: 0 ($grid-gutter-width / 2);
|
|
111
|
+
padding-bottom: ($grid-gutter-width / 2);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__btn-group__group-by {
|
|
115
|
+
display: inline;
|
|
116
|
+
margin-left: var(--pf-global--spacer--md);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__content {
|
|
120
|
+
flex: 1 1 auto;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__description {
|
|
125
|
+
margin-top: -10px;
|
|
126
|
+
padding: 0 ($grid-gutter-width / 2) 10px;
|
|
127
|
+
@media (min-width: $grid-float-breakpoint) {
|
|
128
|
+
padding-left: $grid-gutter-width;
|
|
129
|
+
padding-right: $grid-gutter-width;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__filter {
|
|
134
|
+
display: flex;
|
|
135
|
+
justify-content: space-between;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&__filter-toggle {
|
|
139
|
+
margin-top: 5px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__grid {
|
|
143
|
+
background-color: $color-pf-black-150;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&__grouped-items {
|
|
147
|
+
margin-bottom: var(--pf-global--spacer--md);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&__group-title {
|
|
151
|
+
margin-bottom: var(--pf-global--spacer--sm);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&__header {
|
|
155
|
+
margin: 0 $grid-gutter-width 0 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&__heading {
|
|
159
|
+
font-size: 16px;
|
|
160
|
+
margin: 0 0 20px 30px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&__hint {
|
|
164
|
+
margin: 0 0 var(--pf-global--spacer--md) 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__input {
|
|
168
|
+
display: inline-flex !important;
|
|
169
|
+
margin: 0 0 20px 30px;
|
|
170
|
+
width: auto !important;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&__sort {
|
|
174
|
+
display: inline;
|
|
175
|
+
margin-left: var(--pf-global--spacer--md);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&__num-items {
|
|
179
|
+
font-weight: var(--pf-global--FontWeight--bold);
|
|
180
|
+
padding: 0 0 20px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__info-icon {
|
|
184
|
+
vertical-align: middle;
|
|
185
|
+
color: #6a6e73;
|
|
186
|
+
&:hover {
|
|
187
|
+
color: #151515;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Enable scrolling on the modal
|
|
192
|
+
&__overlay {
|
|
193
|
+
border: 0 !important; // Collapse default PF4 modal border-width
|
|
194
|
+
|
|
195
|
+
.modal-body .pfext-hint-block {
|
|
196
|
+
margin-bottom: 10px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.properties-side-panel-pf {
|
|
200
|
+
flex: 0 0 auto;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__overlay--right {
|
|
205
|
+
bottom: 0;
|
|
206
|
+
padding: 0 !important;
|
|
207
|
+
right: 0;
|
|
208
|
+
top: 4.75rem; // --pf-c-page__header--MinHeight
|
|
209
|
+
|
|
210
|
+
.pf-c-modal-box__body {
|
|
211
|
+
// Required to position scroll shadows correctly on Chrome
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
margin: 0 !important;
|
|
215
|
+
padding: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.modal-body-inner-shadow-covers {
|
|
219
|
+
padding-left: 0 !important;
|
|
220
|
+
padding-right: 0 !important;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
h1 {
|
|
224
|
+
white-space: normal;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&__overlay-action {
|
|
229
|
+
align-items: baseline;
|
|
230
|
+
display: inline-flex !important;
|
|
231
|
+
margin: var(--pf-global--spacer--sm) var(--pf-global--spacer--sm) 0 0;
|
|
232
|
+
overflow-x: hidden;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&__overlay-action-icon {
|
|
236
|
+
flex-shrink: 0;
|
|
237
|
+
font-size: $font-size-base;
|
|
238
|
+
margin-left: 6px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&__overlay-action-label {
|
|
242
|
+
overflow-x: hidden;
|
|
243
|
+
text-overflow: ellipsis;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&__overlay-actions {
|
|
247
|
+
display: flex;
|
|
248
|
+
flex-wrap: wrap;
|
|
249
|
+
margin-bottom: var(--pf-global--spacer--md);
|
|
250
|
+
white-space: normal;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&__overlay-header {
|
|
254
|
+
margin-bottom: var(--pf-global--spacer--md);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&__overlay-body {
|
|
258
|
+
margin: 0;
|
|
259
|
+
padding-left: var(--pf-global--spacer--lg);
|
|
260
|
+
padding-right: var(--pf-global--spacer--lg);
|
|
261
|
+
padding-top: var(--pf-global--spacer--md);
|
|
262
|
+
@media (min-width: $screen-sm-min) {
|
|
263
|
+
display: flex;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&__overlay-description {
|
|
268
|
+
margin: 20px 0 0;
|
|
269
|
+
white-space: pre-wrap;
|
|
270
|
+
// TODO: find fix for urls that don't wrap
|
|
271
|
+
// fix below causes undesirable wrapping on non-urls
|
|
272
|
+
// word-break: break-all;
|
|
273
|
+
h1,
|
|
274
|
+
h2,
|
|
275
|
+
h3 {
|
|
276
|
+
color: #333; // same color as styles hardcoded in markdown text component
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
h2 {
|
|
280
|
+
font-size: 20px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
p,
|
|
284
|
+
li,
|
|
285
|
+
ol {
|
|
286
|
+
color: #333; // same color as styles hardcoded in markdown text component
|
|
287
|
+
font-size: $font-size-base !important;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@media (min-width: $screen-sm-min) {
|
|
291
|
+
flex: 1 1 auto;
|
|
292
|
+
margin-left: 20px;
|
|
293
|
+
margin-top: 0;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&__tabs {
|
|
298
|
+
flex: 0 0 220px;
|
|
299
|
+
margin: 0 ($grid-gutter-width / 2) 0 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@media screen and (min-width: $screen-sm) {
|
|
304
|
+
.pf-c-modal-box.pfext-catalog-page__overlay {
|
|
305
|
+
width: 600px;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@media screen and (min-width: $screen-md) {
|
|
310
|
+
.pf-c-modal-box.pfext-catalog-page__overlay {
|
|
311
|
+
width: 900px;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.pfext-catalog-tab__empty {
|
|
316
|
+
color: $color-pf-black-600;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.pfext-modal-ignore-warning {
|
|
320
|
+
height: initial;
|
|
321
|
+
|
|
322
|
+
&__checkbox.checkbox {
|
|
323
|
+
margin-bottom: 0;
|
|
324
|
+
padding-top: 15px;
|
|
325
|
+
}
|
|
326
|
+
&__content {
|
|
327
|
+
display: flex;
|
|
328
|
+
}
|
|
329
|
+
&__icon {
|
|
330
|
+
font-size: $pfext-modal-ignore-warning-icon-width;
|
|
331
|
+
margin-right: 15px;
|
|
332
|
+
// Avoid the dialog shifting when the icon loads.
|
|
333
|
+
min-width: $pfext-modal-ignore-warning-icon-width;
|
|
334
|
+
}
|
|
335
|
+
&__link {
|
|
336
|
+
display: block;
|
|
337
|
+
margin: 10px 0;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.properties-side-panel-pf-property-label {
|
|
342
|
+
font-size: ($font-size-base - 1);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.properties-side-panel-pf-property-value__capability-level {
|
|
346
|
+
color: $catalog-capability-level-inactive-color;
|
|
347
|
+
margin-bottom: 5px;
|
|
348
|
+
position: relative;
|
|
349
|
+
|
|
350
|
+
&--active {
|
|
351
|
+
color: inherit;
|
|
352
|
+
|
|
353
|
+
&::before {
|
|
354
|
+
display: none; // hide empty circle since icon is present
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&::before {
|
|
359
|
+
// empty circle
|
|
360
|
+
border: 1px solid $catalog-capability-level-inactive-color;
|
|
361
|
+
border-radius: 10px;
|
|
362
|
+
content: '';
|
|
363
|
+
height: 14px;
|
|
364
|
+
left: $catalog-capability-level-icon-left;
|
|
365
|
+
position: absolute;
|
|
366
|
+
top: $catalog-capability-level-icon-top;
|
|
367
|
+
width: 14px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
&:not(:last-child)::after {
|
|
371
|
+
// pipe after circle
|
|
372
|
+
background: $catalog-capability-level-inactive-color;
|
|
373
|
+
content: '';
|
|
374
|
+
height: 6px;
|
|
375
|
+
left: -13px;
|
|
376
|
+
position: absolute;
|
|
377
|
+
top: 21px;
|
|
378
|
+
width: 1px;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.properties-side-panel-pf-property-value__capability-level-icon {
|
|
383
|
+
left: $catalog-capability-level-icon-left;
|
|
384
|
+
position: absolute;
|
|
385
|
+
top: $catalog-capability-level-icon-top;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.properties-side-panel-pf-property-value__capability-levels {
|
|
389
|
+
list-style: none;
|
|
390
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import { Converter } from 'showdown';
|
|
4
|
+
import { useForceRender } from '@console/shared';
|
|
5
|
+
import { QuickStartContext, QuickStartContextValues } from '../../utils/quick-start-context';
|
|
6
|
+
import './_markdown-view.scss';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9
|
+
const DOMPurify = require('dompurify');
|
|
10
|
+
|
|
11
|
+
// const tableTags = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];
|
|
12
|
+
|
|
13
|
+
type ShowdownExtension = {
|
|
14
|
+
type: string;
|
|
15
|
+
regex?: RegExp;
|
|
16
|
+
replace?: (...args: any[]) => string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const markdownConvert = (markdown, extensions?: ShowdownExtension[]) => {
|
|
20
|
+
const converter = new Converter({
|
|
21
|
+
tables: true,
|
|
22
|
+
openLinksInNewWindow: true,
|
|
23
|
+
strikethrough: true,
|
|
24
|
+
emoji: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (extensions) {
|
|
28
|
+
converter.addExtension(extensions);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
DOMPurify.addHook('beforeSanitizeElements', function(node) {
|
|
32
|
+
// nodeType 1 = element type
|
|
33
|
+
|
|
34
|
+
// transform anchor tags
|
|
35
|
+
if (node.nodeType === 1 && node.nodeName.toLowerCase() === 'a') {
|
|
36
|
+
node.setAttribute('rel', 'noopener noreferrer');
|
|
37
|
+
return node;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// add PF class to ul and ol lists
|
|
41
|
+
if (
|
|
42
|
+
node.nodeType === 1 &&
|
|
43
|
+
(node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol')
|
|
44
|
+
) {
|
|
45
|
+
node.setAttribute('class', 'pf-c-list');
|
|
46
|
+
return node;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Add a hook to make all links open a new window
|
|
51
|
+
DOMPurify.addHook('afterSanitizeAttributes', function(node) {
|
|
52
|
+
// set all elements owning target to target=_blank
|
|
53
|
+
if ('target' in node) {
|
|
54
|
+
node.setAttribute('target', '_blank');
|
|
55
|
+
}
|
|
56
|
+
// set non-HTML/MathML links to xlink:show=new
|
|
57
|
+
if (
|
|
58
|
+
!node.hasAttribute('target') &&
|
|
59
|
+
(node.hasAttribute('xlink:href') || node.hasAttribute('href'))
|
|
60
|
+
) {
|
|
61
|
+
node.setAttribute('xlink:show', 'new');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return DOMPurify.sanitize(converter.makeHtml(markdown), {
|
|
66
|
+
USE_PROFILES: {
|
|
67
|
+
html: true,
|
|
68
|
+
svg: true,
|
|
69
|
+
},
|
|
70
|
+
// ALLOWED_TAGS: [
|
|
71
|
+
// 'b',
|
|
72
|
+
// 'i',
|
|
73
|
+
// 'strike',
|
|
74
|
+
// 's',
|
|
75
|
+
// 'del',
|
|
76
|
+
// 'em',
|
|
77
|
+
// 'strong',
|
|
78
|
+
// 'a',
|
|
79
|
+
// 'p',
|
|
80
|
+
// 'h1',
|
|
81
|
+
// 'h2',
|
|
82
|
+
// 'h3',
|
|
83
|
+
// 'h4',
|
|
84
|
+
// 'ul',
|
|
85
|
+
// 'ol',
|
|
86
|
+
// 'li',
|
|
87
|
+
// 'code',
|
|
88
|
+
// 'pre',
|
|
89
|
+
// 'button',
|
|
90
|
+
// ...tableTags,
|
|
91
|
+
// 'div',
|
|
92
|
+
// 'img',
|
|
93
|
+
// 'span',
|
|
94
|
+
// 'svg',
|
|
95
|
+
// ],
|
|
96
|
+
// ALLOWED_ATTR: ['href', 'target', 'rel', 'class', 'src', 'alt', 'id'],
|
|
97
|
+
// ALLOWED_URI_REGEXP: /^(?:(?:https?|mailto|didact):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i,
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
type SyncMarkdownProps = {
|
|
102
|
+
content?: string;
|
|
103
|
+
emptyMsg?: string;
|
|
104
|
+
exactHeight?: boolean;
|
|
105
|
+
/* truncateContent?: boolean; */
|
|
106
|
+
extensions?: ShowdownExtension[];
|
|
107
|
+
renderExtension?: (contentDocument: HTMLDocument, rootSelector: string) => React.ReactNode;
|
|
108
|
+
inline?: boolean;
|
|
109
|
+
className?: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
type InnerSyncMarkdownProps = Pick<SyncMarkdownProps, 'renderExtension' | 'exactHeight'> & {
|
|
113
|
+
markup: string;
|
|
114
|
+
isEmpty: boolean;
|
|
115
|
+
className?: string;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const SyncMarkdownView: React.FC<SyncMarkdownProps> = ({
|
|
119
|
+
// truncateContent,
|
|
120
|
+
content,
|
|
121
|
+
emptyMsg,
|
|
122
|
+
extensions,
|
|
123
|
+
renderExtension,
|
|
124
|
+
exactHeight,
|
|
125
|
+
inline,
|
|
126
|
+
className,
|
|
127
|
+
}) => {
|
|
128
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
129
|
+
const markup = React.useMemo(() => {
|
|
130
|
+
return markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
131
|
+
}, [content, emptyMsg, extensions, getResource]);
|
|
132
|
+
const innerProps: InnerSyncMarkdownProps = {
|
|
133
|
+
renderExtension: extensions?.length > 0 ? renderExtension : undefined,
|
|
134
|
+
exactHeight,
|
|
135
|
+
markup,
|
|
136
|
+
isEmpty: !content,
|
|
137
|
+
className,
|
|
138
|
+
};
|
|
139
|
+
return inline ? <InlineMarkdownView {...innerProps} /> : <IFrameMarkdownView {...innerProps} />;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const uniqueId = (function() {
|
|
143
|
+
let num = 0;
|
|
144
|
+
return function(prefix) {
|
|
145
|
+
const prefixStr = String(prefix) || '';
|
|
146
|
+
num += 1;
|
|
147
|
+
return prefixStr + num;
|
|
148
|
+
};
|
|
149
|
+
})();
|
|
150
|
+
|
|
151
|
+
type RenderExtensionProps = {
|
|
152
|
+
renderExtension: (contentDocument: HTMLDocument, rootSelector: string) => React.ReactNode;
|
|
153
|
+
selector: string;
|
|
154
|
+
markup: string;
|
|
155
|
+
docContext?: HTMLDocument;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const RenderExtension: React.FC<RenderExtensionProps> = ({
|
|
159
|
+
renderExtension,
|
|
160
|
+
selector,
|
|
161
|
+
markup,
|
|
162
|
+
docContext,
|
|
163
|
+
}) => {
|
|
164
|
+
const forceRender = useForceRender();
|
|
165
|
+
const markupRef = React.useRef<string>(null);
|
|
166
|
+
const shouldRenderExtension = React.useCallback(() => {
|
|
167
|
+
if (markupRef.current === markup) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
markupRef.current = markup;
|
|
171
|
+
return false;
|
|
172
|
+
}, [markup]);
|
|
173
|
+
/**
|
|
174
|
+
* During a render cycle in which markup changes, renderExtension receives an old copy of document
|
|
175
|
+
* because react is still updating the dom using `dangerouslySetInnerHTML` with latest markdown markup
|
|
176
|
+
* which causes the component rendered by renderExtension to receive old copy of document
|
|
177
|
+
* use forceRender to delay the rendering of extension by one render cycle
|
|
178
|
+
*/
|
|
179
|
+
React.useEffect(() => {
|
|
180
|
+
if (renderExtension) {
|
|
181
|
+
forceRender();
|
|
182
|
+
}
|
|
183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
184
|
+
}, [markup]);
|
|
185
|
+
return (
|
|
186
|
+
<>{shouldRenderExtension() ? renderExtension?.(docContext ?? document, selector) : null}</>
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const InlineMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
|
|
191
|
+
markup,
|
|
192
|
+
isEmpty,
|
|
193
|
+
renderExtension,
|
|
194
|
+
className,
|
|
195
|
+
}) => {
|
|
196
|
+
const id = React.useMemo(() => uniqueId('markdown'), []);
|
|
197
|
+
return (
|
|
198
|
+
<div className={css('pfext-markdown-view', { 'is-empty': isEmpty }, className)} id={id}>
|
|
199
|
+
<div dangerouslySetInnerHTML={{ __html: markup }} />
|
|
200
|
+
{renderExtension && (
|
|
201
|
+
<RenderExtension renderExtension={renderExtension} selector={`#${id}`} markup={markup} />
|
|
202
|
+
)}
|
|
203
|
+
</div>
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const IFrameMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
|
|
208
|
+
exactHeight,
|
|
209
|
+
markup,
|
|
210
|
+
isEmpty,
|
|
211
|
+
renderExtension,
|
|
212
|
+
className,
|
|
213
|
+
}) => {
|
|
214
|
+
const [frame, setFrame] = React.useState<HTMLIFrameElement>();
|
|
215
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
216
|
+
const updateTimeoutHandle = React.useRef<number>();
|
|
217
|
+
|
|
218
|
+
const updateDimensions = React.useCallback(() => {
|
|
219
|
+
if (!frame?.contentWindow?.document.body.firstChild) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight}px`;
|
|
223
|
+
|
|
224
|
+
// Let the new height take effect, then reset again once we recompute
|
|
225
|
+
// @ts-ignore
|
|
226
|
+
updateTimeoutHandle.current = setTimeout(() => {
|
|
227
|
+
if (exactHeight) {
|
|
228
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight}px`;
|
|
229
|
+
} else {
|
|
230
|
+
// Increase by 15px for the case where a horizontal scrollbar might appear
|
|
231
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight +
|
|
232
|
+
15}px`;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}, [frame, exactHeight]);
|
|
236
|
+
|
|
237
|
+
React.useEffect(
|
|
238
|
+
() => () => {
|
|
239
|
+
clearTimeout(updateTimeoutHandle.current);
|
|
240
|
+
},
|
|
241
|
+
[],
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const onLoad = React.useCallback(() => {
|
|
245
|
+
updateDimensions();
|
|
246
|
+
setLoaded(true);
|
|
247
|
+
}, [updateDimensions]);
|
|
248
|
+
|
|
249
|
+
// Find the app's stylesheets and inject them into the frame to ensure consistent styling.
|
|
250
|
+
const filteredLinks = Array.from(document.getElementsByTagName('link')).filter((l) =>
|
|
251
|
+
l.href.includes('app-bundle'),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const linkRefs = filteredLinks.reduce(
|
|
255
|
+
(refs, link) => `${refs}
|
|
256
|
+
<link rel="stylesheet" href="${link.href}">`,
|
|
257
|
+
'',
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const contents = `
|
|
261
|
+
${linkRefs}
|
|
262
|
+
<style type="text/css">
|
|
263
|
+
body {
|
|
264
|
+
background-color: transparent !important;
|
|
265
|
+
color: ${isEmpty ? '#999' : '#333'};
|
|
266
|
+
font-family: var(--pf-global--FontFamily--sans-serif);
|
|
267
|
+
min-width: auto !important;
|
|
268
|
+
}
|
|
269
|
+
table {
|
|
270
|
+
display: block;
|
|
271
|
+
margin-bottom: 11.5px;
|
|
272
|
+
overflow-x: auto;
|
|
273
|
+
}
|
|
274
|
+
td,
|
|
275
|
+
th {
|
|
276
|
+
border-bottom: 1px solid #ededed;
|
|
277
|
+
padding: 10px;
|
|
278
|
+
vertical-align: top;
|
|
279
|
+
}
|
|
280
|
+
th {
|
|
281
|
+
padding-top: 0;
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
284
|
+
<body class="pf-m-redhat-font"><div style="overflow-y: auto;">${markup}</div></body>`;
|
|
285
|
+
return (
|
|
286
|
+
<>
|
|
287
|
+
<iframe
|
|
288
|
+
sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin"
|
|
289
|
+
srcDoc={contents}
|
|
290
|
+
style={{ border: '0px', display: 'block', width: '100%', height: '0' }}
|
|
291
|
+
ref={(r) => setFrame(r)}
|
|
292
|
+
onLoad={() => onLoad()}
|
|
293
|
+
className={className}
|
|
294
|
+
/>
|
|
295
|
+
{loaded && frame && renderExtension && (
|
|
296
|
+
<RenderExtension
|
|
297
|
+
markup={markup}
|
|
298
|
+
selector={''}
|
|
299
|
+
renderExtension={renderExtension}
|
|
300
|
+
docContext={frame.contentDocument}
|
|
301
|
+
/>
|
|
302
|
+
)}
|
|
303
|
+
</>
|
|
304
|
+
);
|
|
305
|
+
};
|