forked from vscode-kubernetes-tools/vscode-kubernetes-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding stricter tslint rules (vscode-kubernetes-tools#274)
* Adding stricter tslint rules * TSLint auto-fixing pass * Manual fixes for stuff TSLint couldnt fix
- Loading branch information
Showing
51 changed files
with
462 additions
and
525 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
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 |
---|---|---|
|
@@ -37,4 +37,3 @@ export function formPage(fd: FormData): string { | |
</form> | ||
</div>`; | ||
} | ||
|
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 |
---|---|---|
|
@@ -26,4 +26,3 @@ export class Git { | |
return { succeeded: false, error: [ sr.stderr ] }; | ||
} | ||
} | ||
|
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,49 @@ | ||
import { refreshExplorer } from '../clusterprovider/common/explorer'; | ||
import { promptKindName } from '../../extension'; | ||
import { host } from '../../host'; | ||
import * as kubectlUtils from '../../kubectlUtils'; | ||
import * as kuberesources from '../../kuberesources'; | ||
import * as explorer from '../../explorer'; | ||
import { Kubectl } from '../../kubectl'; | ||
|
||
export async function useNamespaceKubernetes(kubectl: Kubectl, explorerNode: explorer.KubernetesObject) { | ||
if (explorerNode) { | ||
if (await kubectlUtils.switchNamespace(kubectl, explorerNode.id)) { | ||
refreshExplorer(); | ||
host.showInformationMessage(`Switched to namespace ${explorerNode.id}`); | ||
return; | ||
} | ||
} | ||
|
||
const currentNS = await kubectlUtils.currentNamespace(kubectl); | ||
promptKindName( | ||
[kuberesources.allKinds.namespace], | ||
undefined, | ||
{ | ||
prompt: 'What namespace do you want to use?', | ||
placeHolder: 'Enter the namespace to switch to or press enter to select from available list', | ||
filterNames: [currentNS] | ||
}, | ||
switchToNamespace.bind(this, kubectl, currentNS) | ||
); | ||
} | ||
|
||
async function switchToNamespace (kubectl: Kubectl, currentNS: string, resource: string) { | ||
if (!resource) { | ||
return; | ||
} | ||
|
||
let toSwitchNamespace = resource; | ||
// resource will be of format <kind>/<name>, when picked up from the quickpick | ||
if (toSwitchNamespace.lastIndexOf('/') !== -1) { | ||
toSwitchNamespace = toSwitchNamespace.substring(toSwitchNamespace.lastIndexOf('/') + 1); | ||
} | ||
|
||
// Switch if an only if the currentNS and toSwitchNamespace are different | ||
if (toSwitchNamespace && currentNS !== toSwitchNamespace) { | ||
if (await kubectlUtils.switchNamespace(kubectl, toSwitchNamespace)) { | ||
refreshExplorer(); | ||
host.showInformationMessage(`Switched to namespace ${toSwitchNamespace}`); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.