Skip to content

Commit

Permalink
Merge pull request #2301 from sulmoJ/directory
Browse files Browse the repository at this point in the history
refactor: refactor directory structure & models
  • Loading branch information
yuda110 authored Nov 23, 2023
2 parents 686db4a + 91dc8a7 commit a6092c1
Show file tree
Hide file tree
Showing 148 changed files with 515 additions and 434 deletions.
5 changes: 4 additions & 1 deletion apps/web/src/lib/access-control/page-permission-helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@


import type { RoleType } from '@/schema/identity/role/type';

import type {
PagePermissionMap,
PagePermissionTuple, PagePermissionType, RawPagePermission,
Expand All @@ -16,7 +19,7 @@ import { MENU_INFO_MAP } from '@/lib/menu/menu-info';

import type { LNBItem, LNBMenu } from '@/common/modules/navigations/lnb/type';

import type { RoleType } from '@/api-schema/identity/role/model';



export const getDefaultPagePermissionList = (isDomainOwner: boolean, roleType?: RoleType): PagePermissionTuple[] => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/schema/_common/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface TimeStamp {

export interface ListResponse<T> {
results: T[];
total_count?: number;
total_count: number;
}

export interface AnalyzeResponse<T> {
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
25 changes: 25 additions & 0 deletions apps/web/src/schema/identity/policy/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Tags, TimeStamp } from '@/schema/_common/model';

export interface PolicyModel {
created_at: TimeStamp;
domain_id: string;
name: string;
permissions: Array<string>;
policy_id: string;
repository_info?: RepositoryInfoDataModel;
tags: Tags;
policy_type?: string;
project_id?: string;
labels?: any;
state?: PolicyState;
updated_at?: TimeStamp;
}

interface RepositoryInfoDataModel {
repository_id: string;
name: string;
repository_type: string;
endpoint: string;
}

type PolicyState = 'ENABLED' | 'DISABLED';
22 changes: 22 additions & 0 deletions apps/web/src/schema/identity/provider/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { JsonSchema } from '@spaceone/design-system/types/inputs/forms/json-schema-form/type';

import type { Tags, TimeStamp } from '@/schema/_common/model';

const idField = 'provider';

interface IdParameter {
[idField]: string;
}

export interface ProviderModel extends Tags, IdParameter {
name: string;
template: {
service_account: {
schema: JsonSchema;
};
};
capability: {
supported_schema: string[];
};
created_at: TimeStamp;
}
17 changes: 17 additions & 0 deletions apps/web/src/schema/identity/role-binding/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { TimeStamp } from '@/schema/_common/model';
import type { ProjectGroupModel } from '@/schema/identity/project-group/model';
import type { ProjectModel } from '@/schema/identity/project/model';
import type { RoleModel } from '@/schema/identity/role/model';

export interface RoleBindingModel {
created_at: TimeStamp;
domain_id: string;
labels?: string[];
project_group_info?: ProjectGroupModel | undefined;
project_info?: ProjectModel | undefined;
resource_id: string;
resource_type: string;
role_binding_id: string;
role_info: RoleModel;
tags: { description: string };
}
16 changes: 16 additions & 0 deletions apps/web/src/schema/identity/role/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Tags, TimeStamp } from '@/schema/_common/model';
import type { RoleType, Policy } from '@/schema/identity/role/type';

import type { RawPagePermission } from '@/lib/access-control/config';

export interface RoleModel {
created_at: TimeStamp;
deleted_at?: TimeStamp;
domain_id: string;
name: string;
policies?: Policy[];
page_permissions: RawPagePermission[];
role_id: string;
role_type: RoleType;
tags?: Tags; // [ description: string ]
}
8 changes: 8 additions & 0 deletions apps/web/src/schema/identity/role/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ROLE_TYPE } from '@/schema/identity/role/constant';

export type RoleType = typeof ROLE_TYPE[keyof typeof ROLE_TYPE];

export interface Policy {
policy_id: string;
policy_type: string;
}
4 changes: 4 additions & 0 deletions apps/web/src/schema/identity/service-account/constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const ACCOUNT_TYPE = {
GENERAL: 'GENERAL',
TRUSTED: 'TRUSTED',
} as const;
18 changes: 18 additions & 0 deletions apps/web/src/schema/identity/service-account/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { ACCOUNT_TYPE } from '@/schema/identity/service-account/constant';

export interface ServiceAccountModel {
name: string;
provider: string;
service_account_id: string;
service_account_type?: AccountType;
data: {
[key: string]: string;
},
tags: { [key: string]: unknown; };
}

export interface ServiceAccountModelForBinding extends Omit<ServiceAccountModel, 'service_account_type'> {
service_account_type?: AccountType | 'TRUSTED-MANAGED';
}

export type AccountType = typeof ACCOUNT_TYPE[keyof typeof ACCOUNT_TYPE];
24 changes: 0 additions & 24 deletions apps/web/src/schema/identity/user-group/model.ts
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
import type { Tags, TimeStamp } from '@/api-schema/common/model';

export interface PolicyModel {
created_at: TimeStamp;
domain_id: string;
name: string;
permissions: Array<string>;
policy_id: string;
repository_info?: RepositoryInfoDataModel;
tags: Tags;
policy_type?: string;
project_id?: string;
labels?: any;
state?: PolicyState;
updated_at?: TimeStamp;
}

