Browse Source

fix: pr review comments

pull/9323/head
DarkPhoenix2704 2 months ago
parent
commit
3b29051862
  1. 22
      packages/nc-gui/components/feed/Changelog/Item.vue
  2. 11
      packages/nc-gui/components/feed/Recents/Card.vue
  3. 2
      packages/nc-gui/components/feed/Recents/index.vue
  4. 2
      packages/nc-gui/components/feed/View.vue
  5. 4
      packages/nocodb/src/controllers/utils.controller.ts
  6. 4
      packages/nocodb/src/schema/swagger.json
  7. 49
      packages/nocodb/src/services/utils.service.ts

22
packages/nc-gui/components/feed/Changelog/Item.vue

@ -64,7 +64,7 @@ const renderedText = computedAsync(async () => {
<div class="content">
<div class="flex flex-col py-6 gap-5">
<div class="flex items-center">
<div
<a
v-for="tag in tags"
:key="tag.text"
:class="{
@ -94,7 +94,7 @@ const renderedText = computedAsync(async () => {
>
{{ tag.text }}
</span>
</div>
</a>
</div>
<div class="flex flex-col gap-2">
<NcBadge
@ -113,22 +113,26 @@ const renderedText = computedAsync(async () => {
</div>
</template>
<style lang="scss">
<style scoped lang="scss">
.nc-title-badge {
width: fit-content;
}
.content {
@apply !pl-50;
}
.prose {
img {
@apply !rounded-lg;
a {
@apply !no-underline;
}
h1 {
@apply !text-3xl !font-bold;
:deep(.prose) {
img {
@apply !rounded-lg;
}
h1 {
@apply !text-3xl !font-bold;
}
}
}

11
packages/nc-gui/components/feed/Recents/Card.vue

@ -76,20 +76,19 @@ const renderedText = computedAsync(async () => {
</div>
</template>
<style lang="scss">
<style scoped lang="scss">
.recent-card {
box-shadow: 0px 4px 8px -2px rgba(0, 0, 0, 0.08), 0px 2px 4px -2px rgba(0, 0, 0, 0.04);
.prose {
:deep(.prose) {
a {
@apply !text-gray-900;
@apply text-gray-900;
}
h1 {
@apply !text-2xl !font-semibold truncate;
@apply text-2xl font-semibold truncate;
}
p {
@apply !text-md !leading-6;
@apply text-md leading-6;
}
}
}

2
packages/nc-gui/components/feed/Recents/index.vue

@ -35,5 +35,3 @@ const { isLoading } = useInfiniteScroll(
</div>
</div>
</template>
<style scoped lang="scss"></style>

2
packages/nc-gui/components/feed/View.vue

@ -76,5 +76,3 @@ const tabs: Array<{
</NcTabs>
</div>
</template>
<style scoped lang="scss"></style>

4
packages/nocodb/src/controllers/utils.controller.ts

@ -169,13 +169,13 @@ export class UtilsController {
}
@UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/feed')
@Get('/api/v2/feed')
async feed(@Request() req: NcRequest) {
return await this.utilsService.feed(req);
}
@UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/new-feed')
@Get('/api/v2/new-feed')
async newFeed(@Request() req: NcRequest) {
return await this.utilsService.getLatestFeed(req);
}

4
packages/nocodb/src/schema/swagger.json

@ -16015,7 +16015,7 @@
]
}
},
"/api/v1/new-feed": {
"/api/v2/new-feed": {
"get": {
"summary": "Get Feed",
"operationId": "utils-feed",
@ -16042,7 +16042,7 @@
]
}
},
"/api/v1/feed": {
"/api/v2/feed": {
"get": {
"summary": "Get Feed",
"operationId": "utils-feed",

49
packages/nocodb/src/services/utils.service.ts

@ -1,5 +1,5 @@
import process from 'process';
import { Injectable } from '@nestjs/common';
import { Injectable, Logger } from '@nestjs/common';
import axios from 'axios';
import { compareVersions, validate } from 'compare-versions';
import { ViewTypes } from 'nocodb-sdk';
@ -75,6 +75,8 @@ interface AllMeta {
@Injectable()
export class UtilsService {
protected logger = new Logger(UtilsService.name);
constructor(protected readonly configService: ConfigService<AppConfig>) {}
lastSyncTime = dayjs();
@ -497,7 +499,7 @@ export class UtilsService {
try {
return JSON.parse(cachedData);
} catch (e) {
console.log(e);
this.logger.error(e?.message, e);
}
}
@ -520,7 +522,7 @@ export class UtilsService {
},
);
} catch (e) {
console.log(e);
this.logger.error(e?.message, e);
return [];
}
@ -551,33 +553,30 @@ export class UtilsService {
page: 1,
missedItems: 0,
};
while (!utils.found) {
const feed = await this.feed({
query: {
type: 'all',
page: utils.page.toString(),
per_page: '100',
},
} as unknown as NcRequest);
const feed = await this.feed({
query: {
type: 'all',
page: utils.page.toString(),
per_page: '100',
},
} as unknown as NcRequest);
if (!feed || !feed?.length) {
return 0;
}
if (!feed || !feed?.length) {
for (const item of feed) {
if (item['Published Time'] === last_published_at) {
utils.found = true;
break;
}
utils.missedItems++;
}
for (const item of feed) {
if (item['Published Time'] === last_published_at) {
utils.found = true;
break;
}
utils.missedItems++;
}
if (!utils.found) {
utils.page++;
}
if (utils.found) {
return utils.missedItems;
}
return utils.missedItems;
return `${utils.missedItems}+`;
}
}

Loading…
Cancel
Save