Commit Graph

30 Commits (08d0835634ba414f83fffeb9ae33518e38d15111)

Author SHA1 Message Date
Ryan Wang 54755c5842
refactor: router and menu generation (#651)
#### What type of PR is this?

/kind api-change
/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

Ref https://github.com/halo-dev/halo/issues/2595

重构路由和侧边菜单生成的逻辑,**注意,此 PR 对插件的 Console 入口文件中的路由和菜单定义包含破坏性更新。**

1. 移除 `definePlugin` 方法的 `menus` 字段,改为在 route 的 meta 中定义。
2. 将 `RoutesMenu` 组件从 `@halo-dev/components` 包中移出。
3. 将 `BasicLayout` 组件从 `@halo-dev/console-shared` 包中移出。

定义路由的方式:

```ts
import { definePlugin } from "@halo-dev/console-shared";
import BasicLayout from "@/layouts/BasicLayout.vue";
import AttachmentList from "./AttachmentList.vue";
import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue";
import { IconFolder } from "@halo-dev/components";
import { markRaw } from "vue";

export default definePlugin({
  name: "attachmentModule",
  components: [AttachmentSelectorModal],
  routes: [
    {
      path: "/attachments",
      component: BasicLayout,
      children: [
        {
          path: "",
          name: "Attachments",
          component: AttachmentList,
          meta: {
            title: "附件",
            permissions: ["system:attachments:view"],
            menu: {
              name: "附件",
              group: "内容",
              icon: markRaw(IconFolder),
              priority: 4,
              mobile: true,
            },
          },
        },
      ],
    },
  ],
});
```

menu 字段类型:

```ts
interface RouteMeta {
  title?: string;
  searchable?: boolean;
  permissions?: string[];
  menu?: {
    name: string;
    group?: string;
    icon?: Component;
    priority: number;
    mobile?: true;
  };
}
```

插件适配需要做的改动:

1. 移除 `definePlugin` 中的 menus 字段。
2. 在需要添加到菜单的 route 中提供 `meta.menu` 对象,可参考上方的 menu 字段类型。

详细文档可查阅:https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation

todolist:

- [x] 完善预设的菜单分组定义。
- [x] 绑定权限,根据权限决定是否需要将路由添加到菜单。
- [x] 优化菜单排序的定义方式。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2595

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm build:packages`
2. 测试后台的菜单及路由是否有异常。
3. 新建角色测试路由和菜单对权限的绑定。
4. 按照 https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation 文档,创建插件,测试插件添加路由和菜单是否正常。

#### Does this PR introduce a user-facing change?

```release-note
重构路由和侧边菜单生成的逻辑。
```
2022-10-19 08:54:13 +00:00
Ryan Wang 512ee82216
refactor: api of dialog component (#646)
#### What type of PR is this?

/kind api-change
/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

重构 Dialog 组件使用 API 的调用方式,改为与 Toast 组件一致。https://github.com/halo-dev/console/pull/644

同样的,使用此方式调用 Dialog 组件不限制在 Vue 组件。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

需要测试后台各个操作的会话框是否正常。

#### Does this PR introduce a user-facing change?

```release-note
重构 Dialog 组件使用 API 的调用方式。
```
2022-10-18 01:58:09 +00:00
Ryan Wang e8b6f5ccb9
feat: add global search support (#623)
#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

添加全局搜索框支持。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/1924

#### Screenshots:

<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/192448624-fbef4e58-7c0e-4c24-b29e-4dd6eba9fa4f.png">
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/192448660-369e19a4-747d-45ad-9056-162f5c8e01be.png">
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/192449009-6b856d82-e7a6-4e93-b2fa-d0d0c7a58ebf.png">


#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 本地 Console 切换到当前 PR 的分支,需要 `pnpm install && pnpm build:packages`
2. 使用 Ctrl + K(Windows/Linux) 或者 Command + K(macOS)调起搜索框
3. 可以使用键盘上/下键(或者 Ctrl + J / Ctrl + K)选择搜索条目,回车键确认选择。

#### Does this PR introduce a user-facing change?

```release-note
后台添加全局搜索的支持
```
2022-09-28 06:50:16 +00:00
Ryan Wang e13d086236 perf: optimize the UI of the global scrollbar
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-09-23 22:29:50 +08:00
Ryan Wang 36bb28cd0e feat: update page title when route change
Close https://github.com/halo-dev/halo/issues/2431
2022-09-22 12:16:11 +08:00
Ryan Wang cd338f0b1f feat: add dialog component
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-06-29 14:53:57 +08:00
Ryan Wang ce03f4c923 feat: user creation support
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-06-27 16:16:49 +08:00
Ryan Wang 2538959339 feat: add animation for user profile route 2022-06-19 23:39:45 +08:00
Ryan Wang 43945378d5 feat: add filters dropdown ui
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-05-26 17:37:08 +08:00
Ryan Wang ced9ede9af feat: add user list page
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-05-24 15:10:16 +08:00
Ryan Wang aa861c3783 feat: add tabbar component
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-04-28 21:55:56 +08:00
Ryan Wang 038bea728c fix: menu vertical overflow
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-04-24 14:33:46 +08:00
Ryan Wang 3d572c0643 feat: add base layout components
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-04-15 16:17:02 +08:00
Ryan Wang 245f4475ed feat: add logo
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-04-13 17:32:46 +08:00
Ryan Wang 0f91488044 feat: add RoutesMenu component
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-04-12 18:06:13 +08:00
Ryan Wang bd446449c0
feat: add menu component (#534) 2022-04-12 14:23:14 +08:00
Ryan Wang d48bd388ba
chore: cleanup unnecessary files (#494)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-03-08 16:43:58 +08:00
Ryan Wang 9cf97b9d3c
chore: add pre commit hook (#479)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-03-04 14:57:42 +08:00
Ryan Wang 020db1422e
chore: next major version base project (#478)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-03-03 18:26:15 +08:00
Ryan Wang 1eac16acfd chore: clean code for next major version
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-03-03 11:44:12 +08:00
Ryan Wang 48d145f053
refactor: use js-sdk/admin-api (#378)
* 1.3.0-beta.2

* fix: token expire.

* pref: #291

* refactor: use js-sdk/admin-api

* chore: remove unnecessary files

* chore: remove unnecessary files

* chore: remove unnecessary files

* chore: remove unnecessary files

* refactor: developer/Environment.vue

* chore: remove unnecessary files

* refactor: login auth

* refactor: login auth

* refactor: remove api url setting

* refactor: custom sheet list

* style: reformat code

* refactor: logout

* refactor: remove setTimeout when fetch api

* fix: auto login error

* fix: post update error

* fix: backup

* fix: turn on developer mode error

* fix: mfa setting error

* chore: remove unnecessary files

* feat: add interceptors

* refactor: api client

* refactor: api client

* chore(deps): upgrade admin-api

* refactor: 重构认证

* fix: 修复认证请求头参数

* refactor: login

* feat: add error handle

* refactor: api client

* refactor: refresh token

* refactor: attachment upload

* refactor: upload component

* refactor: upload

* fix: tag save

* fix: github api request

* fix: installation page

* feat: add version field for html

* fix: option.list to option.listAsMapView

* fix: directory base path of static storage

* chore: upgrade halo sdk version

Co-authored-by: guqing <1484563614@qq.com>
2021-11-26 23:05:00 +08:00
Ryan Wang 17e0f47465 chore: remove unnecessary dependencies. 2021-03-06 18:38:10 +08:00
Ryan Wang eeed76a14e
pref: change locale provider to config provider. (#232) 2020-08-24 00:53:33 +08:00
Ryan Wang 4612ce592b
pref: code optimization. (#213)
* pref: code optimization.

* fix: theme configuration loading.

* pref: code optimization.
2020-07-13 09:32:07 +08:00
ruibaby 540388bbaf Fommat code. 2019-04-24 11:14:44 +08:00
johnniang 640fcda640 Resolve mavon-editor style bug involving antd style 2019-04-15 23:42:57 +08:00
johnniang 7f6ae15853 Refactor the post table show and reformat some docs 2019-03-22 09:57:06 +08:00
ruibaby 2f24ff9610 Complate Dashboard index 2019-03-20 20:22:52 +08:00
johnniang ff6ea659a8 Build base structure 2019-03-19 16:43:49 +08:00
johnniang 6d0f6f70d8 init 2019-03-19 00:35:13 +08:00