interface RepositoryInfoDataModel {
repository_id: string;
name: string;
repository_type: string;
endpoint: string;
}
type PolicyState = 'ENABLED' | 'DISABLED';
22 changes: 22 additions & 0 deletions apps/web/src/schema/identity/user/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Tags, TimeStamp } from '@/schema/_common/model';
import type { RoleBindingModel } from '@/schema/identity/role-binding/model';
import type { UserType } from '@/schema/identity/user/type';


export interface UserModel {
created_at: TimeStamp;
domain_id?: string;
email?: string;
email_verified?: boolean;
language: string;
last_accessed_at: TimeStamp | number;
name: string;
state: string;
tags?: Tags;
timezone: string;
user_id: string;
backend: string;
user_type: UserType;
role_bindings?: RoleBindingModel[];
}

3 changes: 3 additions & 0 deletions apps/web/src/schema/identity/user/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { USER_TYPE } from '@/schema/identity/user/constant';

export type UserType = typeof USER_TYPE[keyof typeof USER_TYPE];
18 changes: 0 additions & 18 deletions apps/web/src/schema/inventory/cloud-service-query-set/model.ts
Original file line number Diff line number Diff line change
@@ -1,18 +0,0 @@
import type { ProjectGroupInfo, ProjectModel } from '@/services/project/type';

import type { TimeStamp } from '@/api-schema/common/model';
import type { RoleModel } from '@/api-schema/identity/role/model';


export interface RoleBindingModel {
created_at: TimeStamp;
domain_id: string;
labels?: string[];
project_group_info?: ProjectGroupInfo | undefined;
project_info?: ProjectModel | undefined;
resource_id: string;
resource_type: string;
role_binding_id: string;
role_info: RoleModel;
tags: { description: string };
}
23 changes: 0 additions & 23 deletions apps/web/src/schema/inventory/cloud-service-report/model.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
import type { ROLE_TYPE } from '@/schema/identity/role/constant';

import type { RawPagePermission } from '@/lib/access-control/config';

import type { Tags, TimeStamp } from '@/api-schema/common/model';

export type RoleType = typeof ROLE_TYPE[keyof typeof ROLE_TYPE];

export interface RoleModel {
created_at: TimeStamp;
deleted_at?: TimeStamp;
domain_id: string;
name: string;
policies?: Policy[];
page_permissions: RawPagePermission[];
role_id: string;
role_type: RoleType;
tags?: Tags; // [ description: string ]
}

export interface Policy {
policy_id: string;
policy_type: string;
}
16 changes: 16 additions & 0 deletions apps/web/src/schema/inventory/cloud-service-type/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Tags } from '@/schema/_common/model';

export interface CloudServiceTypeInfo {
cloud_service_type_id: string;
cloud_service_type_key: string;
name: string;
provider: string;
group: string;
service_code: string;
is_primary: boolean;
is_major: boolean;
resource_type: string;
metadata: any;
labels: string[];
tags: Tags;
}
77 changes: 1 addition & 76 deletions apps/web/src/schema/inventory/collector/model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { JsonSchema } from '@spaceone/design-system/types/inputs/forms/json-schema-form/type';

import type { Tags } from '@/schema/_common/model';

import type { MonitoringType } from '@/common/modules/monitoring/config';
import type { Capability } from '@/schema/repository/plugin/model';


// CollectorPluginModel
Expand Down Expand Up @@ -33,50 +32,6 @@ export interface CollectorPluginModel {
}
}

// RepositoryPluginModel
interface Capability {
supported_schemas: string[];
use_resource_secret: boolean;
monitoring_type: MonitoringType;
supported_providers?: string[];
[key: string]: any;
}

export interface RepositoryInfo {
created_at: string;
endpoint: string;
name: string;
repository_id: string;
repository_type: string;
}

export interface RepositoryPluginModel {
plugin_id: string;
name: string;
image: string;
registry_type: 'DOCKER_HUB'|'AWS_PUBLIC_ECR'|'HARBOR';
registry_url: string;
registry_config: object;
service_type: string;
provider?: string;
capability: Capability;
template: {
options: {
schema: JsonSchema;
}
};
repository_info: RepositoryInfo;
project_id: string;
labels: string[];
version: string;
tags: {
icon?: string;
description?: string;
link?: string;
beta?: string;
} & Tags;
}


// CollectorModel
export const COLLECTOR_SECRET_STATE = {
Expand Down Expand Up @@ -115,16 +70,6 @@ export interface CollectorModel {
tags: Tags;
}

// SecretModel
export interface SecretModel {
secret_id: string;
provider: string;
service_account_id: string;
project_id: string;
created_at: string;
name: string;
}

// collector api parameters
export interface CollectorUpdateParameter {
collector_id: string;
Expand All @@ -148,23 +93,3 @@ export interface CollectorUpdatePluginParameter {
upgrade_mode?: UpgradeMode;
}

export type JobStatus = |
'IN_PROGRESS'| // One or more JobTasks are running
'FAILURE'| // When one or more JobTasks are FAILURE or TIMEOUT
'CANCELED'| // When a Job is Canceled
'SUCCESS'; // When all JobTasks succeed

export interface JobModel {
job_id: string;
status: JobStatus;
remained_tasks: number;
total_tasks: number;
failure_tasks: number;
success_tasks: number;
collector_id: string;
plugin_id: string;
created_at: string;
finished_at: string;
updated_at: string;
secret_id?: string;
}
Loading

1 comment on commit a6092c1

@vercel
Copy link

@vercel vercel bot commented on a6092c1 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

console – ./

console-cloudforet.vercel.app
console-git-master-cloudforet.vercel.app

Please sign in to comment.