-
Notifications
You must be signed in to change notification settings - Fork 60
Implement manage repositories workflow in serverless view #3126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mohitsuman
merged 12 commits into
redhat-developer:main
from
msivasubramaniaan:3055-implement-manage-repositories-workflow-in-serverless-view
Aug 31, 2023
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4f43a57
manage repo initial commit
msivasubramaniaan 150b434
add,edit and delete functionalites were added
msivasubramaniaan e31362e
Merge branch 'main' into 3055-implement-manage-repositories-workflow-…
msivasubramaniaan 5c6de2e
added telemetery
msivasubramaniaan 5d14acd
added telemetery
msivasubramaniaan d3acb59
refactor the method
msivasubramaniaan 189247f
Update src/webview/manage-repository/app/addRepository.tsx
msivasubramaniaan 0f1f948
changed the entire layout
msivasubramaniaan 0fccdf0
addressed review comments
msivasubramaniaan 090c217
removed loading button
msivasubramaniaan 44eef52
addressed review comments
msivasubramaniaan 2443ebb
desc changed
msivasubramaniaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,101 @@ | ||
| /*----------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Red Hat, Inc. All rights reserved. | ||
| * Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
| *-----------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as vscode from 'vscode'; | ||
| import { OdoImpl } from '../odo'; | ||
| import sendTelemetry from '../telemetry'; | ||
| import { Progress } from '../util/progress'; | ||
| import { ServerlessCommand } from './commands'; | ||
|
|
||
| export class ManageRepository { | ||
|
|
||
| private static instance: ManageRepository; | ||
|
|
||
| static getInstance(): ManageRepository { | ||
| if (!ManageRepository.instance) { | ||
| ManageRepository.instance = new ManageRepository(); | ||
| } | ||
| return ManageRepository.instance; | ||
| } | ||
|
|
||
| public async deleteRepo(name: string): Promise<boolean> { | ||
| await sendTelemetry('openshift.managerepo.delete', { | ||
| name | ||
| }); | ||
| const result = await OdoImpl.Instance.execute(ServerlessCommand.deleteRepo(name), '', false); | ||
| if (result.error) { | ||
| await sendTelemetry('openshift.managerepo.delete.error', { | ||
| error: result.error.message | ||
| }); | ||
| void vscode.window.showErrorMessage(result.error.message); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| public async renameRepo(oldName: string, newName: string): Promise<boolean> { | ||
| await sendTelemetry('openshift.managerepo.rename', { | ||
| oldName, | ||
| newName | ||
| }); | ||
| const result = await OdoImpl.Instance.execute(ServerlessCommand.renameRepo(oldName, newName), '', false); | ||
| if (result.error) { | ||
| await sendTelemetry('openshift.managerepo.rename.error', { | ||
| error: result.error.message | ||
| }); | ||
| void vscode.window.showErrorMessage(result.error.message); | ||
| return false; | ||
| } | ||
| await sendTelemetry('openshift.managerepo.rename.success', { | ||
| message: `Repo ${newName} renamed successfully` | ||
| }); | ||
| return true; | ||
| } | ||
|
|
||
| public async addRepo(name: string, url: string): Promise<boolean> { | ||
| await sendTelemetry('openshift.managerepo.add', { | ||
| name, url | ||
| }); | ||
| return new Promise<boolean>((resolve, _reject) => { | ||
| void Progress.execFunctionWithProgress(`Adding repository ${name}`, async () => { | ||
| const result = await OdoImpl.Instance.execute(ServerlessCommand.addRepo(name, url), '', false); | ||
| if (result.error) { | ||
| await sendTelemetry('openshift.managerepo.add.error', { | ||
| error: result.error.message | ||
| }); | ||
| void vscode.window.showErrorMessage(result.error.message); | ||
| resolve(false); | ||
| } else if (result.stdout.length === 0 && result.stderr.length === 0) { | ||
| await sendTelemetry('openshift.managerepo.add.success', { | ||
| name, | ||
| message: 'Repo added successfully' | ||
| }); | ||
| void vscode.window.showInformationMessage(`Repository ${name} added successfully`); | ||
| resolve(true); | ||
| } | ||
| await sendTelemetry('openshift.managerepo.add.error', { | ||
| error: result.stderr | ||
| }); | ||
| resolve(false); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| public async list(): Promise<string[]> { | ||
| await sendTelemetry('openshift.managerepo.list'); | ||
| const result = await OdoImpl.Instance.execute(ServerlessCommand.list(), '', false); | ||
| if (result.error) { | ||
| await sendTelemetry('openshift.managerepo.list.error', { | ||
| error: result.error.message | ||
| }); | ||
| void vscode.window.showErrorMessage(result.error.message); | ||
| return []; | ||
| } | ||
| await sendTelemetry('openshift.managerepo.list.success', { | ||
| repos: result.stdout.split('\n') | ||
| }); | ||
| return result.stdout.split('\n'); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.