Skip to content

Commit f51a4b9

Browse files
Add feedback webview (#2925)
* added survey webview Signed-off-by: msivasubramaniaan <[email protected]> * added feedback UI code with mentioned changes Signed-off-by: msivasubramaniaan <[email protected]> * changed the survey compile based on latest esbuild Signed-off-by: msivasubramaniaan <[email protected]> * added telemetry event for post the survey Signed-off-by: msivasubramaniaan <[email protected]> * changed name to feedback Signed-off-by: msivasubramaniaan <[email protected]> * addressed review comment Signed-off-by: msivasubramaniaan <[email protected]> * show submit button atleaset one question was answered Signed-off-by: msivasubramaniaan <[email protected]> * Update src/webview/feedback/json.js Co-authored-by: Mohit Suman <[email protected]> * Update src/webview/feedback/json.js Co-authored-by: Mohit Suman <[email protected]> * Update src/webview/feedback/json.js Co-authored-by: Mohit Suman <[email protected]> * Update src/webview/feedback/json.js Co-authored-by: Mohit Suman <[email protected]> * addressed the review comments Signed-off-by: msivasubramaniaan <[email protected]> * added caption text Signed-off-by: msivasubramaniaan <[email protected]> * Update src/webview/feedback/app/feedback.tsx Co-authored-by: Mohit Suman <[email protected]> * Update src/webview/feedback/app/index.html Co-authored-by: Mohit Suman <[email protected]> * make underying on Rate us on Marketplace text Signed-off-by: msivasubramaniaan <[email protected]> * added the share feedback Signed-off-by: msivasubramaniaan <[email protected]> --------- Signed-off-by: msivasubramaniaan <[email protected]> Co-authored-by: Mohit Suman <[email protected]>
1 parent fd1ea8d commit f51a4b9

File tree

17 files changed

+566
-0
lines changed

17 files changed

+566
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ src/webview/devfile-registry
1717
src/webview/welcome
1818
src/webview/git-import
1919
src/webview/helm-chart
20+
src/webview/feedback
2021
test/sandbox-registration

build/esbuild.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const webviews = [
1616
'helm-chart',
1717
'log',
1818
'welcome',
19+
'feedback'
1920
];
2021

2122
function kebabToCamel(text) {

images/openshift_icon.png

10.7 KB
Loading

package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
"sinon-chai": "^3.7.0",
202202
"source-map-support": "^0.5.21",
203203
"style-loader": "^3.3.1",
204+
"survey-react-ui": "^1.9.89",
204205
"targz": "^1.0.1",
205206
"ts-loader": "^9.2.6",
206207
"tslint": "^5.20.1",
@@ -377,6 +378,12 @@
377378
"light": "images/title/light/icon-issue.svg"
378379
}
379380
},
381+
{
382+
"command": "openshift.show.feedback",
383+
"title": "Share your feedback",
384+
"category": "OpenShift",
385+
"icon": "$(feedback)"
386+
},
380387
{
381388
"command": "openshift.project.create",
382389
"title": "New Project",
@@ -1122,6 +1129,11 @@
11221129
"when": "view == openshiftProjectExplorer",
11231130
"group": "navigation@4"
11241131
},
1132+
{
1133+
"command": "openshift.show.feedback",
1134+
"when": "view == openshiftProjectExplorer",
1135+
"group": "navigation@5"
1136+
},
11251137
{
11261138
"command": "openshift.component.createFromLocal",
11271139
"when": "view == openshiftComponentsView",

src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export async function activate(extensionContext: ExtensionContext): Promise<any>
7676
'./componentsView',
7777
'./webview/devfile-registry/registryViewLoader',
7878
'./webview/helm-chart/helmChartLoader',
79+
'./feedback'
7980
)),
8081
commands.registerCommand('clusters.openshift.useProject', (context) =>
8182
commands.executeCommand('extension.vsKubernetesUseNamespace', context),

src/feedback.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
import { vsCommand } from './vscommand';
6+
import FeedbackLoader from './webview/feedback/feedbackLoader';
7+
8+
export class Feedback {
9+
10+
@vsCommand('openshift.show.feedback')
11+
static async openFeedbackWindow(): Promise<void> {
12+
await FeedbackLoader.loadView('Share Feedback');
13+
}
14+
15+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
.parentContainer {
2+
display: flex;
3+
flex-direction: column;
4+
background-color: var(--vscode-editor-background) !important;
5+
color: var(--vscode-editor-foreground) !important;
6+
font-family: var(--vscode-editor-font-family) !important;
7+
font-size: var(--vscode-editor-font-size) !important;
8+
font-weight: var(--vscode-editor-font-weight) !important;
9+
}
10+
11+
.header__logo {
12+
margin-top: 1rem;
13+
margin-left: 1rem;
14+
display: flex;
15+
flex-direction: row;
16+
justify-content: left;
17+
gap: 3px;
18+
}
19+
20+
.image__logo {
21+
height: 48px;
22+
width: 54px;
23+
object-fit: contain;
24+
}
25+
26+
.highlight {
27+
color: #EE0000;
28+
display: inline;
29+
}
30+
31+
.foreGroundColor {
32+
color: var(--vscode-foreground);
33+
font-weight: normal;
34+
}
35+
36+
.headerContainer {
37+
display: flex;
38+
flex-direction: row;
39+
border-bottom: 3px solid #EE0000;
40+
}
41+
42+
.captionHeader {
43+
display: flex;
44+
flex-direction: column;
45+
gap: 2px;
46+
justify-content: center;
47+
margin: auto;
48+
margin-top: 1rem;
49+
word-spacing: 2px;
50+
}
51+
52+
.section__header-hint {
53+
width: 550px;
54+
justify-content: center;
55+
word-spacing: 5px;
56+
text-align: justify;
57+
color: var(--vscode-foreground);
58+
font-weight: normal;
59+
font-family: var(--vscode-font-family);
60+
font-size: 14px;
61+
}
62+
63+
.section__footer {
64+
width: fit-content;
65+
word-spacing: 0px;
66+
}
67+
68+
.footerText:hover {
69+
border-bottom: 3px solid #EE0000 !important;
70+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
import React from 'react';
6+
import { Icon, Stack, Typography } from '@mui/material';
7+
import { Model } from 'survey-core';
8+
import { Survey } from 'survey-react-ui';
9+
import { DefaultProps } from '../../common/propertyTypes';
10+
import { json } from '../json';
11+
import { VSCodeMessage } from './vsCodeMessage';
12+
import GitHubIcon from '@mui/icons-material/GitHub';
13+
import OpenShiftExtensionIcon from '../../../../images/openshift_icon.png';
14+
import MicrosoftIcon from '../../../../images/welcome/microsoft.svg';
15+
import 'survey-core/defaultV2.css';
16+
import './feedback.css'
17+
18+
export const FeedbackComponent: React.FC<DefaultProps> = ({ }) => {
19+
20+
const feedbackModal = new Model(json);
21+
22+
feedbackModal.onComplete.add((sender, options) => {
23+
options.showSaveInProgress();
24+
VSCodeMessage.postMessage({
25+
action: 'postFeedback',
26+
data: sender.data
27+
});
28+
options.showSaveSuccess();
29+
});
30+
31+
feedbackModal.onValueChanged.add((sender, _options) => {
32+
if (Object.keys(sender.getAllValues()).length > 0) {
33+
sender.showNavigationButtons = true;
34+
} else {
35+
sender.showNavigationButtons = false;
36+
}
37+
});
38+
39+
feedbackModal.completeText = 'Submit';
40+
feedbackModal.showNavigationButtons = false;
41+
42+
return (
43+
<div className='parentContainer'>
44+
<div className='headerContainer'>
45+
<header className='header__logo' style={{ width: '50%' }}>
46+
<img className='image__logo' src={OpenShiftExtensionIcon} />
47+
<div style={{ display: 'flex', flexDirection: 'column' }}>
48+
<label style={{ display: 'flex', flexDirection: 'row', textAlign: 'center' }}>
49+
<Typography variant='h4' className='highlight'>OpenShift</Typography>
50+
<Typography variant='h4' style={{ paddingLeft: '1rem' }} className='foreGroundColor'>Toolkit</Typography>
51+
</label>
52+
<Typography variant='h6' style={{ marginTop: '2px' }} className='foreGroundColor'>Your opinion matters to us!</Typography>
53+
</div>
54+
</header>
55+
<div style={{ width: '50%' }}>
56+
<label style={{ display: 'flex', flexDirection: 'row', gap: '1rem', textAlign: 'center', float: 'right', margin: '1rem' }}>
57+
<a href='https://github.com/redhat-developer/vscode-openshift-tools/issues'>
58+
<div className='section__header-hint section__footer'>
59+
<Stack direction='row' alignItems='center' gap={1}>
60+
<GitHubIcon style={{ fontSize: 25 }} />
61+
<Typography variant='body2' className='footerText'>Contact us on GitHub</Typography>
62+
</Stack>
63+
</div>
64+
</a>
65+
<a href='https://marketplace.visualstudio.com/items?itemName=redhat.vscode-openshift-connector&ssr=false#review-details'>
66+
<div className='section__header-hint section__footer'>
67+
<Stack direction='row' alignItems='center' gap={1}>
68+
<Icon sx={{
69+
fontSize: 23
70+
}}>
71+
<img src={MicrosoftIcon} />
72+
</Icon>
73+
<Typography variant='body2' className='footerText'>Rate us on Marketplace</Typography>
74+
</Stack>
75+
</div>
76+
</a>
77+
</label>
78+
</div>
79+
</div>
80+
<div className='captionHeader'>
81+
<Typography variant='subtitle2' className='foreGroundColor'>The Red Hat OpenShift Toolkit extension team would like to learn from your experience to improve the extension workflow.</Typography>
82+
<Typography variant='subtitle2' className='foreGroundColor'>This survey will take about 2 minutes. Your feedback is extremely valuable and will directly impact the product moving forward.</Typography>
83+
</div>
84+
<Survey model={feedbackModal} />
85+
</div>
86+
);
87+
}

src/webview/feedback/app/index.css

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.sd-root-modern,
2+
.sd-container-modern,
3+
.sd-title.sd-container-modern__title {
4+
background-color: var(--vscode-editor-background) !important;
5+
color: var(--vscode-editor-foreground) !important;
6+
font-family: var(--vscode-editor-font-family) !important;
7+
font-size: var(--vscode-editor-font-size) !important;
8+
font-weight: var(--vscode-editor-font-weight) !important;
9+
}
10+
11+
.sd-header__text .sd-title {
12+
color: #EE0000 !important;
13+
}
14+
15+
.sd-title.sd-container-modern__title {
16+
box-shadow: 0px 2px 0px var(--sjs-primary-backcolor, #ee0000) !important;
17+
}
18+
19+
.sd-progress,
20+
.sd-progress__bar {
21+
background-color: var(--sjs-border-light, var(--border-light, #EE0000)) !important;
22+
}
23+
24+
.sd-rating__item:focus-within {
25+
border-color: var(--sjs-primary-backcolor, var(--primary, #EE0000)) !important;
26+
27+
}
28+
29+
.sd-rating__item--selected {
30+
background-color: var(--sjs-primary-backcolor, var(--primary, #EE0000)) !important;
31+
border-color: var(--sjs-primary-backcolor, var(--primary, #EE0000)) !important;
32+
}
33+
34+
.sd-boolean__control:focus~.sd-boolean__switch {
35+
box-shadow: inset 0 0 0 2px var(--sjs-primary-backcolor, var(--primary, #fff)) !important;
36+
}
37+
38+
.sd-boolean__thumb,
39+
.sd-btn {
40+
color: var(--sjs-primary-backcolor, var(--primary, #EE0000)) !important;
41+
}
42+
43+
.sd-btn--action {
44+
background-color: var(--sjs-primary-backcolor, var(--primary, #EE0000)) !important;
45+
color: var(--sjs-primary-backcolor, var(--primary, var(--vscode-button-foreground))) !important;
46+
}
47+
48+
.sv-logo--left {
49+
width: 5rem !important;
50+
}
51+
52+
.sd-description {
53+
color: var(--vscode-descriptionForeground) !important;
54+
}
55+
56+
.sd-element__title span {
57+
background-color: var(--vscode-editor-background) !important;
58+
color: var(--vscode-editor-foreground) !important;
59+
font-weight: var(--vscode-editor-font-weight) !important;
60+
}
61+
62+
.svc-logic-question-value,
63+
.sd-element--with-frame {
64+
background-color: transparent !important;
65+
}
66+
67+
.sd-rating__item-text.sd-rating__item-text {
68+
border: none !important;
69+
}
70+
71+
.sd-rating__item-smiley {
72+
background-color: #ffd700 !important;
73+
fill: black !important;
74+
}
75+
76+
a:link {
77+
text-decoration: none !important;
78+
}
79+
80+
a:focus {
81+
box-shadow: none !important;
82+
outline: 0 !important;
83+
}

0 commit comments

Comments
 (0)