mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Remove the aclUI=1 flag and add 'BETA' tag to the Access Rules page name.
Summary: - Remove support for aclUI=1 URL parameter, making it the default. - Add 'BETA' tag to the Access Rules link in side panel. - Remove all mentions of aclUI=1 in tests. Test Plan: Updated tests should pass Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2766
This commit is contained in:
parent
9d1bc5a518
commit
8c2bea0f73
@ -105,8 +105,8 @@ export const cssPageEntry = styled('div', `
|
|||||||
}
|
}
|
||||||
&-disabled, &-disabled:hover, &-disabled.weasel-popup-open {
|
&-disabled, &-disabled:hover, &-disabled.weasel-popup-open {
|
||||||
background-color: initial;
|
background-color: initial;
|
||||||
color: ${colors.mediumGrey};
|
color: ${colors.darkGrey};
|
||||||
--icon-color: ${colors.mediumGrey};
|
--icon-color: ${colors.darkGrey};
|
||||||
}
|
}
|
||||||
.${cssTools.className}-collapsed > & {
|
.${cssTools.className}-collapsed > & {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
@ -8,13 +8,13 @@ import { hoverTooltip, tooltipCloseButton } from 'app/client/ui/tooltips';
|
|||||||
import { colors } from 'app/client/ui2018/cssVars';
|
import { colors } from 'app/client/ui2018/cssVars';
|
||||||
import { icon } from 'app/client/ui2018/icons';
|
import { icon } from 'app/client/ui2018/icons';
|
||||||
import { cssLink } from 'app/client/ui2018/links';
|
import { cssLink } from 'app/client/ui2018/links';
|
||||||
|
import { menuAnnotate } from 'app/client/ui2018/menus';
|
||||||
import { userOverrideParams } from 'app/common/gristUrls';
|
import { userOverrideParams } from 'app/common/gristUrls';
|
||||||
import { Disposable, dom, makeTestId, Observable, observable, styled } from "grainjs";
|
import { Disposable, dom, makeTestId, Observable, observable, styled } from "grainjs";
|
||||||
|
|
||||||
const testId = makeTestId('test-tools-');
|
const testId = makeTestId('test-tools-');
|
||||||
|
|
||||||
export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Observable<boolean>): Element {
|
export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Observable<boolean>): Element {
|
||||||
const aclUIEnabled = Boolean(urlState().state.get().params?.aclUI);
|
|
||||||
const isOwner = gristDoc.docPageModel.currentDoc.get()?.access === 'owners';
|
const isOwner = gristDoc.docPageModel.currentDoc.get()?.access === 'owners';
|
||||||
const isOverridden = Boolean(gristDoc.docPageModel.userOverride.get());
|
const isOverridden = Boolean(gristDoc.docPageModel.userOverride.get());
|
||||||
const canViewAccessRules = observable(false);
|
const canViewAccessRules = observable(false);
|
||||||
@ -28,22 +28,22 @@ export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Obse
|
|||||||
cssTools.cls('-collapsed', (use) => !use(leftPanelOpen)),
|
cssTools.cls('-collapsed', (use) => !use(leftPanelOpen)),
|
||||||
cssSectionHeader("TOOLS"),
|
cssSectionHeader("TOOLS"),
|
||||||
|
|
||||||
(aclUIEnabled ?
|
cssPageEntry(
|
||||||
cssPageEntry(
|
cssPageEntry.cls('-selected', (use) => use(gristDoc.activeViewId) === 'acl'),
|
||||||
cssPageEntry.cls('-selected', (use) => use(gristDoc.activeViewId) === 'acl'),
|
cssPageEntry.cls('-disabled', (use) => !use(canViewAccessRules)),
|
||||||
cssPageEntry.cls('-disabled', (use) => !use(canViewAccessRules)),
|
dom.domComputed(canViewAccessRules, (_canViewAccessRules) => {
|
||||||
dom.domComputed(canViewAccessRules, (_canViewAccessRules) => {
|
return cssPageLink(
|
||||||
return cssPageLink(
|
cssPageIcon('EyeShow'),
|
||||||
cssPageIcon('EyeShow'),
|
cssLinkText('Access Rules',
|
||||||
cssLinkText('Access Rules'),
|
menuAnnotate('Beta', cssBetaTag.cls(''))
|
||||||
_canViewAccessRules ? urlState().setLinkUrl({docPage: 'acl'}) : null,
|
),
|
||||||
isOverridden ? addRevertViewAsUI() : null,
|
_canViewAccessRules ? urlState().setLinkUrl({docPage: 'acl'}) : null,
|
||||||
);
|
isOverridden ? addRevertViewAsUI() : null,
|
||||||
}),
|
);
|
||||||
testId('access-rules'),
|
}),
|
||||||
) :
|
testId('access-rules'),
|
||||||
null
|
|
||||||
),
|
),
|
||||||
|
|
||||||
cssPageEntry(
|
cssPageEntry(
|
||||||
cssPageLink(cssPageIcon('Log'), cssLinkText('Document History'), testId('log'),
|
cssPageLink(cssPageIcon('Log'), cssLinkText('Document History'), testId('log'),
|
||||||
dom.on('click', () => gristDoc.showTool('docHistory')))
|
dom.on('click', () => gristDoc.showTool('docHistory')))
|
||||||
@ -159,3 +159,9 @@ const cssRevertViewAsButton = styled(cssExampleCardOpener, `
|
|||||||
background-color: ${colors.slate};
|
background-color: ${colors.slate};
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
const cssBetaTag = styled('div', `
|
||||||
|
.${cssPageEntry.className}-disabled & {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
@ -55,8 +55,6 @@ async function getModel(options: IUserManagerOptions): Promise<UserManagerModelI
|
|||||||
export function showUserManagerModal(userApi: UserAPI, options: IUserManagerOptions) {
|
export function showUserManagerModal(userApi: UserAPI, options: IUserManagerOptions) {
|
||||||
const modelObs: Observable<UserManagerModel|null> = observable(null);
|
const modelObs: Observable<UserManagerModel|null> = observable(null);
|
||||||
|
|
||||||
const aclUIEnabled = Boolean(urlState().state.get().params?.aclUI);
|
|
||||||
|
|
||||||
async function onConfirm(ctl: IModalControl) {
|
async function onConfirm(ctl: IModalControl) {
|
||||||
const model = modelObs.get();
|
const model = modelObs.get();
|
||||||
if (model) {
|
if (model) {
|
||||||
@ -107,15 +105,13 @@ export function showUserManagerModal(userApi: UserAPI, options: IUserManagerOpti
|
|||||||
dom.on('click', () => ctl.close()),
|
dom.on('click', () => ctl.close()),
|
||||||
testId('um-cancel')
|
testId('um-cancel')
|
||||||
),
|
),
|
||||||
(aclUIEnabled ?
|
cssAccessLink({href: urlState().makeUrl({docPage: 'acl'})},
|
||||||
cssAccessLink({href: urlState().makeUrl({docPage: 'acl'})},
|
dom.text(use => (use(modelObs) && use(use(modelObs)!.isAnythingChanged)) ? 'Save & ' : ''),
|
||||||
dom.text(use => (use(modelObs) && use(use(modelObs)!.isAnythingChanged)) ? 'Save & ' : ''),
|
'Open Access Rules',
|
||||||
'Open Access Rules',
|
dom.on('click', (ev) => {
|
||||||
dom.on('click', (ev) => {
|
ev.preventDefault();
|
||||||
ev.preventDefault();
|
return onConfirm(ctl).then(() => urlState().pushUrl({docPage: 'acl'}));
|
||||||
return onConfirm(ctl).then(() => urlState().pushUrl({docPage: 'acl'}));
|
}),
|
||||||
}),
|
|
||||||
) : null
|
|
||||||
),
|
),
|
||||||
testId('um-buttons'),
|
testId('um-buttons'),
|
||||||
)
|
)
|
||||||
|
@ -255,8 +255,8 @@ export function menuItemCmd(cmd: Command, label: string, ...args: DomElementArg[
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function menuAnnotate(text: string) {
|
export function menuAnnotate(text: string, ...args: DomElementArg[]) {
|
||||||
return cssAnnotateMenuItem('Beta');
|
return cssAnnotateMenuItem(text, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const menuDivider = styled(weasel.cssMenuDivider, `
|
export const menuDivider = styled(weasel.cssMenuDivider, `
|
||||||
|
@ -65,7 +65,6 @@ export interface IGristUrlState {
|
|||||||
embed?: boolean;
|
embed?: boolean;
|
||||||
style?: InterfaceStyle;
|
style?: InterfaceStyle;
|
||||||
compare?: string;
|
compare?: string;
|
||||||
aclUI?: boolean;
|
|
||||||
linkParameters?: Record<string, string>; // Parameters to pass as 'user.Link' in granular ACLs.
|
linkParameters?: Record<string, string>; // Parameters to pass as 'user.Link' in granular ACLs.
|
||||||
// Encoded in URL as query params with extra '_' suffix.
|
// Encoded in URL as query params with extra '_' suffix.
|
||||||
};
|
};
|
||||||
@ -265,9 +264,6 @@ export function decodeUrl(gristConfig: Partial<GristLoadConfig>, location: Locat
|
|||||||
if (sp.has('compare')) {
|
if (sp.has('compare')) {
|
||||||
state.params!.compare = sp.get('compare')!;
|
state.params!.compare = sp.get('compare')!;
|
||||||
}
|
}
|
||||||
if (sp.has('aclUI')) {
|
|
||||||
state.params!.aclUI = isAffirmative(sp.get('aclUI'));
|
|
||||||
}
|
|
||||||
for (const [k, v] of sp.entries()) {
|
for (const [k, v] of sp.entries()) {
|
||||||
if (k.endsWith('_')) {
|
if (k.endsWith('_')) {
|
||||||
if (!state.params!.linkParameters) { state.params!.linkParameters = {}; }
|
if (!state.params!.linkParameters) { state.params!.linkParameters = {}; }
|
||||||
|
Loading…
Reference in New Issue
Block a user