2022-02-01 17:38:45 +00:00
|
|
|
import angular from 'angular';
|
|
|
|
|
2022-03-14 06:26:30 +00:00
|
|
|
import { AzureSidebarAngular } from './AzureSidebar/AzureSidebar';
|
2022-02-24 23:22:56 +00:00
|
|
|
import { DashboardViewAngular } from './Dashboard/DashboardView';
|
2022-02-01 17:38:45 +00:00
|
|
|
import { containerInstancesModule } from './ContainerInstances';
|
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
angular
|
|
|
|
.module('portainer.azure', ['portainer.app', containerInstancesModule])
|
|
|
|
.config([
|
|
|
|
'$stateRegistryProvider',
|
|
|
|
function ($stateRegistryProvider) {
|
|
|
|
'use strict';
|
2020-06-09 02:43:32 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
var azure = {
|
|
|
|
name: 'azure',
|
|
|
|
url: '/azure',
|
|
|
|
parent: 'endpoint',
|
|
|
|
abstract: true,
|
|
|
|
onEnter: /* @ngInject */ function onEnter($async, $state, endpoint, EndpointProvider, Notifications, StateManager) {
|
|
|
|
return $async(async () => {
|
|
|
|
if (endpoint.Type !== 3) {
|
|
|
|
$state.go('portainer.home');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
EndpointProvider.setEndpointID(endpoint.Id);
|
|
|
|
EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
|
|
|
|
EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
|
|
|
|
await StateManager.updateEndpointState(endpoint, []);
|
|
|
|
} catch (e) {
|
|
|
|
Notifications.error('Failed loading environment', e);
|
|
|
|
$state.go('portainer.home', {}, { reload: true });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
2020-06-09 02:43:32 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
var containerInstances = {
|
|
|
|
name: 'azure.containerinstances',
|
|
|
|
url: '/containerinstances',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
templateUrl: './views/containerinstances/containerinstances.html',
|
|
|
|
controller: 'AzureContainerInstancesController',
|
|
|
|
},
|
2020-06-09 02:43:32 +00:00
|
|
|
},
|
2022-02-24 23:22:56 +00:00
|
|
|
};
|
2020-06-09 02:43:32 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
var containerInstance = {
|
|
|
|
name: 'azure.containerinstances.container',
|
|
|
|
url: '/:id',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
component: 'containerInstanceDetails',
|
|
|
|
},
|
2020-07-20 21:08:20 +00:00
|
|
|
},
|
2022-02-24 23:22:56 +00:00
|
|
|
};
|
2020-07-20 21:08:20 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
var containerInstanceCreation = {
|
|
|
|
name: 'azure.containerinstances.new',
|
|
|
|
url: '/new/',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
component: 'createContainerInstanceView',
|
|
|
|
},
|
2020-06-09 02:43:32 +00:00
|
|
|
},
|
2022-02-24 23:22:56 +00:00
|
|
|
};
|
2020-06-09 02:43:32 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
var dashboard = {
|
|
|
|
name: 'azure.dashboard',
|
|
|
|
url: '/dashboard',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
component: 'dashboardView',
|
|
|
|
},
|
2020-06-09 02:43:32 +00:00
|
|
|
},
|
2022-02-24 23:22:56 +00:00
|
|
|
};
|
2020-06-09 02:43:32 +00:00
|
|
|
|
2022-02-24 23:22:56 +00:00
|
|
|
$stateRegistryProvider.register(azure);
|
|
|
|
$stateRegistryProvider.register(containerInstances);
|
|
|
|
$stateRegistryProvider.register(containerInstance);
|
|
|
|
$stateRegistryProvider.register(containerInstanceCreation);
|
|
|
|
$stateRegistryProvider.register(dashboard);
|
|
|
|
},
|
|
|
|
])
|
2022-03-14 06:26:30 +00:00
|
|
|
.component('azureSidebar', AzureSidebarAngular)
|
|
|
|
.component('dashboardView', DashboardViewAngular);
|