From 718d55608020f521a81752c9df7ca8b986a60fb8 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Mon, 18 Jan 2021 14:59:34 -0700 Subject: [PATCH] rename stuff --- agent/src/Handler/Apps.hs | 25 ++++++++++++------------ agent/src/Handler/Types/Apps.hs | 10 +++++----- agent/src/Lib/External/AppManifest.hs | 28 +++++++++++++-------------- agent/src/Lib/Types/ServerApp.hs | 12 ++++++------ 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/agent/src/Handler/Apps.hs b/agent/src/Handler/Apps.hs index 1ee581fbb..563dac58f 100644 --- a/agent/src/Handler/Apps.hs +++ b/agent/src/Handler/Apps.hs @@ -210,7 +210,7 @@ getAvailableAppByIdLogic appId = do , appAvailableFullReleaseNotes = storeAppVersionInfoReleaseNotes latest , appAvailableFullDependencyRequirements = HM.elems dependencyRequirements , appAvailableFullVersions = storeAppVersionInfoVersion <$> storeAppVersions - , appAvailableFullInstallWarning = storeAppVersionInfoInstallWarning latest + , appAvailableFullInstallAlert = storeAppVersionInfoInstallAlert latest } getAppLogsByIdR :: AppId -> Handler (JSONResponse [Text]) @@ -287,7 +287,7 @@ getInstalledAppByIdLogic appId = do , appInstalledFullLastBackup = backupTime , appInstalledFullTorAddress = Nothing , appInstalledFullConfiguredRequirements = [] - , appInstalledFullUninstallWarning = Nothing + , appInstalledFullUninstallAlert = Nothing } serverApps <- AppMgr2.list [AppMgr2.flags|-s -d|] let remapped = remapAppMgrInfo jobCache serverApps @@ -318,16 +318,15 @@ getInstalledAppByIdLogic appId = do manifest <- lift $ LAsync.wait manifest' instructions <- lift $ LAsync.wait instructions' backupTime <- lift $ LAsync.wait backupTime' - pure AppInstalledFull - { appInstalledFullBase = AppBase appId infoResTitle (iconUrl appId version) - , appInstalledFullStatus = status - , appInstalledFullVersionInstalled = version - , appInstalledFullInstructions = instructions - , appInstalledFullLastBackup = backupTime - , appInstalledFullTorAddress = infoResTorAddress - , appInstalledFullConfiguredRequirements = HM.elems requirements - , appInstalledFullUninstallWarning = manifest >>= AppManifest.appManifestUninstallWarning - } + pure AppInstalledFull { appInstalledFullBase = AppBase appId infoResTitle (iconUrl appId version) + , appInstalledFullStatus = status + , appInstalledFullVersionInstalled = version + , appInstalledFullInstructions = instructions + , appInstalledFullLastBackup = backupTime + , appInstalledFullTorAddress = infoResTorAddress + , appInstalledFullConfiguredRequirements = HM.elems requirements + , appInstalledFullUninstallAlert = manifest >>= AppManifest.appManifestUninstallAlert + } runMaybeT (installing <|> installed) `orThrowM` NotFoundE "appId" (show appId) postUninstallAppR :: AppId -> Handler (JSONResponse (WithBreakages ())) @@ -651,7 +650,7 @@ getAvailableAppVersionInfoLogic appId appVersionSpec = do pure AppVersionInfo { appVersionInfoVersion = storeAppVersionInfoVersion , appVersionInfoReleaseNotes = storeAppVersionInfoReleaseNotes , appVersionInfoDependencyRequirements = HM.elems requirements - , appVersionInfoInstallWarning = storeAppVersionInfoInstallWarning + , appVersionInfoInstallAlert = storeAppVersionInfoInstallAlert } postAutoconfigureR :: AppId -> AppId -> Handler (JSONResponse (WithBreakages AutoconfigureChangesRes)) diff --git a/agent/src/Handler/Types/Apps.hs b/agent/src/Handler/Types/Apps.hs index 0529783b2..15ec0dd51 100644 --- a/agent/src/Handler/Types/Apps.hs +++ b/agent/src/Handler/Types/Apps.hs @@ -74,7 +74,7 @@ data AppAvailableFull = AppAvailableFull , appAvailableFullDescriptionShort :: Text , appAvailableFullDescriptionLong :: Text , appAvailableFullReleaseNotes :: Text - , appAvailableFullInstallWarning :: Maybe Text + , appAvailableFullInstallAlert :: Maybe Text , appAvailableFullDependencyRequirements :: [Full AppDependencyRequirement] , appAvailableFullVersions :: NonEmpty Version } @@ -131,7 +131,7 @@ data AppInstalledFull = AppInstalledFull , appInstalledFullInstructions :: Maybe Text , appInstalledFullLastBackup :: Maybe UTCTime , appInstalledFullConfiguredRequirements :: [Stripped AppDependencyRequirement] - , appInstalledFullUninstallWarning :: Maybe Text + , appInstalledFullUninstallAlert :: Maybe Text } instance ToJSON AppInstalledFull where toJSON AppInstalledFull {..} = object @@ -144,21 +144,21 @@ instance ToJSON AppInstalledFull where , "iconURL" .= appBaseIconUrl appInstalledFullBase , "versionInstalled" .= appInstalledFullVersionInstalled , "status" .= appInstalledFullStatus - , "uninstallWarning" .= appInstalledFullUninstallWarning + , "uninstallAlert" .= appInstalledFullUninstallAlert ] data AppVersionInfo = AppVersionInfo { appVersionInfoVersion :: Version , appVersionInfoReleaseNotes :: Text , appVersionInfoDependencyRequirements :: [Full AppDependencyRequirement] - , appVersionInfoInstallWarning :: Maybe Text + , appVersionInfoInstallAlert :: Maybe Text } instance ToJSON AppVersionInfo where toJSON AppVersionInfo {..} = object [ "version" .= appVersionInfoVersion , "releaseNotes" .= appVersionInfoReleaseNotes , "serviceRequirements" .= appVersionInfoDependencyRequirements - , "installWarning" .= appVersionInfoInstallWarning + , "installAlert" .= appVersionInfoInstallAlert ] data ApiDependencyViolation diff --git a/agent/src/Lib/External/AppManifest.hs b/agent/src/Lib/External/AppManifest.hs index 38aa07958..7e216e3e5 100644 --- a/agent/src/Lib/External/AppManifest.hs +++ b/agent/src/Lib/External/AppManifest.hs @@ -60,7 +60,7 @@ data AppManifest where , appManifestAssets :: [AssetMapping] , appManifestOnionVersion :: OnionVersion , appManifestDependencies :: HM.HashMap AppId VersionRange - , appManifestUninstallWarning :: Maybe Text + , appManifestUninstallAlert :: Maybe Text } -> AppManifest uiAvailable :: AppManifest -> Bool @@ -68,19 +68,19 @@ uiAvailable AppManifest {..} = isJust $ HM.lookup 80 appManifestPortMapping instance FromJSON AppManifest where parseJSON = withObject "App Manifest " $ \o -> do - appManifestId <- o .: "id" - appManifestVersion <- o .: "version" - appManifestTitle <- o .: "title" - appManifestDescShort <- o .: "description" >>= (.: "short") - appManifestDescLong <- o .: "description" >>= (.: "long") - appManifestReleaseNotes <- o .: "release-notes" - appManifestPortMapping <- o .: "ports" >>= fmap HM.fromList . traverse parsePortMapping - appManifestImageType <- o .: "image" >>= (.: "type") - appManifestMount <- o .: "mount" - appManifestAssets <- o .: "assets" >>= traverse parseJSON - appManifestOnionVersion <- o .: "hidden-service-version" - appManifestDependencies <- o .:? "dependencies" .!= HM.empty >>= traverse parseDepInfo - appManifestUninstallWarning <- o .:? "uninstall-warning" + appManifestId <- o .: "id" + appManifestVersion <- o .: "version" + appManifestTitle <- o .: "title" + appManifestDescShort <- o .: "description" >>= (.: "short") + appManifestDescLong <- o .: "description" >>= (.: "long") + appManifestReleaseNotes <- o .: "release-notes" + appManifestPortMapping <- o .: "ports" >>= fmap HM.fromList . traverse parsePortMapping + appManifestImageType <- o .: "image" >>= (.: "type") + appManifestMount <- o .: "mount" + appManifestAssets <- o .: "assets" >>= traverse parseJSON + appManifestOnionVersion <- o .: "hidden-service-version" + appManifestDependencies <- o .:? "dependencies" .!= HM.empty >>= traverse parseDepInfo + appManifestUninstallAlert <- o .:? "uninstall-alert" pure $ AppManifest { .. } where parsePortMapping = withObject "Port Mapping" $ \o -> liftA2 (,) (o .: "tor") (o .: "internal") diff --git a/agent/src/Lib/Types/ServerApp.hs b/agent/src/Lib/Types/ServerApp.hs index 27bb19386..1ffa0aebb 100644 --- a/agent/src/Lib/Types/ServerApp.hs +++ b/agent/src/Lib/Types/ServerApp.hs @@ -25,18 +25,18 @@ data StoreApp = StoreApp deriving (Eq, Show) data StoreAppVersionInfo = StoreAppVersionInfo - { storeAppVersionInfoVersion :: Version - , storeAppVersionInfoReleaseNotes :: Text - , storeAppVersionInfoInstallWarning :: Maybe Text + { storeAppVersionInfoVersion :: Version + , storeAppVersionInfoReleaseNotes :: Text + , storeAppVersionInfoInstallAlert :: Maybe Text } deriving (Eq, Show) instance Ord StoreAppVersionInfo where compare = compare `on` storeAppVersionInfoVersion instance FromJSON StoreAppVersionInfo where parseJSON = withObject "Store App Version Info" $ \o -> do - storeAppVersionInfoVersion <- o .: "version" - storeAppVersionInfoReleaseNotes <- o .: "release-notes" - storeAppVersionInfoInstallWarning <- o .: "install-warning" + storeAppVersionInfoVersion <- o .: "version" + storeAppVersionInfoReleaseNotes <- o .: "release-notes" + storeAppVersionInfoInstallAlert <- o .: "install-alert" pure StoreAppVersionInfo { .. } instance ToJSON StoreAppVersionInfo where toJSON StoreAppVersionInfo {..} =