Skip to content

Commit 11e4982

Browse files
committed
try new test file
1 parent afb574e commit 11e4982

File tree

3 files changed

+44
-19
lines changed

3 files changed

+44
-19
lines changed

.github/workflows/jscpd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"ignore": ["**node_modules**", "**dist**"],
44
"gitignore": true,
55
"threshold": 50,
6-
"minLines": 5,
6+
"minLines": 3,
77
"output": "./",
88
"reporters": ["json"]
99
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import { Ec2InstanceNode } from './explorer/ec2InstanceNode'
6+
import { Ec2Node } from './explorer/ec2ParentNode'
7+
import { Ec2Prompter, instanceFilter, Ec2Selection } from './prompter'
8+
import { copyToClipboard } from '../../shared/utilities/messages'
9+
import { getLogger } from '../../shared/logger'
10+
import { ec2LogSchema } from './ec2LogDocumentProvider'
11+
import { getAwsConsoleUrl } from '../../shared/awsConsole'
12+
import { showRegionPrompter } from '../../auth/utils'
13+
import { openUrl } from '../../shared/utilities/vsCodeUtils'
14+
import { showFile } from '../../shared/utilities/textDocumentUtilities'
15+
16+
export function refreshExplorer(node?: Ec2Node) {
17+
if (node) {
18+
const n = node instanceof Ec2InstanceNode ? node.parent : node
19+
n.refreshNode().catch((e) => {
20+
getLogger().error('refreshNode failed: %s', (e as Error).message)
21+
})
22+
}
23+
}
24+
25+
export async function linkToLaunchInstance(node?: Ec2Node) {
26+
const region = node ? node.regionCode : (await showRegionPrompter('Select Region', '')).id
27+
const url = getAwsConsoleUrl('ec2-launch', region)
28+
await openUrl(url)
29+
}
30+
31+
async function getSelection(node?: Ec2Node, filter?: instanceFilter): Promise<Ec2Selection> {
32+
const prompter = new Ec2Prompter(filter)
33+
const selection = node && node instanceof Ec2InstanceNode ? node.toSelection() : await prompter.promptUser()
34+
return selection
35+
}
36+
37+
export async function copyInstanceId(instanceId: string): Promise<void> {
38+
await copyToClipboard(instanceId, 'Id')
39+
}
40+
41+
export async function openLogDocument(node?: Ec2InstanceNode): Promise<void> {
42+
return await showFile(ec2LogSchema.form(await getSelection(node)))
43+
}

packages/core/src/awsService/ec2/util2.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)