Skip to content

Commit

Permalink
Merge pull request #1633 from vincent99/master
Browse files Browse the repository at this point in the history
Restore target mode on gitrepo edit
  • Loading branch information
vincent99 authored Oct 6, 2020
2 parents 1b3b38e + 114b08b commit 596c2fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
13 changes: 9 additions & 4 deletions components/ResourceDetail/Masthead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import BadgeState from '@/components/BadgeState';
import Banner from '@/components/Banner';
import { get } from '@/utils/object';
import { NAME as FLEET_NAME } from '@/config/product/fleet';
import { _VIEW } from '@/config/query-params';
export default {
components: {
Expand Down Expand Up @@ -61,6 +62,10 @@ export default {
return out;
},
isView() {
return this.mode === _VIEW;
},
isNamespace() {
return this.schema?.id === NAMESPACE;
},
Expand Down Expand Up @@ -179,18 +184,18 @@ export default {
</nuxt-link>
<span v-html="h1" />
</h1>
<BadgeState v-if="mode==='view'" :value="value" />
<BadgeState v-if="isView" :value="value" />
</div>
<!-- //TODO use nuxt-link for an internal project detail page once it exists -->
<div v-if="mode==='view'" class="subheader">
<div v-if="isView" class="subheader">
<span v-if="isNamespace && project">{{ t("resourceDetail.masthead.project") }}: {{ project.nameDisplay }}</span>
<span v-else-if="isWorkspace">{{ t("resourceDetail.masthead.workspace") }}: <nuxt-link :to="workspaceLocation">{{ namespace }}</nuxt-link></span>
<span v-else-if="namespace">{{ t("resourceDetail.masthead.namespace") }}: <nuxt-link :to="namespaceLocation">{{ namespace }}</nuxt-link></span>
<span v-if="!parent.hideAge">{{ t("resourceDetail.masthead.age") }}: <LiveDate class="live-date" :value="get(value, 'metadata.creationTimestamp')" /></span>
</div>
</div>
<slot name="right">
<div v-if="mode==='view'" class="actions">
<div v-if="isView" class="actions">
<div v-if="hasDetailOrEdit">
<ButtonGroup :labels-are-translations="true" :value="asYaml" :options="[{label: 'resourceDetail.masthead.overview', value: false},{label:'resourceDetail.masthead.yaml', value: true }]" @input="toggleYaml" />
</div>
Expand All @@ -199,7 +204,7 @@ export default {
</button>
</div>
</slot>
<div v-if="banner && !parent.hideBanner" class="state-banner">
<div v-if="banner && isView && !parent.hideBanner" class="state-banner">
<Banner class="state-banner" :color="banner.color" :label="banner.message" />
</div>
</header>
Expand Down
15 changes: 10 additions & 5 deletions edit/fleet.cattle.io.gitrepo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,28 @@ export default {
data() {
const targetInfo = this.value.targetInfo;
let targetMode = targetInfo.mode;
const targetCluster = targetInfo.cluster;
const targetClusterGroup = targetInfo.clusterGroup;
const targetAdvanced = targetInfo.advanced;
const ref = ( this.value.spec?.revision ? 'revision' : 'branch' );
const refValue = this.value.spec?.[ref] || '';
let targetMode = targetInfo.mode;
if (!this.value.id ) {
targetMode = 'all';
} else if ( targetMode === 'cluster' ) {
targetMode = `cluster://${ targetCluster }`;
} else if ( targetMode === 'clusterGroup' ) {
targetMode = `group://${ targetClusterGroup }`;
}
return {
allClusters: null,
allClusterGroups: null,
allWorkspaces: null,
allSecrets: null,
allClusters: [],
allClusterGroups: [],
allWorkspaces: [],
allSecrets: [],
authSecret: null,
username: null,
Expand Down
2 changes: 2 additions & 0 deletions plugins/steve/resource-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const REMAP_STATE = {
waitapplied: 'Wait Applied',
outofsync: 'Out of Sync',
'in-progress': 'In Progress',
gitupdating: 'Git Updating',
errapplied: 'Err Applied'
};

const DEFAULT_COLOR = 'warning';
Expand Down

0 comments on commit 596c2fb

Please sign in to comment.