Skip to content

Commit 1f5e17e

Browse files
committed
Fix: ActiveUserCount
1 parent 95718aa commit 1f5e17e

File tree

4 files changed

+60
-33
lines changed

4 files changed

+60
-33
lines changed

docs/api/schemas.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
| `allow_user_cancel_workspace_jobs` | boolean | false | none | Allow users to cancel in-progress workspace jobs.<br>\*bool as the default value is "true". |
6161
| `default_ttl_ms` | integer | false | none | DefaultTTLMillis allows optionally specifying the default TTL<br>for all workspaces created from this template. |
6262
| `description` | string | false | none | Description is a description of what the template contains. It must be<br>less than 128 bytes. |
63-
| `display_name` | string | false | none | DisplayName is the displayed name of the template. |
63+
| `display_name` | string | false | none | Display name is the displayed name of the template. |
6464
| `icon` | string | false | none | Icon is a relative path or external URL that specifies<br>an icon to be displayed in the dashboard. |
6565
| `name` | string | true | none | Name is the name of the template. |
6666
| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | none | none |
@@ -98,7 +98,7 @@
9898
| ----------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------ |
9999
| `interval` | integer | false | none | Interval specifies the seconds between each health check. |
100100
| `threshold` | integer | false | none | Threshold specifies the number of consecutive failed health checks before returning "unhealthy". |
101-
| `url` | string | false | none | URL specifies the url to check for the app health. |
101+
| `url` | string | false | none | Url specifies the url to check for the app health. |
102102

103103
## codersdk.ProvisionerJob
104104

@@ -208,25 +208,25 @@
208208

209209
### Properties
210210

