From 0ba9055d28cb26e6e10ec963740006ed32d2d843 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 9 Jul 2020 11:36:07 +0200 Subject: [PATCH] KEYCLOAK-14709 removed circular dependency --- .../AbstractResourceTable.tsx | 2 +- .../my-resources-page/EditTheResource.tsx | 2 +- .../my-resources-page/MyResourcesPage.tsx | 42 +------------------ .../my-resources-page/PermissionRequest.tsx | 2 +- .../my-resources-page/PermissionSelect.tsx | 2 +- .../my-resources-page/ResourcesTable.tsx | 2 +- .../my-resources-page/ShareTheResource.tsx | 2 +- .../SharedResourcesTable.tsx | 2 +- .../my-resources-page/resource-model.ts | 40 ++++++++++++++++++ 9 files changed, 48 insertions(+), 48 deletions(-) create mode 100644 themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/resource-model.ts diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/AbstractResourceTable.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/AbstractResourceTable.tsx index e3b5d0dcd5..e1c6f40c8b 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/AbstractResourceTable.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/AbstractResourceTable.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Permission, PaginatedResources, Client } from './MyResourcesPage'; +import { Permission, PaginatedResources, Client } from './resource-model'; import { Msg } from '../../widgets/Msg'; export interface ResourcesTableProps { diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/EditTheResource.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/EditTheResource.tsx index 59d1f76c97..4d07174b95 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/EditTheResource.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/EditTheResource.tsx @@ -26,7 +26,7 @@ import { } from '@patternfly/react-core'; import { OkIcon } from '@patternfly/react-icons'; -import { Resource, Permission, Scope } from './MyResourcesPage'; +import { Resource, Permission, Scope } from './resource-model'; import { Msg } from '../../widgets/Msg'; import { AccountServiceContext } from '../../account-service/AccountServiceContext'; import { ContentAlert } from '../ContentAlert'; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/MyResourcesPage.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/MyResourcesPage.tsx index f1897c1970..a1aff52ca0 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/MyResourcesPage.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/MyResourcesPage.tsx @@ -23,6 +23,7 @@ import { Button, Level, LevelItem, Stack, StackItem, Tab, Tabs, TextInput } from import {HttpResponse} from '../../account-service/account.service'; import {AccountServiceContext} from '../../account-service/AccountServiceContext'; +import { PaginatedResources, Resource, Scope, Permission } from './resource-model'; import {ResourcesTable} from './ResourcesTable'; import {ContentPage} from '../ContentPage'; import {Msg} from '../../widgets/Msg'; @@ -39,47 +40,6 @@ export interface MyResourcesPageState { sharedWithMe: PaginatedResources; } -export interface Resource { - _id: string; - name: string; - client: Client; - scopes: Scope[]; - uris: string[]; - shareRequests: Permission[]; -} - -export interface Client { - baseUrl: string; - clientId: string; - name?: string; -} - -export class Scope { - public constructor(public name: string, public displayName?: string) {} - - public toString(): string { - if (this.hasOwnProperty('displayName') && (this.displayName)) { - return this.displayName; - } else { - return this.name; - } - } -} - -export interface PaginatedResources { - nextUrl: string; - prevUrl: string; - data: Resource[]; -} - -export interface Permission { - email?: string; - firstName?: string; - lastName?: string; - scopes: Scope[] | string[]; // this should be Scope[] - fix API - username: string; -} - const MY_RESOURCES_TAB = 0; const SHARED_WITH_ME_TAB = 1; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionRequest.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionRequest.tsx index d328035b8e..e9ea584e44 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionRequest.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionRequest.tsx @@ -35,7 +35,7 @@ import { HttpResponse } from '../../account-service/account.service'; import { AccountServiceContext } from '../../account-service/AccountServiceContext'; import { Msg } from '../../widgets/Msg'; import { ContentAlert } from '../ContentAlert'; -import { Resource, Scope, Permission } from './MyResourcesPage'; +import { Resource, Scope, Permission } from './resource-model'; interface PermissionRequestProps { diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionSelect.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionSelect.tsx index 38f84c54e1..8b9ca88053 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionSelect.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/PermissionSelect.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { Select, SelectOption, SelectVariant, SelectOptionObject } from '@patternfly/react-core'; -import { Scope } from './MyResourcesPage'; +import { Scope } from './resource-model'; interface PermissionSelectState { selected: ScopeValue[]; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ResourcesTable.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ResourcesTable.tsx index b2f3527475..2d6cbf0a11 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ResourcesTable.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ResourcesTable.tsx @@ -42,7 +42,7 @@ import { HttpResponse } from '../../account-service/account.service'; import { AccountServiceContext } from '../../account-service/AccountServiceContext'; import { PermissionRequest } from "./PermissionRequest"; import { ShareTheResource } from "./ShareTheResource"; -import { Permission, Resource } from "./MyResourcesPage"; +import { Permission, Resource } from "./resource-model"; import { Msg } from '../../widgets/Msg'; import { ResourcesTableState, ResourcesTableProps, AbstractResourcesTable } from './AbstractResourceTable'; import { EditTheResource } from './EditTheResource'; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ShareTheResource.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ShareTheResource.tsx index ed4728bd13..cc481c0c4b 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ShareTheResource.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/ShareTheResource.tsx @@ -32,7 +32,7 @@ import { } from '@patternfly/react-core'; import { AccountServiceContext } from '../../account-service/AccountServiceContext'; -import { Resource, Permission, Scope } from './MyResourcesPage'; +import { Resource, Permission, Scope } from './resource-model'; import { Msg } from '../../widgets/Msg'; import {ContentAlert} from '../ContentAlert'; import { PermissionSelect } from './PermissionSelect'; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/SharedResourcesTable.tsx b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/SharedResourcesTable.tsx index 120b24d0be..0bf081763d 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/SharedResourcesTable.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/SharedResourcesTable.tsx @@ -29,7 +29,7 @@ import { import { RepositoryIcon } from '@patternfly/react-icons'; -import {PaginatedResources, Resource, Scope} from "./MyResourcesPage"; +import { PaginatedResources, Resource, Scope } from "./resource-model"; import { Msg } from '../../widgets/Msg'; import { AbstractResourcesTable, ResourcesTableState } from './AbstractResourceTable'; import EmptyMessageState from '../../widgets/EmptyMessageState'; diff --git a/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/resource-model.ts b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/resource-model.ts new file mode 100644 index 0000000000..960bd51b03 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak-preview/account/src/app/content/my-resources-page/resource-model.ts @@ -0,0 +1,40 @@ +export interface Resource { + _id: string; + name: string; + client: Client; + scopes: Scope[]; + uris: string[]; + shareRequests: Permission[]; +} + +export interface Client { + baseUrl: string; + clientId: string; + name?: string; +} + +export class Scope { + public constructor(public name: string, public displayName?: string) {} + + public toString(): string { + if (this.hasOwnProperty('displayName') && (this.displayName)) { + return this.displayName; + } else { + return this.name; + } + } +} + +export interface PaginatedResources { + nextUrl: string; + prevUrl: string; + data: Resource[]; +} + +export interface Permission { + email?: string; + firstName?: string; + lastName?: string; + scopes: Scope[] | string[]; // this should be Scope[] - fix API + username: string; +}