Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ <h3>Storage accounts in the same region as your batch account({{account.location
<bl-thead>
<bl-column [sortable]="true">Name</bl-column>
<bl-column [sortable]="true">Region</bl-column>
<bl-column [sortable]="false"></bl-column>
</bl-thead>
<bl-row [key]="noSelectionKey">
<bl-cell>No storage account</bl-cell>
<bl-cell></bl-cell>

<bl-cell></bl-cell>
</bl-row>
<bl-row *ngFor="let account of preferedAccounts" [key]="account.id.toLowerCase()">
<bl-cell [value]="account.name"></bl-cell>

<bl-cell [value]="account.location"></bl-cell>
<bl-cell [value]="account.isClassic">{{account.isClassic ? "Classic" : ""}}</bl-cell>
</bl-row>
</bl-table>
<div *ngIf="preferedAccounts.size === 0" class="no-prefered-account">
Expand All @@ -28,10 +29,13 @@ <h3>Other regions</h3>
<bl-thead>
<bl-column [sortable]="true">Name</bl-column>
<bl-column [sortable]="true">Region</bl-column>
<bl-column [sortable]="false"></bl-column>

</bl-thead>
<bl-row *ngFor="let account of otherAccounts" [key]="account.id.toLowerCase()">
<bl-cell [value]="account.name"></bl-cell>
<bl-cell [value]="account.location"></bl-cell>
<bl-cell [value]="account.isClassic">{{account.isClassic ? "Classic" : ""}}</bl-cell>
</bl-row>
</bl-table>
</div>
Expand Down
5 changes: 5 additions & 0 deletions app/core/record/arm-record.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Model, Prop } from "./decorators";
import { Record } from "./record";

export interface ArmRecordAttributes {
id: string;
type: string;
}

/**
* ArmRecord is a subclass of record that unify the id for ARM record which have problems with the case.
*/
@Model()
export class ArmRecord<T extends ArmRecordAttributes> extends Record<T> {
@Prop() public type: string;

constructor(data: T) {
super(Object.assign({}, data, { id: data.id && data.id.toLowerCase() }));
}
Expand Down
16 changes: 13 additions & 3 deletions app/models/storage-account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArmRecord, Model, Prop, Record } from "app/core";
import { ArmRecord, ArmRecordAttributes, Model, Prop, Record } from "app/core";

interface StorageAccountPropertiesAttributes {
creationTime: Date;
Expand Down Expand Up @@ -27,14 +27,16 @@ class StorageAccountProperties extends Record<StorageAccountPropertiesAttributes
@Prop() public supportsHttpsTrafficOnly: boolean;
}

export interface StorageAccountAttributes {
id: string;
export interface StorageAccountAttributes extends ArmRecordAttributes {
location: string;
name: string;
kind: string;
properties: Partial<StorageAccountPropertiesAttributes>;
type: StorageAccountType;
}

export type StorageAccountType = "Microsoft.Storage/storageAccounts" | "Microsoft.ClassicStorage/storageAccounts";

@Model()
export class StorageAccount extends ArmRecord<StorageAccountAttributes> {
@Prop() public id: string;
Expand All @@ -46,4 +48,12 @@ export class StorageAccount extends ArmRecord<StorageAccountAttributes> {
@Prop() public kind: string;

@Prop() public properties: StorageAccountProperties;

public type: StorageAccountType;
public isClassic: boolean;

constructor(data: StorageAccountAttributes) {
super(data);
this.isClassic = this.type === "Microsoft.ClassicStorage/storageAccounts";
}
}
4 changes: 3 additions & 1 deletion app/services/storage-account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export class StorageAccountService {

public list(subscriptionId: string): Observable<List<StorageAccount>> {
const search = new URLSearchParams();
search.set("$filter", "resourceType eq 'Microsoft.Storage/storageAccounts'");
search.set("$filter",
"resourceType eq 'Microsoft.Storage/storageAccounts'" +
"or resourceType eq 'Microsoft.ClassicStorage/storageAccounts'");
const options = new RequestOptions({ search });

return this.subscriptionService.get(subscriptionId)
Expand Down