Browse Source

Removed links.

pull/364/head
Sebastian Stehle 7 years ago
parent
commit
a842e09c00
  1. 9
      src/Squidex/app/features/administration/state/users.state.ts
  2. 4
      src/Squidex/app/shared/components/markdown-editor.component.ts
  3. 10
      src/Squidex/app/shared/components/pipes.ts
  4. 6
      src/Squidex/app/shared/components/rich-editor.component.ts
  5. 4
      src/Squidex/app/shared/services/assets.service.ts
  6. 8
      src/Squidex/app/shared/state/backups.state.ts
  7. 8
      src/Squidex/app/shared/state/clients.state.ts
  8. 9
      src/Squidex/app/shared/state/contents.state.ts
  9. 8
      src/Squidex/app/shared/state/contributors.state.ts
  10. 7
      src/Squidex/app/shared/state/languages.state.ts
  11. 10
      src/Squidex/app/shared/state/patterns.state.ts
  12. 8
      src/Squidex/app/shared/state/roles.state.ts
  13. 8
      src/Squidex/app/shared/state/rules.state.ts
  14. 8
      src/Squidex/app/shared/state/schemas.state.ts

9
src/Squidex/app/features/administration/state/users.state.ts

@ -15,7 +15,6 @@ import {
DialogService,
ImmutableArray,
Pager,
ResourceLinks,
shareSubscribed,
State
} from '@app/shared';
@ -45,9 +44,6 @@ interface Snapshot {
// Indicates if the user can create a user.
canCreate?: boolean;
// The resource links.
_links?: ResourceLinks;
}
export type UsersList = ImmutableArray<UserDto>;
@ -114,7 +110,7 @@ export class UsersState extends State<Snapshot> {
this.snapshot.usersPager.pageSize,
this.snapshot.usersPager.skip,
this.snapshot.usersQuery).pipe(
tap(({ total, items, canCreate, _links }) => {
tap(({ total, items, canCreate }) => {
if (isReload) {
this.dialogs.notifyInfo('Users reloaded.');
}
@ -134,8 +130,7 @@ export class UsersState extends State<Snapshot> {
isLoaded: true,
selectedUser,
users,
usersPager,
_links
usersPager
};
});
}),

4
src/Squidex/app/shared/components/markdown-editor.component.ts

@ -201,7 +201,7 @@ export class MarkdownEditorComponent extends StatefulControlComponent<State, str
let content = '';
for (let asset of assets) {
content += `![${asset.fileName}](${asset._links['content'].href} '${asset.fileName}')`;
content += `![${asset.fileName}](${asset.contentUrl} '${asset.fileName}')`;
}
if (content.length > 0) {
@ -244,7 +244,7 @@ export class MarkdownEditorComponent extends StatefulControlComponent<State, str
this.assetUploader.uploadFile(file)
.subscribe(asset => {
if (Types.is(asset, AssetDto)) {
replaceText(`![${asset.fileName}](${asset._links['content'].href} '${asset.fileName}')`);
replaceText(`![${asset.fileName}](${asset.contentUrl} '${asset.fileName}')`);
}
}, error => {
if (!Types.is(error, UploadCanceled)) {

10
src/Squidex/app/shared/components/pipes.ts

@ -13,10 +13,10 @@ import { map } from 'rxjs/operators';
import {
ApiUrlConfig,
AssetDto,
formatHistoryMessage,
HistoryEventDto,
MathHelper,
Resource,
UserDto,
UsersProviderService
} from '@app/shared/internal';
@ -216,8 +216,8 @@ export class UserPictureRefPipe extends UserAsyncPipe implements PipeTransform {
pure: true
})
export class AssetUrlPipe implements PipeTransform {
public transform(asset: Resource): string {
return `${asset._links['content'].href}&sq=${MathHelper.guid()}`;
public transform(asset: AssetDto): string {
return `${asset.contentUrl}&sq=${MathHelper.guid()}`;
}
}
@ -226,8 +226,8 @@ export class AssetUrlPipe implements PipeTransform {
pure: true
})
export class AssetPreviewUrlPipe implements PipeTransform {
public transform(asset: Resource): string {
return asset._links['content'].href;
public transform(asset: AssetDto): string {
return asset.contentUrl;
}
}

6
src/Squidex/app/shared/components/rich-editor.component.ts

@ -98,7 +98,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
this.assetUploader.uploadFile(file)
.subscribe(asset => {
if (Types.is(asset, AssetDto)) {
success(asset._links['content'].href);
success(asset.contentUrl);
}
}, error => {
if (!Types.is(error, UploadCanceled)) {
@ -186,7 +186,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
let content = '';
for (let asset of assets) {
content += `<img src="${asset._links['content'].href}" alt="${asset.fileName}" />`;
content += `<img src="${asset.contentUrl}" alt="${asset.fileName}" />`;
}
if (content.length > 0) {
@ -216,7 +216,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
this.assetUploader.uploadFile(file)
.subscribe(asset => {
if (Types.is(asset, AssetDto)) {
replaceText(`<img src="${asset._links['content'].href}" alt="${asset.fileName}" />`);
replaceText(`<img src="${asset.contentUrl}" alt="${asset.fileName}" />`);
}
}, error => {
if (!Types.is(error, UploadCanceled)) {

4
src/Squidex/app/shared/services/assets.service.ts

@ -39,6 +39,10 @@ export class AssetDto {
public readonly canUpdate: boolean;
public readonly canUpload: boolean;
public get contentUrl() {
return this._links['content'].href;
}
constructor(links: ResourceLinks, meta: Metadata,
public readonly id: string,
public readonly created: DateTime,

8
src/Squidex/app/shared/state/backups.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareSubscribed,
State
} from '@app/framework';
@ -30,9 +29,6 @@ interface Snapshot {
// Indicates if the user can create new backups.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
type BackupsList = ImmutableArray<BackupDto>;
@ -65,7 +61,7 @@ export class BackupsState extends State<Snapshot> {
}
return this.backupsService.getBackups(this.appName).pipe(
tap(({ items, canCreate, _links }) => {
tap(({ items, canCreate }) => {
if (isReload && !silent) {
this.dialogs.notifyInfo('Backups reloaded.');
}
@ -73,7 +69,7 @@ export class BackupsState extends State<Snapshot> {
this.next(s => {
return { ...s, backups, isLoaded: true, canCreate, _links };
return { ...s, backups, isLoaded: true, canCreate };
});
}),
shareSubscribed(this.dialogs, { silent }));

8
src/Squidex/app/shared/state/clients.state.ts

@ -14,7 +14,6 @@ import { tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareSubscribed,
State,
Version
@ -42,9 +41,6 @@ interface Snapshot {
// Indicates if the user can create new clients.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
type ClientsList = ImmutableArray<ClientDto>;
@ -109,12 +105,12 @@ export class ClientsState extends State<Snapshot> {
}
private replaceClients(payload: ClientsPayload, version: Version) {
const { canCreate, items, _links } = payload;
const { canCreate, items } = payload;
const clients = ImmutableArray.of(items);
this.next(s => {
return { ...s, clients, isLoaded: true, version, canCreate, _links };
return { ...s, clients, isLoaded: true, version, canCreate };
});
}

9
src/Squidex/app/shared/state/contents.state.ts

@ -14,7 +14,6 @@ import {
ErrorDto,
ImmutableArray,
Pager,
ResourceLinks,
shareSubscribed,
State,
Version,
@ -51,9 +50,6 @@ interface Snapshot {
// Indicates if the user can create and publish a content.
canCreateAndPublish?: boolean;
// The links.
_links?: ResourceLinks;
}
function sameContent(lhs: ContentDto, rhs?: ContentDto): boolean {
@ -137,7 +133,7 @@ export abstract class ContentsStateBase extends State<Snapshot> {
this.snapshot.contentsPager.pageSize,
this.snapshot.contentsPager.skip,
this.snapshot.contentsQuery, undefined).pipe(
tap(({ total, items, canCreate, canCreateAndPublish, statuses, _links }) => {
tap(({ total, items, canCreate, canCreateAndPublish, statuses }) => {
if (isReload) {
this.dialogs.notifyInfo('Contents reloaded.');
}
@ -161,8 +157,7 @@ export abstract class ContentsStateBase extends State<Snapshot> {
contentsPager,
isLoaded: true,
selectedContent,
statuses,
_links
statuses
};
});
}));

8
src/Squidex/app/shared/state/contributors.state.ts

@ -13,7 +13,6 @@ import {
DialogService,
ErrorDto,
ImmutableArray,
ResourceLinks,
shareMapSubscribed,
shareSubscribed,
State,
@ -45,9 +44,6 @@ interface Snapshot {
// Indicates if the user can add a contributor.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
type ContributorsList = ImmutableArray<ContributorDto>;
@ -115,11 +111,11 @@ export class ContributorsState extends State<Snapshot> {
private replaceContributors(version: Version, payload: ContributorsPayload) {
this.next(s => {
const { canCreate, items, maxContributors, _links } = payload;
const { canCreate, items, maxContributors } = payload;
const contributors = ImmutableArray.of(items);
return { ...s, contributors, maxContributors, isLoaded: true, version, canCreate, _links };
return { ...s, contributors, maxContributors, isLoaded: true, version, canCreate };
});
}

7
src/Squidex/app/shared/state/languages.state.ts

@ -12,7 +12,6 @@ import { map, tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareMapSubscribed,
shareSubscribed,
State,
@ -58,9 +57,6 @@ interface Snapshot {
// Inedicates if the user can add a language.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
type AppLanguagesList = ImmutableArray<AppLanguageDto>;
@ -146,7 +142,7 @@ export class LanguagesState extends State<Snapshot> {
this.next(s => {
allLanguages = allLanguages || s.allLanguages;
const { canCreate, items, _links } = payload;
const { canCreate, items } = payload;
const languages = ImmutableArray.of(items);
@ -157,7 +153,6 @@ export class LanguagesState extends State<Snapshot> {
allLanguages: allLanguages,
allLanguagesNew: allLanguages.filter(x => !languages.find(l => l.iso2Code === x.iso2Code)),
isLoaded: true,
_links,
version: version
};
});

10
src/Squidex/app/shared/state/patterns.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareMapSubscribed,
shareSubscribed,
State,
@ -40,9 +39,6 @@ interface Snapshot {
// Indicates if patterns can be created.
canCreate?: boolean;
// The links.
_links: ResourceLinks;
}
type PatternsList = ImmutableArray<PatternDto>;
@ -63,7 +59,7 @@ export class PatternsState extends State<Snapshot> {
private readonly appsState: AppsState,
private readonly dialogs: DialogService
) {
super({ patterns: ImmutableArray.empty(), version: Version.EMPTY, _links: {} });
super({ patterns: ImmutableArray.empty(), version: Version.EMPTY });
}
public load(isReload = false): Observable<any> {
@ -109,10 +105,10 @@ export class PatternsState extends State<Snapshot> {
private replacePatterns(payload: PatternsPayload, version: Version) {
const patterns = ImmutableArray.of(payload.items);
const { _links: links, canCreate } = payload;
const { canCreate } = payload;
this.next(s => {
return { ...s, patterns, isLoaded: true, version, _links: links, canCreate };
return { ...s, patterns, isLoaded: true, version, canCreate };
});
}

8
src/Squidex/app/shared/state/roles.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareSubscribed,
State,
Version
@ -40,9 +39,6 @@ interface Snapshot {
// Indicates if the user can add a role.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
type RolesList = ImmutableArray<RoleDto>;
@ -107,12 +103,12 @@ export class RolesState extends State<Snapshot> {
}
private replaceRoles(payload: RolesPayload, version: Version) {
const { canCreate, items, _links } = payload;
const { canCreate, items } = payload;
const roles = ImmutableArray.of(items);
this.next(s => {
return { ...s, roles, isLoaded: true, version, canCreate, _links };
return { ...s, roles, isLoaded: true, version, canCreate };
});
}

8
src/Squidex/app/shared/state/rules.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import {
DialogService,
ImmutableArray,
ResourceLinks,
shareSubscribed,
State
} from '@app/framework';
@ -37,9 +36,6 @@ interface Snapshot {
// Indicates if the user can read events.
canReadEvents?: boolean;
// The resource links.
_links?: ResourceLinks;
}
type RulesList = ImmutableArray<RuleDto>;
@ -72,7 +68,7 @@ export class RulesState extends State<Snapshot> {
}
return this.rulesService.getRules(this.appName).pipe(
tap(({ items, canCreate, canReadEvents, _links }) => {
tap(({ items, canCreate, canReadEvents }) => {
if (isReload) {
this.dialogs.notifyInfo('Rules reloaded.');
}
@ -80,7 +76,7 @@ export class RulesState extends State<Snapshot> {
this.next(s => {
const rules = ImmutableArray.of(items);
return { ...s, rules, isLoaded: true, canCreate, canReadEvents, _links };
return { ...s, rules, isLoaded: true, canCreate, canReadEvents };
});
}),
shareSubscribed(this.dialogs));

8
src/Squidex/app/shared/state/schemas.state.ts

@ -13,7 +13,6 @@ import {
compareStringsAsc,
DialogService,
ImmutableArray,
ResourceLinks,
shareMapSubscribed,
shareSubscribed,
State,
@ -52,9 +51,6 @@ interface Snapshot {
// Indicates if the user can create a schema.
canCreate?: boolean;
// The links.
_links?: ResourceLinks;
}
export type SchemasList = ImmutableArray<SchemaDto>;
@ -122,7 +118,7 @@ export class SchemasState extends State<Snapshot> {
}
return this.schemasService.getSchemas(this.appName).pipe(
tap(({ items, canCreate, _links }) => {
tap(({ items, canCreate }) => {
if (isReload) {
this.dialogs.notifyInfo('Schemas reloaded.');
}
@ -132,7 +128,7 @@ export class SchemasState extends State<Snapshot> {
const categories = buildCategories(s.categories, schemas);
return { ...s, schemas, isLoaded: true, categories, canCreate, _links };
return { ...s, schemas, isLoaded: true, categories, canCreate };
});
}),
shareSubscribed(this.dialogs));

Loading…
Cancel
Save