-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into org-library-mvp
# Conflicts: # backend/src/Designer/Controllers/PreviewController.cs # backend/src/Designer/Infrastructure/ServiceRegistration.cs
- Loading branch information
Showing
112 changed files
with
1,746 additions
and
364 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Deploy Gitea Runner for brg organization | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/deploy-gitea-runner-brg.yaml' | ||
- '.github/workflows/template-docker-push.yaml' | ||
- '.github/workflows/template-flux-config-push.yaml' | ||
- '.github/workflows/template-helm-push.yaml' | ||
- '.github/workflows/template-short-sha.yaml' | ||
- 'charts/gitea-runner-brg/**' | ||
- 'charts/gitea-runner-brg-config/**' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
environments: | ||
description: 'Environments to deploy to. Multiple environments can be specified by separating them with a comma.' | ||
required: false | ||
default: 'dev' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
get-short-sha: | ||
uses: ./.github/workflows/template-short-sha.yaml | ||
|
||
construct-environments-array: | ||
uses: ./.github/workflows/template-construct-environments.yaml | ||
with: | ||
environments: ${{ github.event.inputs.environments || 'dev,staging,prod' }} | ||
|
||
determine-tag: | ||
needs: get-short-sha | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.determine-tag.outputs.tag }} | ||
steps: | ||
- name: Determine tag | ||
id: determine-tag | ||
run: | | ||
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
echo "tag=${{ needs.get-short-sha.outputs.short-sha }}" >> $GITHUB_OUTPUT | ||
else | ||
sanitized_branch_name=$(echo "${{ github.ref_name }}" | tr -d '()' | tr '/' '-') | ||
echo "tag=${sanitized_branch_name}-${{ needs.get-short-sha.outputs.short-sha }}" >> $GITHUB_OUTPUT | ||
fi | ||
helm-push: | ||
needs: [get-short-sha, determine-tag] | ||
uses: ./.github/workflows/template-helm-push.yaml | ||
with: | ||
tag: 0.1.0+${{ needs.determine-tag.outputs.tag }} # Helm version needs to be valid sematic version | ||
chart-name: gitea-runner-brg | ||
registry-name: altinntjenestercontainerregistry.azurecr.io | ||
environment: dev # dev environment has push access and doesn't require review | ||
secrets: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }} | ||
|
||
flux-config-push: | ||
needs: [get-short-sha, helm-push, determine-tag, construct-environments-array] | ||
strategy: | ||
matrix: | ||
environment: ${{ fromJSON(needs.construct-environments-array.outputs.environmentsjson) }} | ||
uses: ./.github/workflows/template-flux-config-push.yaml | ||
with: | ||
tag: ${{ needs.determine-tag.outputs.tag }} | ||
registry-name: altinntjenestercontainerregistry.azurecr.io | ||
environment: ${{ matrix.environment }} | ||
config-chart-name: gitea-runner-brg-config | ||
artifact-name: gitea-runner-brg | ||
helm-set-arguments: chartVersion=0.1.0+${{ needs.determine-tag.outputs.tag }} | ||
trace-workflow: true | ||
trace-team-name: 'team-studio' | ||
secrets: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }} | ||
trace-connection-string: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }} | ||
trace-repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
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,127 @@ | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Helpers; | ||
using Altinn.Studio.Designer.Models; | ||
using Altinn.Studio.Designer.Models.Dto; | ||
using Altinn.Studio.Designer.Services.Interfaces; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
namespace Altinn.Studio.Designer.Controllers | ||
{ | ||
[ApiController] | ||
[Authorize] | ||
[AutoValidateAntiforgeryToken] | ||
[Route("designer/api/{org}/{app}/layouts/layoutSet/{layoutSetId}/")] | ||
public class LayoutController(ILayoutService layoutService) : Controller | ||
{ | ||
[EndpointSummary("Retrieve pages")] | ||
[ProducesResponseType<Pages>(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
[HttpGet("pages")] | ||
public async Task<ActionResult<Pages>> GetPages( | ||
[FromRoute] string org, | ||
[FromRoute] string app, | ||
[FromRoute] string layoutSetId | ||
) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); | ||
Pages pages = await layoutService.GetPagesByLayoutSetId(editingContext, layoutSetId); | ||
return Ok(pages); | ||
} | ||
|
||
[EndpointSummary("Create page")] | ||
[ProducesResponseType<Pages>(StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status409Conflict)] | ||
[HttpPost("pages")] | ||
public async Task<ActionResult<Page>> CreatePage( | ||
[FromRoute] string org, | ||
[FromRoute] string app, | ||
[FromRoute] string layoutSetId, | ||
[FromBody] Page page | ||
) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); | ||
|
||
Page existingPage = await layoutService.GetPageById(editingContext, layoutSetId, page.id); | ||
if (existingPage != null) | ||
{ | ||
return Conflict(); | ||
} | ||
await layoutService.CreatePage(editingContext, layoutSetId, page.id); | ||
return Created(); | ||
} | ||
|
||
[EndpointSummary("Retrieve page")] | ||
[ProducesResponseType<Page>(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
[HttpGet("pages/{pageId}")] | ||
[ProducesResponseType<Page>(StatusCodes.Status200OK)] | ||
public async Task<ActionResult<Page>> GetPage( | ||
[FromRoute] string org, | ||
[FromRoute] string app, | ||
[FromRoute] string layoutSetId, | ||
[FromRoute] string pageId | ||
) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); | ||
Page page = await layoutService.GetPageById(editingContext, layoutSetId, pageId); | ||
if (page == null) | ||
{ | ||
return NotFound(); | ||
} | ||
return Ok(page); | ||
} | ||
|
||
[EndpointSummary("Modify page")] | ||
[ProducesResponseType<Page>(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
[HttpPut("pages/{pageId}")] | ||
public async Task<ActionResult<Page>> ModifyPage( | ||
[FromRoute] string org, | ||
[FromRoute] string app, | ||
[FromRoute] string layoutSetId, | ||
[FromRoute] string pageId, | ||
[FromBody] Page page | ||
) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); | ||
Page existingPage = await layoutService.GetPageById(editingContext, layoutSetId, pageId); | ||
if (existingPage == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
await layoutService.UpdatePage(editingContext, layoutSetId, pageId, page); | ||
return Ok(); | ||
} | ||
|
||
[EndpointSummary("Delete page")] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
[HttpDelete("pages/{pageId}")] | ||
public async Task<ActionResult> DeletePage( | ||
[FromRoute] string org, | ||
[FromRoute] string app, | ||
[FromRoute] string layoutSetId, | ||
[FromRoute] string pageId | ||
) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); | ||
Page page = await layoutService.GetPageById(editingContext, layoutSetId, pageId); | ||
if (page == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
await layoutService.DeletePage(editingContext, layoutSetId, pageId); | ||
return Ok(); | ||
} | ||
} | ||
} |
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.