Skip to content

Commit 7068b86

Browse files
Merge remote-tracking branch 'origin/master' into improve-ui-config-handling
2 parents 19352e3 + d42c5f8 commit 7068b86

File tree

11 files changed

+39
-29
lines changed

11 files changed

+39
-29
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
# was configured by the "Set up Go" step (otherwise, it'd use sudo's "go" executable)
2929
run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test ./... -race -coverprofile=coverage.txt -covermode=atomic
3030
- name: Codecov
31-
uses: codecov/[email protected].1
31+
uses: codecov/[email protected].2
3232
with:
3333
files: ./coverage.txt
3434
token: ${{ secrets.CODECOV_TOKEN }}

web/app/src/App.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
</div>
134134

135135
<a
136-
:href="`${SERVER_URL}/oidc/login`"
136+
:href="`/oidc/login`"
137137
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-11 px-8 w-full"
138138
@click="isOidcLoading = true"
139139
>
@@ -162,7 +162,6 @@ import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'
162162
import Social from './components/Social.vue'
163163
import Tooltip from './components/Tooltip.vue'
164164
import Loading from './components/Loading.vue'
165-
import { SERVER_URL } from '@/main'
166165
167166
const route = useRoute()
168167
@@ -188,7 +187,7 @@ const buttons = computed(() => window.config?.buttons ?? [])
188187
// Methods
189188
const fetchConfig = async () => {
190189
try {
191-
const response = await fetch(`${SERVER_URL}/api/v1/config`, { credentials: 'include' })
190+
const response = await fetch(`/api/v1/config`, { credentials: 'include' })
192191
if (response.status === 200) {
193192
const data = await response.json()
194193
config.value = data

web/app/src/components/SearchBar.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ const sortOptions = [
6464
6565
const emit = defineEmits(['search', 'update:showOnlyFailing', 'update:showRecentFailures', 'update:groupByGroup', 'update:sortBy', 'initializeCollapsedGroups'])
6666
67-
const handleFilterChange = (value) => {
67+
const handleFilterChange = (value, store = true) => {
6868
filterBy.value = value
69-
localStorage.setItem('gatus:filter-by', value)
69+
if (store)
70+
localStorage.setItem('gatus:filter-by', value)
7071
7172
// Reset all filter states first
7273
emit('update:showOnlyFailing', false)
@@ -80,9 +81,11 @@ const handleFilterChange = (value) => {
8081
}
8182
}
8283
83-
const handleSortChange = (value) => {
84+
const handleSortChange = (value, store = true) => {
8485
sortBy.value = value
85-
localStorage.setItem('gatus:sort-by', value)
86+
if (store)
87+
localStorage.setItem('gatus:sort-by', value)
88+
8689
emit('update:sortBy', value)
8790
emit('update:groupByGroup', value === 'group')
8891
@@ -93,8 +96,8 @@ const handleSortChange = (value) => {
9396
}
9497
9598
onMounted(() => {
96-
// Apply saved filter/sort state on load
97-
handleFilterChange(filterBy.value)
98-
handleSortChange(sortBy.value)
99+
// Apply saved or application wide filter/sort state on load but do not store it in localstorage
100+
handleFilterChange(filterBy.value, false)
101+
handleSortChange(sortBy.value, false)
99102
})
100103
</script>

web/app/src/main.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ import App from './App.vue'
33
import './index.css'
44
import router from './router'
55

6-
export const SERVER_URL = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:8080'
7-
86
createApp(App).use(router).mount('#app')

web/app/src/views/EndpointDetails.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ import Settings from '@/components/Settings.vue'
213213
import Pagination from '@/components/Pagination.vue'
214214
import Loading from '@/components/Loading.vue'
215215
import ResponseTimeChart from '@/components/ResponseTimeChart.vue'
216-
import { SERVER_URL } from '@/main.js'
217216
import { generatePrettyTimeAgo, generatePrettyTimeDifference } from '@/utils/time'
218217
219218
const router = useRouter()
@@ -228,7 +227,6 @@ const resultPageSize = 50
228227
const showResponseTimeChartAndBadges = ref(false)
229228
const showAverageResponseTime = ref(false)
230229
const selectedChartDuration = ref('24h')
231-
const serverUrl = SERVER_URL === '.' ? '..' : SERVER_URL
232230
const isRefreshing = ref(false)
233231
234232
const latestResult = computed(() => {
@@ -305,7 +303,7 @@ const lastCheckTime = computed(() => {
305303
const fetchData = async () => {
306304
isRefreshing.value = true
307305
try {
308-
const response = await fetch(`${serverUrl}/api/v1/endpoints/${route.params.key}/statuses?page=${currentPage.value}&pageSize=${resultPageSize}`, {
306+
const response = await fetch(`/api/v1/endpoints/${route.params.key}/statuses?page=${currentPage.value}&pageSize=${resultPageSize}`, {
309307
credentials: 'include'
310308
})
311309
@@ -386,15 +384,15 @@ const prettifyTimestamp = (timestamp) => {
386384
}
387385
388386
const generateHealthBadgeImageURL = () => {
389-
return `${serverUrl}/api/v1/endpoints/${endpointStatus.value.key}/health/badge.svg`
387+
return `/api/v1/endpoints/${endpointStatus.value.key}/health/badge.svg`
390388
}
391389
392390
const generateUptimeBadgeImageURL = (duration) => {
393-
return `${serverUrl}/api/v1/endpoints/${endpointStatus.value.key}/uptimes/${duration}/badge.svg`
391+
return `/api/v1/endpoints/${endpointStatus.value.key}/uptimes/${duration}/badge.svg`
394392
}
395393
396394
const generateResponseTimeBadgeImageURL = (duration) => {
397-
return `${serverUrl}/api/v1/endpoints/${endpointStatus.value.key}/response-times/${duration}/badge.svg`
395+
return `/api/v1/endpoints/${endpointStatus.value.key}/response-times/${duration}/badge.svg`
398396
}
399397
400398
onMounted(() => {

web/app/src/views/Home.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ import Settings from '@/components/Settings.vue'
193193
import Loading from '@/components/Loading.vue'
194194
import AnnouncementBanner from '@/components/AnnouncementBanner.vue'
195195
import PastAnnouncements from '@/components/PastAnnouncements.vue'
196-
import { SERVER_URL } from '@/main.js'
197196
198197
const props = defineProps({
199198
announcements: {
@@ -434,7 +433,7 @@ const fetchData = async () => {
434433
}
435434
try {
436435
// Fetch endpoints
437-
const endpointResponse = await fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=1&pageSize=${resultPageSize}`, {
436+
const endpointResponse = await fetch(`/api/v1/endpoints/statuses?page=1&pageSize=${resultPageSize}`, {
438437
credentials: 'include'
439438
})
440439
if (endpointResponse.status === 200) {
@@ -445,7 +444,7 @@ const fetchData = async () => {
445444
}
446445
447446
// Fetch suites
448-
const suiteResponse = await fetch(`${SERVER_URL}/api/v1/suites/statuses?page=1&pageSize=${resultPageSize}`, {
447+
const suiteResponse = await fetch(`/api/v1/suites/statuses?page=1&pageSize=${resultPageSize}`, {
449448
credentials: 'include'
450449
})
451450
if (suiteResponse.status === 200) {

web/app/src/views/SuiteDetails.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ import StepDetailsModal from '@/components/StepDetailsModal.vue'
154154
import Settings from '@/components/Settings.vue'
155155
import Loading from '@/components/Loading.vue'
156156
import { generatePrettyTimeAgo } from '@/utils/time'
157-
import { SERVER_URL } from '@/main'
158157
159158
const router = useRouter()
160159
const route = useRoute()
@@ -191,7 +190,7 @@ const fetchData = async () => {
191190
}
192191
193192
try {
194-
const response = await fetch(`${SERVER_URL}/api/v1/suites/${route.params.key}/statuses`, {
193+
const response = await fetch(`/api/v1/suites/${route.params.key}/statuses`, {
195194
credentials: 'include'
196195
})
197196

web/app/vue.config.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,19 @@ module.exports = {
66
filenameHashing: false,
77
productionSourceMap: false,
88
outputDir: '../static',
9-
publicPath: '/'
10-
}
9+
publicPath: '/',
10+
devServer: {
11+
port: 8081,
12+
https: false,
13+
client: {
14+
webSocketURL:'auto://0.0.0.0/ws'
15+
},
16+
proxy: {
17+
'^/api|^/css|^/oicd': {
18+
target: "http://localhost:8080",
19+
changeOrigin: true,
20+
secure: false,
21+
}
22+
}
23+
}
24+
}

web/static/css/app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/static/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)