[settingsSync] IJPL-188449 Settings Sync: No icon indicators for sync states

(cherry picked from commit e032801b59fad308dd60493494a88223763271c2)

GitOrigin-RevId: 47971dca77459b74707180568ca5521837dc5d32
This commit is contained in:
Sergey Pak
2025-05-22 20:08:21 +02:00
committed by intellij-monorepo-bot
parent ae7f835a19
commit 5edc6554bf
2 changed files with 25 additions and 23 deletions

View File

@@ -116,10 +116,12 @@ sync.restart.notification.submessage.plugins={0} plugin(s): {1}\u2026
# {0} - IDE name, i.e. Android Studio, MPS, etc.
sync.restart.notification.action=Restart {0}
sync.status.enabled=Backup and Sync is enabled
sync.status.will.enable=Backup and Sync will be enabled
# {0} - name of Apply button
sync.status.will.enable=Pending, click "{0}" to start syncing
sync.status.disabled=Backup and Sync disabled
sync.status.will.disable=Backup and Sync will be disabled
sync.status.action.required=Action required: {0}
sync.status.action.required.comment=Pending, click "{0}" to {1}
sync.status.failed=Sync failed: {0}
sync.status.login.message=Login to enable Backup and Sync
# {0} is last sync time (human-readable), after (in a different component) goes a user-name, for example: "Last synced 5 minutes ago for John.Doe"

View File

@@ -1,6 +1,8 @@
package com.intellij.settingsSync.core.config
import com.intellij.BundleBase
import com.intellij.CommonBundle
import com.intellij.icons.AllIcons
import com.intellij.ide.BrowserUtil
import com.intellij.ide.DataManager
@@ -249,6 +251,7 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco
userId = userDropDownLink.selectedItem?.userId
providerCode = userDropDownLink.selectedItem?.providerCode
}
cellDropDownLink.comment?.text = ""
if (enableCheckbox.isSelected) {
syncConfigPanel.apply()
}
@@ -360,7 +363,9 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco
withContext(Dispatchers.EDT) {
triggerUpdateConfigurable()
}
cellDropDownLink.comment?.text = message("sync.status.will.enable")
cellDropDownLink.comment?.text = "<icon src='AllIcons.General.History'>&nbsp;" +
message("sync.status.will.enable",
CommonBundle.getApplyButtonText().replace(BundleBase.MNEMONIC_STRING, ""))
} else {
enableCheckbox.isSelected = false
}
@@ -611,34 +616,29 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco
cellDropDownLink.comment?.text = "" //message("sync.status.disabled.message")
return
}
val currentStatus = SettingsSyncStatusTracker.getInstance().currentStatus
actionRequired.set(currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired)
if (SettingsSyncSettings.getInstance().syncEnabled) {
val currentStatus = SettingsSyncStatusTracker.getInstance().currentStatus
actionRequired.set(currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired)
when(currentStatus) {
SettingsSyncStatusTracker.SyncStatus.Success -> {
//statusLabel.icon = icons.SettingsSyncIcons.StatusEnabled
if (currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired) {
actionRequiredAction = { currentStatus.execute(syncConfigPanel) }
actionRequiredLabel.text = currentStatus.message
actionRequiredButton.text = currentStatus.actionTitle
cellDropDownLink.comment?.text = message("sync.status.action.required.comment", currentStatus.actionTitle, currentStatus.message)
} else {
cellDropDownLink.comment?.text = ""
actionRequiredAction = null
actionRequiredLabel.text = ""
actionRequiredButton.text = ""
if (currentStatus == SettingsSyncStatusTracker.SyncStatus.Success) {
val lastSyncTime = SettingsSyncStatusTracker.getInstance().getLastSyncTime()
if (lastSyncTime > 0) {
cellDropDownLink.comment?.text = message("sync.status.last.sync.message", DateFormatUtil.formatPrettyDateTime(lastSyncTime))
cellDropDownLink.comment?.text = "<icon src='AllIcons.General.GreenCheckmark'>&nbsp;" + message("sync.status.last.sync.message", DateFormatUtil.formatPrettyDateTime(lastSyncTime))
} else {
cellDropDownLink.comment?.text = message("sync.status.enabled")
}
}
is SettingsSyncStatusTracker.SyncStatus.Error -> {
} else if (currentStatus is SettingsSyncStatusTracker.SyncStatus.Error) {
cellDropDownLink.comment?.text = message("sync.status.failed", currentStatus.errorMessage)
//statusLabel.icon = AllIcons.General.Error
}
is SettingsSyncStatusTracker.SyncStatus.ActionRequired -> {
actionRequiredAction = { currentStatus.execute(syncConfigPanel) }
actionRequiredLabel.text = currentStatus.message
actionRequiredButton.text = currentStatus.actionTitle
//actionRequiredData = Pair(currentStatus.message, currentStatus.actionTitle)
/*
cellDropDownLink.comment?.text = message("sync.status.action.required", currentStatus.message)
//statusLabel.icon = AllIcons.General.BalloonWarning
enableCheckbox.text = currentStatus.actionTitle
*/
}
}
}