Skip to content

Commit

Permalink
chore: add down time feature flag (#1342)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Sep 10, 2024
1 parent e772be6 commit a51a91f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
3 changes: 2 additions & 1 deletion config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ compliance_certificate=false
user_management_revamp=false
pm_authentication_processor=true
performance_monitor=false
new_analytics=false
new_analytics=false
down_time=false
27 changes: 18 additions & 9 deletions src/entryPoints/AuthModule/AuthEntry.res
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
@react.component
let make = () => {
<AuthInfoProvider>
<AuthWrapper>
<GlobalProvider>
<UserInfoProvider>
<HyperSwitchApp />
</UserInfoProvider>
</GlobalProvider>
</AuthWrapper>
</AuthInfoProvider>
open HyperswitchAtom
let {downTime} = featureFlagAtom->Recoil.useRecoilValueFromAtom
<>
<RenderIf condition={downTime}>
<UnderMaintenance />
</RenderIf>
<RenderIf condition={!downTime}>
<AuthInfoProvider>
<AuthWrapper>
<GlobalProvider>
<UserInfoProvider>
<HyperSwitchApp />
</UserInfoProvider>
</GlobalProvider>
</AuthWrapper>
</AuthInfoProvider>
</RenderIf>
</>
}
28 changes: 28 additions & 0 deletions src/entryPoints/AuthModule/UnderMaintenance.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@react.component
let make = () => {
open HeadlessUI
<>
<Transition
\"as"="span"
enter={"transition ease-out duration-300"}
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave={"transition ease-in duration-300"}
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
show={true}>
<div
className={`flex flex-row px-4 py-2 md:gap-8 gap-4 rounded whitespace-nowrap text-fs-13 bg-yellow-200 border-yellow-200 font-semibold justify-center`}>
<div className="flex gap-2">
<div className="flex text-gray-500 items-center">
{`Hyperswitch Control Center is under maintenance`->React.string}
</div>
</div>
</div>
</Transition>
<NoDataFound
message="Hyperswitch Control Center is under maintenance will be back in an hour"
renderType=LoadError
/>
</>
}
2 changes: 2 additions & 0 deletions src/entryPoints/FeatureFlagUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type featureFlag = {
pmAuthenticationProcessor: bool,
performanceMonitor: bool,
newAnalytics: bool,
downTime: bool,
}

let featureFlagType = (featureFlags: JSON.t) => {
Expand Down Expand Up @@ -73,6 +74,7 @@ let featureFlagType = (featureFlags: JSON.t) => {
pmAuthenticationProcessor: dict->getBool("pm_authentication_processor", false),
performanceMonitor: dict->getBool("performance_monitor", false),
newAnalytics: dict->getBool("new_analytics", false),
downTime: dict->getBool("down_time", false),
}
typedFeatureFlag
}

0 comments on commit a51a91f

Please sign in to comment.