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="content">
<div class="flex flex-col py-6 gap-5"> <div class="flex flex-col py-6 gap-5">
<div class="flex items-center"> <div class="flex items-center">
<div <a
v-for="tag in tags" v-for="tag in tags"
:key="tag.text" :key="tag.text"
:class="{ :class="{
@ -94,7 +94,7 @@ const renderedText = computedAsync(async () => {
> >
{{ tag.text }} {{ tag.text }}
</span> </span>
</div> </a>
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<NcBadge <NcBadge
@ -113,22 +113,26 @@ const renderedText = computedAsync(async () => {
</div> </div>
</template> </template>
<style lang="scss"> <style scoped lang="scss">
.nc-title-badge { .nc-title-badge {
width: fit-content; width: fit-content;
} }
.content { .content {
@apply !pl-50; @apply !pl-50;
}
.prose { a {
img { @apply !no-underline;
@apply !rounded-lg;
} }
h1 { :deep(.prose) {
@apply !text-3xl !font-bold; 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> </div>
</template> </template>
<style lang="scss"> <style scoped lang="scss">
.recent-card { .recent-card {
box-shadow: 0px 4px 8px -2px rgba(0, 0, 0, 0.08), 0px 2px 4px -2px rgba(0, 0, 0, 0.04); box-shadow: 0px 4px 8px -2px rgba(0, 0, 0, 0.08), 0px 2px 4px -2px rgba(0, 0, 0, 0.04);
:deep(.prose) {
.prose {
a { a {
@apply !text-gray-900; @apply text-gray-900;
} }
h1 { h1 {
@apply !text-2xl !font-semibold truncate; @apply text-2xl font-semibold truncate;
} }
p { 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>
</div> </div>
</template> </template>
<style scoped lang="scss"></style>

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

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

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

@ -169,13 +169,13 @@ export class UtilsController {
} }
@UseGuards(PublicApiLimiterGuard) @UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/feed') @Get('/api/v2/feed')
async feed(@Request() req: NcRequest) { async feed(@Request() req: NcRequest) {
return await this.utilsService.feed(req); return await this.utilsService.feed(req);
} }
@UseGuards(PublicApiLimiterGuard) @UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/new-feed') @Get('/api/v2/new-feed')
async newFeed(@Request() req: NcRequest) { async newFeed(@Request() req: NcRequest) {
return await this.utilsService.getLatestFeed(req); 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": { "get": {
"summary": "Get Feed", "summary": "Get Feed",
"operationId": "utils-feed", "operationId": "utils-feed",
@ -16042,7 +16042,7 @@
] ]
} }
}, },
"/api/v1/feed": { "/api/v2/feed": {
"get": { "get": {
"summary": "Get Feed", "summary": "Get Feed",
"operationId": "utils-feed", "operationId": "utils-feed",

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

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

Loading…
Cancel
Save