Files
threshold-ui/ui/admin/app/routes/scopes/scope/targets/target/index.js
T
lisbet-alvarezandZhihe Li 6a48c31d83 feat: 🎸 add storage bucket card on ssh target (#163)
* feat: 🎸 storage bucket card on ssh target

✅ Closes: ICU-8631

* Update ui/admin/app/routes/scopes/scope/targets/target/index.js

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>

---------

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
2023-04-05 10:49:15 -07:00

34 lines
847 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeTargetsTargetIndexRoute extends Route {
// =services
@service store;
// =methods
/**
* Adds storage bucket name to the context.
* @param {Controller} controller
* @param {TargetModel} target
*/
async setupController(controller, target) {
super.setupController(...arguments);
if (target?.storage_bucket_id) {
const { storage_bucket_id } = target;
const storageBucket = await this.store.findRecord(
'storage-bucket',
storage_bucket_id
);
const storage_bucket_name = storageBucket.displayName;
controller.set('storage_bucket_name', storage_bucket_name);
}
}
}