mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
* feat(stack): backport changes to CE EE-1189 * feat(stack): front end backport changes to CE EE-1199 (#5455) * feat(stack): front end backport changes to CE EE-1199 * fix k8s deploy logic * fixed web editor confirmation message typo. EE-1501 * fix(stack): fixed issue auth detail not remembered EE-1502 (#5459) * show status in buttons * removed onChangeRef function. * moved buttons in git form to its own component * removed unused variable. Co-authored-by: ArrisLee <arris_li@hotmail.com> * moved formvalue to kube app component * fix(stack): failed to pull and redeploy compose format k8s stack * fixed form value * fix(k8s): file content overridden when deployment failed with compose format EE-1548 * updated API response to get IsComposeFormat and show appropriate text. * error message updates for different file type * not display creation source for external application * added confirmation modal to advanced app created by web editor * stop showing confirmation modal when updating application * disable rollback button when application type is not applicatiom form * added analytics-on directive to pull and redeploy button * fix(kube): don't valide resource control access for kube (#5568) * added question marks to k8s app confirmation modal * fix(k8s): Git authentication info not persisted * removed unused function. Co-authored-by: Hui <arris_li@hotmail.com> Co-authored-by: fhanportainer <79428273+fhanportainer@users.noreply.github.com> Co-authored-by: Felix Han <felix.han@portainer.io>
93 lines
2.9 KiB
JavaScript
93 lines
2.9 KiB
JavaScript
import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
|
|
|
|
angular.module('portainer.docker').controller('KubernetesResourcePoolsDatatableController', [
|
|
'$scope',
|
|
'$controller',
|
|
'Authentication',
|
|
'DatatableService',
|
|
function ($scope, $controller, Authentication, DatatableService) {
|
|
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
|
|
|
|
var ctrl = this;
|
|
|
|
this.settings = Object.assign(this.settings, {
|
|
showSystem: false,
|
|
});
|
|
|
|
this.onSettingsShowSystemChange = function () {
|
|
DatatableService.setDataTableSettings(this.tableKey, this.settings);
|
|
};
|
|
|
|
this.canManageAccess = function (item) {
|
|
if (!this.endpoint.Kubernetes.Configuration.RestrictDefaultNamespace) {
|
|
return !KubernetesNamespaceHelper.isDefaultNamespace(item.Namespace.Name) && !this.isSystemNamespace(item);
|
|
} else {
|
|
return !this.isSystemNamespace(item);
|
|
}
|
|
};
|
|
|
|
this.disableRemove = function (item) {
|
|
return this.isSystemNamespace(item) || KubernetesNamespaceHelper.isDefaultNamespace(item.Namespace.Name);
|
|
};
|
|
|
|
this.isSystemNamespace = function (item) {
|
|
return KubernetesNamespaceHelper.isSystemNamespace(item.Namespace.Name);
|
|
};
|
|
|
|
this.isDisplayed = function (item) {
|
|
return !ctrl.isSystemNamespace(item) || (ctrl.settings.showSystem && ctrl.isAdmin);
|
|
};
|
|
|
|
this.namespaceStatusColor = function (status) {
|
|
switch (status.toLowerCase()) {
|
|
case 'active':
|
|
return 'success';
|
|
case 'terminating':
|
|
return 'danger';
|
|
default:
|
|
return 'primary';
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Do not allow system namespaces to be selected
|
|
*/
|
|
this.allowSelection = function (item) {
|
|
return !this.disableRemove(item);
|
|
};
|
|
|
|
this.$onInit = function () {
|
|
this.isAdmin = Authentication.isAdmin();
|
|
this.setDefaults();
|
|
this.prepareTableFromDataset();
|
|
|
|
this.state.orderBy = this.orderBy;
|
|
var storedOrder = DatatableService.getDataTableOrder(this.tableKey);
|
|
if (storedOrder !== null) {
|
|
this.state.reverseOrder = storedOrder.reverse;
|
|
this.state.orderBy = storedOrder.orderBy;
|
|
}
|
|
|
|
var textFilter = DatatableService.getDataTableTextFilters(this.tableKey);
|
|
if (textFilter !== null) {
|
|
this.state.textFilter = textFilter;
|
|
this.onTextFilterChange();
|
|
}
|
|
|
|
var storedFilters = DatatableService.getDataTableFilters(this.tableKey);
|
|
if (storedFilters !== null) {
|
|
this.filters = storedFilters;
|
|
}
|
|
if (this.filters && this.filters.state) {
|
|
this.filters.state.open = false;
|
|
}
|
|
|
|
var storedSettings = DatatableService.getDataTableSettings(this.tableKey);
|
|
if (storedSettings !== null) {
|
|
this.settings = storedSettings;
|
|
this.settings.open = false;
|
|
}
|
|
this.onSettingsRepeaterChange();
|
|
};
|
|
},
|
|
]);
|