-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as vscode from 'vscode'; | ||
import { globalContext } from './extension'; | ||
import { NotificationBuilder } from './notification'; | ||
import { MirrordStatus } from './status'; | ||
|
||
const RUN_COUNTER = 'mirrord-for-teams-counter'; | ||
const NOTIFICATION_STARTS_AT = 100; | ||
const NOTIFICATION_REPEATS_EVERY = 30; | ||
|
||
async function showMirrordForTeamsNotification(message: string) { | ||
new NotificationBuilder() | ||
.withMessage(message) | ||
.withGenericAction("Read more", async () => { | ||
await vscode.commands.executeCommand(MirrordStatus.mirrordForTeamsCommandId); | ||
}) | ||
.withDisableAction("promptMirrordForTeams") | ||
.info(); | ||
} | ||
|
||
export function tickMirrordForTeamsCounter(isDeploymentExec: boolean) { | ||
const counter = parseInt(globalContext.globalState.get(RUN_COUNTER) ?? '0') || 0; | ||
|
||
if (isDeploymentExec) { | ||
showMirrordForTeamsNotification( | ||
'When targeting multi-pod deployments, mirrord impersonates the first pod in the deployment.\n \ | ||
Support for multi-pod impersonation requires the mirrord operator, which is part of mirrord for Teams.' | ||
); | ||
} else if (counter >= NOTIFICATION_STARTS_AT) { | ||
if (counter === NOTIFICATION_STARTS_AT || (counter - NOTIFICATION_STARTS_AT) % NOTIFICATION_REPEATS_EVERY === 0) { | ||
showMirrordForTeamsNotification( | ||
'mirrord for Teams ' // TODO | ||
); | ||
} | ||
} | ||
|
||
globalContext.globalState.update(RUN_COUNTER, `${counter + 1}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.