Skip to content

Commit e418bb8

Browse files
Merge pull request #77 from constantine2nd/develop
Git commit id
2 parents de4cac4 + bbfd1ae commit e418bb8

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<link rel="stylesheet" href="/styles/androidstudio.min.css" />
1111
<script src="/js/highlight.min.js"></script>
1212
<script src="/js/highlightjs-line-numbers.min.js"></script>
13+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1314
<style>
1415
.loading-page {
1516
display: flex;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-explorer",
3-
"version": "1.0.29",
3+
"version": "1.1.1",
44
"private": true,
55
"scripts": {
66
"dev": "vite & ts-node server/app.ts",

server/app.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,20 @@ console.log(
121121
)
122122

123123
// Get commit ID
124-
export const commitId = execSync('git rev-parse HEAD').toString().trim();
125-
console.log('Current Commit ID:', commitId);
124+
export let commitId = '';
125+
126+
try {
127+
// Try to get the commit ID
128+
commitId = execSync('git rev-parse HEAD', { encoding: 'utf-8' }).trim();
129+
console.log('Current Commit ID:', commitId);
130+
} catch (error) {
131+
// Log the error but do not terminate the process
132+
console.error('Warning: Failed to retrieve the commit ID. Proceeding without it.');
133+
console.error('Error details:', error.message);
134+
commitId = 'unknown'; // Assign a fallback value
135+
}
136+
// Continue execution with or without a valid commit ID
137+
console.log('Execution continues with commitId:', commitId);
126138

127139
// Error Handling to Shut Down the App
128140
server.on('error', (err) => {

src/components/Preview.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,9 @@ const copyToClipboard = () => {
263263
<input type="text" v-show="exampleRequestBody" v-model="exampleRequestBody" />
264264
</div>
265265
<div v-show="successResponseBody">
266-
<pre><span>{{ responseHeaderTitle }}:</span>
267-
<code>
268-
<div id="code" v-html="successResponseBody"></div>
269-
</code>
270-
</pre>
266+
<p class="header-container">{{ responseHeaderTitle }}:</p>
267+
<pre><button @click="copyToClipboard" class="copy-button icon-md-heavy" title="Copy to Clipboard"><i class="material-icons">content_copy</i></button>
268+
<code><div id="code" v-html="successResponseBody"></div></code></pre>
271269
</div>
272270
<el-form ref="roleFormRef" :model="roleForm">
273271
<div v-show="showRequiredRoles">
@@ -456,4 +454,29 @@ li {
456454
#conector-method-link {
457455
color: white !important;
458456
}
457+
.copy-button {
458+
background: none;
459+
border: none;
460+
padding: 0;
461+
cursor: pointer;
462+
display: flex;
463+
align-items: center;
464+
justify-content: center;
465+
}
466+
467+
.copy-button .material-icons {
468+
font-size: 20px;
469+
color: #757575;
470+
transition: color 0.2s ease, transform 0.2s ease;
471+
}
472+
473+
.copy-button:hover .material-icons {
474+
color: #424242;
475+
transform: scale(1.1);
476+
}
477+
478+
.copy-button:active .material-icons {
479+
color: #212121;
480+
transform: scale(0.95);
481+
}
459482
</style>

0 commit comments

Comments
 (0)