Browse Source

chore(gui-v2): type correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3057/head
Pranav C 2 years ago
parent
commit
50645333fe
  1. 8
      packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue
  2. 6
      packages/nocodb-sdk/src/lib/Api.ts
  3. 7
      scripts/sdk/swagger.json

8
packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { FormType, GalleryType, GridType, KanbanType, ViewTypes } from 'nocodb-sdk' import type { ViewType, ViewTypes } from 'nocodb-sdk'
import type { SortableEvent } from 'sortablejs' import type { SortableEvent } from 'sortablejs'
import type { Menu as AntMenu } from 'ant-design-vue' import type { Menu as AntMenu } from 'ant-design-vue'
import { notification } from 'ant-design-vue' import { notification } from 'ant-design-vue'
@ -45,7 +45,7 @@ let isMarked = $ref<string | false>(false)
/** Watch currently active view, so we can mark it in the menu */ /** Watch currently active view, so we can mark it in the menu */
watch(activeView, (nextActiveView) => { watch(activeView, (nextActiveView) => {
const _nextActiveView = nextActiveView as GridType | FormType | KanbanType const _nextActiveView = nextActiveView as ViewType
if (_nextActiveView && _nextActiveView.id) { if (_nextActiveView && _nextActiveView.id) {
selected.value = [_nextActiveView.id] selected.value = [_nextActiveView.id]
@ -140,7 +140,7 @@ function changeView(view: { id: string; alias?: string; title?: string; type: Vi
} }
/** Rename a view */ /** Rename a view */
async function onRename(view: Record<string, any>) { async function onRename(view: ViewType) {
const valid = validate(view.title) const valid = validate(view.title)
if (valid !== true) { if (valid !== true) {
@ -152,7 +152,7 @@ async function onRename(view: Record<string, any>) {
try { try {
// todo typing issues, order and id do not exist on all members of ViewTypes (Kanban, Gallery, Form, Grid) // todo typing issues, order and id do not exist on all members of ViewTypes (Kanban, Gallery, Form, Grid)
await api.dbView.update(view.id, { await api.dbView.update(view.id!, {
title: view.title, title: view.title,
order: view.order, order: view.order,
}) })

6
packages/nocodb-sdk/src/lib/Api.ts

@ -122,7 +122,7 @@ export interface TableType {
export interface ViewType { export interface ViewType {
id?: string; id?: string;
title?: string; title: string;
deleted?: boolean; deleted?: boolean;
order?: number; order?: number;
fk_model_id?: string; fk_model_id?: string;
@ -1518,7 +1518,7 @@ export class Api<
*/ */
reorder: ( reorder: (
tableId: string, tableId: string,
data: { order?: string }, data: { order?: number },
params: RequestParams = {} params: RequestParams = {}
) => ) =>
this.request<void, any>({ this.request<void, any>({
@ -1632,7 +1632,7 @@ export class Api<
update: ( update: (
viewId: string, viewId: string,
data: { data: {
order?: string; order?: number;
title?: string; title?: string;
show_system_fields?: boolean; show_system_fields?: boolean;
lock_type?: 'collaborative' | 'locked' | 'personal'; lock_type?: 'collaborative' | 'locked' | 'personal';

7
scripts/sdk/swagger.json

@ -1334,7 +1334,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"order": { "order": {
"type": "string" "type": "number"
} }
} }
} }
@ -1506,7 +1506,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"order": { "order": {
"type": "string" "type": "number"
}, },
"title": { "title": {
"type": "string" "type": "string"
@ -6011,7 +6011,8 @@
"type": "string" "type": "string"
}, },
"title": { "title": {
"type": "string" "type": "string",
"required": true
}, },
"deleted": { "deleted": {
"type": "boolean" "type": "boolean"

Loading…
Cancel
Save