-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
index: Add dropdown for picking release
It allows the user to choose the extensions's release. Pushing the VSCode button will redirect to a url that has that particular release. Signed-off-by: Filip Zajdel <[email protected]>
- Loading branch information
1 parent
391e851
commit c579b5f
Showing
7 changed files
with
94 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import { NormalisedApp } from '../schema'; | ||
import Select from 'react-select'; | ||
|
||
interface Props { | ||
app: NormalisedApp; | ||
onReleaseChosen: (tag: string) => void; | ||
}; | ||
|
||
function ReleasesDropDownList({ app, onReleaseChosen }: Props): JSX.Element { | ||
|
||
const releases = [{ label: app.defaultBranch, value: app.defaultBranch }]; | ||
|
||
app.releases.reduce((releaseList, release) => { | ||
releaseList.push({label: release.name, value: release.tag ?? ""}); | ||
return releaseList; | ||
}, releases); | ||
|
||
return ( | ||
<Select | ||
instanceId={`${app.id}-release-select`} | ||
defaultValue={releases[0]} | ||
options={releases} | ||
className="dropdown" | ||
menuPlacement="auto" | ||
onChange={(option) => { onReleaseChosen(option ? option.value : ""); }} | ||
hideSelectedOptions={true} | ||
/> | ||
) | ||
} | ||
|
||
export default ReleasesDropDownList; |
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,32 @@ | ||
/* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import { NormalisedApp } from '../schema'; | ||
|
||
|
||
class VSCodeQueryParams{ | ||
app: string; | ||
branch: string; | ||
manifest: string; | ||
repo: string; | ||
|
||
constructor(app: NormalisedApp) { | ||
this.app = app.name; | ||
this.branch = app.defaultBranch; | ||
this.manifest = app.manifest ?? ""; | ||
this.repo = app.repo; | ||
} | ||
|
||
toString(): string { | ||
return new URLSearchParams({ | ||
app: this.app, | ||
branch: this.branch, | ||
manifest: this.manifest, | ||
repo: this.repo, | ||
}).toString(); | ||
} | ||
}; | ||
|
||
export default VSCodeQueryParams; |
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