mirror of https://github.com/portainer/portainer
refactor(portainer): remove offline mode [EE-4348] (#7761)
Co-authored-by: deviantony <anthony.lapenna@portainer.io>pull/8086/head
parent
61e8e68c31
commit
75f40fe485
|
@ -21,7 +21,7 @@
|
|||
data-cy="image-searchInput"
|
||||
/>
|
||||
</div>
|
||||
<div class="actionBar !gap-3" ng-if="!$ctrl.offlineMode" authorization="DockerImageDelete, DockerImageBuild, DockerImageLoad, DockerImageGet">
|
||||
<div class="actionBar !gap-3" authorization="DockerImageDelete, DockerImageBuild, DockerImageLoad, DockerImageGet">
|
||||
<div class="btn-group" authorization="DockerImageDelete">
|
||||
<button
|
||||
type="button"
|
||||
|
@ -128,7 +128,7 @@
|
|||
<tr>
|
||||
<th uib-dropdown dropdown-append-to-body auto-close="disabled" popover-placement="bottom-left" is-open="$ctrl.filters.state.open">
|
||||
<div class="flex gap-1 items-center">
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode">
|
||||
<span class="md-checkbox">
|
||||
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
|
||||
<label for="select_all"></label>
|
||||
</span>
|
||||
|
@ -208,14 +208,11 @@
|
|||
ng-class="{ active: item.Checked }"
|
||||
>
|
||||
<td>
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode">
|
||||
<span class="md-checkbox">
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.images.image({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{
|
||||
item.Id | truncate: 40
|
||||
}}</a>
|
||||
<span ng-if="$ctrl.offlineMode">{{ item.Id | truncate: 40 }}</span>
|
||||
<a ui-sref="docker.images.image({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{ item.Id | truncate: 40 }}</a>
|
||||
<span style="margin-left: 10px" class="label label-warning image-tag" ng-if="::item.ContainerCount === 0">Unused</span>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -13,7 +13,6 @@ angular.module('portainer.docker').component('imagesDatatable', {
|
|||
downloadAction: '<',
|
||||
forceRemoveAction: '<',
|
||||
exportInProgress: '<',
|
||||
offlineMode: '<',
|
||||
refreshCallback: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<td ng-if="allowCheckbox">
|
||||
<span class="md-checkbox" ng-if="!parentCtrl.offlineMode" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<span class="md-checkbox" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<input
|
||||
id="select_{{ $index }}"
|
||||
type="checkbox"
|
||||
|
@ -15,8 +15,7 @@
|
|||
</td>
|
||||
<td ng-if="!allowCheckbox"></td>
|
||||
<td>
|
||||
<a ng-if="!parentCtrl.offlineMode" ui-sref="docker.networks.network({ id: item.Id, nodeName: item.NodeName })" title="{{ item.Name }}">{{ item.Name | truncate: 40 }}</a>
|
||||
<span ng-if="parentCtrl.offlineMode">{{ item.Name | truncate: 40 }}</span>
|
||||
<a ui-sref="docker.networks.network({ id: item.Id, nodeName: item.NodeName })" title="{{ item.Name }}">{{ item.Name | truncate: 40 }}</a>
|
||||
<span style="margin-left: 10px" class="label label-info image-tag space-left" ng-if="item.ResourceControl.System">System</span>
|
||||
</td>
|
||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
data-cy="network-searchInput"
|
||||
/>
|
||||
</div>
|
||||
<div class="actionBar !gap-3" ng-if="!$ctrl.offlineMode" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<div class="actionBar !gap-3" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-dangerlight h-fit vertical-center !ml-0"
|
||||
|
@ -84,7 +84,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th style="width: 55px">
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<span class="md-checkbox" authorization="DockerNetworkDelete, DockerNetworkCreate">
|
||||
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
|
||||
<label for="select_all"></label>
|
||||
</span>
|
||||
|
|
|
@ -10,7 +10,6 @@ angular.module('portainer.docker').component('networksDatatable', {
|
|||
reverseOrder: '<',
|
||||
showHostColumn: '<',
|
||||
removeAction: '<',
|
||||
offlineMode: '<',
|
||||
refreshCallback: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
data-cy="volume-searchInput"
|
||||
/>
|
||||
</div>
|
||||
<div class="actionBar !gap-3" ng-if="!$ctrl.offlineMode" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<div class="actionBar !gap-3" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-dangerlight h-fit vertical-center !ml-0"
|
||||
|
@ -84,7 +84,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.filters.state.open" class="flex gap-1">
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<span class="md-checkbox" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
|
||||
<label for="select_all"></label>
|
||||
</span>
|
||||
|
@ -182,17 +182,14 @@
|
|||
ng-class="{ active: item.Checked }"
|
||||
>
|
||||
<td>
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<span class="md-checkbox" authorization="DockerVolumeDelete, DockerVolumeCreate">
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" />
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ng-if="!$ctrl.offlineMode" ui-sref="docker.volumes.volume({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{
|
||||
item.Id | truncate: 40
|
||||
}}</a>
|
||||
<span ng-if="$ctrl.offlineMode">{{ item.Id | truncate: 40 }}</span>
|
||||
<a ui-sref="docker.volumes.volume({ id: item.Id, nodeName: item.NodeName })" class="monospaced" title="{{ item.Id }}">{{ item.Id | truncate: 40 }}</a>
|
||||
|
||||
<button
|
||||
ng-if="$ctrl.showBrowseAction && !$ctrl.offlineMode"
|
||||
ng-if="$ctrl.showBrowseAction"
|
||||
type="button"
|
||||
ui-sref="docker.volumes.volume.browse({ id: item.Id, nodeName: item.NodeName })"
|
||||
class="btn btn-xs btn-primary space-left"
|
||||
|
|
|
@ -11,7 +11,6 @@ angular.module('portainer.docker').component('volumesDatatable', {
|
|||
showHostColumn: '<',
|
||||
removeAction: '<',
|
||||
showBrowseAction: '<',
|
||||
offlineMode: '<',
|
||||
refreshCallback: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
<page-header title="'Host overview'" breadcrumbs="['Docker']" reload="true"> </page-header>
|
||||
|
||||
<information-panel-offline ng-if="$ctrl.offlineMode"></information-panel-offline>
|
||||
|
||||
<host-details-panel
|
||||
host="$ctrl.hostDetails"
|
||||
is-browse-enabled="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && !$ctrl.offlineMode && $ctrl.hostFeaturesEnabled"
|
||||
is-browse-enabled="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && $ctrl.hostFeaturesEnabled"
|
||||
browse-url="{{ $ctrl.browseUrl }}"
|
||||
></host-details-panel>
|
||||
|
||||
<engine-details-panel engine="$ctrl.engineDetails"></engine-details-panel>
|
||||
|
||||
<devices-panel ng-if="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && !$ctrl.offlineMode && $ctrl.hostFeaturesEnabled" devices="$ctrl.devices"></devices-panel>
|
||||
<disks-panel ng-if="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && !$ctrl.offlineMode && $ctrl.hostFeaturesEnabled" disks="$ctrl.disks"></disks-panel>
|
||||
<devices-panel ng-if="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && $ctrl.hostFeaturesEnabled" devices="$ctrl.devices"></devices-panel>
|
||||
<disks-panel ng-if="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && $ctrl.hostFeaturesEnabled" disks="$ctrl.disks"></disks-panel>
|
||||
|
||||
<ng-transclude></ng-transclude>
|
||||
|
|
|
@ -6,7 +6,6 @@ angular.module('portainer.docker').component('hostOverview', {
|
|||
devices: '<',
|
||||
disks: '<',
|
||||
isAgent: '<',
|
||||
offlineMode: '<',
|
||||
agentApiVersion: '<',
|
||||
refreshUrl: '@',
|
||||
browseUrl: '@',
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('ContainersInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Containers;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('ImagesInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Images;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('InfoInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined && endpoint.Snapshots.length && endpoint.Snapshots[0].SnapshotRaw) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Info;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('NetworksInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Networks;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('VersionInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined && endpoint.Snapshots.length && endpoint.Snapshots[0].SnapshotRaw) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Version;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -1,24 +0,0 @@
|
|||
angular.module('portainer.app').factory('VolumesInterceptor', [
|
||||
'$q',
|
||||
'EndpointProvider',
|
||||
function ($q, EndpointProvider) {
|
||||
'use strict';
|
||||
var interceptor = {};
|
||||
|
||||
interceptor.responseError = responseErrorInterceptor;
|
||||
|
||||
function responseErrorInterceptor(rejection) {
|
||||
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
|
||||
var endpoint = EndpointProvider.currentEndpoint();
|
||||
if (endpoint !== undefined) {
|
||||
var data = endpoint.Snapshots[0].SnapshotRaw.Volumes;
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
return interceptor;
|
||||
},
|
||||
]);
|
|
@ -5,7 +5,6 @@
|
|||
<dashboard-cluster-agent-info endpoint-id="endpoint.Id"></dashboard-cluster-agent-info>
|
||||
</div>
|
||||
</div>
|
||||
<information-panel-offline ng-if="offlineMode"></information-panel-offline>
|
||||
<information-panel
|
||||
ng-if="
|
||||
!applicationState.UI.dismissedInfoPanels['docker-dashboard-info-01'] &&
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
|
||||
import { useContainerStatusComponent } from '@/react/docker/DashboardView/ContainerStatus';
|
||||
import { useImagesTotalSizeComponent } from '@/react/docker/DashboardView/ImagesTotalSize';
|
||||
|
@ -41,7 +40,6 @@ angular.module('portainer.docker').controller('DashboardController', [
|
|||
StateManager.dismissInformationPanel(id);
|
||||
};
|
||||
|
||||
$scope.offlineMode = false;
|
||||
$scope.showStacks = false;
|
||||
|
||||
$scope.buildGpusStr = function (gpuUseSet) {
|
||||
|
@ -122,7 +120,6 @@ angular.module('portainer.docker').controller('DashboardController', [
|
|||
', '
|
||||
)
|
||||
: '-';
|
||||
$scope.offlineMode = isOfflineEndpoint(endpoint);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to load dashboard data');
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
angular.module('portainer.docker').controller('HostViewController', [
|
||||
'$q',
|
||||
'SystemService',
|
||||
|
@ -16,7 +14,6 @@ angular.module('portainer.docker').controller('HostViewController', [
|
|||
ctrl.state = {
|
||||
isAgent: false,
|
||||
isAdmin: false,
|
||||
offlineMode: false,
|
||||
};
|
||||
|
||||
this.engineDetails = {};
|
||||
|
@ -40,7 +37,6 @@ angular.module('portainer.docker').controller('HostViewController', [
|
|||
.then(function success(data) {
|
||||
ctrl.engineDetails = buildEngineDetails(data);
|
||||
ctrl.hostDetails = buildHostDetails(data.info);
|
||||
ctrl.state.offlineMode = isOfflineEndpoint(ctrl.endpoint);
|
||||
ctrl.jobs = data.jobs;
|
||||
|
||||
if (ctrl.state.isAgent && agentApiVersion > 1 && ctrl.state.enableHostManagementFeatures) {
|
||||
|
|
|
@ -7,6 +7,5 @@
|
|||
devices="$ctrl.devices"
|
||||
refresh-url="docker.host"
|
||||
browse-url="docker.host.browser"
|
||||
offline-mode="$ctrl.state.offlineMode"
|
||||
host-features-enabled="$ctrl.state.enableHostManagementFeatures"
|
||||
></host-overview>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<page-header title="'Image list'" breadcrumbs="['Images']" reload="true"> </page-header>
|
||||
|
||||
<div class="row" ng-if="!offlineMode" authorization="DockerImageCreate">
|
||||
<div class="row" authorization="DockerImageCreate">
|
||||
<div class="col-lg-12 col-md-12 col-xs-12">
|
||||
<rd-widget>
|
||||
<rd-widget-header icon="download" feather-icon="true" title-text="Pull image "> </rd-widget-header>
|
||||
|
@ -44,7 +44,6 @@
|
|||
</rd-widget>
|
||||
</div>
|
||||
</div>
|
||||
<information-panel-offline ng-if="offlineMode"></information-panel-offline>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<images-datatable
|
||||
|
@ -58,7 +57,6 @@
|
|||
remove-action="removeAction"
|
||||
force-remove-action="confirmRemovalAction"
|
||||
export-in-progress="state.exportInProgress"
|
||||
offline-mode="offlineMode"
|
||||
refresh-callback="getImages"
|
||||
></images-datatable>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import _ from 'lodash-es';
|
||||
import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
angular.module('portainer.docker').controller('ImagesController', [
|
||||
'$scope',
|
||||
|
@ -135,14 +134,11 @@ angular.module('portainer.docker').controller('ImagesController', [
|
|||
});
|
||||
};
|
||||
|
||||
$scope.offlineMode = false;
|
||||
|
||||
$scope.getImages = getImages;
|
||||
function getImages() {
|
||||
ImageService.images(true)
|
||||
.then(function success(data) {
|
||||
$scope.images = data;
|
||||
$scope.offlineMode = isOfflineEndpoint(endpoint);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve images');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<page-header title="'Network list'" breadcrumbs="['Networks']" reload="true"> </page-header>
|
||||
|
||||
<information-panel-offline ng-if="offlineMode"></information-panel-offline>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<networks-datatable
|
||||
|
@ -11,7 +10,6 @@
|
|||
order-by="Name"
|
||||
remove-action="removeAction"
|
||||
show-host-column="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'"
|
||||
offline-mode="offlineMode"
|
||||
refresh-callback="getNetworks"
|
||||
></networks-datatable>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import _ from 'lodash-es';
|
||||
import DockerNetworkHelper from 'Docker/helpers/networkHelper';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { confirmDeletionAsync } from 'Portainer/services/modal.service/confirm';
|
||||
import DockerNetworkHelper from '@/docker/helpers/networkHelper';
|
||||
import { confirmDeletionAsync } from '@/portainer/services/modal.service/confirm';
|
||||
|
||||
angular.module('portainer.docker').controller('NetworksController', [
|
||||
'$q',
|
||||
|
@ -39,8 +38,6 @@ angular.module('portainer.docker').controller('NetworksController', [
|
|||
});
|
||||
};
|
||||
|
||||
$scope.offlineMode = false;
|
||||
|
||||
$scope.getNetworks = getNetworks;
|
||||
|
||||
function groupSwarmNetworksManagerNodesFirst(networks, agents) {
|
||||
|
@ -71,7 +68,6 @@ angular.module('portainer.docker').controller('NetworksController', [
|
|||
|
||||
$q.all(req)
|
||||
.then((data) => {
|
||||
$scope.offlineMode = isOfflineEndpoint(endpoint);
|
||||
const networks = _.forEach(data.networks, (item) => (item.Subs = []));
|
||||
if ($scope.applicationState.endpoint.mode.agentProxy && $scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE') {
|
||||
$scope.networks = groupSwarmNetworksManagerNodesFirst(data.networks, data.agents);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<page-header title="'Volume list'" breadcrumbs="['Volumes']" reload="true"> </page-header>
|
||||
|
||||
<information-panel-offline ng-if="offlineMode"></information-panel-offline>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<volumes-datatable
|
||||
|
@ -12,7 +11,6 @@
|
|||
remove-action="removeAction"
|
||||
show-host-column="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'"
|
||||
show-browse-action="showBrowseAction"
|
||||
offline-mode="offlineMode"
|
||||
refresh-callback="getVolumes"
|
||||
></volumes-datatable>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
angular.module('portainer.docker').controller('VolumesController', [
|
||||
'$q',
|
||||
'$scope',
|
||||
|
@ -39,8 +37,6 @@ angular.module('portainer.docker').controller('VolumesController', [
|
|||
});
|
||||
};
|
||||
|
||||
$scope.offlineMode = false;
|
||||
|
||||
$scope.getVolumes = getVolumes;
|
||||
function getVolumes() {
|
||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
||||
|
@ -53,7 +49,6 @@ angular.module('portainer.docker').controller('VolumesController', [
|
|||
})
|
||||
.then(function success(data) {
|
||||
var services = data.services;
|
||||
$scope.offlineMode = isOfflineEndpoint(endpoint);
|
||||
$scope.volumes = data.attached
|
||||
.map(function (volume) {
|
||||
volume.dangling = false;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
data-cy="k8sApp-searchApplicationsInput"
|
||||
/>
|
||||
</div>
|
||||
<div class="actionBar !gap-3 !mr-0" ng-if="!$ctrl.offlineMode">
|
||||
<div class="actionBar !gap-3 !mr-0">
|
||||
<button
|
||||
ng-if="$ctrl.isPrimary"
|
||||
type="button"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
data-cy="stack-searchInput"
|
||||
/>
|
||||
</div>
|
||||
<div class="actionBar !gap-3" ng-if="!$ctrl.offlineMode" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<div class="actionBar !gap-3" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-dangerlight h-fit vertical-center !ml-0"
|
||||
|
@ -92,7 +92,7 @@
|
|||
<tr>
|
||||
<th uib-dropdown dropdown-append-to-body auto-close="disabled" is-open="$ctrl.filters.state.open">
|
||||
<div class="flex flex-row flex-no-wrap gap-1">
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<span class="md-checkbox" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
|
||||
<label for="select_all"></label>
|
||||
</span>
|
||||
|
@ -175,16 +175,15 @@
|
|||
ng-class="{ active: item.Checked }"
|
||||
>
|
||||
<td>
|
||||
<span class="md-checkbox" ng-if="!$ctrl.offlineMode" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<span class="md-checkbox" authorization="PortainerStackCreate, PortainerStackDelete">
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-click="$ctrl.selectItem(item, $event)" ng-disabled="!$ctrl.allowSelection(item)" />
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a
|
||||
ng-if="!$ctrl.offlineMode && $ctrl.createEnabled"
|
||||
ng-if="$ctrl.createEnabled"
|
||||
ui-sref="docker.stacks.stack({ name: item.Name, id: item.Id, type: item.Type, regular: item.Regular, external: item.External, orphaned: item.Orphaned, orphanedRunning: item.OrphanedRunning })"
|
||||
>{{ item.Name }}</a
|
||||
>
|
||||
<span ng-if="$ctrl.offlineMode">{{ item.Name }}</span>
|
||||
<span ng-if="item.Regular && item.Status == 2" class="label label-warning image-tag ml-2">Inactive</span>
|
||||
</td>
|
||||
<td>{{ item.Type === 1 ? 'Swarm' : 'Compose' }}</td>
|
||||
|
|
|
@ -9,7 +9,6 @@ angular.module('portainer.app').component('stacksDatatable', {
|
|||
orderBy: '@',
|
||||
reverseOrder: '<',
|
||||
removeAction: '<',
|
||||
offlineMode: '<',
|
||||
refreshCallback: '<',
|
||||
createEnabled: '<',
|
||||
},
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<information-panel title-text="Offline mode" cant-dismiss="true">
|
||||
<span class="small">
|
||||
<p class="text-muted">
|
||||
<i class="fa fa-exclamation-circle orange-icon" aria-hidden="true" style="margin-right: 2px"></i>
|
||||
This environment is currently offline (read-only). Data shown is based on the latest available snapshot.
|
||||
</p>
|
||||
<p class="text-muted">
|
||||
<i class="fa fa-clock" aria-hidden="true" style="margin-right: 2px"></i>
|
||||
Last snapshot: {{ $ctrl.snapshotTime | getisodatefromtimestamp }}
|
||||
</p>
|
||||
<button type="button" class="btn btn-xs btn-primary" ng-click="$ctrl.triggerSnapshot()" ng-if="$ctrl.showRefreshButton">
|
||||
<i class="fa fa-sync space-right" aria-hidden="true"></i>Refresh
|
||||
</button>
|
||||
</span>
|
||||
</information-panel>
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.app').component('informationPanelOffline', {
|
||||
templateUrl: './informationPanelOffline.html',
|
||||
controller: 'InformationPanelOfflineController',
|
||||
});
|
|
@ -1,38 +0,0 @@
|
|||
angular.module('portainer.app').controller('InformationPanelOfflineController', [
|
||||
'$state',
|
||||
'EndpointProvider',
|
||||
'EndpointService',
|
||||
'Authentication',
|
||||
'Notifications',
|
||||
function StackDuplicationFormController($state, EndpointProvider, EndpointService, Authentication, Notifications) {
|
||||
var ctrl = this;
|
||||
|
||||
this.$onInit = onInit;
|
||||
this.triggerSnapshot = triggerSnapshot;
|
||||
|
||||
function triggerSnapshot() {
|
||||
var endpointId = EndpointProvider.endpointID();
|
||||
|
||||
EndpointService.snapshotEndpoint(endpointId)
|
||||
.then(function onSuccess() {
|
||||
$state.reload();
|
||||
})
|
||||
.catch(function onError(err) {
|
||||
Notifications.error('Failure', err, 'An error occurred during environment snapshot');
|
||||
});
|
||||
}
|
||||
|
||||
function onInit() {
|
||||
var endpointId = EndpointProvider.endpointID();
|
||||
ctrl.showRefreshButton = Authentication.isAdmin();
|
||||
|
||||
EndpointService.endpoint(endpointId)
|
||||
.then(function onSuccess(data) {
|
||||
ctrl.snapshotTime = data.Snapshots[0].Time;
|
||||
})
|
||||
.catch(function onError(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve environment information');
|
||||
});
|
||||
}
|
||||
},
|
||||
]);
|
|
@ -39,7 +39,3 @@ export default class EndpointHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isOfflineEndpoint(endpoint) {
|
||||
return endpoint.Status !== 1;
|
||||
}
|
||||
|
|
|
@ -194,11 +194,9 @@ function StateManagerFactory(
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
const reload = endpoint.Status === 1 || !endpoint.Snaphosts || !endpoint.Snaphosts.length || !endpoint.Snapshots[0].SnapshotRaw;
|
||||
|
||||
$q.all({
|
||||
version: reload ? SystemService.version() : $q.when(endpoint.Snapshots[0].SnapshotRaw.Version),
|
||||
info: reload ? SystemService.info() : $q.when(endpoint.Snapshots[0].SnapshotRaw.Info),
|
||||
version: SystemService.version(),
|
||||
info: SystemService.info(),
|
||||
})
|
||||
.then(function success(data) {
|
||||
var endpointMode = InfoHelper.determineEndpointMode(data.info, endpoint.Type);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<page-header title="'Stacks list'" breadcrumbs="['Stacks']" reload="true"> </page-header>
|
||||
|
||||
<information-panel-offline ng-if="offlineMode"></information-panel-offline>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<stacks-datatable
|
||||
|
@ -10,7 +9,6 @@
|
|||
table-key="stacks"
|
||||
order-by="Name"
|
||||
remove-action="removeAction"
|
||||
offline-mode="offlineMode"
|
||||
refresh-callback="getStacks"
|
||||
create-enabled="createEnabled"
|
||||
></stacks-datatable>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
angular.module('portainer.app').controller('StacksController', StacksController);
|
||||
|
||||
/* @ngInject */
|
||||
|
@ -35,7 +33,6 @@ function StacksController($scope, $state, Notifications, StackService, ModalServ
|
|||
});
|
||||
}
|
||||
|
||||
$scope.offlineMode = false;
|
||||
$scope.createEnabled = false;
|
||||
|
||||
$scope.getStacks = getStacks;
|
||||
|
@ -48,7 +45,6 @@ function StacksController($scope, $state, Notifications, StackService, ModalServ
|
|||
StackService.stacks(true, endpointMode.provider === 'DOCKER_SWARM_MODE' && endpointMode.role === 'MANAGER', endpointId, includeOrphanedStacks)
|
||||
.then(function success(stacks) {
|
||||
$scope.stacks = stacks;
|
||||
$scope.offlineMode = isOfflineEndpoint(endpoint);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
$scope.stacks = [];
|
||||
|
|
|
@ -2,9 +2,6 @@ import { Column } from 'react-table';
|
|||
import { useSref } from '@uirouter/react';
|
||||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const image: Column<DockerContainer> = {
|
||||
Header: 'Image',
|
||||
|
@ -25,12 +22,6 @@ function ImageCell({ value: imageName }: Props) {
|
|||
const linkProps = useSref('docker.images.image', { id: imageName });
|
||||
const shortImageName = trimSHASum(imageName);
|
||||
|
||||
const { environment } = useRowContext();
|
||||
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortImageName}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={linkProps.href} onClick={linkProps.onClick}>
|
||||
{shortImageName}
|
||||
|
|
|
@ -3,12 +3,10 @@ import _ from 'lodash';
|
|||
import { useSref } from '@uirouter/react';
|
||||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
import { useTableSettings } from '@@/datatables/useZustandTableSettings';
|
||||
|
||||
import { TableSettings } from '../types';
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const name: Column<DockerContainer> = {
|
||||
Header: 'Name',
|
||||
|
@ -36,17 +34,11 @@ export function NameCell({
|
|||
const { settings } = useTableSettings<TableSettings>();
|
||||
const truncate = settings.truncateContainerName;
|
||||
|
||||
const { environment } = useRowContext();
|
||||
|
||||
let shortName = name;
|
||||
if (truncate > 0) {
|
||||
shortName = _.truncate(name, { length: truncate });
|
||||
}
|
||||
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortName}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={linkProps.href} onClick={linkProps.onClick} title={name}>
|
||||
{shortName}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { CellProps, Column } from 'react-table';
|
||||
|
||||
import { useAuthorizations } from '@/react/hooks/useUser';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { useCurrentEnvironment } from '@/react/hooks/useCurrentEnvironment';
|
||||
import { ContainerQuickActions } from '@/react/docker/containers/components/ContainerQuickActions';
|
||||
import { DockerContainer } from '@/react/docker/containers/types';
|
||||
|
||||
|
@ -24,11 +22,6 @@ export const quickActions: Column<DockerContainer> = {
|
|||
function QuickActionsCell({
|
||||
row: { original: container },
|
||||
}: CellProps<DockerContainer>) {
|
||||
const environmentQuery = useCurrentEnvironment();
|
||||
|
||||
const environment = environmentQuery.data;
|
||||
const offlineMode = !environment || isOfflineEndpoint(environment);
|
||||
|
||||
const { settings } = useTableSettings<TableSettings>();
|
||||
|
||||
const { hiddenQuickActions = [] } = settings;
|
||||
|
@ -57,7 +50,7 @@ function QuickActionsCell({
|
|||
'DockerTaskLogs',
|
||||
]);
|
||||
|
||||
if (offlineMode || !someOn || !isAuthorized) {
|
||||
if (!someOn || !isAuthorized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import {
|
|||
import {
|
||||
type Environment,
|
||||
type EnvironmentId,
|
||||
EnvironmentStatus,
|
||||
} from '@/react/portainer/environments/types';
|
||||
import { Authorized, useUser, isEnvironmentAdmin } from '@/react/hooks/useUser';
|
||||
import { useInfo, useVersion } from '@/docker/services/system.service';
|
||||
|
@ -47,8 +46,6 @@ export function DockerSidebar({ environmentId, environment }: Props) {
|
|||
const isSwarmManager = envInfoQuery.data;
|
||||
const apiVersion = envVersionQuery.data || 0;
|
||||
|
||||
const offlineMode = environment.Status === EnvironmentStatus.Down;
|
||||
|
||||
const setupSubMenuProps = isSwarmManager
|
||||
? {
|
||||
label: 'Swarm',
|
||||
|
@ -163,7 +160,7 @@ export function DockerSidebar({ environmentId, environment }: Props) {
|
|||
/>
|
||||
)}
|
||||
|
||||
{!isSwarmManager && isAdmin && !offlineMode && (
|
||||
{!isSwarmManager && isAdmin && (
|
||||
<SidebarItem
|
||||
to="docker.events"
|
||||
params={{ endpointId: environmentId }}
|
||||
|
|
Loading…
Reference in New Issue