Skip to content

Commit

Permalink
Unify Metadata (#49)
Browse files Browse the repository at this point in the history
This also enables generic handling of status, names and descriptions,
all of which are mutable etc etc.
  • Loading branch information
spjmurray authored Jun 5, 2024
1 parent d94b71d commit 32f4e12
Show file tree
Hide file tree
Showing 66 changed files with 3,500 additions and 791 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test:integration": "playwright test",
"test:unit": "vitest",
"openapi": "openapi-generator-cli",
"openapi:identity": "openapi-generator-cli generate -g typescript-fetch --generate-alias-as-model --global-property skipFormModel=false -i https://raw.githubusercontent.com/unikorn-cloud/identity/main/openapi/server.spec.yaml -o src/lib/openapi/identity",
"openapi:server": "openapi-generator-cli generate -g typescript-fetch --generate-alias-as-model -i https://raw.githubusercontent.com/unikorn-cloud/unikorn/main/pkg/server/openapi/server.spec.yaml -o src/lib/openapi/server"
"openapi:identity": "openapi-generator-cli generate -g typescript-fetch --generate-alias-as-model --global-property skipFormModel=false -i https://raw.githubusercontent.com/unikorn-cloud/identity/main/pkg/openapi/server.spec.yaml -o src/lib/openapi/identity",
"openapi:server": "openapi-generator-cli generate -g typescript-fetch --generate-alias-as-model -i https://raw.githubusercontent.com/unikorn-cloud/unikorn/main/pkg/openapi/server.spec.yaml -o src/lib/openapi/server"
},
"devDependencies": {
"@playwright/test": "^1.28.1",
Expand Down
20 changes: 10 additions & 10 deletions src/lib/StatusIcon.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<script lang="ts">
import * as Models from '$lib/openapi/server/models';
import * as Identity from '$lib/openapi/identity';
export let metadata: Models.ResourceMetadata;
export let metadata: Identity.ResourceReadMetadata;
function getColor(metadata: Models.ResourceMetadata): string {
if (metadata.status == 'Provisioned') return 'text-success-500';
if (metadata.status == 'Errored') return 'text-error-500';
if (metadata.status == 'Unknown') return 'text-warning-500';
function getColor(metadata: Identity.ResourceReadMetadata): string {
if (metadata.provisioningStatus == 'provisioned') return 'text-success-500';
if (metadata.provisioningStatus == 'error') return 'text-error-500';
if (metadata.provisioningStatus == 'unknown') return 'text-warning-500';
return 'dark:text-surface-500';
}
function getIcon(metadata: Models.ResourceMetadata): string {
if (metadata.status == 'Provisioned') return 'mdi:tick-circle-outline';
if (metadata.status == 'Errored') return 'mdi:error-outline';
if (metadata.status == 'Unknown') return 'mdi:question-mark';
function getIcon(metadata: Identity.ResourceReadMetadata): string {
if (metadata.provisioningStatus == 'provisioned') return 'mdi:tick-circle-outline';
if (metadata.provisioningStatus == 'error') return 'mdi:error-outline';
if (metadata.provisioningStatus == 'unknown') return 'mdi:question-mark';
return 'svg-spinners:ring-resize';
}
Expand Down
16 changes: 16 additions & 0 deletions src/lib/layouts/ShellListItem.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<script lang="ts">
import * as Identity from '$lib/openapi/identity';
import StatusIcon from '$lib/StatusIcon.svelte';
export let metadata: Identity.ResourceReadMetadata;
export let href: string;
</script>

<div class="flex gap-4 items-center justify-between variant-glass rounded-lg p-4">
<header class="flex items-center gap-4">
<StatusIcon {metadata} />
<a class="font-bold" {href}>{metadata.name}</a>
{#if metadata.description}
<em>{metadata.description}</em>
{/if}
</header>

<slot />
</div>
24 changes: 18 additions & 6 deletions src/lib/openapi/identity/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,43 @@ models/AvailableGroups.ts
models/Claim.ts
models/CodeChallengeMethod.ts
models/GrantType.ts
models/Group.ts
models/GroupIDs.ts
models/GroupRead.ts
models/GroupSpec.ts
models/GroupWrite.ts
models/Groups.ts
models/JsonWebKey.ts
models/JsonWebKeySet.ts
models/LoginRequestOptions.ts
models/Oauth2Error.ts
models/Oauth2Provider.ts
models/Oauth2ProviderCreate.ts
models/Oauth2ProviderRead.ts
models/Oauth2ProviderSpec.ts
models/Oauth2ProviderType.ts
models/Oauth2ProviderWrite.ts
models/Oauth2Providers.ts
models/OpenidConfiguration.ts
models/Organization.ts
models/OrganizationRead.ts
models/OrganizationScopedResourceReadMetadata.ts
models/OrganizationSpec.ts
models/OrganizationType.ts
models/OrganizationWrite.ts
models/Organizations.ts
models/Project.ts
models/ProjectMetadata.ts
models/ProjectRead.ts
models/ProjectSpec.ts
models/ProjectWrite.ts
models/Projects.ts
models/ProviderGroupList.ts
models/ProviderScope.ts
models/ResourceMetadata.ts
models/ResourceProvisioningStatus.ts
models/ResourceReadMetadata.ts
models/ResourceWriteMetadata.ts
models/ResponseType.ts
models/RoleList.ts
models/Scope.ts
models/SigningAlgorithm.ts
models/SystemOauth2ProviderRead.ts
models/SystemOauth2Providers.ts
models/Token.ts
models/TokenRequestOptions.ts
models/UserList.ts
Expand Down
Loading

0 comments on commit 32f4e12

Please sign in to comment.