-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trimmed batches and move components
- Loading branch information
1 parent
f292e80
commit 13c053a
Showing
10 changed files
with
67 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<span class="badge text-white" :class="['text-bg-' + color]" tabindex="0" style="display: inline-block;" | ||
type="button" data-bs-container="body" :data-bs-toggle="value.length > MAX_STRING_LENGTH ? 'tooltip' : ''" | ||
:data-bs-title="value" @click="copyToClipboard">{{ | ||
trimString(value) | ||
}}</span> | ||
</template> | ||
|
||
<script> | ||
import { useToast } from "vue-toastification"; | ||
export default { | ||
name: 'TrimmedBatch', | ||
props: { | ||
value: String, | ||
MAX_STRING_LENGTH: { | ||
default: 32, | ||
type: Number | ||
}, | ||
color: { | ||
default: 'primary', | ||
type: String | ||
}, | ||
}, | ||
data() { | ||
return { | ||
toast: useToast(), | ||
} | ||
}, | ||
methods: { | ||
trimString(string) { | ||
if (string.length < this.MAX_STRING_LENGTH) return string; | ||
return string.substring(0, this.MAX_STRING_LENGTH / 2 - 2) + "..." + string.substr(length - this.MAX_STRING_LENGTH / 2 + 2); | ||
}, | ||
copyToClipboard() { | ||
navigator.clipboard.writeText(this.value); | ||
this.toast.info(`Copied "${this.value}" to clipboard!`); | ||
}, | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters