+
@@ -40,19 +48,19 @@
@route="authenticated.new"
{{!-- @isIconOnly={{true}} --}}
@text="New Doc"
- {{!-- @icon="file-plus" --}}
- {{!-- class="create-draft-button" --}}
+ @icon="file-plus"
+ {{! class="create-draft-button" }}
class="navbar-button"
/>
+ @icon ="folder-users"
+ {{!-- @isIconOnly={{true}} --}}
+ @text="Directory"
+ @color="secondary"
+ class="navbar-button"
+ {{on "click" (fn this.toggleModal)}}
+ />
{{#if this.userMenuHighlightIsShown}}
@@ -97,7 +105,7 @@
/>
@@ -114,32 +122,30 @@
-
-
- {{#if this.showModal}}
-
-
- Directory List
-
-
-
-
- {{#each-in this.products as |buKey buValue|}}
- {{!-- Use the 'collapsible-folder' component --}}
-
- {{/each-in}}
-
-
-
-
+{{#if this.showModal}}
+
+
+ Directory List
+
+
+
+
+ {{#each-in this.products as |buKey buValue|}}
+ {{! Use the 'collapsible-folder' component }}
+
+ {{/each-in}}
+
+
+
+
-
-
- {{/if}}
\ No newline at end of file
+
+{{/if}}
\ No newline at end of file
diff --git a/web/app/controllers/authenticated/waiting-for-me.js b/web/app/controllers/authenticated/waiting-for-me.js
new file mode 100644
index 000000000..8de43f56e
--- /dev/null
+++ b/web/app/controllers/authenticated/waiting-for-me.js
@@ -0,0 +1,24 @@
+import Controller from "@ember/controller";
+import { alias } from "@ember/object/computed";
+import { inject as service } from "@ember/service";
+import {tracked} from "@glimmer/tracking";
+import {action} from "@ember/object";
+import {task, timeout} from "ember-concurrency";
+import Ember from "ember";
+import {TaskForAsyncTaskFunction} from "ember-concurrency";
+import FetchService from "../../services/fetch";
+import { HermesUser } from "hermes/types/document";
+
+const AWAIT_DOC_DELAY = Ember.testing ? 0 : 1000;
+
+export default class AuthenticatedWaitingForMeController extends Controller {
+ @alias("model.docsWaitingForReview") docsWaitingForReview;
+ @alias("model.docsReviewed") docsReviewed;
+
+ @service router;
+ @service authenticatedUser;
+ @service("config") configSvc;
+ @service("recently-viewed-docs") recentDocs;
+ @service('flash-messages') flashMessages;
+ @service("fetch") fetchSvc: FetchService;
+}
\ No newline at end of file
diff --git a/web/app/router.js b/web/app/router.js
index 8be2cced2..cb929fc39 100644
--- a/web/app/router.js
+++ b/web/app/router.js
@@ -13,6 +13,7 @@ Router.map(function () {
this.route("document", { path: "/document/:document_id" });
this.route("drafts");
this.route("my");
+ this.route("waiting-for-me");
this.route("results");
this.route("settings");
this.route("new", function () {
diff --git a/web/app/routes/authenticated/waiting-for-me.js b/web/app/routes/authenticated/waiting-for-me.js
new file mode 100644
index 000000000..57cd55e2d
--- /dev/null
+++ b/web/app/routes/authenticated/waiting-for-me.js
@@ -0,0 +1,144 @@
+import Route from "@ember/routing/route";
+import RSVP from "rsvp";
+import { inject as service } from "@ember/service";
+import timeAgo from "hermes/utils/time-ago";
+import { action } from "@ember/object";
+
+export default class WaitingForMeRoute extends Route {
+ @service algolia;
+ @service("config") configSvc;
+ @service("fetch") fetchSvc;
+ @service("recently-viewed-docs") recentDocs;
+ @service session;
+ @service authenticatedUser;
+
+ queryParams = {
+ latestUpdates: {
+ refreshModel: true,
+ replace: true,
+ },
+ };
+
+ resetController(controller, isExiting, transition) {
+ if (isExiting) {
+ controller.set("latestUpdates", "newDocs");
+ }
+ }
+
+ async model(params) {
+ // Create facet filter for recently updated docs depending on the selected
+ // "Latest updates" tab.
+ let facetFilter = "";
+ if (params.latestUpdates == "reviewed") {
+ facetFilter = "status:reviewed";
+ } else if (params.latestUpdates == "inReview") {
+ facetFilter = "status:In-Review";
+ }
+
+ const userInfo = this.authenticatedUser.info;
+
+ const docsWaitingForReview = this.algolia.searchIndex
+ .perform(this.configSvc.config.algolia_docs_index_name, "", {
+ filters:
+ `reviewers:'${userInfo.email}'` +
+ ` AND NOT reviewedBy:'${userInfo.email}'` +
+ " AND appCreated:true" +
+ " AND status:In-Review",
+ hitsPerPage: 1000,
+ })
+ .then((result) => {
+ // Add modifiedAgo for each doc.
+ for (const hit of result.hits) {
+ this.fetchSvc
+ .fetch("/api/v1/documents/" + hit.objectID)
+ .then((resp) => resp.json())
+ .then((doc) => {
+ if (doc.modifiedTime) {
+ const modifiedDate = new Date(doc.modifiedTime * 1000);
+ hit.modifiedAgo = `Modified ${timeAgo(modifiedDate)}`;
+ }
+ })
+ .catch((err) => {
+ console.log(
+ `Error getting document waiting for review (${hit.objectID}):`,
+ err
+ );
+ });
+ }
+ return result.hits;
+ });
+
+ const docsReviewed = this.algolia.searchIndex
+ .perform(this.configSvc.config.algolia_docs_index_name, "", {
+ filters:
+ `reviewers:'${userInfo.email}'` +
+ ` AND reviewedBy:'${userInfo.email}'` +
+ " AND appCreated:true",
+ // +
+ // " AND status:In-Review",
+ hitsPerPage: 1000,
+ })
+ .then((result) => {
+ // Add modifiedAgo for each doc.
+ for (const hit of result.hits) {
+ this.fetchSvc
+ .fetch("/api/v1/documents/" + hit.objectID)
+ .then((resp) => resp.json())
+ .then((doc) => {
+ if (doc.modifiedTime) {
+ const modifiedDate = new Date(doc.modifiedTime * 1000);
+ hit.modifiedAgo = `Modified ${timeAgo(modifiedDate)}`;
+ }
+ })
+ .catch((err) => {
+ console.log(
+ `Error getting document waiting for review (${hit.objectID}):`,
+ err
+ );
+ });
+ }
+ return result.hits;
+ });
+
+ await this.recentDocs.fetchAll.perform();
+ if (this.recentDocs.all === null) {
+ try {
+ await this.recentDocs.fetchAll.perform();
+ } catch {
+ /**
+ * This tells our template to show the error state.
+ */
+ this.recentDocs.all = null;
+ }
+ }
+
+ docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) =>
+ a.dueDate.localeCompare(b.dueDate)
+ );
+ console.log("docsReviewed : ", docsReviewed);
+ return RSVP.hash({
+ docsWaitingForReview: docsWaitingForReview,
+ docsReviewed: docsReviewed,
+ });
+ }
+
+ /**
+ * Builds a parent query string for searching for Google files. The folders
+ * parameter is an array of all folder ID strings to search.
+ */
+ buildParentsQuery(folders) {
+ let parentsQuery = "";
+ if (folders.length > 0) {
+ parentsQuery += " and (";
+ folders.forEach((folder, index) => {
+ if (index == 0) {
+ parentsQuery += `'${folder}' in parents`;
+ } else {
+ parentsQuery += ` or '${folder}' in parents`;
+ }
+ });
+ parentsQuery += ")";
+ }
+ return parentsQuery;
+ }
+}
diff --git a/web/app/styles/app.scss b/web/app/styles/app.scss
index 5050c350e..2a8991985 100644
--- a/web/app/styles/app.scss
+++ b/web/app/styles/app.scss
@@ -254,6 +254,9 @@ ol {
.x-container {
@apply w-full max-w-screen-lg mx-auto px-8;
}
+.x-container-navbar {
+ @apply w-full mx-auto px-20;
+}
h1 {
@apply text-display-500 font-bold text-color-foreground-strong mb-1.5;
diff --git a/web/app/templates/authenticated/waiting-for-me.hbs b/web/app/templates/authenticated/waiting-for-me.hbs
new file mode 100644
index 000000000..8b6b4209d
--- /dev/null
+++ b/web/app/templates/authenticated/waiting-for-me.hbs
@@ -0,0 +1,126 @@
+{{page-title "waiting for me"}}
+
+
+ {{#if this.docsWaitingForReview}}
+
+
+
+
Documents waiting for your review
+
+
+ {{!--
+ {{#each this.docsWaitingForReview as |doc index|}}
+ {{#if (lt index 1000)}}
+
+ {{/if}}
+ {{/each}}
+
--}}
+
+ <:head as |H|>
+
+ Name
+ Type
+ Status
+ Product/Area
+ Owner
+ Created
+ Due Date
+
+
+ <:body>
+ {{#each this.docsWaitingForReview as |doc index|}}
+
+ {{/each}}
+
+
+
+ {{/if}}
+
+
+
+
Documents you have reviewed
+
+
+ {{!--
+ {{#each this.docsWaitingForReview as |doc index|}}
+ {{#if (lt index 1000)}}
+
+ {{/if}}
+ {{/each}}
+
--}}
+
+ <:head as |H|>
+
+ Name
+ Type
+ Status
+ Product/Area
+ Owner
+ Created
+ Due Date
+
+
+ <:body>
+ {{#each this.docsReviewed as |doc index|}}
+
+ {{/each}}
+
+
+
+
+
\ No newline at end of file
From 8e9358eb841f12965314742d8eff2d256a453432 Mon Sep 17 00:00:00 2001
From: soujash-mandal <2002soujash@gmail.com>
Date: Tue, 25 Jul 2023 00:02:07 +0530
Subject: [PATCH 07/11] Merge Conflict Bug Fix
---
web/app/components/doc/row.hbs | 22 ++++++++++++++++++++++
web/app/components/doc/tile.hbs | 20 ++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/web/app/components/doc/row.hbs b/web/app/components/doc/row.hbs
index e46135904..3631b4f6e 100644
--- a/web/app/components/doc/row.hbs
+++ b/web/app/components/doc/row.hbs
@@ -37,4 +37,26 @@
{{@createdDate}}
+
+ {{#if (not (is-empty @dueDate))}}
+ {{#if @showColorBadge}}
+ {{#if @isReviewed}}
+
+ {{else if this.isDueDateOverdue}}
+
+ {{else}}
+
+ {{/if}}
+ {{else}}
+
+ {{/if}}
+ {{else}}
+ {{#if @isReviewed}}
+
+ {{else}}
+
+ {{/if}}
+
+ {{/if}}
+
\ No newline at end of file
diff --git a/web/app/components/doc/tile.hbs b/web/app/components/doc/tile.hbs
index 924113e75..ca29968b4 100644
--- a/web/app/components/doc/tile.hbs
+++ b/web/app/components/doc/tile.hbs
@@ -34,6 +34,26 @@
@icon={{or (get-product-id this.this.args.productArea) "folder"}}
/>
+ {{#if (not (is-empty @dueDate))}}
+ {{#if @showColorBadge}}
+ {{#if this.isDueDateOverdue}}
+
+ {{else}}
+
+ {{/if}}
+ {{else}}
+
+ {{/if}}
+ {{else}}
+
+ {{/if}}
+
{{#if (and @isResult @snippet)}}
{{/if}}
From cfcd957e79d664a9ae3970c1e8af9accc2769de9 Mon Sep 17 00:00:00 2001
From: soujash-mandal <2002soujash@gmail.com>
Date: Tue, 25 Jul 2023 01:51:47 +0530
Subject: [PATCH 08/11] fixing sort wrt due Date bug
---
web/app/routes/authenticated/dashboard.js | 18 ++++++++++++++---
.../routes/authenticated/waiting-for-me.js | 20 +++++++++++++++----
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/web/app/routes/authenticated/dashboard.js b/web/app/routes/authenticated/dashboard.js
index c82f61815..3c2aa56de 100644
--- a/web/app/routes/authenticated/dashboard.js
+++ b/web/app/routes/authenticated/dashboard.js
@@ -79,9 +79,21 @@ export default class DashboardRoute extends Route {
this.recentDocs.all = null;
}
}
- docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) =>
- a.dueDate.localeCompare(b.dueDate)
- );
+ docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
+ // Check if 'dueDate' property exists in both 'a' and 'b'
+ if (a.dueDate && b.dueDate) {
+ return a.dueDate.localeCompare(b.dueDate);
+ } else if (a.dueDate) {
+ // If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
+ return -1;
+ } else if (b.dueDate) {
+ // If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
+ return 1;
+ } else {
+ // If 'dueDate' doesn't exist in both 'a' and 'b', maintain their original order
+ return 0;
+ }
+ });
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
});
diff --git a/web/app/routes/authenticated/waiting-for-me.js b/web/app/routes/authenticated/waiting-for-me.js
index 57cd55e2d..c811eb4d6 100644
--- a/web/app/routes/authenticated/waiting-for-me.js
+++ b/web/app/routes/authenticated/waiting-for-me.js
@@ -112,10 +112,22 @@ export default class WaitingForMeRoute extends Route {
}
}
- docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) =>
- a.dueDate.localeCompare(b.dueDate)
- );
- console.log("docsReviewed : ", docsReviewed);
+ docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
+ // Check if 'dueDate' property exists in both 'a' and 'b'
+ if (a.dueDate && b.dueDate) {
+ return a.dueDate.localeCompare(b.dueDate);
+ } else if (a.dueDate) {
+ // If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
+ return -1;
+ } else if (b.dueDate) {
+ // If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
+ return 1;
+ } else {
+ // If 'dueDate' doesn't exist in both 'a' and 'b', maintain their original order
+ return 0;
+ }
+ });
+
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
docsReviewed: docsReviewed,
From c434646e7f1186f4fcd7e1ff6c0a01cfc0a89338 Mon Sep 17 00:00:00 2001
From: soujash-mandal <2002soujash@gmail.com>
Date: Tue, 25 Jul 2023 10:48:57 +0530
Subject: [PATCH 09/11] resolving sorting error
---
web/app/routes/authenticated/dashboard.js | 16 ++++++++++++----
web/app/routes/authenticated/waiting-for-me.js | 14 +++++++++-----
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/web/app/routes/authenticated/dashboard.js b/web/app/routes/authenticated/dashboard.js
index 3c2aa56de..3c0d1da02 100644
--- a/web/app/routes/authenticated/dashboard.js
+++ b/web/app/routes/authenticated/dashboard.js
@@ -79,14 +79,20 @@ export default class DashboardRoute extends Route {
this.recentDocs.all = null;
}
}
+
+
docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
+ // Use optional chaining to access the 'dueDate' property safely
+ const dueDateA = a.dueDate?.toString()||"";
+ const dueDateB = b.dueDate?.toString()||"";
+
// Check if 'dueDate' property exists in both 'a' and 'b'
- if (a.dueDate && b.dueDate) {
- return a.dueDate.localeCompare(b.dueDate);
- } else if (a.dueDate) {
+ if (dueDateA && dueDateB) {
+ return dueDateA.localeCompare(dueDateB);
+ } else if (dueDateA) {
// If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
return -1;
- } else if (b.dueDate) {
+ } else if (dueDateB) {
// If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
return 1;
} else {
@@ -94,6 +100,8 @@ export default class DashboardRoute extends Route {
return 0;
}
});
+
+
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
});
diff --git a/web/app/routes/authenticated/waiting-for-me.js b/web/app/routes/authenticated/waiting-for-me.js
index c811eb4d6..7b0264edc 100644
--- a/web/app/routes/authenticated/waiting-for-me.js
+++ b/web/app/routes/authenticated/waiting-for-me.js
@@ -113,13 +113,17 @@ export default class WaitingForMeRoute extends Route {
}
docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
+ // Use optional chaining to access the 'dueDate' property safely
+ const dueDateA = a.dueDate?.toString()||"";
+ const dueDateB = b.dueDate?.toString()||"";
+
// Check if 'dueDate' property exists in both 'a' and 'b'
- if (a.dueDate && b.dueDate) {
- return a.dueDate.localeCompare(b.dueDate);
- } else if (a.dueDate) {
+ if (dueDateA && dueDateB) {
+ return dueDateA.localeCompare(dueDateB);
+ } else if (dueDateA) {
// If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
return -1;
- } else if (b.dueDate) {
+ } else if (dueDateB) {
// If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
return 1;
} else {
@@ -127,7 +131,7 @@ export default class WaitingForMeRoute extends Route {
return 0;
}
});
-
+
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
docsReviewed: docsReviewed,
From 783d762206d4528322d0223f1d6081701352a889 Mon Sep 17 00:00:00 2001
From: soujash-mandal <2002soujash@gmail.com>
Date: Tue, 25 Jul 2023 17:17:18 +0530
Subject: [PATCH 10/11] sort the waiting docs wrt due date resolved frontend->
algolia
---
pkg/algolia/client.go | 94 ++++++++++++++++++-
web/app/routes/authenticated/dashboard.js | 25 +----
.../routes/authenticated/waiting-for-me.js | 29 +-----
3 files changed, 98 insertions(+), 50 deletions(-)
diff --git a/pkg/algolia/client.go b/pkg/algolia/client.go
index 73c3d33ab..e210b718b 100644
--- a/pkg/algolia/client.go
+++ b/pkg/algolia/client.go
@@ -28,6 +28,8 @@ type Client struct {
// by descending modified time.
DocsModifiedTimeDesc *search.Index
+ DocsDueDateAsc *search.Index
+
// Drafts is an Algolia index for storing metadata for draft documents.
Drafts *search.Index
@@ -143,6 +145,7 @@ func New(cfg *Config) (*Client, error) {
cfg.DocsIndexName+"_createdTime_asc",
cfg.DocsIndexName+"_createdTime_desc",
cfg.DocsIndexName+"_modifiedTime_desc",
+ cfg.DocsIndexName+"_dueDate_asc",
),
})
if err != nil {
@@ -153,11 +156,14 @@ func New(cfg *Config) (*Client, error) {
c.DocsCreatedTimeAsc = a.InitIndex(cfg.DocsIndexName + "_createdTime_asc")
c.DocsCreatedTimeDesc = a.InitIndex(cfg.DocsIndexName + "_createdTime_desc")
c.DocsModifiedTimeDesc = a.InitIndex(cfg.DocsIndexName + "_modifiedTime_desc")
- err = configureReplicaIndexes(
+ c.DocsDueDateAsc = a.InitIndex(cfg.DocsIndexName + "_dueDate_asc")
+
+ err = configureDocsReplicaIndexes(
cfg.DocsIndexName,
c.DocsCreatedTimeAsc,
c.DocsCreatedTimeDesc,
c.DocsModifiedTimeDesc,
+ c.DocsDueDateAsc,
)
if err != nil {
return nil, err
@@ -224,6 +230,7 @@ func configureReplicaIndexes(
createdTimeAscIndex *search.Index,
createdTimeDescIndex *search.Index,
modifiedTimeDescIndex *search.Index,
+
) error {
// Configure the createdTime_asc replica for index.
_, err := createdTimeAscIndex.SetSettings(search.Settings{
@@ -284,6 +291,90 @@ func configureReplicaIndexes(
return nil
}
+func configureDocsReplicaIndexes(
+ indexName string,
+ createdTimeAscIndex *search.Index,
+ createdTimeDescIndex *search.Index,
+ modifiedTimeDescIndex *search.Index,
+ dueDateAscIndex *search.Index,
+) error {
+ // Configure the createdTime_asc replica for index.
+ _, err := createdTimeAscIndex.SetSettings(search.Settings{
+ AttributesForFaceting: opt.AttributesForFaceting(
+ "contributors",
+ "docType",
+ "owners",
+ "product",
+ "status",
+ ),
+
+ Ranking: opt.Ranking(
+ "asc(createdTime)",
+ ),
+ })
+ if err != nil {
+ return fmt.Errorf(
+ "error setting settings for the %s createdTime_asc standard replica: %w",
+ indexName, err)
+ }
+
+ // Configure the createdTime_desc replica for index.
+ _, err = createdTimeDescIndex.SetSettings(search.Settings{
+ AttributesForFaceting: opt.AttributesForFaceting(
+ "contributors",
+ "docType",
+ "owners",
+ "product",
+ "status",
+ ),
+
+ Ranking: opt.Ranking(
+ "desc(createdTime)",
+ ),
+ })
+ if err != nil {
+ return fmt.Errorf(
+ "error setting settings for the %s createdTime_desc standard replica: %w",
+ indexName, err)
+ }
+
+ // Configure the modifiedTime_desc replica for index.
+ _, err = modifiedTimeDescIndex.SetSettings(search.Settings{
+ AttributesForFaceting: opt.AttributesForFaceting(
+ "status",
+ ),
+
+ Ranking: opt.Ranking(
+ "desc(modifiedTime)",
+ ),
+ })
+ if err != nil {
+ return fmt.Errorf(
+ "error setting settings for the %s modifiedTime_desc standard replica: %w",
+ indexName, err)
+ }
+
+ // Configure the dueDate_asc replica for index.
+ _, err = dueDateAscIndex.SetSettings(search.Settings{
+ AttributesForFaceting: opt.AttributesForFaceting(
+ "reviewers",
+ "reviewedBy",
+ "appCreated",
+ "status",
+ ),
+ Ranking: opt.Ranking(
+ "asc(dueDate)",
+ ),
+ })
+ if err != nil {
+ return fmt.Errorf(
+ "error setting settings for the %s modifiedTime_desc standard replica: %w",
+ indexName, err)
+ }
+
+ return nil
+}
+
// NewSearchClient returns a new Algolia client for searching indices.
func NewSearchClient(cfg *Config) (*Client, error) {
if err := validate(cfg); err != nil {
@@ -299,6 +390,7 @@ func NewSearchClient(cfg *Config) (*Client, error) {
c.DocsCreatedTimeAsc = a.InitIndex(cfg.DocsIndexName + "_createdTime_asc")
c.DocsCreatedTimeDesc = a.InitIndex(cfg.DocsIndexName + "_createdTime_desc")
c.DocsModifiedTimeDesc = a.InitIndex(cfg.DocsIndexName + "_modifiedTime_desc")
+ c.DocsDueDateAsc = a.InitIndex(cfg.DocsIndexName + "_dueDate_asc")
c.Drafts = a.InitIndex(cfg.DraftsIndexName)
c.DraftsCreatedTimeAsc = a.InitIndex(cfg.DraftsIndexName + "_createdTime_asc")
c.DraftsCreatedTimeDesc = a.InitIndex(cfg.DraftsIndexName + "_createdTime_desc")
diff --git a/web/app/routes/authenticated/dashboard.js b/web/app/routes/authenticated/dashboard.js
index 3c0d1da02..8f6748dbd 100644
--- a/web/app/routes/authenticated/dashboard.js
+++ b/web/app/routes/authenticated/dashboard.js
@@ -38,13 +38,13 @@ export default class DashboardRoute extends Route {
const userInfo = this.authenticatedUser.info;
const docsWaitingForReview = this.algolia.searchIndex
- .perform(this.configSvc.config.algolia_docs_index_name, "", {
+ .perform(this.configSvc.config.algolia_docs_index_name+"_dueDate_asc","", {
filters:
`reviewers:'${userInfo.email}'` +
` AND NOT reviewedBy:'${userInfo.email}'` +
" AND appCreated:true" +
" AND status:In-Review",
- hitsPerPage: 1000,
+ hitsPerPage: 4,
})
.then((result) => {
// Add modifiedAgo for each doc.
@@ -81,27 +81,6 @@ export default class DashboardRoute extends Route {
}
- docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
- // Use optional chaining to access the 'dueDate' property safely
- const dueDateA = a.dueDate?.toString()||"";
- const dueDateB = b.dueDate?.toString()||"";
-
- // Check if 'dueDate' property exists in both 'a' and 'b'
- if (dueDateA && dueDateB) {
- return dueDateA.localeCompare(dueDateB);
- } else if (dueDateA) {
- // If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
- return -1;
- } else if (dueDateB) {
- // If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
- return 1;
- } else {
- // If 'dueDate' doesn't exist in both 'a' and 'b', maintain their original order
- return 0;
- }
- });
-
-
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
});
diff --git a/web/app/routes/authenticated/waiting-for-me.js b/web/app/routes/authenticated/waiting-for-me.js
index 7b0264edc..c8e7a12af 100644
--- a/web/app/routes/authenticated/waiting-for-me.js
+++ b/web/app/routes/authenticated/waiting-for-me.js
@@ -36,9 +36,9 @@ export default class WaitingForMeRoute extends Route {
}
const userInfo = this.authenticatedUser.info;
-
+ const searchIndex=this.configSvc.config.algolia_docs_index_name + "_dueDate_asc";
const docsWaitingForReview = this.algolia.searchIndex
- .perform(this.configSvc.config.algolia_docs_index_name, "", {
+ .perform(searchIndex, "", {
filters:
`reviewers:'${userInfo.email}'` +
` AND NOT reviewedBy:'${userInfo.email}'` +
@@ -69,13 +69,11 @@ export default class WaitingForMeRoute extends Route {
});
const docsReviewed = this.algolia.searchIndex
- .perform(this.configSvc.config.algolia_docs_index_name, "", {
+ .perform(searchIndex, "", {
filters:
`reviewers:'${userInfo.email}'` +
` AND reviewedBy:'${userInfo.email}'` +
" AND appCreated:true",
- // +
- // " AND status:In-Review",
hitsPerPage: 1000,
})
.then((result) => {
@@ -111,27 +109,6 @@ export default class WaitingForMeRoute extends Route {
this.recentDocs.all = null;
}
}
-
- docsWaitingForReview._result = docsWaitingForReview._result.sort((a, b) => {
- // Use optional chaining to access the 'dueDate' property safely
- const dueDateA = a.dueDate?.toString()||"";
- const dueDateB = b.dueDate?.toString()||"";
-
- // Check if 'dueDate' property exists in both 'a' and 'b'
- if (dueDateA && dueDateB) {
- return dueDateA.localeCompare(dueDateB);
- } else if (dueDateA) {
- // If 'dueDate' exists in 'a' but not in 'b', consider 'a' to come before 'b'
- return -1;
- } else if (dueDateB) {
- // If 'dueDate' exists in 'b' but not in 'a', consider 'b' to come before 'a'
- return 1;
- } else {
- // If 'dueDate' doesn't exist in both 'a' and 'b', maintain their original order
- return 0;
- }
- });
-
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
docsReviewed: docsReviewed,
From 73ea4126e1a866d8a00a3a37b13967b6839275e3 Mon Sep 17 00:00:00 2001
From: soujash-mandal <2002soujash@gmail.com>
Date: Tue, 25 Jul 2023 17:40:29 +0530
Subject: [PATCH 11/11] Update waiting-for-me.js
---
web/app/routes/authenticated/waiting-for-me.js | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/web/app/routes/authenticated/waiting-for-me.js b/web/app/routes/authenticated/waiting-for-me.js
index c8e7a12af..bac3f4d6c 100644
--- a/web/app/routes/authenticated/waiting-for-me.js
+++ b/web/app/routes/authenticated/waiting-for-me.js
@@ -8,7 +8,6 @@ export default class WaitingForMeRoute extends Route {
@service algolia;
@service("config") configSvc;
@service("fetch") fetchSvc;
- @service("recently-viewed-docs") recentDocs;
@service session;
@service authenticatedUser;
@@ -98,17 +97,7 @@ export default class WaitingForMeRoute extends Route {
return result.hits;
});
- await this.recentDocs.fetchAll.perform();
- if (this.recentDocs.all === null) {
- try {
- await this.recentDocs.fetchAll.perform();
- } catch {
- /**
- * This tells our template to show the error state.
- */
- this.recentDocs.all = null;
- }
- }
+
return RSVP.hash({
docsWaitingForReview: docsWaitingForReview,
docsReviewed: docsReviewed,