Skip to content

Commit aa9b858

Browse files
committed
admin report working perfectly
1 parent ef0701c commit aa9b858

3 files changed

Lines changed: 107 additions & 90 deletions

File tree

get-workspace-admins/create-admin-report.js

Whitespace-only changes.

get-workspace-admins/get-team-workspaces.js

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -119,64 +119,11 @@ async function generateHtmlReport(reportJsonPath, templatePath, outputPath) {
119119
}
120120

121121
// Read the template and report data
122-
const styleTemplate = fs.readFileSync(templatePath, 'utf-8');
122+
const templateContent = fs.readFileSync(templatePath, 'utf-8');
123123
const reportData = JSON.parse(fs.readFileSync(reportJsonPath, 'utf-8'));
124124

125-
// Create a complete HTML template with the styles
126-
const fullTemplate = `
127-
<!DOCTYPE html>
128-
<html lang="en">
129-
<head>
130-
<meta charset="UTF-8">
131-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
132-
<title>Postman Workspace Admins Report</title>
133-
${styleTemplate}
134-
</head>
135-
<body>
136-
<h1>Postman Workspace Admins Report</h1>
137-
<p>Generated: {{generated_at}}</p>
138-
139-
<table class="tftable">
140-
<tr>
141-
<th>Workspace</th>
142-
<th>Type</th>
143-
<th>Visibility</th>
144-
<th>Admin User</th>
145-
<th>Username</th>
146-
<th>Email</th>
147-
</tr>
148-
{{#each workspaces}}
149-
{{#each admin_users}}
150-
<tr>
151-
{{#if @index}}
152-
<td></td>
153-
<td></td>
154-
<td></td>
155-
{{else}}
156-
<td>{{../workspace_name}}</td>
157-
<td>{{../workspace_type}}</td>
158-
<td>{{../workspace_visibility}}</td>
159-
{{/if}}
160-
<td>{{user_name}}</td>
161-
<td>{{user_username}}</td>
162-
<td>{{user_email}}</td>
163-
</tr>
164-
{{else}}
165-
<tr>
166-
<td>{{workspace_name}}</td>
167-
<td>{{workspace_type}}</td>
168-
<td>{{workspace_visibility}}</td>
169-
<td colspan="3">No admin users found</td>
170-
</tr>
171-
{{/each}}
172-
{{/each}}
173-
</table>
174-
</body>
175-
</html>
176-
`;
177-
178125
// Compile and render the template
179-
const template = handlebars.compile(fullTemplate);
126+
const template = handlebars.compile(templateContent);
180127
const htmlOutput = template(reportData);
181128

182129
// Write the HTML output to the file
Lines changed: 105 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,105 @@
1-
<style type="text/css">
2-
.tftable {
3-
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
4-
font-size: 14px;
5-
color: #333333;
6-
width: 100%;
7-
border-width: 1px;
8-
border-color: #87ceeb;
9-
border-collapse: collapse;
10-
}
11-
.tftable th {
12-
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
13-
font-size: 18px;
14-
background-color: #87ceeb;
15-
border-width: 1px;
16-
padding: 8px;
17-
border-style: solid;
18-
border-color: #87ceeb;
19-
text-align: left;
20-
}
21-
.tftable tr {
22-
background-color: #ffffff;
23-
}
24-
.tftable td {
25-
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
26-
font-size: 14px;
27-
border-width: 1px;
28-
padding: 8px;
29-
border-style: solid;
30-
border-color: #87ceeb;
31-
}
32-
.tftable tr:hover {
33-
background-color: #e0ffff;
34-
}
35-
</style>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Postman Workspace Admins Report</title>
7+
<style type="text/css">
8+
.tftable {
9+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
10+
font-size: 14px;
11+
color: #333333;
12+
width: 100%;
13+
border-width: 1px;
14+
border-color: #87ceeb;
15+
border-collapse: collapse;
16+
}
17+
.tftable th {
18+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
19+
font-size: 18px;
20+
background-color: #87ceeb;
21+
border-width: 1px;
22+
padding: 8px;
23+
border-style: solid;
24+
border-color: #87ceeb;
25+
text-align: left;
26+
}
27+
.tftable tr {
28+
background-color: #ffffff;
29+
}
30+
.tftable td {
31+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
32+
font-size: 14px;
33+
border-width: 1px;
34+
padding: 8px;
35+
border-style: solid;
36+
border-color: #87ceeb;
37+
}
38+
.tftable tr:hover {
39+
background-color: #e0ffff;
40+
}
41+
body {
42+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
43+
margin: 20px;
44+
padding: 0;
45+
color: #333333;
46+
}
47+
h1 {
48+
color: #0077cc;
49+
border-bottom: 2px solid #87ceeb;
50+
padding-bottom: 10px;
51+
}
52+
.report-info {
53+
margin-bottom: 20px;
54+
font-style: italic;
55+
color: #666666;
56+
}
57+
</style>
58+
</head>
59+
<body>
60+
<h1>Postman Workspace Admins Report</h1>
61+
<div class="report-info">
62+
<p>Generated: {{generated_at}}</p>
63+
</div>
64+
65+
<table class="tftable">
66+
<thead>
67+
<tr>
68+
<th>Workspace</th>
69+
<th>Type</th>
70+
<th>Visibility</th>
71+
<th>Admin User</th>
72+
<th>Username</th>
73+
<th>Email</th>
74+
</tr>
75+
</thead>
76+
<tbody>
77+
{{#each workspaces}}
78+
{{#each admin_users}}
79+
<tr>
80+
{{#if @index}}
81+
<td></td>
82+
<td></td>
83+
<td></td>
84+
{{else}}
85+
<td>{{../workspace_name}}</td>
86+
<td>{{../workspace_type}}</td>
87+
<td>{{../workspace_visibility}}</td>
88+
{{/if}}
89+
<td>{{user_name}}</td>
90+
<td>{{user_username}}</td>
91+
<td><a href="mailto:{{user_email}}">{{user_email}}</a> </td>
92+
</tr>
93+
{{else}}
94+
<tr>
95+
<td>{{workspace_name}}</td>
96+
<td>{{workspace_type}}</td>
97+
<td>{{workspace_visibility}}</td>
98+
<td colspan="3">No admin users found</td>
99+
</tr>
100+
{{/each}}
101+
{{/each}}
102+
</tbody>
103+
</table>
104+
</body>
105+
</html>

0 commit comments

Comments
 (0)