diff --git a/dolphinscheduler-ui-next/src/App.tsx b/dolphinscheduler-ui-next/src/App.tsx index a23f14454f..62ceab3d12 100644 --- a/dolphinscheduler-ui-next/src/App.tsx +++ b/dolphinscheduler-ui-next/src/App.tsx @@ -36,6 +36,8 @@ const App = defineComponent({ const themeOverrides: GlobalThemeOverrides = themeList[this.currentTheme ? 'dark' : 'light'] + console.log(themeOverrides) + return ( { NProgress.done() }) -export default router \ No newline at end of file +export default router diff --git a/dolphinscheduler-ui-next/src/router/routes.ts b/dolphinscheduler-ui-next/src/router/routes.ts index bb928036bc..52b4f32553 100644 --- a/dolphinscheduler-ui-next/src/router/routes.ts +++ b/dolphinscheduler-ui-next/src/router/routes.ts @@ -44,15 +44,15 @@ const basePage: RouteRecordRaw[] = [ /** * Login page */ - const loginPage: RouteRecordRaw[] = [ +const loginPage: RouteRecordRaw[] = [ { path: '/login', name: 'login', - component: components['login'] - } + component: components['login'], + }, ] const routes: RouteRecordRaw[] = [...basePage, ...loginPage] // 重新组织后导出 -export default routes \ No newline at end of file +export default routes diff --git a/dolphinscheduler-ui-next/src/service/modules/alert-group/index.ts b/dolphinscheduler-ui-next/src/service/modules/alert-group/index.ts new file mode 100644 index 0000000000..4a4e95c741 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/alert-group/index.ts @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { ListReq, GroupNameReq, IdReq, GroupReq } from './types' + +export function queryAlertGroupListPaging(params: ListReq): any { + return axios({ + url: '/alert-groups', + method: 'get', + params, + }) +} + +export function createAlertGroup(data: GroupReq): any { + return axios({ + url: '/alert-groups', + method: 'post', + data, + }) +} + +export function listAlertGroupById(): any { + return axios({ + url: '/alert-groups/list', + method: 'get', + }) +} + +export function queryAlertGroupById(data: IdReq): any { + return axios({ + url: '/alert-groups/query', + method: 'post', + data, + }) +} + +export function verifyGroupName(params: GroupNameReq): any { + return axios({ + url: '/alert-groups/verify-name', + method: 'get', + params, + }) +} + +export function updateAlertGroup(data: GroupReq, id: IdReq): any { + return axios({ + url: `/alert-groups/${id}`, + method: 'put', + data, + }) +} + +export function delAlertGroupById(id: IdReq): any { + return axios({ + url: `/alert-groups/${id}`, + method: 'delete', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/alert-group/types.ts b/dolphinscheduler-ui-next/src/service/modules/alert-group/types.ts new file mode 100644 index 0000000000..640ecd3578 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/alert-group/types.ts @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface ListReq { + pageNo: number + pageSize: number + searchVal?: string +} + +interface GroupNameReq { + groupName: string +} + +interface IdReq { + id: number +} + +interface GroupReq extends GroupNameReq { + alertInstanceIds: string + description?: string +} + +export { ListReq, GroupNameReq, IdReq, GroupReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/alert-plugin/index.ts b/dolphinscheduler-ui-next/src/service/modules/alert-plugin/index.ts new file mode 100644 index 0000000000..0205b28279 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/alert-plugin/index.ts @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { + ListReq, + PluginInstanceReq, + InstanceNameReq, + IdReq, + UpdatePluginInstanceReq, +} from './types' + +export function queryAlertPluginInstanceListPaging(params: ListReq): any { + return axios({ + url: '/alert-plugin-instances', + method: 'get', + params, + }) +} + +export function createAlertPluginInstance(data: PluginInstanceReq): any { + return axios({ + url: '/alert-plugin-instances', + method: 'post', + data, + }) +} + +export function queryAlertPluginInstanceList(): any { + return axios({ + url: '/alert-plugin-instances/list', + method: 'get', + }) +} + +export function verifyAlertInstanceName(params: InstanceNameReq): any { + return axios({ + url: '/alert-plugin-instances/verify-name', + method: 'get', + params, + }) +} + +export function getAlertPluginInstance(id: IdReq): any { + return axios({ + url: `/alert-plugin-instances/${id}`, + method: 'get', + }) +} + +export function updateAlertPluginInstance( + data: UpdatePluginInstanceReq, + id: IdReq +): any { + return axios({ + url: `/alert-plugin-instances/${id}`, + method: 'put', + data, + }) +} + +export function deleteAlertPluginInstance(id: IdReq): any { + return axios({ + url: `/alert-plugin-instances/${id}`, + method: 'delete', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/alert-plugin/types.ts b/dolphinscheduler-ui-next/src/service/modules/alert-plugin/types.ts new file mode 100644 index 0000000000..524cf335da --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/alert-plugin/types.ts @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface ListReq { + pageNo: number + pageSize: number + searchVal?: string +} + +interface PluginInstanceReq { + instanceName: string + pluginDefineId: number + pluginInstanceParams: string +} + +interface InstanceNameReq { + alertInstanceName: string +} + +interface IdReq { + id: number +} + +interface UpdatePluginInstanceReq { + alertPluginInstanceId: number + instanceName: string + pluginInstanceParams: string +} + +export { + ListReq, + PluginInstanceReq, + InstanceNameReq, + IdReq, + UpdatePluginInstanceReq, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/data-source/index.ts b/dolphinscheduler-ui-next/src/service/modules/data-source/index.ts new file mode 100644 index 0000000000..b2ebd8681c --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/data-source/index.ts @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { + ListReq, + DataSourceReq, + UserIdReq, + TypeReq, + NameReq, + IdReq, +} from './types' + +export function queryDataSourceListPaging(params: ListReq): any { + return axios({ + url: '/datasources', + method: 'get', + params, + }) +} + +export function createDataSource(data: DataSourceReq): any { + return axios({ + url: '/datasources', + method: 'post', + data, + }) +} + +export function authedDatasource(params: UserIdReq): any { + return axios({ + url: '/datasources/authed-datasource', + method: 'get', + params, + }) +} + +export function connectDataSource(data: DataSourceReq): any { + return axios({ + url: '/datasources/connect', + method: 'post', + data, + }) +} + +export function getKerberosStartupState(): any { + return axios({ + url: '/datasources/kerberos-startup-state', + method: 'get', + }) +} + +export function queryDataSourceList(params: TypeReq): any { + return axios({ + url: '/datasources/list', + method: 'get', + params, + }) +} + +export function unAuthDatasource(params: UserIdReq): any { + return axios({ + url: '/datasources/unauth-datasource', + method: 'get', + params, + }) +} + +export function verifyDataSourceName(params: NameReq): any { + return axios({ + url: '/datasources/verify-name', + method: 'get', + params, + }) +} + +export function queryDataSource(id: IdReq): any { + return axios({ + url: `/datasources/${id}`, + method: 'get', + }) +} + +export function updateDataSource(data: DataSourceReq, id: IdReq): any { + return axios({ + url: `/datasources/${id}`, + method: 'put', + data, + }) +} + +export function deleteDataSource(id: IdReq): any { + return axios({ + url: `/datasources/${id}`, + method: 'delete', + }) +} + +export function connectionTest(id: IdReq): any { + return axios({ + url: `/datasources/${id}/connect-test`, + method: 'get', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/data-source/types.ts b/dolphinscheduler-ui-next/src/service/modules/data-source/types.ts new file mode 100644 index 0000000000..212e96594e --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/data-source/types.ts @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +type DataBase = + | 'MYSQL' + | 'POSTGRESQL' + | 'HIVE' + | 'SPARK' + | 'CLICKHOUSE' + | 'ORACLE' + | 'SQLSERVER' + | 'DB2' + | 'PRESTO' + | 'H2' + +interface DataSource { + database?: string + host?: string + id?: number + name?: string + note?: string + other?: object + password?: string + port?: number + type?: DataBase + userName?: string +} + +interface ListReq { + pageNo: number + pageSize: number + searchVal?: string +} + +interface DataSourceReq { + dataSourceParam: DataSource +} + +interface UserIdReq { + userId: number +} + +interface TypeReq { + type: DataBase +} + +interface NameReq { + name: string +} + +interface IdReq { + id: number +} + +export { ListReq, DataSourceReq, UserIdReq, TypeReq, NameReq, IdReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/environment/index.ts b/dolphinscheduler-ui-next/src/service/modules/environment/index.ts new file mode 100644 index 0000000000..1f2a117141 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/environment/index.ts @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { + EnvironmentReq, + EnvironmentCodeReq, + EnvironmentNameReq, + ListReq, + CodeReq, +} from './types' + +export function createEnvironment(data: EnvironmentReq): any { + return axios({ + url: '/environment/create', + method: 'post', + data, + }) +} + +export function deleteEnvironmentByCode(data: EnvironmentCodeReq): any { + return axios({ + url: '/environment/delete', + method: 'post', + data, + }) +} + +export function queryEnvironmentListPaging(params: ListReq): any { + return axios({ + url: '/environment/list-paging', + method: 'get', + params, + }) +} + +export function queryEnvironmentByCode(params: EnvironmentCodeReq): any { + return axios({ + url: '/environment/query-by-code', + method: 'get', + params, + }) +} + +export function queryAllEnvironmentList(): any { + return axios({ + url: '/environment/query-environment-list', + method: 'get', + }) +} + +export function updateEnvironment(data: EnvironmentReq & CodeReq): any { + return axios({ + url: '/environment/update', + method: 'post', + data, + }) +} + +export function verifyEnvironment(data: EnvironmentNameReq): any { + return axios({ + url: '/environment/verify-environment', + method: 'post', + data, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/environment/types.ts b/dolphinscheduler-ui-next/src/service/modules/environment/types.ts new file mode 100644 index 0000000000..515cdc1632 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/environment/types.ts @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface EnvironmentReq { + config: string + name: string + description?: string + workerGroups?: string +} + +interface EnvironmentCodeReq { + environmentCode: number +} + +interface EnvironmentNameReq { + environmentName: string +} + +interface ListReq { + pageNo: number + pageSize: number + searchVal?: string +} + +interface CodeReq { + code: number +} + +export { + EnvironmentReq, + EnvironmentCodeReq, + EnvironmentNameReq, + ListReq, + CodeReq, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/executors/index.ts b/dolphinscheduler-ui-next/src/service/modules/executors/index.ts new file mode 100644 index 0000000000..96b47048e9 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/executors/index.ts @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { + ExecuteReq, + ProjectCodeReq, + ProcessDefinitionCodeReq, + ProcessInstanceReq, +} from './types' + +export function execute(data: ExecuteReq, code: ProjectCodeReq): any { + return axios({ + url: `/projects/${code}/executors/execute`, + method: 'post', + data, + }) +} + +export function startCheckProcessDefinition( + data: ProcessDefinitionCodeReq, + code: ProjectCodeReq +): any { + return axios({ + url: `/projects/${code}/executors/start-check`, + method: 'post', + data, + }) +} + +export function startProcessInstance( + data: ProcessInstanceReq, + code: ProjectCodeReq +): any { + return axios({ + url: `/projects/${code}/executors/start-process-instance`, + method: 'post', + data, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/executors/types.ts b/dolphinscheduler-ui-next/src/service/modules/executors/types.ts new file mode 100644 index 0000000000..812bf72a29 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/executors/types.ts @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +type Execute = + | 'NONE' + | 'REPEAT_RUNNING' + | 'RECOVER_SUSPENDED_PROCESS' + | 'START_FAILURE_TASK_PROCESS' + | 'STOP' + | 'PAUSE' + +type Exec = + | 'START_PROCESS' + | 'START_CURRENT_TASK_PROCESS' + | 'RECOVER_TOLERANCE_FAULT_PROCESS' + | 'RECOVER_SUSPENDED_PROCESS' + | 'START_FAILURE_TASK_PROCESS' + | 'COMPLEMENT_DATA' + | 'SCHEDULER' + | 'REPEAT_RUNNING' + | 'PAUSE' + | 'STOP' + | 'RECOVER_WAITING_THREAD' + +interface ExecuteReq { + executeType: Execute + processInstanceId: number +} + +interface ProjectCodeReq { + projectCode: number +} + +interface ProcessDefinitionCodeReq { + processDefinitionCode: number +} + +interface ProcessInstanceReq extends ProcessDefinitionCodeReq { + failureStrategy: 'END' | 'CONTINUE' + processInstancePriority: 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW' | 'LOWEST' + scheduleTime: string + warningGroupId: number + warningType: 'NONE' | 'SUCCESS' | 'FAILURE' | 'ALL' + dryRun?: number + environmentCode?: number + execType?: Exec + expectedParallelismNumber?: number + runMode?: 'RUN_MODE_SERIAL' | 'RUN_MODE_PARALLEL' + startNodeList?: string + startParams?: string + taskDependType?: 'TASK_ONLY' | 'TASK_PRE' | 'TASK_POST' + timeout?: number + workerGroup?: string +} + +export { + ExecuteReq, + ProjectCodeReq, + ProcessDefinitionCodeReq, + ProcessInstanceReq, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/log/index.ts b/dolphinscheduler-ui-next/src/service/modules/log/index.ts new file mode 100644 index 0000000000..51ccf311f9 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/log/index.ts @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { IdReq, LogReq } from './types' + +export function queryLog(params: LogReq): any { + return axios({ + url: '/log/detail', + method: 'get', + params, + }) +} + +export function downloadTaskLog(params: IdReq): any { + return axios({ + url: '/log/download-log', + method: 'get', + params, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/log/types.ts b/dolphinscheduler-ui-next/src/service/modules/log/types.ts new file mode 100644 index 0000000000..dc89444b80 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/log/types.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface IdReq { + taskInstanceId: number +} + +interface LogReq extends IdReq { + limit: number + skipLineNum: number +} + +export { IdReq, LogReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/login/index.ts b/dolphinscheduler-ui-next/src/service/modules/login/index.ts new file mode 100644 index 0000000000..166e342ab8 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/login/index.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { LoginReq } from './types' + +export function queryLog(data: LoginReq): any { + return axios({ + url: '/login', + method: 'post', + data, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/login/types.ts b/dolphinscheduler-ui-next/src/service/modules/login/types.ts new file mode 100644 index 0000000000..8ea7d72c8a --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/login/types.ts @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface LoginReq { + userName: string + userPassword: string +} + +export { LoginReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/monitor/index.ts b/dolphinscheduler-ui-next/src/service/modules/monitor/index.ts new file mode 100644 index 0000000000..4defbd0b77 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/monitor/index.ts @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' + +export function queryDatabaseState(): any { + return axios({ + url: '/monitor/databases', + method: 'get', + }) +} + +export function listMaster(): any { + return axios({ + url: '/monitor/masters', + method: 'get', + }) +} + +export function listWorker(): any { + return axios({ + url: '/monitor/workers', + method: 'get', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/monitor/types.ts b/dolphinscheduler-ui-next/src/service/modules/monitor/types.ts new file mode 100644 index 0000000000..3e7c6c26f5 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/monitor/types.ts @@ -0,0 +1,16 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/dolphinscheduler-ui-next/src/service/modules/process-definition/index.ts b/dolphinscheduler-ui-next/src/service/modules/process-definition/index.ts new file mode 100644 index 0000000000..d6f9a24f9e --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/process-definition/index.ts @@ -0,0 +1,244 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { + CodeReq, + CodesReq, + FileReq, + NameReq, + ReleaseStateReq, + VersionReq, + LimitReq, + PageReq, + ListReq, + ProcessDefinitionReq, + TargetCodeReq, +} from './types' + +export function queryListPaging(params: PageReq & ListReq, code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition`, + method: 'get', + params, + }) +} + +export function createProcessDefinition( + data: ProcessDefinitionReq & NameReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition`, + method: 'post', + data, + }) +} + +export function queryAllByProjectCode(code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/all`, + method: 'post', + }) +} + +export function batchCopyByCodes( + data: TargetCodeReq & CodesReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/batch-copy`, + method: 'post', + data, + }) +} + +export function batchDeleteByCodes(data: CodesReq, code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/batch-delete`, + method: 'post', + data, + }) +} + +export function batchExportByCodes(data: CodesReq, code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/batch-export`, + method: 'post', + data, + }) +} + +export function batchMoveByCodes( + data: TargetCodeReq & CodesReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/batch-move`, + method: 'post', + data, + }) +} + +export function getTaskListByDefinitionCodes( + params: CodesReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/batch-query-tasks`, + method: 'get', + params, + }) +} + +export function importProcessDefinition(data: FileReq, code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/import`, + method: 'post', + data, + }) +} + +export function queryList(code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/list`, + method: 'get', + }) +} + +export function queryProcessDefinitionByName( + params: NameReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/query-by-name`, + method: 'get', + params, + }) +} + +export function querySimpleList(code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/simple-list`, + method: 'get', + }) +} + +export function verifyName(params: NameReq, code: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/verify-name`, + method: 'get', + params, + }) +} + +export function queryProcessDefinitionByCode( + code: CodeReq, + processCode: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}`, + method: 'get', + }) +} + +export function update( + data: ProcessDefinitionReq & NameReq & ReleaseStateReq, + code: CodeReq, + processCode: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}`, + method: 'put', + data, + }) +} + +export function deleteByCode(code: CodeReq, processCode: CodeReq): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}`, + method: 'delete', + }) +} + +export function release( + data: NameReq & ReleaseStateReq, + code: CodeReq, + processCode: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/release`, + method: 'post', + data, + }) +} + +export function getTasksByDefinitionCode( + code: CodeReq, + processCode: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/tasks`, + method: 'get', + }) +} + +export function queryVersions( + params: PageReq, + code: CodeReq, + processCode: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/versions`, + method: 'get', + params, + }) +} + +export function switchVersion( + code: CodeReq, + processCode: CodeReq, + version: VersionReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/versions/${version}`, + method: 'get', + }) +} + +export function deleteVersion( + code: CodeReq, + processCode: CodeReq, + version: VersionReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/versions/${version}`, + method: 'delete', + }) +} + +export function viewTree( + code: CodeReq, + processCode: CodeReq, + params: LimitReq +): any { + return axios({ + url: `/projects/${code}/process-definition/${processCode}/view-tree`, + method: 'get', + params, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/process-definition/types.ts b/dolphinscheduler-ui-next/src/service/modules/process-definition/types.ts new file mode 100644 index 0000000000..3a5ac248d1 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/process-definition/types.ts @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface CodeReq { + projectCode: number +} + +interface CodesReq { + codes: string +} + +interface FileReq { + file: any +} + +interface NameReq { + name: string +} + +interface ReleaseStateReq { + releaseState: 'OFFLINE' | 'ONLINE' +} + +interface VersionReq { + version: number +} + +interface LimitReq { + limit: number +} + +interface PageReq { + pageNo: number + pageSize: number +} + +interface ListReq extends PageReq { + searchVal?: string + userId?: number +} + +interface ProcessDefinitionReq extends NameReq { + locations: string + taskDefinitionJson: string + taskRelationJson: string + tenantCode: string + description?: string + globalParams?: string + timeout?: number +} + +interface TargetCodeReq { + targetProjectCode: number +} + +export { + CodeReq, + CodesReq, + FileReq, + NameReq, + ReleaseStateReq, + VersionReq, + LimitReq, + PageReq, + ListReq, + ProcessDefinitionReq, + TargetCodeReq, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts new file mode 100644 index 0000000000..3e7c6c26f5 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts @@ -0,0 +1,16 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts new file mode 100644 index 0000000000..12bee2f860 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface CodeReq { + projectCode: number +} + +interface ProcessInstanceListReq { + pageNo: number + pageSize: number + endDate?: string + executorName?: string + host?: string + processDefineCode?: number + processDefiniteCode?: string + searchVal?: string + startDate?: string + stateType?: string +} + +interface BatchDeleteReq { + processInstanceIds: string + projectName: string + alertGroup?: string + createTime?: string + email?: string + id?: number + phone?: string + queue?: string + queueName?: string + state?: number + tenantCode?: string + tenantId?: number + updateTime?: string + userName?: string + userPassword?: string + userType?: string +} + +interface SubIdReq { + subId: number +} + +interface TaskReq { + taskCode: string + taskId: number +} + +interface LongestReq { + endTime: string + size: number + startTime: string +} + +interface IdReq { + id: number +} diff --git a/dolphinscheduler-ui-next/src/service/modules/projects-analysis/index.ts b/dolphinscheduler-ui-next/src/service/modules/projects-analysis/index.ts new file mode 100644 index 0000000000..b914d1f2e5 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/projects-analysis/index.ts @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { CodeReq, StateReq } from './types' + +export function countCommandState(): any { + return axios({ + url: '/projects/analysis/command-state-count', + method: 'get', + }) +} + +export function countDefinitionByUser(params: CodeReq): any { + return axios({ + url: '/projects/analysis/define-user-count', + method: 'get', + params, + }) +} + +export function countProcessInstanceState(params: StateReq): any { + return axios({ + url: '/projects/analysis/process-state-count', + method: 'get', + params, + }) +} + +export function countQueueState(): any { + return axios({ + url: '/projects/analysis/queue-count', + method: 'get', + }) +} + +export function countTaskState(params: StateReq): any { + return axios({ + url: '/projects/analysis/task-state-count', + method: 'get', + params, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/projects-analysis/types.ts b/dolphinscheduler-ui-next/src/service/modules/projects-analysis/types.ts new file mode 100644 index 0000000000..30a21c53db --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/projects-analysis/types.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface CodeReq { + projectCode?: number +} + +interface StateReq extends CodeReq { + endDate?: string + startDate?: string +} + +export { CodeReq, StateReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/sign-out/index.ts b/dolphinscheduler-ui-next/src/service/modules/sign-out/index.ts new file mode 100644 index 0000000000..4b3ebe3eec --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/sign-out/index.ts @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' + +export function signOut(): any { + return axios({ + url: '/signOut', + method: 'post', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/sign-out/types.ts b/dolphinscheduler-ui-next/src/service/modules/sign-out/types.ts new file mode 100644 index 0000000000..3e7c6c26f5 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/sign-out/types.ts @@ -0,0 +1,16 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/dolphinscheduler-ui-next/src/service/modules/token/index.ts b/dolphinscheduler-ui-next/src/service/modules/token/index.ts new file mode 100644 index 0000000000..0b5ab5afe1 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/token/index.ts @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { ListReq, TokenReq, UserReq, UpdateTokenReq } from './types' + +export function queryAccessTokenList(params: ListReq): any { + return axios({ + url: '/access-tokens', + method: 'get', + params, + }) +} + +export function createToken(data: TokenReq): any { + return axios({ + url: '/access-tokens', + method: 'post', + data, + }) +} + +export function queryAccessTokenByUser(params: UserReq): any { + return axios({ + url: '/access-tokens', + method: 'get', + params, + }) +} + +export function updateToken(data: UpdateTokenReq): any { + return axios({ + url: '/access-tokens', + method: 'put', + data, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/token/types.ts b/dolphinscheduler-ui-next/src/service/modules/token/types.ts new file mode 100644 index 0000000000..98bc1f9b7d --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/modules/token/types.ts @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface ListReq { + pageNo: number + pageSize: number + searchVal?: string +} + +interface TokenReq { + expireTime: string + userId: number + token?: string +} + +interface UserReq { + userId?: number +} + +interface UpdateTokenReq extends TokenReq { + id: number + alertGroup?: string + createTime?: string + email?: string + phone?: string + queue?: string + queueName?: string + state?: number + tenantCode?: string + tenantId?: number + updateTime?: string + userName?: string + userPassword?: string + userType?: string +} + +export { ListReq, TokenReq, UserReq, UpdateTokenReq } diff --git a/dolphinscheduler-ui-next/src/service/service.ts b/dolphinscheduler-ui-next/src/service/service.ts index 72f58c5592..a8211dc2cc 100644 --- a/dolphinscheduler-ui-next/src/service/service.ts +++ b/dolphinscheduler-ui-next/src/service/service.ts @@ -18,7 +18,7 @@ import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' const baseRequestConfig: AxiosRequestConfig = { - baseURL: '/', + baseURL: '/dolphinscheduler', timeout: 10000, } diff --git a/dolphinscheduler-ui-next/src/utils/index.ts b/dolphinscheduler-ui-next/src/utils/index.ts index c9f8c51aa8..6c1dbc5e78 100644 --- a/dolphinscheduler-ui-next/src/utils/index.ts +++ b/dolphinscheduler-ui-next/src/utils/index.ts @@ -18,7 +18,7 @@ import classification from './classification' const utils = { - classification + classification, } export default utils diff --git a/dolphinscheduler-ui-next/src/views/home/index.tsx b/dolphinscheduler-ui-next/src/views/home/index.tsx index 82f1038207..77bcf765ee 100644 --- a/dolphinscheduler-ui-next/src/views/home/index.tsx +++ b/dolphinscheduler-ui-next/src/views/home/index.tsx @@ -19,11 +19,9 @@ import { defineComponent } from 'vue' import styles from './index.module.scss' export default defineComponent({ - name: 'home', - setup() {}, - render() { - return
- Home Test -
- } -}) \ No newline at end of file + name: 'home', + setup() {}, + render() { + return
Home Test
+ }, +}) diff --git a/dolphinscheduler-ui-next/src/views/login/index.tsx b/dolphinscheduler-ui-next/src/views/login/index.tsx index 4079cf9e53..c052007eef 100644 --- a/dolphinscheduler-ui-next/src/views/login/index.tsx +++ b/dolphinscheduler-ui-next/src/views/login/index.tsx @@ -35,21 +35,21 @@ const Login = defineComponent({ rules: { username: { trigger: ['input', 'blur'], - validator () { + validator() { if (state.loginForm.username === '') { return new Error(`${t('login.username_tips')}`) } - } + }, }, password: { trigger: ['input', 'blur'], - validator () { + validator() { if (state.loginForm.password === '') { return new Error(`${t('login.password_tips')}`) } - } - } - } as FormRules + }, + }, + } as FormRules, }) const handleChange = (value: string) => { @@ -67,16 +67,20 @@ const Login = defineComponent({ }) } - return { t, locale, handleChange, handleLogin, ...toRefs(state)} + return { t, locale, handleChange, handleLogin, ...toRefs(state) } }, render() { return (
- + {{ - checked: () => 'en_US', - unchecked: () =>'zh_CN' + checked: () => 'en_US', + unchecked: () => 'zh_CN', }}
@@ -85,28 +89,36 @@ const Login = defineComponent({
- - + + - + - + {this.t('login.signin')}
@@ -116,4 +128,4 @@ const Login = defineComponent({ }, }) -export default Login \ No newline at end of file +export default Login