Skip to content

Commit b604e58

Browse files
Cyrille Bourgoisjleveugle
authored andcommitted
fix(pci.project.instances): add state reload
* add goToInstances & goToInstance resolve and use it in goBack sub resolve * fix translations loading ref: MSB-18
1 parent 870366d commit b604e58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+310
-340
lines changed

packages/manager/modules/pci/src/projects/project/instances/active-monthly-billing/active-monthly-billing.routing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ export default /* @ngInject */($stateProvider) => {
1616
instanceId,
1717
) => PciProjectsProjectInstanceService
1818
.get(projectId, instanceId),
19-
goBack: /* @ngInject */ ($state, projectId) => () => $state.go('pci.projects.project.instances', {
20-
projectId,
21-
}),
19+
goBack: /* @ngInject */ goToInstances => goToInstances,
2220
},
2321
});
2422
};

packages/manager/modules/pci/src/projects/project/instances/add/add.controller.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export default class PciInstancesAddController {
6363
}
6464

6565
loadMessages() {
66-
this.CucCloudMessage.unSubscribe('pci.projects.project.instances.add');
6766
this.messageHandler = this.CucCloudMessage.subscribe('pci.projects.project.instances.add', { onMessage: () => this.refreshMessages() });
6867
}
6968

packages/manager/modules/pci/src/projects/project/instances/add/add.routing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default /* @ngInject */($stateProvider) => {
2121
projectId,
2222
}),
2323

24-
goBack: ($state, projectId) => () => $state.go('pci.projects.project.instances', { projectId }),
24+
goBack: /* @ngInject */ goToInstances => goToInstances,
2525
},
2626
});
2727
};

packages/manager/modules/pci/src/projects/project/instances/backup/backup.routing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ export default /* @ngInject */($stateProvider) => {
2222
instance,
2323
) => PciProjectsProjectInstanceService
2424
.getBackupPriceEstimation(projectId, instance),
25-
goBack: /* @ngInject */ ($state, projectId) => () => $state.go('pci.projects.project.instances', {
26-
projectId,
27-
}),
25+
goBack: /* @ngInject */ goToInstances => goToInstances,
2826
},
2927
});
3028
};

packages/manager/modules/pci/src/projects/project/instances/delete/delete.routing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ export default /* @ngInject */($stateProvider) => {
1616
instanceId,
1717
) => PciProjectsProjectInstanceService
1818
.get(projectId, instanceId),
19-
goBack: /* @ngInject */ ($state, projectId) => () => $state.go('pci.projects.project.instances', {
20-
projectId,
21-
}),
19+
goBack: /* @ngInject */ goToInstances => goToInstances,
2220
},
2321
});
2422
};

packages/manager/modules/pci/src/projects/project/instances/hard-reboot/hard-reboot.routing.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export default /* @ngInject */($stateProvider) => {
1717
instanceId,
1818
) => PciProjectsProjectInstanceService
1919
.get(projectId, instanceId),
20-
goBack: /* @ngInject */ ($state, projectId, instanceId) => () => $state.go('pci.projects.project.instances', {
21-
projectId,
22-
instanceId,
23-
}),
20+
goBack: /* @ngInject */ goToInstances => goToInstances,
2421
},
2522
});
2623
};

packages/manager/modules/pci/src/projects/project/instances/instance.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default class Instance {
135135
}
136136

137137
isRescuableWithDefaultImage() {
138-
return !includes(['freebsd', 'windows'], this.image.distribution);
138+
return !includes(['freebsd', 'windows'], get(this.image, 'distribution'));
139139
}
140140

141141
get connectionInfos() {

packages/manager/modules/pci/src/projects/project/instances/instance/active-monthly-billing/active-monthly-billing.controller.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,26 @@ export default class PciInstanceActiveMonthlyBillingController {
2020
this.isLoading = true;
2121
return this.PciProjectsProjectInstanceService
2222
.activeMonthlyBilling(this.projectId, this.instance)
23-
.then(() => {
24-
this.CucCloudMessage.success(
25-
this.$translate.instant(
26-
'pci_projects_project_instances_instance_active-monthly-billing_success_message',
27-
{
28-
instance: this.instance.name,
29-
},
30-
),
31-
);
32-
})
33-
.catch((err) => {
34-
this.CucCloudMessage.error(
35-
this.$translate.instant(
36-
'pci_projects_project_instances_instance_active-monthly-billing_error_enable',
37-
{
38-
message: get(err, 'data.message', null),
39-
},
40-
),
41-
);
42-
})
23+
.then(() => this.goBack(
24+
this.$translate.instant(
25+
'pci_projects_project_instances_instance_active-monthly-billing_success_message',
26+
{
27+
instance: this.instance.name,
28+
},
29+
),
30+
))
31+
.catch(err => this.goBack(
32+
this.$translate.instant(
33+
'pci_projects_project_instances_instance_active-monthly-billing_error_enable',
34+
{
35+
message: get(err, 'data.message', null),
36+
instance: this.instance.name,
37+
},
38+
),
39+
'error',
40+
))
4341
.finally(() => {
4442
this.isLoading = false;
45-
return this.goBack();
4643
});
4744
}
4845
}

packages/manager/modules/pci/src/projects/project/instances/instance/active-monthly-billing/active-monthly-billing.routing.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ export default /* @ngInject */($stateProvider) => {
88
},
99
},
1010
layout: 'modal',
11+
translations: {
12+
value: ['.'],
13+
format: 'json',
14+
},
1115
resolve: {
12-
goBack: /* @ngInject */ ($state, projectId, instanceId) => () => $state.go('pci.projects.project.instances.instance', {
13-
projectId,
14-
instanceId,
15-
}),
16+
goBack: /* @ngInject */ goToInstance => goToInstance,
1617
},
1718
});
1819
};

packages/manager/modules/pci/src/projects/project/instances/instance/attach-private-network/attach-private-network.controller.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,19 @@ export default class PciInstanceAttachPrivateNetworkController {
4040
},
4141
);
4242
}
43-
44-
this.CucCloudMessage.success(
45-
message,
46-
'pci.projects.project.instances.instance',
47-
);
48-
})
49-
.catch((err) => {
50-
this.CucCloudMessage.error(
51-
this.$translate.instant(
52-
'pci_projects_project_instances_instance_attach-private-network_error_attach',
53-
{
54-
message: get(err, 'data.message', null),
55-
},
56-
'pci.projects.project.instances.instance',
57-
),
58-
);
43+
return this.goBack(message);
5944
})
45+
.catch(err => this.goBack(
46+
this.$translate.instant(
47+
'pci_projects_project_instances_instance_attach-private-network_error_attach',
48+
{
49+
message: get(err, 'data.message', null),
50+
},
51+
),
52+
'error',
53+
))
6054
.finally(() => {
6155
this.isLoading = false;
62-
return this.goBack();
6356
});
6457
}
6558
}

0 commit comments

Comments
 (0)