Skip to content

Commit 6be4167

Browse files
committed
RavenDB-24365 Apply a future date in the examples (archival, refresh, expiration)
1 parent 39f064f commit 6be4167

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/Raven.Studio/typescript/components/pages/database/settings/dataArchival/DataArchival.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ import { useRavenLink } from "hooks/useRavenLink";
3737

3838
const defaultItemsToProcess = 65536;
3939

40+
// Compute a future date dynamically for the sample in the 'About this view' text:
41+
const archiveAt = new Date();
42+
archiveAt.setFullYear(archiveAt.getFullYear() + 1);
43+
4044
export default function DataArchival() {
4145
const databaseName = useAppSelector(databaseSelectors.activeDatabaseName);
4246
const hasDatabaseAdminAccess = useAppSelector(accessManagerSelectors.getHasDatabaseAdminAccess)();
@@ -247,7 +251,7 @@ export default function DataArchival() {
247251
</ul>
248252
</li>
249253
</ul>
250-
<p>Sample document:</p>
254+
<p>Example of a document scheduled for archival:</p>
251255
<Code code={codeExample} language="javascript" />
252256
<hr />
253257
<div className="small-label mb-2">useful links</div>
@@ -268,11 +272,10 @@ export default function DataArchival() {
268272
}
269273

270274
const codeExample = `{
271-
"Example":
272-
"Set a timestamp in the @archive-at metadata property",
275+
"Example": "Set a timestamp in the @archive-at metadata property",
273276
"@metadata": {
274277
"@collection": "Foo",
275-
"@archive-at": "2023-07-16T08:00:00.0000000Z"
278+
"@archive-at": "${archiveAt.toISOString()}"
276279
}
277280
}`;
278281

src/Raven.Studio/typescript/components/pages/database/settings/documentExpiration/DocumentExpiration.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import RichAlert from "components/common/RichAlert";
3333

3434
const defaultItemsToProcess = 65536;
3535

36+
// Compute a future date dynamically for the sample in the 'About this view' text:
37+
const expireAt = new Date();
38+
expireAt.setFullYear(expireAt.getFullYear() + 1);
39+
3640
export default function DocumentExpiration() {
3741
const databaseName = useAppSelector(databaseSelectors.activeDatabaseName);
3842
const { databasesService } = useServices();
@@ -248,7 +252,7 @@ export default function DocumentExpiration() {
248252
</li>
249253
</ul>
250254

251-
<p>Sample document:</p>
255+
<p>Example of a document scheduled for expiration:</p>
252256
<Code code={codeExample} language="javascript" />
253257
<hr />
254258
<div className="small-label mb-2">useful links</div>
@@ -293,7 +297,7 @@ const codeExample = `{
293297
"Set a timestamp in the @expires metadata property",
294298
"@metadata": {
295299
"@collection": "Foo",
296-
"@expires": "2023-07-16T08:00:00.0000000Z"
300+
"@expires": "${expireAt.toISOString()}"
297301
}
298302
}`;
299303

src/Raven.Studio/typescript/components/pages/database/settings/documentRefresh/DocumentRefresh.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import RichAlert from "components/common/RichAlert";
3333

3434
const defaultItemsToProcess = 65536;
3535

36+
// Compute a future date dynamically for the sample in the 'About this view' text:
37+
const refreshAt = new Date();
38+
refreshAt.setFullYear(refreshAt.getFullYear() + 1);
39+
3640
export default function DocumentRefresh() {
3741
const databaseName = useAppSelector(databaseSelectors.activeDatabaseName);
3842
const { databasesService } = useServices();
@@ -247,7 +251,7 @@ export default function DocumentRefresh() {
247251
Subscriptions, etc.), as defined by your configuration.
248252
</li>
249253
</ul>
250-
<p>Sample document:</p>
254+
<p>Example of a document scheduled for refresh:</p>
251255
<Code code={codeExample} language="javascript" />
252256
<hr />
253257
<div className="small-label mb-2">useful links</div>
@@ -292,7 +296,7 @@ const codeExample = `{
292296
"Set a timestamp in the @refresh metadata property",
293297
"@metadata": {
294298
"@collection": "Foo",
295-
"@refresh": "2023-07-16T08:00:00.0000000Z"
299+
"@refresh": "${refreshAt.toISOString()}"
296300
}
297301
}`;
298302

0 commit comments

Comments
 (0)