Browse Source

fix(nc-gui): pr review changes

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
ab2802c11d
  1. 8
      packages/nc-gui/components/dlg/ViewCreate.vue
  2. 25
      packages/nc-gui/components/smartsheet/toolbar/CalendarRange.vue
  3. 3
      packages/nc-gui/lang/en.json
  4. 4
      packages/nc-gui/utils/generateName.ts

8
packages/nc-gui/components/dlg/ViewCreate.vue

@ -206,7 +206,7 @@ async function onSubmit() {
} catch (e: any) {
message.error(e.message)
} finally {
refreshCommandPalette()
await refreshCommandPalette()
}
vModel.value = false
@ -219,7 +219,7 @@ async function onSubmit() {
const addCalendarRange = async () => {
form.calendar_range.push({
fk_from_column_id: viewSelectFieldOptions.value[0].value,
fk_from_column_id: viewSelectFieldOptions.value[0].value as string,
fk_to_column_id: null,
})
}
@ -431,11 +431,11 @@ onMounted(async () => {
</span>
<NcSelect v-model:value="range.fk_from_column_id" :disabled="isMetaLoading" :loading="isMetaLoading">
<a-select-option
v-for="(option, id) in [...viewSelectFieldOptions].filter((f) => {
v-for="(option, id) in [...viewSelectFieldOptions!].filter((f) => {
// If the fk_from_column_id of first range is Date, then all the other ranges should be Date
// If the fk_from_column_id of first range is DateTime, then all the other ranges should be DateTime
if (index === 0) return true
const firstRange = viewSelectFieldOptions.find((f) => f.value === form.calendar_range[0].fk_from_column_id)
const firstRange = viewSelectFieldOptions!.find((f) => f.value === form.calendar_range[0].fk_from_column_id)
return firstRange?.uidt === f.uidt
})"
:key="id"

25
packages/nc-gui/components/smartsheet/toolbar/CalendarRange.vue

@ -96,7 +96,7 @@ const dateFieldOptions = computed<SelectProps['options']>(() => {
// To add new calendar range
const addCalendarRange = async () => {
_calendar_ranges.value.push({
fk_from_column_id: dateFieldOptions.value[0].value,
fk_from_column_id: dateFieldOptions.value![0].value as string,
fk_to_column_id: null,
})
await saveCalendarRanges()
@ -104,7 +104,11 @@ const addCalendarRange = async () => {
const removeRange = async (id: number) => {
_calendar_ranges.value = _calendar_ranges.value.filter((_, i) => i !== id)
await saveCalendarRanges()
}
const saveCalendarRange = async (range: CalendarRangeType, value?) => {
range.fk_to_column_id = value
await saveCalendarRanges()
}
</script>
@ -166,12 +170,7 @@ const removeRange = async (id: number) => {
v-if="range.fk_to_column_id === null && isEeUI && false"
class="flex cursor-pointer flex text-gray-800 items-center gap-1"
data-testid="nc-calendar-range-add-end-date"
@click="
() => {
range.fk_to_column_id = undefined
saveCalendarRanges()
}
"
@click="saveCalendarRange(range, undefined)"
>
<component :is="iconMap.plus" class="h-4 w-4" />
{{ $t('activity.addEndDate') }}
@ -206,17 +205,7 @@ const removeRange = async (id: number) => {
</div>
</a-select-option>
</NcSelect>
<NcButton
class="!rounded-l-none !border-l-0"
size="small"
type="secondary"
@click="
() => {
range.fk_to_column_id = null
saveCalendarRanges()
}
"
>
<NcButton class="!rounded-l-none !border-l-0" size="small" type="secondary" @click="saveCalendarRange(range, null)">
<component :is="iconMap.delete" class="h-4 w-4" />
</NcButton>
</div>

3
packages/nc-gui/lang/en.json

@ -435,7 +435,6 @@
"newProvider": "New Provider",
"generalSettings": "General Settings",
"ssoSettings": "SSO Settings",
"organizeRecordsBy": "Organize records by",
"organizeBy": "Organize by",
"previous": "Previous",
"nextMonth": "Next Month",
@ -1097,7 +1096,7 @@
"tooLargeFieldEntity": "The field is too large to be converted to {entity}",
"roleRequired": "Role required",
"warning": {
"calendarNoFields": "Calendar view requires a date or date time field to be setup. Try setting up a calendar view after adding a date/ date time field!",
"calendarNoFields": "Calendar view requires a date or date time field to be setup. Try setting up a calendar view after adding a date / date time field!",
"kanbanNoFields": "Kanban view requires a single select field to be setup. Try setting up a kanban view after adding a single select field!",
"mapNoFields": "Map view requires a geo data field to be setup. Try setting up a map view after adding a geo data field!",
"dbValid": "Please make sure database you are trying to connect is valid! This operation can cause schema loss!!",

4
packages/nc-gui/utils/generateName.ts

@ -22,7 +22,5 @@ export const generateUniqueTitle = <T extends Record<string, any> = Record<strin
}
export const generateRandomNumber = () => {
const typedArray = new Uint8Array(10)
const randomValues = window.crypto.getRandomValues(typedArray)
return randomValues.join('')
return window.crypto.getRandomValues(new Uint8Array(10)).join('')
}

Loading…
Cancel
Save