211-
| Name | Type | Required | Restrictions | Description |
212-
| ---------------------------------- | ------------------------------------------------------------------ | -------- | ------------ | ------------------------------------------ |
213-
| `active_user_count` | integer | false | none | ActiveUserCount is set to -1 when loading. |
214-
| `active_version_id` | string | false | none | none |
215-
| `allow_user_cancel_workspace_jobs` | boolean | false | none | none |
216-
| `build_time_stats` | [codersdk.TemplateBuildTimeStats](#codersdktemplatebuildtimestats) | false | none | none |
217-
| `created_at` | string | false | none | none |
218-
| `created_by_id` | string | false | none | none |
219-
| `created_by_name` | string | false | none | none |
220-
| `default_ttl_ms` | integer | false | none | none |
221-
| `description` | string | false | none | none |
222-
| `display_name` | string | false | none | none |
223-
| `icon` | string | false | none | none |
224-
| `id` | string | false | none | none |
225-
| `name` | string | false | none | none |
226-
| `organization_id` | string | false | none | none |
227-
| `provisioner` | string | false | none | none |
228-
| `updated_at` | string | false | none | none |
229-
| `workspace_owner_count` | integer | false | none | none |
211+
| Name | Type | Required | Restrictions | Description |
212+
| ---------------------------------- | ------------------------------------------------------------------ | -------- | ------------ | -------------------------------------------- |
213+
| `active_user_count` | integer | false | none | Active user count is set to -1 when loading. |
214+
| `active_version_id` | string | false | none | none |
215+
| `allow_user_cancel_workspace_jobs` | boolean | false | none | none |
216+
| `build_time_stats` | [codersdk.TemplateBuildTimeStats](#codersdktemplatebuildtimestats) | false | none | none |
217+
| `created_at` | string | false | none | none |
218+
| `created_by_id` | string | false | none | none |
219+
| `created_by_name` | string | false | none | none |
220+
| `default_ttl_ms` | integer | false | none | none |
221+
| `description` | string | false | none | none |
222+
| `display_name` | string | false | none | none |
223+
| `icon` | string | false | none | none |
224+
| `id` | string | false | none | none |
225+
| `name` | string | false | none | none |
226+
| `organization_id` | string | false | none | none |
227+
| `provisioner` | string | false | none | none |
228+
| `updated_at` | string | false | none | none |
229+
| `workspace_owner_count` | integer | false | none | none |
230230

231231
## codersdk.TemplateBuildTimeStats
232232

@@ -245,9 +245,9 @@
245245

246246
### Properties
247247

248-
| Name | Type | Required | Restrictions | Description |
249-
| -------------------------- | ---------------------------------------------------- | -------- | ------------ | ----------- |
250-
| `**additionalProperties**` | [codersdk.TransitionStats](#codersdktransitionstats) | false | none | none |
248+
| Name | Type | Required | Restrictions | Description |
249+
| ---------------- | ---------------------------------------------------- | -------- | ------------ | ----------- |
250+
| `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | none | none |
251251

252252
## codersdk.TransitionStats
253253

@@ -588,7 +588,7 @@
588588
| Name | Type | Required | Restrictions | Description |
589589
| --------------- | -------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
590590
| `command` | string | false | none | none |
591-
| `display_name` | string | false | none | DisplayName is a friendly name for the app. |
591+
| `display_name` | string | false | none | Display name is a friendly name for the app. |
592592
| `external` | boolean | false | none | External specifies whether the URL should be opened externally on<br>the client or not. |
593593
| `health` | string | false | none | none |
594594
| `healthcheck` | [codersdk.Healthcheck](#codersdkhealthcheck) | false | none | none |
@@ -597,7 +597,7 @@
597597
| `sharing_level` | string | false | none | none |
598598
| `slug` | string | false | none | Slug is a unique identifier within the agent. |
599599
| `subdomain` | boolean | false | none | Subdomain denotes whether the app should be accessed via a path on the<br>`coder server` or via a hostname-based dev URL. If this is set to true<br>and there is no app wildcard configured on the server, the app will not<br>be accessible in the UI. |
600-
| `url` | string | false | none | URL is the address being proxied to inside the workspace.<br>If external is specified, this will be opened on the client. |
600+
| `url` | string | false | none | Url is the address being proxied to inside the workspace.<br>If external is specified, this will be opened on the client. |
601601

602602
## codersdk.WorkspaceBuild
603603

scripts/apidocgen/markdown-template/main.dot

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
return p.type;
55
}
66

7-
var pRef = p.$ref.replace("#/components/schemas/","");
7+
const pRef = p.$ref.replace("#/components/schemas/","");
88
if (pRef == "codersdk.NullTime") {
99
return "string(time) or `null`";
1010
}
@@ -22,8 +22,35 @@
2222
if (p.displayName == "» **additionalProperties**") {
2323
return "» `[any property]`";
2424
}
25+
if (p.displayName == "**additionalProperties**") {
26+
return "`[any property]`";
27+
}
2528
return "`" + p.displayName + "`";
2629
}
30+
31+
function renderDescription(p) {
32+
if (!p.description) {
33+
return "none";
34+
}
35+
36+
const toSnakeCase = str =>
37+
str
38+
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
39+
.map(x => x.toLowerCase())
40+
.join('_');
41+
42+
const words = p.description.split(' ');
43+
if (words.length == 0) {
44+
return "none";
45+
}
46+
47+
var firstWord = toSnakeCase(words[0]);
48+
if (p.displayName == firstWord) {
49+
const displayName = p.displayName.charAt(0).toUpperCase() + p.displayName.replaceAll("_", " ").toLowerCase().slice(1);
50+
return displayName + " " + words.slice(1).join(' ');
51+
}
52+
return p.description;
53+
}
2754
}}
2855

2956
{{? data.api.components && data.api.components.securitySchemes }}{{#def.security}}{{?}}
@@ -99,7 +126,7 @@
99126

100127
{{? block.rows.length}}|Name|Type|Required|Restrictions|Description|
101128
|---|---|---|---|---|{{?}}
102-
{{~ block.rows :p}}|{{= renderDisplayName(p)}}|{{= renderPropertyType(p)}}|{{=p.required}}|{{=p.restrictions||'none'}}|{{=p.description||'none'}}|
129+
{{~ block.rows :p}}|{{= renderDisplayName(p)}}|{{= renderPropertyType(p)}}|{{=p.required}}|{{=p.restrictions||'none'}}|{{= renderDescription(p)}}|
103130
{{~}}
104131
{{~}}
105132
{{? (blocks[0].rows.length === 0) && (blocks.length === 1) }}

scripts/apidocgen/markdown-template/parameters.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{{
22
function renderParameterType(p) {
33
if (p.schema['x-widdershins-oldRef']) {
4-
var aType = p.schema['x-widdershins-oldRef'].replace("#/components/schemas/","");
5-
var href = aType.replace(".","").toLowerCase();
4+
const aType = p.schema['x-widdershins-oldRef'].replace("#/components/schemas/","");
5+
const href = aType.replace(".","").toLowerCase();
66
return "[" + aType + "](schemas.md#" + href + ")";
77
}
88
return p.safeType;

scripts/apidocgen/markdown-template/responses.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
return "no schema";
1313
}
1414

15-
var oldRef = content.schema["x-widdershins-oldRef"];
16-
var aType = oldRef.replace("#/components/schemas/","");
17-
var href = aType.replace(".","").toLowerCase();
15+
const oldRef = content.schema["x-widdershins-oldRef"];
16+
const aType = oldRef.replace("#/components/schemas/","");
17+
const href = aType.replace(".","").toLowerCase();
1818
return "[" + aType + "](schemas.md#" + href + ")";
1919
}
2020
}}

0 commit comments

Comments
 (0)