Skip to content

Commit

Permalink
fix(regulations-admin): Update styling. Update presigned query. (#16007)
Browse files Browse the repository at this point in the history
* Update styling. Update presigned query

* little renaming

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
thordurhhh and kodiakhq[bot] authored Sep 16, 2024
1 parent 97928c5 commit 294d012
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/web/components/Regulations/RegulationTexts.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export type RegulationPageTexts = Partial<
| 'historyTitle' // 'Breytingasaga reglugerðar ${name}'
| 'historyStart' // 'Stofnreglugerð gefin út'
| 'historyStartAmending' // 'Reglugerðin gefin út'
| 'historyChange' // 'Breytt af ${name}'
| 'historyChange' // 'Breytt með ${name}'
| 'historyCancel' // 'Brottfelld af ${name}'
| 'historyCurrentVersion' // 'Núgildandi útgáfa'
| 'historyPastSplitter' // 'Gildandi breytingar'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'
import graphqlTypeJson from 'graphql-type-json'

import { UseGuards } from '@nestjs/common'
import { RegulationsService } from '@island.is/clients/regulations'
import { IdsUserGuard, ScopesGuard } from '@island.is/auth-nest-tools'
import {
RegulationSearchResults,
RegulationYears,
RegulationListItem,
} from '@island.is/regulations/web'
import { Audit } from '@island.is/nest/audit'
import {
Regulation,
RegulationDiff,
Expand All @@ -20,18 +21,20 @@ import { GetRegulationInput } from './dto/getRegulation.input'
import { GetRegulationsLawChaptersInput } from './dto/getRegulationsLawChapters.input'
import { GetRegulationsMinistriesInput } from './dto/getRegulationsMinistriesInput.input'
import { GetRegulationsSearchInput } from './dto/getRegulationsSearch.input'
import { CreatePresignedPostInput } from './dto/createPresignedPost.input'
import { CreateRegulationPresignedPostInput } from './dto/createPresignedPost.input'
import { PresignedPostResults } from '@island.is/regulations/admin'

const validPage = (page: number | undefined) => (page && page >= 1 ? page : 1)

@Audit({ namespace: '@island.is/api/regulations' })
@Resolver()
export class RegulationsResolver {
constructor(private regulationsService: RegulationsService) {}

@Mutation(() => graphqlTypeJson)
@Audit()
@UseGuards(IdsUserGuard, ScopesGuard)
@Mutation(() => graphqlTypeJson, { name: 'regulationCreatePresignedPost' })
createPresignedPost(
@Args('input') input: CreatePresignedPostInput,
@Args('input') input: CreateRegulationPresignedPostInput,
): Promise<PresignedPostResults | null> {
return this.regulationsService.createPresignedPost(
input.fileName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Field, InputType } from '@nestjs/graphql'
import { IsString } from 'class-validator'

@InputType()
export class CreatePresignedPostInput {
export class CreateRegulationPresignedPostInput {
@Field()
@IsString()
readonly fileName!: string
Expand Down
34 changes: 19 additions & 15 deletions libs/portals/admin/regulations-admin/src/components/TaskList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,37 @@ export const TaskList = () => {

if (loading) {
return (
<Box marginBottom={[4, 4, 8]}>
<Box paddingTop={1} marginBottom={[4, 4, 8]}>
<SkeletonLoader height={80} repeat={3} space={3} />
</Box>
)
}

if (error) {
return (
<ContentBlock>
<AlertMessage
type="error"
title={t(msg.errorTitle)}
message={t(msg.errorText)}
/>
</ContentBlock>
<Box paddingTop={1}>
<ContentBlock>
<AlertMessage
type="error"
title={t(msg.errorTitle)}
message={t(msg.errorText)}
/>
</ContentBlock>
</Box>
)
}

if (drafts && drafts.length === 0) {
return (
<ContentBlock>
<AlertMessage
type="default"
title={t(msg.noDataTitle)}
message={t(msg.noDataText)}
/>
</ContentBlock>
<Box paddingTop={1}>
<ContentBlock>
<AlertMessage
type="default"
title={t(msg.noDataTitle)}
message={t(msg.noDataText)}
/>
</ContentBlock>
</Box>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ImpactListItem = (props: ImpactListItemProps) => {
variant="small"
color={getCurrentEffect(effect) ? 'mint800' : 'blueberry600'}
>
Breytt af{' '}
Breytt með{' '}
{getCurrentEffect(effect) ? 'núverandi reglugerð' : effect.name}
</Text>
</a>
Expand Down
8 changes: 5 additions & 3 deletions libs/portals/admin/regulations-admin/src/utils/dataHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ type QueryResult<T> =
// ---------------------------------------------------------------------------

export const CreatePresignedPostMutation = gql`
mutation CreatePresignedPostMutation($input: CreatePresignedPostInput!) {
createPresignedPost(input: $input)
mutation CreatePresignedPostMutation(
$input: CreateRegulationPresignedPostInput!
) {
regulationCreatePresignedPost(input: $input)
}
`
export type UploadingState =
Expand Down Expand Up @@ -97,7 +99,7 @@ export const useS3Upload = () => {
},
},
})
return post.data?.createPresignedPost.data
return post.data?.regulationCreatePresignedPost.data
} catch (error) {
setUploadStatus({
uploading: false,
Expand Down

0 comments on commit 294d012

Please sign in to comment.