Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web-ui] Only truncate long evidence names #1504

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ limitations under the License.
<template>
<v-app id="app">
<nav class="navbar">
<v-app-bar flat :elevation="1" >
<v-app-bar flat :elevation="1">
<template v-slot:prepend>
<v-img src="./turbinia-logo-mark.png" height="50" width="70"></v-img>
</template>
Expand Down Expand Up @@ -60,6 +60,14 @@ import RequestList from './components/RequestList.vue'
import TaskDetails from './components/TaskDetails.vue'
import ApiClient from './utils/RestApiClient.js'

export function truncate(text, length, suffix) {
if (text.length > length) {
return text.substring(0, length) + suffix;
} else {
return text;
}
}

export default {
name: 'app',
components: { RequestList, TaskDetails },
Expand Down Expand Up @@ -92,7 +100,7 @@ import { useTheme } from 'vuetify'

const theme = useTheme()

function toggleTheme () {
function toggleTheme() {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/RequestList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ limitations under the License.
import ApiClient from '../utils/RestApiClient.js'
import TaskList from './TaskList.vue'
import { mergeProps } from 'vue'
import { truncate } from '../App.vue'

export default {
components: { TaskList },
Expand Down Expand Up @@ -151,7 +152,7 @@ export default {
failed_tasks: data[req].failed_tasks,
outstanding_perc: outstanding_perc,
status: data[req].status,
evidence_name: data[req].evidence_name.substring(0, 64) + '...',
evidence_name: truncate(data[req].evidence_name, 64, '...'),
evidence_id: data[req].evidence_id,
})
}
Expand Down