Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rancher/dashboard into 12338-fix-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Mo Mesgin authored and Mo Mesgin committed Nov 15, 2024
2 parents 364e96d + 4dcbc1d commit 5bfbe85
Show file tree
Hide file tree
Showing 69 changed files with 1,751 additions and 401 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/tests/pages/fleet/advanced/bundles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Bundles', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, ()
fleetBundleeDetailsPage.waitForPage();

// check table headers
const expectedHeadersDetailsViewEvents = ['Name'];
const expectedHeadersDetailsViewEvents = ['State', 'API Version', 'Kind', 'Name', 'Namespace'];

fleetBundleeDetailsPage.list().resourceTable().sortableTable()
.tableHeaderRow()
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/tests/pages/global-settings/settings-p2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,17 @@ describe('Settings', { testIsolation: 'off' }, () => {
it('can update telemetry-opt', { tags: ['@globalSettings', '@adminUser'] }, () => {
// Update setting: Prompt
SettingsPagePo.navTo();

settingsPage.waitForPage();
settingsPage.settingsValue('telemetry-opt').contains('Opt-out of Telemetry');

settingsPage.editSettingsByLabel('telemetry-opt');

const settingsEdit = settingsPage.editSettings('local', 'telemetry-opt');

settingsEdit.waitForPage();
settingsEdit.title().contains('Setting: telemetry-opt').should('be.visible');
settingsEdit.useDefaultButton().should('be.disabled'); // button should be disabled for this settings option
settingsEdit.useDefaultButton().should('not.be.disabled');
settingsEdit.selectSettingsByLabel('Prompt');
settingsEdit.saveAndWait('telemetry-opt', 'prompt').then(({ request, response }) => {
expect(response?.statusCode).to.eq(200);
Expand Down
2 changes: 0 additions & 2 deletions pkg/aks/util/__tests__/validators.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as validators from '@pkg/aks/util/validators';
import { set } from '@shell/utils/object';
import { AKSNodePool } from 'types';

validators.requiredTranslation = (ctx, label) => `${ label } is required.`;
Expand All @@ -11,7 +10,6 @@ const MOCK_TRANSLATION = 'abc';
const mockCtx = {
normanCluster: { },
t: () => MOCK_TRANSLATION,
$set: set
};

describe('fx: requiredInCluster', () => {
Expand Down
2 changes: 0 additions & 2 deletions pkg/eks/util/__tests__/validators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ describe('validate EKS node group names', () => {
[{
nodeGroups: [{ nodegroupName: 'abc' }, { nodegroupName: 'def' }],
t: mockTranslation,
$set: () => {}
} as any as CruEKSContext, null],
[{
nodeGroups: [{ nodegroupName: 'abc' }, { nodegroupName: 'abc' }, { nodegroupName: 'def' }],
t: mockTranslation,
$set: () => {}
} as any as CruEKSContext, 'eks.errors.nodeGroups.nameUnique']
])('should return an error if any node group within ctx has non-unique name, if not passed a name', (ctx, expected) => {
const res = EKSValidators.nodeGroupNamesUnique(ctx)(undefined);
Expand Down
4 changes: 2 additions & 2 deletions pkg/eks/util/validators.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { set } from '@shell/utils/object';
import { EKSConfig, EKSNodeGroup } from 'types';

export interface CruEKSContext {
$set: Function,
t: Function,
config: EKSConfig,
nodeGroups: EKSNodeGroup[],
Expand Down Expand Up @@ -38,7 +38,7 @@ const nodeGroupNamesUnique = (ctx: CruEKSContext) => {
const name = group.nodegroupName;

if (names.filter((n) => n === name).length > 1) {
ctx.$set(group, '__nameUnique', false);
set(group, '__nameUnique', false);
if (!out) {
out = ctx.t('eks.errors.nodeGroups.nameUnique');
}
Expand Down
4 changes: 4 additions & 0 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,7 @@ cluster:
placeholder: A unique name for the cluster
directoryConfig:
title: Data directory configuration
banner: Data directory configuration can not be changed once the cluster has been created
radioInput:
defaultLabel: Use default data directory configuration
commonLabel: Use a common base directory for data directory configuration (sub-directories will be used for the system-agent, provisioning and distro paths)
Expand Down Expand Up @@ -3237,6 +3238,9 @@ logging:
certificate: Connection
labels: Labels
configuration: Configuration
tips:
singleProvider: This output is configured with multiple providers. We currently only support a single provider per output. You can view or edit the YAML.
multipleProviders: This output is configured with providers we do not support yet. You can view or edit the YAML.
outputProviders:
elasticsearch: Elasticsearch
opensearch: OpenSearch
Expand Down
6 changes: 5 additions & 1 deletion shell/components/BrandImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default {
dark: {
type: Boolean,
default: false
},
supportCustomLogo: {
type: Boolean,
default: false
}
},
data() {
Expand Down Expand Up @@ -75,7 +79,7 @@ export default {
},
pathToBrandedImage() {
if (this.fileName === 'rancher-logo.svg') {
if (this.fileName === 'rancher-logo.svg' || this.supportCustomLogo) {
if (this.theme === 'dark' && this.uiLogoDark) {
return this.uiLogoDark;
}
Expand Down
2 changes: 2 additions & 0 deletions shell/components/CopyToClipboardText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {

<template>
<a
v-if="text"
class="copy-to-clipboard-text"
:class="{ 'copied': copied, 'plain': plain}"
href="#"
Expand All @@ -59,6 +60,7 @@ export default {
</template>
<style lang="scss" scoped>
.copy-to-clipboard-text {
white-space: nowrap;
&.plain {
color: var(--body-text);
Expand Down
1 change: 1 addition & 0 deletions shell/components/CruResourceFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default {
display: flex;
justify-content: flex-end;
margin-top: 20px;
z-index: 40;
.btn {
margin-left: 20px;
Expand Down
2 changes: 1 addition & 1 deletion shell/components/DetailTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
},
labels() {
if (!this.showFilteredSystemLabels) {
if (this.showAllLabels || !this.showFilteredSystemLabels) {
return this.value?.labels || {};
}
Expand Down
6 changes: 5 additions & 1 deletion shell/components/ExplorerMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SortableTable from '@shell/components/SortableTable';
import { mapGetters } from 'vuex';
import { canViewProjectMembershipEditor } from '@shell/components/form/Members/ProjectMembershipEditor.vue';
import { allHash } from '@shell/utils/promise';
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
/**
* Explorer members page.
Expand Down Expand Up @@ -227,6 +228,9 @@ export default {
canEditClusterMembers() {
return this.normanClusterRTBSchema?.collectionMethods.find((x) => x.toLowerCase() === 'post');
},
isHarvester() {
return this.$store.getters['currentProduct'].inStore === HARVESTER;
},
},
methods: {
getMgmtProjectId(group) {
Expand Down Expand Up @@ -324,7 +328,7 @@ export default {
/>
</Tab>
<Tab
v-if="canManageProjectMembers"
v-if="canManageProjectMembers && !isHarvester"
name="project-membership"
:label="t('members.projectMembership')"
>
Expand Down
54 changes: 39 additions & 15 deletions shell/components/ExplorerProjectsNamespaces.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<script>
import { mapGetters } from 'vuex';
import ResourceTable, { defaultTableSortGenerationFn } from '@shell/components/ResourceTable';
import { STATE, AGE, NAME } from '@shell/config/table-headers';
import { STATE, AGE, NAME, NS_SNAPSHOT_QUOTA } from '@shell/config/table-headers';
import { uniq } from '@shell/utils/array';
import { MANAGEMENT, NAMESPACE, VIRTUAL_TYPES } from '@shell/config/types';
import { MANAGEMENT, NAMESPACE, VIRTUAL_TYPES, HCI } from '@shell/config/types';
import { PROJECT_ID, FLAT_VIEW } from '@shell/config/query-params';
import { PanelLocation, ExtensionPoint } from '@shell/core/types';
import ExtensionPanel from '@shell/components/ExtensionPanel';
import Masthead from '@shell/components/ResourceList/Masthead';
import { mapPref, GROUP_RESOURCES, ALL_NAMESPACES } from '@shell/store/prefs';
import { mapPref, GROUP_RESOURCES, ALL_NAMESPACES, DEV } from '@shell/store/prefs';
import MoveModal from '@shell/components/MoveModal';
import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
import { NAMESPACE_FILTER_ALL_ORPHANS } from '@shell/utils/namespace-filter';
import ResourceFetch from '@shell/mixins/resource-fetch';
import DOMPurify from 'dompurify';
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
export default {
name: 'ListProjectNamespace',
Expand Down Expand Up @@ -42,6 +43,7 @@ export default {
async fetch() {
const inStore = this.$store.getters['currentStore'](NAMESPACE);
this.harvesterResourceQuotaSchema = this.$store.getters[`${ inStore }/schemaFor`](HCI.RESOURCE_QUOTA);
this.schema = this.$store.getters[`${ inStore }/schemaFor`](NAMESPACE);
this.projectSchema = this.$store.getters[`management/schemaFor`](MANAGEMENT.PROJECT);
Expand All @@ -60,6 +62,7 @@ export default {
return {
loadResources: [NAMESPACE],
loadIndeterminate: true,
harvesterResourceQuotaSchema: null,
schema: null,
projects: [],
projectSchema: null,
Expand Down Expand Up @@ -93,20 +96,33 @@ export default {
isNamespaceCreatable() {
return (this.schema?.collectionMethods || []).includes('POST');
},
isHarvester() {
return this.$store.getters['currentProduct'].inStore === HARVESTER;
},
headers() {
const project = {
name: 'project',
label: this.t('tableHeaders.project'),
value: 'project.nameDisplay',
sort: ['projectNameSort', 'nameSort'],
};
return [
const headers = [
STATE,
NAME,
this.groupPreference === 'none' ? project : null,
AGE
].filter((h) => h);
];
if (this.groupPreference === 'none') {
const projectHeader = {
name: 'project',
label: this.t('tableHeaders.project'),
value: 'project.nameDisplay',
sort: ['projectNameSort', 'nameSort'],
};
headers.push(projectHeader);
}
if (this.isHarvester && this.harvesterResourceQuotaSchema) {
headers.push(NS_SNAPSHOT_QUOTA);
}
headers.push(AGE);
return headers;
},
projectIdsWithNamespaces() {
const ids = this.rows
Expand Down Expand Up @@ -211,7 +227,15 @@ export default {
return this.groupPreference === 'none' ? this.rows : this.rowsWithFakeNamespaces;
},
rows() {
if (this.$store.getters['prefs/get'](ALL_NAMESPACES)) {
let isDev;
try {
isDev = this.$store.getters['prefs/get'](ALL_NAMESPACES);
} catch {
isDev = this.$store.getters['prefs/get'](DEV);
}
if (isDev) {
// If all namespaces options are turned on in the user preferences,
// return all namespaces including system namespaces and RBAC
// management namespaces.
Expand Down
14 changes: 12 additions & 2 deletions shell/components/HardwareResourceGauge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ export default {
default: null
},
usedTitle: {
type: String,
default: null
},
reserved: {
type: Object,
default: null
},
reservedTitle: {
type: String,
default: null
}
},
computed: {
Expand Down Expand Up @@ -78,7 +88,7 @@ export default {
>
<template #title>
<span>
{{ t('clusterIndexPage.hardwareResourceGauge.reserved') }}
{{ reservedTitle ?? t('clusterIndexPage.hardwareResourceGauge.reserved') }}
<span class="values text-muted">
<span v-if="reserved.formattedUseful">
{{ reserved.formattedUseful }}
Expand Down Expand Up @@ -112,7 +122,7 @@ export default {
>
<template #title>
<span>
{{ t('clusterIndexPage.hardwareResourceGauge.used') }}
{{ usedTitle ?? t('clusterIndexPage.hardwareResourceGauge.used') }}
<span class="values text-muted">
<span v-if="used.formattedUseful">
{{ used.formattedUseful }}
Expand Down
8 changes: 6 additions & 2 deletions shell/components/InputOrDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ export default {
class="label"
>
<div class="text-label">
{{ $slots.name || name }}
<slot name="name">
{{ name }}
</slot>
</div>
<div class="value">
{{ $slots.value || displayValue }}
<slot name="value">
{{ displayValue }}
</slot>
</div>
</div>
<slot v-else />
Expand Down
2 changes: 1 addition & 1 deletion shell/components/MessageLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export default {
props: {
to: {
type: String,
type: [String, Object],
required: true
},
Expand Down
21 changes: 21 additions & 0 deletions shell/components/ResourceDetail/Masthead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export default {
},
computed: {
dev() {
return this.$store.getters['prefs/dev'];
},
schema() {
const inStore = this.storeOverride || this.$store.getters['currentStore'](this.resource);
Expand Down Expand Up @@ -383,6 +387,10 @@ export default {
hideNamespaceLocation() {
return this.$store.getters['currentProduct'].hideNamespaceLocation || this.value.namespaceLocation === null;
},
resourceExternalLink() {
return this.value.resourceExternalLink;
},
},
methods: {
Expand Down Expand Up @@ -462,6 +470,16 @@ export default {
class="icon icon-sm icon-istio"
/>
</span>
<a
v-if="dev && !!resourceExternalLink"
v-clean-tooltip="t(resourceExternalLink.tipsKey || 'generic.resourceExternalLinkTips')"
class="resource-external"
rel="nofollow noopener noreferrer"
target="_blank"
:href="resourceExternalLink.url"
>
<i class="icon icon-external-link" />
</a>
</h1>
</div>
<div
Expand Down Expand Up @@ -642,4 +660,7 @@ export default {
justify-content: flex-end;
}
.resource-external {
font-size: 18px;
}
</style>
Loading

0 comments on commit 5bfbe85

Please sign in to comment.