Skip to content

Commit

Permalink
Countdown showing Org Owners the number of days to the v1 soft shutdo…
Browse files Browse the repository at this point in the history
…wn in upgrade prompt footer (now April 28th), warning on upgrade attempt if v2 version is outdated
  • Loading branch information
danenania committed Apr 18, 2023
1 parent 5561ca8 commit fb23517
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,9 @@
],
"1.5.8": [
"Fix for v2 account upgrade issue when user hasn't entered master passphrase"
],
"1.5.9": [
"Countdown showing Org Owners the number of days to the v1 soft shutdown in upgrade prompt footer (now April 28th)",
"Warning if v2 version is outdated when running upgrade"
]
}
2 changes: 1 addition & 1 deletion envkey-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EnvKey",
"version": "1.5.8",
"version": "1.5.9",
"description": "EnvKey's cross-platform native app",
"author": "Dane Schneider <dane@envkey.com> (https://www.envkey.com)",
"homepage": "https://www.envkey.com",
Expand Down
7 changes: 6 additions & 1 deletion envkey-react/src/containers/main_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,13 @@ class Main extends React.Component {
if (
this._shouldShowV2UpgradeAlert()
){
const today = new Date();
const targetDate = new Date(2023, 3, 28); // Note that months are zero-based, so 3 represents April
const msPerDay = 24 * 60 * 60 * 1000;
const numDays = Math.floor((targetDate - today) / msPerDay);

return <div className="bottom-alert trial-alert">
<div>Your organization can be automatically upgraded to EnvKey v2.</div>
<div><span>Your org can be upgraded to EnvKey v2. In <strong>{numDays} days,</strong> your v1 org will change to read-only.</span></div>

<button onClick={()=> this.props.startV2Upgrade()}>Upgrade Org</button>
</div>
Expand Down
13 changes: 10 additions & 3 deletions envkey-react/src/sagas/v2_upgrade_sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const onFinishV2OrgUserUpgradeRequest = apiSaga({
urlFn: (action, currentOrg)=> `/orgs/${currentOrg.slug}/finish_v2_org_user_upgrade.json`
})

let warnedOutdatedV2 = false;

function *onCheckV2CoreProcAlive(action){
let res
Expand All @@ -130,8 +131,13 @@ function *onCheckV2CoreProcAlive(action){
return
}

if (!res.data.cliVersion || !semver.gte(res.data.cliVersion, "2.4.0")){
yield put({type: CHECK_V2_CORE_PROC_ALIVE_FAILED, payload: new Error("EnvKey v2 CLI version >= 2.3.0 required")})
if (!res.data.cliVersion || !semver.gte(res.data.cliVersion, "2.4.6")){
if (!warnedOutdatedV2){
alert("EnvKey v2 is running, but the version is outdated. Please make sure you're running the latest version of EnvKey v2.")
warnedOutdatedV2 = true;
}

yield put({type: CHECK_V2_CORE_PROC_ALIVE_FAILED, payload: new Error("EnvKey v2 CLI version >= 2.4.6 required")})
return
}

Expand All @@ -140,6 +146,7 @@ function *onCheckV2CoreProcAlive(action){

function *onV2WaitForCoreProcAlive(action){
let coreProcAlive = false;
warnedOutdatedV2 = false;

while (!coreProcAlive){
let canceled = yield select(getCanceledV2Upgrade)
Expand Down Expand Up @@ -170,7 +177,7 @@ function *onV2WaitForCoreProcAlive(action){
}
}

yield call(delay, 3000)
yield call(delay, 2000)
yield put({type: V2_WAIT_FOR_CORE_PROC_ALIVE_SUCCESS})
}

Expand Down

0 comments on commit fb23517

Please sign in to comment.