Skip to content

Commit

Permalink
Merge branch 'main' into feature/#460
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom authored Sep 14, 2024
2 parents 0b7285e + 0b0143e commit 46cd0fa
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CompareScreenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ jobs:
run: |
./gradlew compareRoborazziDebug compareRoborazziDesktop compareRoborazziJvm compareRoborazziIosArm64 compareRoborazziIosX64 --stacktrace --info
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff
path: |
**/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff-reports
Expand All @@ -75,7 +75,7 @@ jobs:
**/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff-test-results
Expand All @@ -88,7 +88,7 @@ jobs:
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: pr
path: pr/
6 changes: 3 additions & 3 deletions .github/workflows/StoreScreenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ jobs:
cd ..
./gradlew recordRoborazziDebug recordRoborazziDesktop recordRoborazziJvm recordRoborazziIosX64 recordRoborazziIosArm64 --stacktrace
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot
path: |
**/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-reports
Expand All @@ -58,7 +58,7 @@ jobs:
**/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-test-results
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
./gradlew roborazzi-idea-plugin:build --stacktrace
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: roborazzi-plugin-jar
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/compare-verify-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ jobs:
echo "Roborazzi should verify changes"
exit 1
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff
path: sample-android/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff-reports
path: sample-android/build/reports
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: screenshot-diff-test-results
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
docker-version: ${{ env.DOCKER_VERSION }}

- name: Upload documentation
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: docs
path: |
Expand All @@ -62,7 +62,7 @@ jobs:

steps:
- name: Download artifacts
uses: actions/download-artifact@18f0f591fbc635562c815484d73b6e8e3980482e # v1
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: docs
path: artifacts
Expand All @@ -81,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: docs

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
cd include-build
./gradlew roborazzi-gradle-plugin:check --stacktrace
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: test-reports
path: include-build/roborazzi-gradle-plugin/build/reports
retention-days: 30

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: test-test-results
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cd include-build
./gradlew test jvmTest --stacktrace -x testReleaseUnitTest
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: ${{ always() }}
with:
name: tests-reports
Expand Down
2 changes: 1 addition & 1 deletion roborazzi-idea-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "io.github.takahirom.roborazzi"
version = "1.7.0"
version = "1.8.0"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PreviewViewModel {

var coroutineScope = MainScope()
val imagesStateFlow = MutableStateFlow<List<Pair<String, Long>>>(listOf())
private val searchText = MutableStateFlow("")
private val lastEditingFileName = MutableStateFlow<String?>(null)
val statusText = MutableStateFlow("No images found")
private val _dropDownUiState = MutableStateFlow(ActionToolbarUiState())
Expand Down Expand Up @@ -70,6 +71,16 @@ class PreviewViewModel {
}
}

fun onSearchTextChanged(project: Project, text: String) {
searchText.value = text
coroutineScope.launch {
updateListJob?.cancel()
refreshListProcess(project)
selectListIndexByCaret(project)
fetchTasks(project)
}
}

fun onRefreshButtonClicked(project: Project, selectedTaskName: String) {
roborazziLog("Executing task '$selectedTaskName'...")
_dropDownUiState.update { currentUiState ->
Expand Down Expand Up @@ -194,8 +205,14 @@ class PreviewViewModel {
}
}

allPreviewImageFiles.addAll(findImages(classes, files))
allPreviewImageFiles.addAll(findImages(functions, files))
allPreviewImageFiles.addAll(
findImages(classes, files)
.filter { it.name.contains(searchText.value, ignoreCase = true) }
)
allPreviewImageFiles.addAll(
findImages(functions, files)
.filter { it.name.contains(searchText.value, ignoreCase = true) }
)

if (allPreviewImageFiles.isEmpty()) {
statusText.value = "No images found"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.intellij.ui.components.JBBox
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBList
import com.intellij.ui.components.JBScrollPane
import com.intellij.ui.components.JBTextField
import com.intellij.ui.content.ContentFactory
import com.intellij.util.containers.SLRUMap
import com.intellij.util.messages.MessageBusConnection
Expand All @@ -49,13 +50,17 @@ import javax.swing.JPanel
import javax.swing.JScrollPane
import javax.swing.ListCellRenderer
import javax.swing.ListSelectionModel
import javax.swing.event.DocumentEvent
import javax.swing.event.DocumentListener


class RoborazziPreviewToolWindowFactory : ToolWindowFactory {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val contentFactory = ContentFactory.getInstance()
val panel = RoborazziPreviewPanel(project)

val content = contentFactory.createContent(panel, "", false)

toolWindow.contentManager.addContent(content)

if (toolWindow is ToolWindowEx) {
Expand Down Expand Up @@ -160,6 +165,22 @@ class RoborazziPreviewPanel(project: Project) : JPanel(BorderLayout()) {
anchor = GridBagConstraints.WEST
insets = JBUI.insets(4)
})
add((JBTextField().apply {
emptyText.text = "Enter screenshot name..."
document.addDocumentListener(object : DocumentListener {
override fun insertUpdate(e: DocumentEvent) {
viewModel?.onSearchTextChanged(project, text)
}

override fun removeUpdate(e: DocumentEvent) {
viewModel?.onSearchTextChanged(project, text)
}

override fun changedUpdate(e: DocumentEvent) {
viewModel?.onSearchTextChanged(project, text)
}
})
}))
}, BorderLayout.SOUTH)
viewModel?.onInit(project)
imageList.addListSelectionListener { event ->
Expand Down

0 comments on commit 46cd0fa

Please sign in to comment.