-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updates landing-cta image to png with matching height * adds ts definitons for sync adapters * updates sync adapters and serializers to add methods for fetching overview data * adds sync associations list handler to mirage and seeds more associations in scenario * adds table and totals cards to sync overview page * adds sync overview page component tests * fixes tests * changes lastSync key to lastUpdated for sync fetchByDestinations response * adds emdash as placeholder for lastUpdated null value in secrets by destination table * updates to handle 0 associations state for destination in overview table
- Loading branch information
Showing
24 changed files
with
657 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { service } from '@ember/service'; | ||
import { task } from 'ember-concurrency'; | ||
import Ember from 'ember'; | ||
|
||
import type RouterService from '@ember/routing/router-service'; | ||
import type StoreService from 'vault/services/store'; | ||
import type FlashMessageService from 'vault/services/flash-messages'; | ||
import type { SyncDestinationAssociationMetrics } from 'vault/vault/adapters/sync/association'; | ||
import type SyncDestinationModel from 'vault/vault/models/sync/destination'; | ||
|
||
interface Args { | ||
destinations: Array<SyncDestinationModel>; | ||
totalAssociations: number; | ||
} | ||
|
||
export default class SyncSecretsDestinationsPageComponent extends Component<Args> { | ||
@service declare readonly router: RouterService; | ||
@service declare readonly store: StoreService; | ||
@service declare readonly flashMessages: FlashMessageService; | ||
|
||
@tracked destinationMetrics: SyncDestinationAssociationMetrics[] = []; | ||
@tracked page = 1; | ||
|
||
pageSize = Ember.testing ? 3 : 5; // lower in tests to test pagination without seeding more data | ||
|
||
constructor(owner: unknown, args: Args) { | ||
super(owner, args); | ||
if (this.args.destinations.length) { | ||
this.fetchAssociationsForDestinations.perform(); | ||
} | ||
} | ||
|
||
fetchAssociationsForDestinations = task(this, {}, async (page = 1) => { | ||
try { | ||
const total = page * this.pageSize; | ||
const paginatedDestinations = this.args.destinations.slice(total - this.pageSize, total); | ||
this.destinationMetrics = await this.store | ||
.adapterFor('sync/association') | ||
.fetchByDestinations(paginatedDestinations); | ||
this.page = page; | ||
} catch (error) { | ||
this.destinationMetrics = []; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.