Skip to content

Commit 7df1b0b

Browse files
authored
Merge branch 'source' into keycloak-page
2 parents 0775381 + 4aa98cf commit 7df1b0b

20 files changed

+269
-100
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "site",
33
"repository": "https://kube-hpc.github.io",
44
"private": true,
5-
"version": "2.9.8",
5+
"version": "2.9.9",
66
"scripts": {
77
"start": "rm -rf build && babel-node resources/server.js",
88
"build": "rm -rf build && babel-node resources/build.js",

site/_core/CodeTabsWithCopy.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import React from 'react';
2+
import Tabs from 'react-responsive-tabs';
3+
4+
export default class CodeTabsWithCopy extends React.Component {
5+
constructor(props) {
6+
super(props);
7+
this.state = {
8+
items: this._getTabs(),
9+
selectedTabKey: 0,
10+
copied: false
11+
};
12+
13+
// bind event handlers here
14+
this.onTabChange = this.onTabChange.bind(this);
15+
this.copyCode = this.copyCode.bind(this);
16+
}
17+
18+
_getTabs() {
19+
return this.props.schema.map((s, i) => ({
20+
key: i,
21+
tabClassName: 'tab',
22+
panelClassName: 'panel',
23+
title: s.name,
24+
getContent: () => s.content
25+
}));
26+
}
27+
28+
onTabChange(index) {
29+
this.setState({ selectedTabKey: index, copied: false });
30+
}
31+
32+
copyCode() {
33+
const { selectedTabKey, items } = this.state;
34+
const codeNode = items[selectedTabKey].getContent();
35+
36+
let textToCopy = '';
37+
38+
try {
39+
if (
40+
codeNode &&
41+
codeNode.props &&
42+
codeNode.props.children &&
43+
codeNode.props.children.props &&
44+
typeof codeNode.props.children.props.children === 'string'
45+
) {
46+
textToCopy = codeNode.props.children.props.children;
47+
} else if (
48+
codeNode &&
49+
codeNode.props &&
50+
typeof codeNode.props.children === 'string'
51+
) {
52+
textToCopy = codeNode.props.children;
53+
}
54+
} catch (e) {
55+
textToCopy = '';
56+
}
57+
58+
if (textToCopy) {
59+
navigator.clipboard.writeText(textToCopy);
60+
this.setState({ copied: true });
61+
setTimeout(() => this.setState({ copied: false }), 2000);
62+
}
63+
}
64+
65+
render() {
66+
const { items, selectedTabKey, copied } = this.state;
67+
68+
return (
69+
<div style={{ position: 'relative' }}>
70+
<Tabs
71+
transform={false}
72+
items={items}
73+
showInkBar={true}
74+
selectedTabKey={selectedTabKey}
75+
onChange={this.onTabChange}
76+
/>
77+
<button
78+
onClick={this.copyCode}
79+
className="copy-btn"
80+
style={{ top: '62px' }}
81+
aria-label="Copy code"
82+
>
83+
{copied ? 'Copied!' : 'Copy'}
84+
</button>
85+
</div>
86+
);
87+
}
88+
}

site/_core/Marked.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,27 @@ Parser.prototype.tok = function () {
866866
}
867867
}
868868
}
869+
if (this.token.lang === 'hkube-tabs-with-copy') {
870+
var lines = this.token.text.split('\n');
871+
var firstLine = lines.shift().match(/^\s*#\s*({.*})$/);
872+
if (firstLine) {
873+
var metaData;
874+
try {
875+
metaData = JSON.parse(firstLine[1]);
876+
} catch (e) {
877+
console.error('Invalid Metadata JSON:', firstLine[1]);
878+
}
879+
if (metaData) {
880+
return <script data-inline dangerouslySetInnerHTML={{
881+
__html: `
882+
import CodeTabsWithCopy from '../_core/CodeTabsWithCopy';
883+
import Prism from '../_core/Prism';
884+
import schema from '../_core/schemas/${metaData.schema}';
885+
renderHere(<CodeTabsWithCopy schema={schema} />);
886+
`}} />
887+
}
888+
}
889+
}
869890
return <Prism language={this.token.lang} line={this.token.line}>{this.token.text}</Prism>;
870891
}
871892
case 'table': {

site/_core/schemas/install.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,34 @@ const items = [
55
{
66
name: 'Linux',
77
content: <Prism language="bash">
8-
{`
9-
minikube start --driver docker --addons ingress --addons registry \\
10-
--addons registry-aliases --addons storage-provisioner
11-
# verify that all pods are running
12-
kubectl get pods -A
13-
`}
8+
{String.raw`minikube start --driver=docker \
9+
--addons ingress \
10+
--addons registry \
11+
--addons registry-aliases \
12+
--addons storage-provisioner \
13+
--kubernetes-version=v1.23.5`}
1414
</Prism>
1515
},
1616
{
1717
name: 'Windows',
1818
content: <Prism language="shell">
19-
{`
20-
minikube start --driver hyperv --cpus 4 --memory 6GB --addons ingress --addons registry --addons registry-aliases --addons storage-provisioner
21-
kubectl get pods -A
22-
`}
19+
{String.raw`minikube start --driver=hyperv --cpus=4 --memory=6GB ^
20+
--addons=ingress ^
21+
--addons=registry ^
22+
--addons=registry-aliases ^
23+
--addons=storage-provisioner ^
24+
--kubernetes-version=v1.23.5`}
2325
</Prism>
2426
},
2527
{
2628
name: 'MacOS',
2729
content: <Prism language="shell">
28-
{`
29-
minikube start --cpus 4 --memory 6GB \\
30-
--addons ingress --addons registry --addons registry-aliases --addons storage-provisioner
31-
kubectl get pods -A
32-
`}
30+
{String.raw`minikube start --cpus=4 --memory=6GB \
31+
--addons=ingress \
32+
--addons=registry \
33+
--addons=registry-aliases \
34+
--addons=storage-provisioner \
35+
--kubernetes-version=v1.23.5`}
3336
</Prism>
3437
},
3538
];

site/_css/copy-button.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
cursor: pointer;
88
font-size: 12px;
99
position: absolute;
10-
bottom: 10px;
10+
top: 10px;
1111
right: 10px;
1212
}
1313

site/learn/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ layout: ../_core/DocsLayout
55
category: Learn
66
permalink: /learn/api/
77
sublinks: Restful, Cli
8-
next: /learn/algorithms/
8+
next: /learn/installCLI/
99
---
1010

1111
HKube supports two types of APIs, Restful and Cli.

site/learn/AdvancedPipelineDescriptor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ layout: ../_core/DocsLayout
55
category: Learn
66
permalink: /learn/advancedPipeline/
77
sublinks: Advance Options
8-
next: /learn/install/
8+
next: /learn/triggers/
99
---
1010

1111
## Advance Options

site/learn/Algorithms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ layout: ../_core/DocsLayout
55
category: Learn
66
sublinks: Integration Methods, Events & Communication, Implementation
77
permalink: /learn/algorithms/
8-
next: /learn/sidecars/
8+
next: /learn/streaming/
99
---
1010

1111
HKube offers two ways to integrate your algorithm:

site/learn/Caching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ layout: ../_core/DocsLayout
55
category: Learn
66
sublinks: Introduction, Use Cases, How to activate cache
77
permalink: /learn/caching/
8-
next: /learn/debug/
8+
next: /learn/codeapi/
99
---
1010

1111
## Introduction

0 commit comments

Comments
 (0)