Skip to content

Commit ed609bf

Browse files
committed
#284 Optimization of VC UTBot Quickstart wizard
- support CMake-generated version - `disabled` and `checked` attribute support for Unix/MS HTML render - added client/server version verification at `Handshake` call - deep refactoring `.css` files - remove `Test server` button and make the mandatory job in background - remove useless class `WizardHTMLBuilder` - fix CMake parameter editor
1 parent 5a4db62 commit ed609bf

File tree

17 files changed

+568
-421
lines changed

17 files changed

+568
-421
lines changed

server/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ message("Organisation: ${PROJECT_ORG}")
2525
message("Homepage: ${CMAKE_PROJECT_HOMEPAGE_URL}")
2626
message("Version: ${CMAKE_PROJECT_VERSION}")
2727
message("Run from: ${RUN_INFO}")
28+
include_directories(${PROJECT_BINARY_BIN})
2829

2930
configure_file(config.h.in config.h @ONLY)
3031

server/proto/testgen.proto

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "util.proto";
66
import "google/protobuf/duration.proto";
77

88
service TestsGenService {
9-
rpc Handshake(DummyRequest) returns(DummyResponse) {}
9+
rpc Handshake(VersionInfo) returns(VersionInfo) {}
1010

1111
rpc Heartbeat(DummyRequest) returns(HeartbeatResponse) {}
1212

@@ -59,6 +59,10 @@ message DummyRequest {}
5959

6060
message DummyResponse {}
6161

62+
message VersionInfo {
63+
string version = 1;
64+
}
65+
6266
message RegisterClientRequest {
6367
string clientId = 1;
6468
}

server/src/Server.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const std::string Server::logPrefix = "logTo";
4040
const std::string Server::gtestLogPrefix = "gtestLogTo";
4141

4242
void Server::run(uint16_t customPort) {
43-
LOG_S(INFO) << "UnitTestBot Server, build " << UTBOT_BUILD_NUMBER;
43+
LOG_S(INFO) << "UnitTestBot Server, build " << UTBOT_BUILD_VERSION;
4444
LOG_S(INFO) << "Logs directory: " << Paths::logPath;
4545
LOG_S(INFO) << "Latest log path: " << Paths::getUtbotLogAllFilePath();
4646
LOG_S(INFO) << "Tmp directory path: " << Paths::tmpPath;
@@ -157,9 +157,10 @@ Status Server::TestsGenServiceImpl::GeneratePredicateTests(ServerContext *contex
157157
}
158158

159159
Status Server::TestsGenServiceImpl::Handshake(ServerContext *context,
160-
const DummyRequest *request,
161-
DummyResponse *response) {
162-
LOG_S(INFO) << "Handshake complete";
160+
const VersionInfo *request,
161+
VersionInfo *response) {
162+
LOG_S(INFO) << "Handshake complete. Client version: " << request->version();
163+
response->set_version(UTBOT_BUILD_VERSION);
163164
return Status::OK;
164165
}
165166

server/src/Server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class Server {
6565
explicit TestsGenServiceImpl(bool testMode);
6666

6767
Status Handshake(ServerContext *context,
68-
const DummyRequest *request,
69-
DummyResponse *response) override;
68+
const VersionInfo *request,
69+
VersionInfo *response) override;
7070

7171
Status OpenLogChannel(ServerContext *context,
7272
const LogChannelRequest *request,

server/src/Version.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef UNITTESTBOT_VERSION_H
22
#define UNITTESTBOT_VERSION_H
33

4-
#define UTBOT_BUILD_NUMBER "DEVBUILD"
4+
#include "config.h" //CMake generated
5+
#define UTBOT_BUILD_VERSION PROJECT_VERSION
56

67
#endif //UNITTESTBOT_VERSION_H

server/src/utils/StringFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace StringUtils {
3838
}
3939
formatBuffer.resize(std::max(formatBuffer.size(), size));
4040
snprintf(formatBuffer.data(), size, format.c_str(), internal::extractCString(std::forward<Args>(args))...);
41-
return std::string(formatBuffer.begin(), formatBuffer.begin() + size - 1); // We don't want the '\0' inside
41+
return {formatBuffer.begin(), formatBuffer.begin() + size - 1}; // We don't want the '\0' inside
4242
}
4343
}
4444

vscode-plugin/media/vscode.css

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,39 @@ button.secondary:hover {
7373
background: var(--vscode-button-secondaryHoverBackground);
7474
}
7575

76-
button:disabled,
77-
button[disabled] {
78-
color: var(--vscode-debugIcon-breakpointDisabledForeground);
79-
background: var(--vscode-button-secondaryBackground);
80-
}
81-
button:disabled:hover,
82-
button:hover[disabled] {
83-
cursor: default;
84-
}
85-
86-
8776
input:not([type='checkbox']),
8877
textarea {
8978
display: block;
9079
width: 100%;
9180
border: none;
81+
outline-style: solid;
82+
outline-width: thin;
83+
outline-color: var(--vscode-input-border);
9284
font-family: var(--vscode-font-family);
9385
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
9486
color: var(--vscode-input-foreground);
95-
outline-color: var(--vscode-input-border);
9687
background-color: var(--vscode-input-background);
9788
}
9889

9990
input::placeholder,
10091
textarea::placeholder {
101-
color: var(--vscode-input-placeholderForeground);
92+
color: var(--vscode-input-placeholderForeground, #cccccc);
10293
}
10394

10495
label {
10596
font-family: var(--vscode-font-family);
10697
}
98+
99+
input[type = "*"]:disabled,
100+
input[disabled] {
101+
color: var(--vscode-disabledForeground);
102+
background: var(--vscode-disabledBackground);
103+
cursor: default;
104+
}
105+
106+
button:disabled,
107+
button[disabled] {
108+
color: var(--vscode-debugIcon-breakpointDisabledForeground);
109+
background: var(--vscode-button-secondaryBackground);
110+
cursor: default;
111+
}

vscode-plugin/media/wizard.css

Lines changed: 28 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
:root {
2-
--custom-shaded-backgroud: rgba(0, 0, 0, 0.3);
3-
}
4-
51
.utbot-form {
62
background-color: var(--vscode-welcomePage-background);
7-
margin: 150px auto;
8-
margin-top: 75px;
3+
margin: auto auto;
4+
margin-top: 15px;
95
vertical-align: middle;
106
padding: 40px;
117
width: 70%;
@@ -16,6 +12,7 @@
1612
/* Hide all steps by default: */
1713
.utbot-form__tab {
1814
display: none;
15+
min-height: 280px;
1916
}
2017

2118
.utbot-form__tab.active {
@@ -32,54 +29,56 @@
3229
height: 10px;
3330
width: 10px;
3431
margin: 0 2px;
35-
/* background-color: #bbbbbb; */
32+
3633
background-color: var(--vscode-titleBar-activeForeground);
34+
/* background-color: #bbbbbb; */
3735
border: none;
3836
border-radius: 50%;
3937
display: inline-block;
40-
opacity: 0.5;
38+
39+
opacity: 50%;
4140
}
4241

4342
/* Mark the active step: */
4443
.utbot-form__steps_step.active {
45-
opacity: 1;
44+
opacity: 100%;
45+
}
46+
47+
.utbot-form__tab_label {
48+
text-align: right;
49+
margin-top: 10px;
50+
margin-right: 15px;
51+
float:left;
4652
}
4753

4854
.utbot-form__tab_input {
4955
margin-top: 5px;
5056
}
5157

5258
.utbot-form__tab_item {
53-
margin-top: 15px;
54-
margin-bottom: 15px;
55-
}
56-
57-
.utbot-form__tab_connection_test-button {
58-
max-width: 30%;
59-
display: inline-block;
59+
margin-top: 5px;
60+
margin-bottom: 5px;
6061
}
6162

6263
/* By default turn off connection status */
63-
.utbot-form__tab_connection_loader,
64-
.utbot-form__tab_connection_success,
65-
.utbot-form__tab_connection_failure {
64+
#connection_loader,
65+
#connection_success,
66+
#connection_warning,
67+
#connection_failure {
6668
display: none;
6769
}
6870

69-
.utbot-form__tab_connection_loader.active,
70-
.utbot-form__tab_connection_success.active,
71-
.utbot-form__tab_connection_failure.active {
71+
#connection_loader.active,
72+
#connection_success.active,
73+
#connection_warning.active,
74+
#connection_failure.active {
7275
display: inline-block;
7376
}
7477

7578
.utbot-form__steps_step.finish {
7679
background-color: var(--vscode-editorInfo-foreground);
7780
}
7881

79-
.utbot-form__tab_input {
80-
box-sizing: border-box;
81-
}
82-
8382
.utbot-form__navigation {
8483
display: flex;
8584
flex-direction: row;
@@ -117,52 +116,14 @@
117116
margin-right: 0;
118117
}
119118

120-
.utbot-form__tab {
121-
min-height: 190px;
122-
}
123-
124-
/** Connection loader **/
125-
.utbot-form__tab_connection_loader.active {
126-
top: 5px;
127-
position: relative;
128-
height: 100%;
129-
}
130-
131-
.utbot-form__tab_connection_loader.active:after {
132-
content: " ";
133-
display: block;
134-
border-radius: 50%;
135-
width: 0;
136-
height: 0;
137-
margin: 0px;
138-
box-sizing: border-box;
139-
border: 10px solid #fff;
140-
border-color: #fff transparent #fff transparent;
141-
animation: lds-hourglass 1.2s infinite;
142-
}
143-
144-
@keyframes lds-hourglass {
145-
0% {
146-
transform: rotate(0);
147-
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
148-
}
149-
50% {
150-
transform: rotate(900deg);
151-
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
152-
}
153-
100% {
154-
transform: rotate(1800deg);
155-
}
156-
}
157-
158119
.utbot-modal {
159120
position: fixed;
160121
top: 0;
161122
left: 0;
162123
display: flex;
163124
align-items: center;
164125
justify-content: center;
165-
height: 0vh;
126+
height: 0;
166127
overflow: hidden;
167128
transition: background-color 0.25s ease;
168129
z-index: 9999;
@@ -283,7 +244,7 @@
283244
background: var(--vscode-diffEditor-diagonalFill);
284245
}
285246

286-
.utbot-modal__close-button::before,
247+
.utbot-modal__close-button::before,
287248
.utbot-modal__close-button::after {
288249
content: "";
289250
position: absolute;
@@ -311,7 +272,7 @@
311272
transform: rotate(-45deg);
312273
}
313274

314-
.utbot-modal__close-button.thick::before,
275+
.utbot-modal__close-button.thick::before,
315276
.utbot-modal__close-button.thick::after {
316277
height: 4px;
317278
margin-top: -2px;

0 commit comments

Comments
 (0)