@scalar/api-client 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -7
- package/src/components/ApiClient/AddressBar.vue +0 -462
- package/src/components/ApiClient/ApiClient.vue +0 -266
- package/src/components/ApiClient/Request/Request.vue +0 -271
- package/src/components/ApiClient/Request/RequestAuth.vue +0 -221
- package/src/components/ApiClient/Request/RequestBody.vue +0 -40
- package/src/components/ApiClient/Request/RequestHeaders.vue +0 -24
- package/src/components/ApiClient/Request/RequestQuery.vue +0 -25
- package/src/components/ApiClient/Request/RequestVariables.vue +0 -25
- package/src/components/ApiClient/Request/index.ts +0 -1
- package/src/components/ApiClient/RequestHistory.vue +0 -114
- package/src/components/ApiClient/RequestHistoryItem.vue +0 -59
- package/src/components/ApiClient/Response/Copilot.vue.bak +0 -385
- package/src/components/ApiClient/Response/Response.vue +0 -120
- package/src/components/ApiClient/Response/ResponseBody.vue +0 -24
- package/src/components/ApiClient/Response/ResponseHeaders.vue +0 -52
- package/src/components/ApiClient/Response/ResponseMetaInformation.vue +0 -58
- package/src/components/ApiClient/Response/index.ts +0 -1
- package/src/components/ApiClient/index.ts +0 -1
- package/src/components/CollapsibleSection/CollapsibleSection.vue +0 -149
- package/src/components/CollapsibleSection/index.ts +0 -1
- package/src/components/FlowModal.vue +0 -133
- package/src/components/Grid/Grid.vue +0 -511
- package/src/components/Grid/SimpleGrid.vue +0 -33
- package/src/components/Grid/index.ts +0 -2
- package/src/components/HelpfulLink.vue +0 -19
- package/src/components/SimpleTable/SimpleCell.vue +0 -47
- package/src/components/SimpleTable/SimpleHeader.vue +0 -17
- package/src/components/SimpleTable/SimpleRow.vue +0 -14
- package/src/components/SimpleTable/SimpleTable.vue +0 -13
- package/src/components/SimpleTable/index.ts +0 -4
- package/src/fixtures/httpHeaders.ts +0 -530
- package/src/fixtures/httpStatusCodes.ts +0 -259
- package/src/fixtures/index.ts +0 -6
- package/src/helpers/concatenateUrlAndPath.test.ts +0 -27
- package/src/helpers/concatenateUrlAndPath.ts +0 -13
- package/src/helpers/createPlaceholderRequest.ts +0 -16
- package/src/helpers/generateParameters.ts +0 -19
- package/src/helpers/generateRequest.ts +0 -26
- package/src/helpers/index.ts +0 -10
- package/src/helpers/mapFromArray.ts +0 -16
- package/src/helpers/normalizePath.test.ts +0 -17
- package/src/helpers/normalizePath.ts +0 -16
- package/src/helpers/normalizeRequestMethod.test.ts +0 -29
- package/src/helpers/normalizeRequestMethod.ts +0 -43
- package/src/helpers/normalizeUrl.test.ts +0 -25
- package/src/helpers/normalizeUrl.ts +0 -24
- package/src/helpers/replaceVariables.test.ts +0 -13
- package/src/helpers/replaceVariables.ts +0 -11
- package/src/helpers/sendRequest.test.ts +0 -50
- package/src/helpers/sendRequest.ts +0 -105
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useCopilot.ts +0 -64
- package/src/hooks/useOperation.ts +0 -43
- package/src/index.ts +0 -8
- package/src/stores/apiClientRequestStore.ts +0 -103
- package/src/stores/apiClientStore.ts +0 -57
- package/src/stores/index.ts +0 -5
- package/src/types.ts +0 -185
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
|
|
5
|
-
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
6
|
-
|
|
7
|
-
const store = useApiClientRequestStore()
|
|
8
|
-
|
|
9
|
-
const { authState } = store
|
|
10
|
-
|
|
11
|
-
const show = ref(true)
|
|
12
|
-
|
|
13
|
-
const authTypeFriendlyString: { [key: string]: string } = {
|
|
14
|
-
basic: 'Basic Auth',
|
|
15
|
-
digest: 'Digest Auth',
|
|
16
|
-
oauthOne: 'OAuth 1.0',
|
|
17
|
-
oauthTwo: 'OAuth 2.0',
|
|
18
|
-
bearer: 'Bearer Token',
|
|
19
|
-
none: 'None',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const authDropdownItems = [
|
|
23
|
-
{
|
|
24
|
-
text: 'Basic Auth',
|
|
25
|
-
type: 'basic',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
text: 'OAuth 2.0',
|
|
29
|
-
type: 'oauthTwo',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
text: 'Bearer Token',
|
|
33
|
-
type: 'bearer',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
text: 'None',
|
|
37
|
-
type: 'none',
|
|
38
|
-
},
|
|
39
|
-
]
|
|
40
|
-
</script>
|
|
41
|
-
<template>
|
|
42
|
-
<CollapsibleSection title="Authentication">
|
|
43
|
-
<template #options>
|
|
44
|
-
<div>
|
|
45
|
-
<span>
|
|
46
|
-
{{ authTypeFriendlyString[authState.type] }}
|
|
47
|
-
<svg
|
|
48
|
-
height="18"
|
|
49
|
-
viewBox="0 0 10 18"
|
|
50
|
-
width="10"
|
|
51
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
52
|
-
<path
|
|
53
|
-
d="M5 2.83L8.17 6l1.41-1.41L5 0 .41 4.59 1.83 6 5 2.83zm0 12.34L1.83 12 .42 13.41 5 18l4.59-4.59L8.17 12 5 15.17z"
|
|
54
|
-
fill="currentColor"
|
|
55
|
-
fill-rule="nonzero" />
|
|
56
|
-
</svg>
|
|
57
|
-
</span>
|
|
58
|
-
<select
|
|
59
|
-
v-show="show"
|
|
60
|
-
v-model="authState.type"
|
|
61
|
-
@click.prevent>
|
|
62
|
-
<option
|
|
63
|
-
v-for="option in authDropdownItems"
|
|
64
|
-
:key="option.type"
|
|
65
|
-
:value="option.type">
|
|
66
|
-
{{ option.text }}
|
|
67
|
-
</option>
|
|
68
|
-
</select>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<template v-if="authState.type === 'none'">
|
|
73
|
-
<div class="scalar-api-client__empty-state">No Authentication</div>
|
|
74
|
-
</template>
|
|
75
|
-
<template v-else>
|
|
76
|
-
<template v-if="authState.type === 'basic'">
|
|
77
|
-
<div class="input input__half">
|
|
78
|
-
<input
|
|
79
|
-
v-model="authState.basic.userName"
|
|
80
|
-
autocomplete="off"
|
|
81
|
-
placeholder="Username"
|
|
82
|
-
spellcheck="false"
|
|
83
|
-
type="text" />
|
|
84
|
-
<label for="Username">Username</label>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="input input__half">
|
|
87
|
-
<input
|
|
88
|
-
v-model="authState.basic.password"
|
|
89
|
-
autocomplete="off"
|
|
90
|
-
placeholder="Username"
|
|
91
|
-
spellcheck="false"
|
|
92
|
-
type="password" />
|
|
93
|
-
<label for="Password">Password</label>
|
|
94
|
-
</div>
|
|
95
|
-
<label class="check">
|
|
96
|
-
<input
|
|
97
|
-
v-model="authState.basic.active"
|
|
98
|
-
type="checkbox" />
|
|
99
|
-
<span class="checkmark" />
|
|
100
|
-
<p>Enabled</p>
|
|
101
|
-
</label>
|
|
102
|
-
</template>
|
|
103
|
-
<template v-else-if="authState.type === 'digest'">
|
|
104
|
-
<div class="input input__half">
|
|
105
|
-
<input
|
|
106
|
-
v-model="authState.digest.userName"
|
|
107
|
-
autocomplete="off"
|
|
108
|
-
placeholder="Username"
|
|
109
|
-
spellcheck="false"
|
|
110
|
-
type="text" />
|
|
111
|
-
<label for="Username">Username</label>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="input input__half">
|
|
114
|
-
<input
|
|
115
|
-
v-model="authState.digest.password"
|
|
116
|
-
autocomplete="off"
|
|
117
|
-
placeholder="Password"
|
|
118
|
-
spellcheck="false"
|
|
119
|
-
type="password" />
|
|
120
|
-
<label for="Password">Password</label>
|
|
121
|
-
</div>
|
|
122
|
-
<label class="check">
|
|
123
|
-
<input
|
|
124
|
-
v-model="authState.digest.active"
|
|
125
|
-
type="checkbox" />
|
|
126
|
-
<span class="checkmark" />
|
|
127
|
-
<p>Enabled</p>
|
|
128
|
-
</label>
|
|
129
|
-
</template>
|
|
130
|
-
<template v-else-if="authState.type === 'oauthTwo'">
|
|
131
|
-
<div class="input">
|
|
132
|
-
<input
|
|
133
|
-
v-model="authState.oauthTwo.generatedToken"
|
|
134
|
-
autocomplete="off"
|
|
135
|
-
placeholder="Generated Token"
|
|
136
|
-
spellcheck="false"
|
|
137
|
-
type="text" />
|
|
138
|
-
<label for="Consumer Key">Generated Token</label>
|
|
139
|
-
</div>
|
|
140
|
-
<div class="input">
|
|
141
|
-
<input
|
|
142
|
-
v-model="authState.oauthTwo.discoveryURL"
|
|
143
|
-
autocomplete="off"
|
|
144
|
-
placeholder="Discovery URL"
|
|
145
|
-
spellcheck="false"
|
|
146
|
-
type="text" />
|
|
147
|
-
<label for="Consumer Key">OIDC Discovery URL</label>
|
|
148
|
-
</div>
|
|
149
|
-
<div class="input">
|
|
150
|
-
<input
|
|
151
|
-
v-model="authState.oauthTwo.authURL"
|
|
152
|
-
autocomplete="off"
|
|
153
|
-
placeholder="Auth URL"
|
|
154
|
-
spellcheck="false"
|
|
155
|
-
type="text" />
|
|
156
|
-
<label for="Consumer Key">Auth URL</label>
|
|
157
|
-
</div>
|
|
158
|
-
<div class="input">
|
|
159
|
-
<input
|
|
160
|
-
v-model="authState.oauthTwo.accessTokenURL"
|
|
161
|
-
autocomplete="off"
|
|
162
|
-
placeholder="Access Token URL"
|
|
163
|
-
spellcheck="false"
|
|
164
|
-
type="text" />
|
|
165
|
-
<label for="Consumer Key">Access Token URL</label>
|
|
166
|
-
</div>
|
|
167
|
-
<div class="input input__half">
|
|
168
|
-
<input
|
|
169
|
-
v-model="authState.oauthTwo.clientID"
|
|
170
|
-
autocomplete="off"
|
|
171
|
-
placeholder="Client ID"
|
|
172
|
-
spellcheck="false"
|
|
173
|
-
type="text" />
|
|
174
|
-
<label for="Consumer Key">Client ID</label>
|
|
175
|
-
</div>
|
|
176
|
-
<div class="input input__half">
|
|
177
|
-
<input
|
|
178
|
-
v-model="authState.oauthTwo.clientSecret"
|
|
179
|
-
autocomplete="off"
|
|
180
|
-
placeholder="Client Secret"
|
|
181
|
-
spellcheck="false"
|
|
182
|
-
type="text" />
|
|
183
|
-
<label for="Consumer Key">Client Secret</label>
|
|
184
|
-
</div>
|
|
185
|
-
<div class="input">
|
|
186
|
-
<input
|
|
187
|
-
v-model="authState.oauthTwo.scope"
|
|
188
|
-
autocomplete="off"
|
|
189
|
-
placeholder="Scope"
|
|
190
|
-
spellcheck="false"
|
|
191
|
-
type="text" />
|
|
192
|
-
<label for="Consumer Key">Scope</label>
|
|
193
|
-
</div>
|
|
194
|
-
<!-- @click="generateOauthTwoToken" -->
|
|
195
|
-
<button
|
|
196
|
-
class="scalar-api-client__item__content-button"
|
|
197
|
-
type="button">
|
|
198
|
-
Generate Token
|
|
199
|
-
</button>
|
|
200
|
-
</template>
|
|
201
|
-
<template v-else-if="authState.type === 'bearer'">
|
|
202
|
-
<div class="input">
|
|
203
|
-
<input
|
|
204
|
-
v-model="authState.bearer.token"
|
|
205
|
-
autocomplete="off"
|
|
206
|
-
placeholder="Username"
|
|
207
|
-
spellcheck="false"
|
|
208
|
-
type="text" />
|
|
209
|
-
<label for="Username">Token</label>
|
|
210
|
-
</div>
|
|
211
|
-
<label class="check">
|
|
212
|
-
<input
|
|
213
|
-
v-model="authState.bearer.active"
|
|
214
|
-
type="checkbox" />
|
|
215
|
-
<span class="checkmark" />
|
|
216
|
-
<p>Enabled</p>
|
|
217
|
-
</label>
|
|
218
|
-
</template>
|
|
219
|
-
</template>
|
|
220
|
-
</CollapsibleSection>
|
|
221
|
-
</template>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { CodeMirror } from '@scalar/use-codemirror'
|
|
3
|
-
|
|
4
|
-
import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
|
|
5
|
-
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
6
|
-
import { Grid } from '../../Grid'
|
|
7
|
-
|
|
8
|
-
defineProps<{
|
|
9
|
-
body?: string
|
|
10
|
-
formData?: any[]
|
|
11
|
-
}>()
|
|
12
|
-
|
|
13
|
-
const { activeRequest, setActiveRequest } = useApiClientRequestStore()
|
|
14
|
-
|
|
15
|
-
const updateActiveRequest = (value: string) => {
|
|
16
|
-
if (activeRequest.body !== value) {
|
|
17
|
-
setActiveRequest({
|
|
18
|
-
...activeRequest,
|
|
19
|
-
body: value,
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
24
|
-
<template>
|
|
25
|
-
<CollapsibleSection title="Body">
|
|
26
|
-
<template
|
|
27
|
-
v-if="body && body.length === 0 && formData && formData.length === 0">
|
|
28
|
-
<span>No Body</span>
|
|
29
|
-
</template>
|
|
30
|
-
<template v-else-if="formData && formData.length > 0">
|
|
31
|
-
<Grid :items="formData" />
|
|
32
|
-
</template>
|
|
33
|
-
<CodeMirror
|
|
34
|
-
v-else
|
|
35
|
-
:content="activeRequest.body"
|
|
36
|
-
:languages="['json']"
|
|
37
|
-
lineNumbers
|
|
38
|
-
@change="updateActiveRequest" />
|
|
39
|
-
</CollapsibleSection>
|
|
40
|
-
</template>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
3
|
-
import { Grid } from '../../Grid'
|
|
4
|
-
|
|
5
|
-
defineProps<{ headers?: any[] }>()
|
|
6
|
-
</script>
|
|
7
|
-
<template>
|
|
8
|
-
<CollapsibleSection title="Headers">
|
|
9
|
-
<template v-if="!headers || headers.length === 0">
|
|
10
|
-
<div class="scalar-api-client__empty-state">No Headers</div>
|
|
11
|
-
</template>
|
|
12
|
-
<template v-else>
|
|
13
|
-
<Grid :items="headers" />
|
|
14
|
-
<!-- @addAnother="addQuery"
|
|
15
|
-
@deleteItem="deleteQuery"
|
|
16
|
-
@toggleDescription="toggleDescription"
|
|
17
|
-
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
18
|
-
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
19
|
-
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
20
|
-
@updateOrder="updateQueryOrder"
|
|
21
|
-
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
22
|
-
</template>
|
|
23
|
-
</CollapsibleSection>
|
|
24
|
-
</template>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Query } from '../../../types'
|
|
3
|
-
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
4
|
-
import { Grid } from '../../Grid'
|
|
5
|
-
|
|
6
|
-
defineProps<{ queries?: Query[] }>()
|
|
7
|
-
</script>
|
|
8
|
-
<template>
|
|
9
|
-
<CollapsibleSection title="Query Parameters">
|
|
10
|
-
<template v-if="!queries || queries.length === 0">
|
|
11
|
-
<div class="scalar-api-client__empty-state">No Query Parameters</div>
|
|
12
|
-
</template>
|
|
13
|
-
<template v-else>
|
|
14
|
-
<Grid :items="queries" />
|
|
15
|
-
<!-- @addAnother="addQuery"
|
|
16
|
-
@deleteItem="deleteQuery"
|
|
17
|
-
@toggleDescription="toggleDescription"
|
|
18
|
-
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
19
|
-
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
20
|
-
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
21
|
-
@updateOrder="updateQueryOrder"
|
|
22
|
-
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
23
|
-
</template>
|
|
24
|
-
</CollapsibleSection>
|
|
25
|
-
</template>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { BaseParameter } from '../../../types'
|
|
3
|
-
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
4
|
-
import { Grid } from '../../Grid'
|
|
5
|
-
|
|
6
|
-
defineProps<{ variables?: BaseParameter[] }>()
|
|
7
|
-
</script>
|
|
8
|
-
<template>
|
|
9
|
-
<CollapsibleSection title="Variables">
|
|
10
|
-
<template v-if="!variables || variables.length === 0">
|
|
11
|
-
<div class="scalar-api-client__empty-state">No variables</div>
|
|
12
|
-
</template>
|
|
13
|
-
<template v-else>
|
|
14
|
-
<Grid :items="variables" />
|
|
15
|
-
<!-- @addAnother="addQuery"
|
|
16
|
-
@deleteItem="deleteQuery"
|
|
17
|
-
@toggleDescription="toggleDescription"
|
|
18
|
-
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
19
|
-
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
20
|
-
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
21
|
-
@updateOrder="updateQueryOrder"
|
|
22
|
-
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
23
|
-
</template>
|
|
24
|
-
</CollapsibleSection>
|
|
25
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Request } from './Request.vue'
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useApiClientRequestStore } from '../../stores/apiClientRequestStore'
|
|
3
|
-
import RequestHistoryItem from './RequestHistoryItem.vue'
|
|
4
|
-
|
|
5
|
-
defineEmits<{
|
|
6
|
-
(e: 'toggle'): void
|
|
7
|
-
}>()
|
|
8
|
-
|
|
9
|
-
const { requestHistoryOrder } = useApiClientRequestStore()
|
|
10
|
-
</script>
|
|
11
|
-
<template>
|
|
12
|
-
<div class="navigation-content-item">
|
|
13
|
-
<div class="navtable">
|
|
14
|
-
<div class="navtable-table">
|
|
15
|
-
<div class="navtable-item navtable-item__top">
|
|
16
|
-
<div class="navtable-item-40">
|
|
17
|
-
<label for="">Request</label>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="navtable-item-40">
|
|
20
|
-
<label for="">Response</label>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="navtable-item-20">
|
|
23
|
-
<label for="">TIME</label>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="navtable-radios">
|
|
27
|
-
<RequestHistoryItem
|
|
28
|
-
v-for="history in requestHistoryOrder"
|
|
29
|
-
:key="history"
|
|
30
|
-
:history="history" />
|
|
31
|
-
</div>
|
|
32
|
-
<div class="navtable-mock">
|
|
33
|
-
<div class="navtable-item">
|
|
34
|
-
<div class="navtable-item-40" />
|
|
35
|
-
<div class="navtable-item-40" />
|
|
36
|
-
<div class="navtable-item-20" />
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<style>
|
|
45
|
-
.navtable-mock {
|
|
46
|
-
background-repeat: repeat;
|
|
47
|
-
width: 100%;
|
|
48
|
-
background-image: linear-gradient(
|
|
49
|
-
0deg,
|
|
50
|
-
var(--theme-border-color) 1px,
|
|
51
|
-
--theme-background-1 1px
|
|
52
|
-
);
|
|
53
|
-
background-size: 31px 31px;
|
|
54
|
-
background-position: center 1px;
|
|
55
|
-
flex: 1;
|
|
56
|
-
position: relative;
|
|
57
|
-
}
|
|
58
|
-
.navtable-mock .navtable-item {
|
|
59
|
-
position: absolute;
|
|
60
|
-
width: 100%;
|
|
61
|
-
height: 100%;
|
|
62
|
-
left: 0;
|
|
63
|
-
top: 0;
|
|
64
|
-
background: transparent;
|
|
65
|
-
border-top: none;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.radio {
|
|
69
|
-
height: 16px;
|
|
70
|
-
width: 16px;
|
|
71
|
-
background: transparent;
|
|
72
|
-
border: var(--border);
|
|
73
|
-
flex-shrink: 0;
|
|
74
|
-
margin-right: 6px;
|
|
75
|
-
margin-left: 4px;
|
|
76
|
-
border-radius: 50%;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
outline: none;
|
|
81
|
-
}
|
|
82
|
-
.radio:before {
|
|
83
|
-
content: '';
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
width: 100%;
|
|
88
|
-
height: 100%;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
}
|
|
91
|
-
.navtable-item__active .radio:after {
|
|
92
|
-
content: '';
|
|
93
|
-
width: 5px;
|
|
94
|
-
height: 8px;
|
|
95
|
-
border: solid white;
|
|
96
|
-
border-width: 0 1.5px 1.5px 0;
|
|
97
|
-
transform: rotate(45deg) translate3d(-0.5px, -1px, 0);
|
|
98
|
-
}
|
|
99
|
-
.radio.post {
|
|
100
|
-
background: var(--theme-post-color);
|
|
101
|
-
}
|
|
102
|
-
.radio.delete {
|
|
103
|
-
background: var(--theme-delete-color);
|
|
104
|
-
}
|
|
105
|
-
.radio.patch {
|
|
106
|
-
background: var(--theme-patch-color);
|
|
107
|
-
}
|
|
108
|
-
.radio.get {
|
|
109
|
-
background: var(--theme-get-color);
|
|
110
|
-
}
|
|
111
|
-
.radio.put {
|
|
112
|
-
background: var(--theme-put-color);
|
|
113
|
-
}
|
|
114
|
-
</style>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import TimeAgo from 'javascript-time-ago'
|
|
3
|
-
import en from 'javascript-time-ago/locale/en'
|
|
4
|
-
import prettyBytes from 'pretty-bytes'
|
|
5
|
-
import prettyMilliseconds from 'pretty-ms'
|
|
6
|
-
|
|
7
|
-
import { useApiClientRequestStore } from '../../stores/apiClientRequestStore'
|
|
8
|
-
import { type ClientResponse } from '../../types'
|
|
9
|
-
|
|
10
|
-
defineProps<{ history: string }>()
|
|
11
|
-
TimeAgo.addLocale(en)
|
|
12
|
-
const timeAgo = new TimeAgo('en-US')
|
|
13
|
-
|
|
14
|
-
const { requestHistory, activeRequestId, setActiveResponse } =
|
|
15
|
-
useApiClientRequestStore()
|
|
16
|
-
|
|
17
|
-
const getContentLength = (response: ClientResponse) => {
|
|
18
|
-
if (response?.headers?.['X-API-Client-Content-Length']) {
|
|
19
|
-
return prettyBytes(
|
|
20
|
-
parseFloat(response.headers['X-API-Client-Content-Length']),
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
return prettyBytes(0)
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
<template>
|
|
27
|
-
<div
|
|
28
|
-
class="navtable-item"
|
|
29
|
-
:class="{ 'navtable-item__active': activeRequestId === history }"
|
|
30
|
-
@click="setActiveResponse(history)">
|
|
31
|
-
<div class="navtable-item-40 navtable-item-request">
|
|
32
|
-
<button
|
|
33
|
-
class="radio"
|
|
34
|
-
:class="requestHistory[history].request.type.toLowerCase()"
|
|
35
|
-
type="button" />
|
|
36
|
-
<span>
|
|
37
|
-
<em>{{ requestHistory[history].request.type }}</em>
|
|
38
|
-
{{ requestHistory[history].request.url }}
|
|
39
|
-
</span>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="navtable-item-40 navtable-item-response">
|
|
42
|
-
<span>{{
|
|
43
|
-
prettyMilliseconds(requestHistory[history].response.duration)
|
|
44
|
-
}}</span>
|
|
45
|
-
<span
|
|
46
|
-
:class="`scalar-api-client__status--${String(
|
|
47
|
-
requestHistory[history].response.statusCode,
|
|
48
|
-
).charAt(0)}xx`">
|
|
49
|
-
{{ requestHistory[history].response.statusCode }}
|
|
50
|
-
</span>
|
|
51
|
-
<span>{{ getContentLength(requestHistory[history].response) }}</span>
|
|
52
|
-
</div>
|
|
53
|
-
<div class="navtable-item-20 navtable-item-time">
|
|
54
|
-
<span>
|
|
55
|
-
{{ timeAgo.format(requestHistory[history].sentTime) }}
|
|
56
|
-
</span>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</template>
|