diff --git a/site/src/components/files-tree-file/script.js b/site/src/components/files-tree-file/script.js
index dc735df..fbdbec1 100644
--- a/site/src/components/files-tree-file/script.js
+++ b/site/src/components/files-tree-file/script.js
@@ -15,6 +15,42 @@ export default
content: { type: Object }
},
+ computed:
+ {
+ visible()
+ {
+ // Get and clean search
+ const search = this.$store.state.files.search.replace(/\ /g, '').toLowerCase()
+
+ // If no search value, return true
+ if(search === '')
+ {
+ return true
+ }
+
+ // Set up fuzzy search
+ const text = this.content.data.path.full
+ let searchPosition = 0
+
+ // Go through each character in the text
+ for(let n = 0; n < text.length; n++)
+ {
+ // If match a character in the search, highlight it
+ if(searchPosition < search.length && text[n].toLowerCase() === search[searchPosition])
+ {
+ searchPosition += 1
+ }
+ }
+
+ if(searchPosition !== search.length)
+ {
+ return false
+ }
+
+ return true
+ }
+ },
+
methods:
{
onNameClick()
diff --git a/site/src/components/files-tree-file/template.html b/site/src/components/files-tree-file/template.html
index 6d68169..d96f4c7 100644
--- a/site/src/components/files-tree-file/template.html
+++ b/site/src/components/files-tree-file/template.html
@@ -1,4 +1,4 @@
-
+
diff --git a/site/src/components/files-tree/script.js b/site/src/components/files-tree/script.js
index 94ecf02..f612f03 100644
--- a/site/src/components/files-tree/script.js
+++ b/site/src/components/files-tree/script.js
@@ -5,6 +5,13 @@ export default
{
name: 'files-tree',
+ data()
+ {
+ return {
+ searchValue: ''
+ }
+ },
+
components:
{
FilesTreeFile,
@@ -17,5 +24,18 @@ export default
{
return this.$store.state.files.tree
}
+ },
+
+ watch:
+ {
+ searchValue: 'onSearchValueChange'
+ },
+
+ methods:
+ {
+ onSearchValueChange(value)
+ {
+ this.$store.commit('searchFile', value)
+ }
}
}
\ No newline at end of file
diff --git a/site/src/components/files-tree/template.html b/site/src/components/files-tree/template.html
index c2aaad2..3e2d26b 100644
--- a/site/src/components/files-tree/template.html
+++ b/site/src/components/files-tree/template.html
@@ -1,3 +1,4 @@
+
\ No newline at end of file
diff --git a/site/src/store/modules/files.js b/site/src/store/modules/files.js
index ad5f30f..6b0a1f9 100644
--- a/site/src/store/modules/files.js
+++ b/site/src/store/modules/files.js
@@ -5,7 +5,8 @@ export default {
{
tree: new FileTree({ autoWash: true }),
current: null,
- currentVersion: null
+ currentVersion: null,
+ search: ''
},
mutations:
@@ -53,6 +54,11 @@ export default {
setVersion(state, data)
{
state.currentVersion = data
+ },
+
+ searchFile(state, data)
+ {
+ state.search = data
}
}
}
\ No newline at end of file